47 def __init__(self, plugin, parent=None, name=None): |
47 def __init__(self, plugin, parent=None, name=None): |
48 """ |
48 """ |
49 Constructor |
49 Constructor |
50 |
50 |
51 @param plugin reference to the plugin object |
51 @param plugin reference to the plugin object |
52 @param parent parent widget (QWidget) |
52 @type VcsMercurialPlugin |
53 @param name name of this object (string) |
53 @param parent parent widget |
|
54 @type QWidget |
|
55 @param name name of this object |
|
56 @type str |
54 """ |
57 """ |
55 from .CloseheadExtension.closehead import Closehead |
58 from .CloseheadExtension.closehead import Closehead |
56 from .GpgExtension.gpg import Gpg |
59 from .GpgExtension.gpg import Gpg |
57 from .HgUtilities import getConfigPath |
60 from .HgUtilities import getConfigPath |
58 from .HisteditExtension.histedit import Histedit |
61 from .HisteditExtension.histedit import Histedit |
159 |
162 |
160 def getPlugin(self): |
163 def getPlugin(self): |
161 """ |
164 """ |
162 Public method to get a reference to the plugin object. |
165 Public method to get a reference to the plugin object. |
163 |
166 |
164 @return reference to the plugin object (VcsMercurialPlugin) |
167 @return reference to the plugin object |
|
168 @rtype VcsMercurialPlugin |
165 """ |
169 """ |
166 return self.__plugin |
170 return self.__plugin |
167 |
171 |
168 def getEncoding(self): |
172 def getEncoding(self): |
169 """ |
173 """ |
170 Public method to get the encoding to be used by Mercurial. |
174 Public method to get the encoding to be used by Mercurial. |
171 |
175 |
172 @return encoding (string) |
176 @return encoding |
|
177 @rtype str |
173 """ |
178 """ |
174 return self.__plugin.getPreferences("Encoding") |
179 return self.__plugin.getPreferences("Encoding") |
175 |
180 |
176 def vcsShutdown(self): |
181 def vcsShutdown(self): |
177 """ |
182 """ |
222 |
227 |
223 def initCommand(self, command): |
228 def initCommand(self, command): |
224 """ |
229 """ |
225 Public method to initialize a command arguments list. |
230 Public method to initialize a command arguments list. |
226 |
231 |
227 @param command command name (string) |
232 @param command command name |
228 @return list of command options (list of string) |
233 @type str |
|
234 @return list of command options |
|
235 @rtype list of str |
229 """ |
236 """ |
230 args = [command] |
237 args = [command] |
231 self.addArguments(args, self.__plugin.getGlobalOptions()) |
238 self.addArguments(args, self.__plugin.getGlobalOptions()) |
232 return args |
239 return args |
233 |
240 |
234 def vcsExists(self): |
241 def vcsExists(self): |
235 """ |
242 """ |
236 Public method used to test for the presence of the hg executable. |
243 Public method used to test for the presence of the hg executable. |
237 |
244 |
238 @return flag indicating the existence (boolean) and an error message |
245 @return flag indicating the existence and an error message |
239 (string) |
246 @rtype tuple of (bool, str) |
240 """ |
247 """ |
241 from .HgUtilities import hgVersion |
248 from .HgUtilities import hgVersion |
242 |
249 |
243 self.versionStr, self.version, errMsg = hgVersion(self.__plugin) |
250 self.versionStr, self.version, errMsg = hgVersion(self.__plugin) |
244 hgExists = errMsg == "" |
251 hgExists = errMsg == "" |
252 |
259 |
253 The initialization is done, when a project is converted into a |
260 The initialization is done, when a project is converted into a |
254 Mercurial controlled project. Therefore we always return TRUE without |
261 Mercurial controlled project. Therefore we always return TRUE without |
255 doing anything. |
262 doing anything. |
256 |
263 |
257 @param vcsDir name of the VCS directory (string) |
264 @param vcsDir name of the VCS directory |
258 @param noDialog flag indicating quiet operations (boolean) |
265 @type str |
259 @return always TRUE |
266 @param noDialog flag indicating quiet operations |
|
267 @type bool |
|
268 @return always True |
|
269 @rtype bool |
260 """ |
270 """ |
261 return True |
271 return True |
262 |
272 |
263 def vcsConvertProject(self, vcsDataDict, project, addAll=True): |
273 def vcsConvertProject(self, vcsDataDict, project, addAll=True): |
264 """ |
274 """ |
292 """ |
302 """ |
293 Public method used to import the project into the Mercurial repository. |
303 Public method used to import the project into the Mercurial repository. |
294 |
304 |
295 @param vcsDataDict dictionary of data required for the import |
305 @param vcsDataDict dictionary of data required for the import |
296 @type dict |
306 @type dict |
297 @param projectDir project directory (string) |
307 @param projectDir project directory |
298 @type str |
308 @type str |
299 @param noDialog flag indicating quiet operations |
309 @param noDialog flag indicating quiet operations |
300 @type bool |
310 @type bool |
301 @param addAll flag indicating to add all files to the repository |
311 @param addAll flag indicating to add all files to the repository |
302 @type bool |
312 @type bool |
341 """ |
351 """ |
342 Public method used to check the project out of a Mercurial repository |
352 Public method used to check the project out of a Mercurial repository |
343 (clone). |
353 (clone). |
344 |
354 |
345 @param vcsDataDict dictionary of data required for the checkout |
355 @param vcsDataDict dictionary of data required for the checkout |
346 @param projectDir project directory to create (string) |
356 @type dict |
|
357 @param projectDir project directory to create |
|
358 @type str |
347 @param noDialog flag indicating quiet operations |
359 @param noDialog flag indicating quiet operations |
348 @return flag indicating an execution without errors (boolean) |
360 @type bool |
|
361 @return flag indicating an execution without errors |
|
362 @rtype bool |
349 """ |
363 """ |
350 noDialog = False |
364 noDialog = False |
351 try: |
365 try: |
352 rev = vcsDataDict["revision"] |
366 rev = vcsDataDict["revision"] |
353 except KeyError: |
367 except KeyError: |
376 def vcsExport(self, vcsDataDict, projectDir): |
390 def vcsExport(self, vcsDataDict, projectDir): |
377 """ |
391 """ |
378 Public method used to export a directory from the Mercurial repository. |
392 Public method used to export a directory from the Mercurial repository. |
379 |
393 |
380 @param vcsDataDict dictionary of data required for the checkout |
394 @param vcsDataDict dictionary of data required for the checkout |
381 @param projectDir project directory to create (string) |
395 @type dict |
382 @return flag indicating an execution without errors (boolean) |
396 @param projectDir project directory to create |
|
397 @type str |
|
398 @return flag indicating an execution without errors |
|
399 @rtype bool |
383 """ |
400 """ |
384 status = self.vcsCheckout(vcsDataDict, projectDir) |
401 status = self.vcsCheckout(vcsDataDict, projectDir) |
385 shutil.rmtree(os.path.join(projectDir, self.adminDir), ignore_errors=True) |
402 shutil.rmtree(os.path.join(projectDir, self.adminDir), ignore_errors=True) |
386 if os.path.exists(os.path.join(projectDir, Hg.IgnoreFileName)): |
403 if os.path.exists(os.path.join(projectDir, Hg.IgnoreFileName)): |
387 os.remove(os.path.join(projectDir, Hg.IgnoreFileName)) |
404 os.remove(os.path.join(projectDir, Hg.IgnoreFileName)) |
392 ): |
409 ): |
393 """ |
410 """ |
394 Public method used to make the change of a file/directory permanent |
411 Public method used to make the change of a file/directory permanent |
395 in the Mercurial repository. |
412 in the Mercurial repository. |
396 |
413 |
397 @param name file/directory name to be committed (string or list of |
414 @param name file/directory name to be committed |
398 strings) |
415 @type str or list of str |
399 @param message message for this operation (string) |
416 @param message message for this operation |
|
417 @type str |
400 @param noDialog flag indicating quiet operations |
418 @param noDialog flag indicating quiet operations |
401 @param closeBranch flag indicating a close branch commit (boolean) |
419 @type bool |
402 @param mq flag indicating a queue commit (boolean) |
420 @param closeBranch flag indicating a close branch commit |
403 @param merge flag indicating a merge commit (boolean) |
421 @type bool |
|
422 @param mq flag indicating a queue commit |
|
423 @type bool |
|
424 @param merge flag indicating a merge commit |
|
425 @type bool |
404 """ |
426 """ |
405 from .HgCommitDialog import HgCommitDialog |
427 from .HgCommitDialog import HgCommitDialog |
406 |
428 |
407 msg = message |
429 msg = message |
408 |
430 |
604 """ |
626 """ |
605 Public method used to update a file/directory with the Mercurial |
627 Public method used to update a file/directory with the Mercurial |
606 repository. |
628 repository. |
607 |
629 |
608 @param name file/directory name to be updated (not used) |
630 @param name file/directory name to be updated (not used) |
609 @param noDialog flag indicating quiet operations (boolean) |
631 @type str |
610 @param revision revision to update to (string) |
632 @param noDialog flag indicating quiet operations |
611 @return flag indicating, that the update contained an add |
633 @type bool |
612 or delete (boolean) |
634 @param revision revision to update to |
|
635 @type str |
|
636 @return flag indicating, that the update contained an add or delete |
|
637 @rtype bool |
613 """ |
638 """ |
614 args = self.initCommand("update") |
639 args = self.initCommand("update") |
615 if "-v" not in args and "--verbose" not in args: |
640 if "-v" not in args and "--verbose" not in args: |
616 args.append("-v") |
641 args.append("-v") |
617 if revision: |
642 if revision: |
632 |
657 |
633 def vcsAdd(self, name, isDir=False, noDialog=False): # noqa: U100 |
658 def vcsAdd(self, name, isDir=False, noDialog=False): # noqa: U100 |
634 """ |
659 """ |
635 Public method used to add a file/directory to the Mercurial repository. |
660 Public method used to add a file/directory to the Mercurial repository. |
636 |
661 |
637 @param name file/directory name to be added (string) |
662 @param name file/directory name to be added |
638 @param isDir flag indicating name is a directory (boolean) |
663 @type str |
|
664 @param isDir flag indicating name is a directory |
|
665 @type bool |
639 @param noDialog flag indicating quiet operations |
666 @param noDialog flag indicating quiet operations |
|
667 @type bool |
640 """ |
668 """ |
641 args = self.initCommand("add") |
669 args = self.initCommand("add") |
642 args.append("-v") |
670 args.append("-v") |
643 |
671 |
644 if isinstance(name, list): |
672 if isinstance(name, list): |
659 def vcsAddBinary(self, name, isDir=False): |
687 def vcsAddBinary(self, name, isDir=False): |
660 """ |
688 """ |
661 Public method used to add a file/directory in binary mode to the |
689 Public method used to add a file/directory in binary mode to the |
662 Mercurial repository. |
690 Mercurial repository. |
663 |
691 |
664 @param name file/directory name to be added (string) |
692 @param name file/directory name to be added |
665 @param isDir flag indicating name is a directory (boolean) |
693 @type str |
|
694 @param isDir flag indicating name is a directory |
|
695 @type bool |
666 """ |
696 """ |
667 self.vcsAdd(name, isDir) |
697 self.vcsAdd(name, isDir) |
668 |
698 |
669 def vcsAddTree(self, path): |
699 def vcsAddTree(self, path): |
670 """ |
700 """ |
671 Public method to add a directory tree rooted at path to the Mercurial |
701 Public method to add a directory tree rooted at path to the Mercurial |
672 repository. |
702 repository. |
673 |
703 |
674 @param path root directory of the tree to be added (string or list of |
704 @param path root directory of the tree to be added |
675 strings)) |
705 @type str or list of str |
676 """ |
706 """ |
677 self.vcsAdd(path, isDir=False) |
707 self.vcsAdd(path, isDir=False) |
678 |
708 |
679 def vcsRemove(self, name, project=False, noDialog=False): # noqa: U100 |
709 def vcsRemove(self, name, project=False, noDialog=False): # noqa: U100 |
680 """ |
710 """ |
681 Public method used to remove a file/directory from the Mercurial |
711 Public method used to remove a file/directory from the Mercurial |
682 repository. |
712 repository. |
683 |
713 |
684 The default operation is to remove the local copy as well. |
714 The default operation is to remove the local copy as well. |
685 |
715 |
686 @param name file/directory name to be removed (string or list of |
716 @param name file/directory name to be removed |
687 strings)) |
717 @type str or list of str |
688 @param project flag indicating deletion of a project tree (boolean) |
718 @param project flag indicating deletion of a project tree |
689 (not needed) |
719 @type bool |
690 @param noDialog flag indicating quiet operations |
720 @param noDialog flag indicating quiet operations |
691 @return flag indicating successfull operation (boolean) |
721 @type bool |
|
722 @return flag indicating successfull operation |
|
723 @rtype bool |
692 """ |
724 """ |
693 args = self.initCommand("remove") |
725 args = self.initCommand("remove") |
694 args.append("-v") |
726 args.append("-v") |
695 if noDialog and "--force" not in args: |
727 if noDialog and "--force" not in args: |
696 args.append("--force") |
728 args.append("--force") |
717 |
749 |
718 def vcsMove(self, name, project, target=None, noDialog=False): |
750 def vcsMove(self, name, project, target=None, noDialog=False): |
719 """ |
751 """ |
720 Public method used to move a file/directory. |
752 Public method used to move a file/directory. |
721 |
753 |
722 @param name file/directory name to be moved (string) |
754 @param name file/directory name to be moved |
|
755 @type str |
723 @param project reference to the project object |
756 @param project reference to the project object |
724 @param target new name of the file/directory (string) |
757 @type Project |
|
758 @param target new name of the file/directory |
|
759 @type str |
725 @param noDialog flag indicating quiet operations |
760 @param noDialog flag indicating quiet operations |
726 @return flag indicating successfull operation (boolean) |
761 @type bool |
|
762 @return flag indicating successfull operation |
|
763 @rtype bool |
727 """ |
764 """ |
728 from .HgCopyDialog import HgCopyDialog |
765 from .HgCopyDialog import HgCopyDialog |
729 |
766 |
730 isDir = os.path.isdir(name) |
767 isDir = os.path.isdir(name) |
731 |
768 |
779 If name is a directory and is the project directory, all project files |
816 If name is a directory and is the project directory, all project files |
780 are saved first. If name is a file (or list of files), which is/are |
817 are saved first. If name is a file (or list of files), which is/are |
781 being edited and has unsaved modification, they can be saved or the |
818 being edited and has unsaved modification, they can be saved or the |
782 operation may be aborted. |
819 operation may be aborted. |
783 |
820 |
784 @param name file/directory name to be diffed (string) |
821 @param name file/directory name to be diffed |
|
822 @type str |
785 """ |
823 """ |
786 from .HgDiffDialog import HgDiffDialog |
824 from .HgDiffDialog import HgDiffDialog |
787 |
825 |
788 names = name[:] if isinstance(name, list) else [name] |
826 names = name[:] if isinstance(name, list) else [name] |
789 for nam in names: |
827 for nam in names: |
806 """ |
844 """ |
807 Public method used to view the status of files/directories in the |
845 Public method used to view the status of files/directories in the |
808 Mercurial repository. |
846 Mercurial repository. |
809 |
847 |
810 @param name file/directory name(s) to show the status of |
848 @param name file/directory name(s) to show the status of |
811 (string or list of strings) |
849 @type str or list of str |
812 """ |
850 """ |
813 from .HgStatusDialog import HgStatusDialog |
851 from .HgStatusDialog import HgStatusDialog |
814 |
852 |
815 if self.status is None: |
853 if self.status is None: |
816 self.status = HgStatusDialog(self) |
854 self.status = HgStatusDialog(self) |
821 def hgSummary(self, mq=False, largefiles=False): |
859 def hgSummary(self, mq=False, largefiles=False): |
822 """ |
860 """ |
823 Public method used to show some summary information of the |
861 Public method used to show some summary information of the |
824 working directory state. |
862 working directory state. |
825 |
863 |
826 @param mq flag indicating to show the queue status as well (boolean) |
864 @param mq flag indicating to show the queue status as well |
|
865 @type bool |
827 @param largefiles flag indicating to show the largefiles status as |
866 @param largefiles flag indicating to show the largefiles status as |
828 well (boolean) |
867 well |
|
868 @type bool |
829 """ |
869 """ |
830 from .HgSummaryDialog import HgSummaryDialog |
870 from .HgSummaryDialog import HgSummaryDialog |
831 |
871 |
832 if self.summary is None: |
872 if self.summary is None: |
833 self.summary = HgSummaryDialog(self) |
873 self.summary = HgSummaryDialog(self) |
838 def vcsTag(self, name=None, revision=None, tagName=None): # noqa: U100 |
878 def vcsTag(self, name=None, revision=None, tagName=None): # noqa: U100 |
839 """ |
879 """ |
840 Public method used to set/remove a tag in the Mercurial repository. |
880 Public method used to set/remove a tag in the Mercurial repository. |
841 |
881 |
842 @param name file/directory name to determine the repo root from |
882 @param name file/directory name to determine the repo root from |
843 (string) |
883 @type str |
844 @param revision revision to set tag for (string) |
884 @param revision revision to set tag for |
845 @param tagName name of the tag (string) |
885 @type str |
846 @return flag indicating a performed tag action (boolean) |
886 @param tagName name of the tag |
|
887 @type str |
|
888 @return flag indicating a performed tag action |
|
889 @rtype bool |
847 """ |
890 """ |
848 from .HgTagDialog import HgTagDialog |
891 from .HgTagDialog import HgTagDialog |
849 |
892 |
850 dlg = HgTagDialog(self.hgGetTagsList(withType=True), revision, tagName) |
893 dlg = HgTagDialog(self.hgGetTagsList(withType=True), revision, tagName) |
851 if dlg.exec() == QDialog.DialogCode.Accepted: |
894 if dlg.exec() == QDialog.DialogCode.Accepted: |
984 |
1027 |
985 def hgReMerge(self, name): |
1028 def hgReMerge(self, name): |
986 """ |
1029 """ |
987 Public method used to merge a URL/revision into the local project. |
1030 Public method used to merge a URL/revision into the local project. |
988 |
1031 |
989 @param name file/directory name to be merged (string) |
1032 @param name file/directory name to be merged |
|
1033 @type str |
990 """ |
1034 """ |
991 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
1035 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
992 |
1036 |
993 args = self.initCommand("resolve") |
1037 args = self.initCommand("resolve") |
994 if self.getPlugin().getPreferences("InternalMerge"): |
1038 if self.getPlugin().getPreferences("InternalMerge"): |
1027 def vcsSwitch(self, name): |
1071 def vcsSwitch(self, name): |
1028 """ |
1072 """ |
1029 Public method used to switch a working directory to a different |
1073 Public method used to switch a working directory to a different |
1030 revision. |
1074 revision. |
1031 |
1075 |
1032 @param name directory name to be switched (string) |
1076 @param name directory name to be switched |
1033 @return flag indicating, that the switch contained an add |
1077 @type str |
1034 or delete (boolean) |
1078 @return flag indicating, that the switch contained an add or delete |
|
1079 @rtype bool |
1035 """ |
1080 """ |
1036 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog |
1081 from .HgRevisionSelectionDialog import HgRevisionSelectionDialog |
1037 |
1082 |
1038 dlg = HgRevisionSelectionDialog( |
1083 dlg = HgRevisionSelectionDialog( |
1039 self.hgGetTagsList(), |
1084 self.hgGetTagsList(), |
1092 <b>Note:</b> If a shortcut is to be taken, the code will only check, |
1137 <b>Note:</b> If a shortcut is to be taken, the code will only check, |
1093 if the named directory has been scanned already. If so, it is assumed, |
1138 if the named directory has been scanned already. If so, it is assumed, |
1094 that the states for all files have been populated by the previous run. |
1139 that the states for all files have been populated by the previous run. |
1095 |
1140 |
1096 @param names dictionary with all filenames to be checked as keys |
1141 @param names dictionary with all filenames to be checked as keys |
1097 @param dname directory to check in (string) |
1142 @type dict |
1098 @param shortcut flag indicating a shortcut should be taken (boolean) |
1143 @param dname directory to check in |
|
1144 @type str |
|
1145 @param shortcut flag indicating a shortcut should be taken |
|
1146 @type bool |
1099 @return the received dictionary completed with a combination of |
1147 @return the received dictionary completed with a combination of |
1100 canBeCommited and canBeAdded or None in order to signal an error |
1148 canBeCommited and canBeAdded or None in order to signal an error |
|
1149 @rtype dict |
1101 """ |
1150 """ |
1102 if dname.endswith(os.sep): |
1151 if dname.endswith(os.sep): |
1103 dname = dname[:-1] |
1152 dname = dname[:-1] |
1104 dname = os.path.normcase(dname) |
1153 dname = os.path.normcase(dname) |
1105 |
1154 |
1153 |
1202 |
1154 def vcsName(self): |
1203 def vcsName(self): |
1155 """ |
1204 """ |
1156 Public method returning the name of the vcs. |
1205 Public method returning the name of the vcs. |
1157 |
1206 |
1158 @return always 'Mercurial' (string) |
1207 @return always 'Mercurial' |
|
1208 @rtype str |
1159 """ |
1209 """ |
1160 return "Mercurial" |
1210 return "Mercurial" |
1161 |
1211 |
1162 def vcsInitConfig(self, project): |
1212 def vcsInitConfig(self, project): |
1163 """ |
1213 """ |
1164 Public method to initialize the VCS configuration. |
1214 Public method to initialize the VCS configuration. |
1165 |
1215 |
1166 This method ensures, that an ignore file exists. |
1216 This method ensures, that an ignore file exists. |
1167 |
1217 |
1168 @param project reference to the project (Project) |
1218 @param project reference to the project |
|
1219 @type Project |
1169 """ |
1220 """ |
1170 ppath = project.getProjectPath() |
1221 ppath = project.getProjectPath() |
1171 if ppath: |
1222 if ppath: |
1172 ignoreName = os.path.join(ppath, Hg.IgnoreFileName) |
1223 ignoreName = os.path.join(ppath, Hg.IgnoreFileName) |
1173 if not os.path.exists(ignoreName): |
1224 if not os.path.exists(ignoreName): |
1175 |
1226 |
1176 def vcsCleanup(self, name): |
1227 def vcsCleanup(self, name): |
1177 """ |
1228 """ |
1178 Public method used to cleanup the working directory. |
1229 Public method used to cleanup the working directory. |
1179 |
1230 |
1180 @param name directory name to be cleaned up (string) |
1231 @param name directory name to be cleaned up |
|
1232 @type str |
1181 """ |
1233 """ |
1182 patterns = self.getPlugin().getPreferences("CleanupPatterns").split() |
1234 patterns = self.getPlugin().getPreferences("CleanupPatterns").split() |
1183 |
1235 |
1184 entries = [] |
1236 entries = [] |
1185 for pat in patterns: |
1237 for pat in patterns: |
1191 |
1243 |
1192 def vcsCommandLine(self, name): |
1244 def vcsCommandLine(self, name): |
1193 """ |
1245 """ |
1194 Public method used to execute arbitrary mercurial commands. |
1246 Public method used to execute arbitrary mercurial commands. |
1195 |
1247 |
1196 @param name directory name of the working directory (string) |
1248 @param name directory name of the working directory |
|
1249 @type str |
1197 """ |
1250 """ |
1198 from .HgCommandDialog import HgCommandDialog |
1251 from .HgCommandDialog import HgCommandDialog |
1199 |
1252 |
1200 dlg = HgCommandDialog(self.commandHistory, name) |
1253 dlg = HgCommandDialog(self.commandHistory, name) |
1201 if dlg.exec() == QDialog.DialogCode.Accepted: |
1254 if dlg.exec() == QDialog.DialogCode.Accepted: |
1221 ): |
1274 ): |
1222 """ |
1275 """ |
1223 Public method to get a dialog to enter repository info. |
1276 Public method to get a dialog to enter repository info. |
1224 |
1277 |
1225 @param project reference to the project object |
1278 @param project reference to the project object |
1226 @param archive name of the project in the repository (string) |
1279 @type Project |
|
1280 @param archive name of the project in the repository |
|
1281 @type str |
1227 @param editable flag indicating that the project name is editable |
1282 @param editable flag indicating that the project name is editable |
1228 (boolean) |
1283 @type bool |
1229 @param parent parent widget (QWidget) |
1284 @param parent parent widget |
1230 @return reference to the instantiated options dialog (HgOptionsDialog) |
1285 @type QWidget |
|
1286 @return reference to the instantiated options dialog |
|
1287 @rtype HgOptionsDialog |
1231 """ |
1288 """ |
1232 from .HgOptionsDialog import HgOptionsDialog |
1289 from .HgOptionsDialog import HgOptionsDialog |
1233 |
1290 |
1234 return HgOptionsDialog(self, project, parent) |
1291 return HgOptionsDialog(self, project, parent) |
1235 |
1292 |
1236 def vcsNewProjectOptionsDialog(self, parent=None): |
1293 def vcsNewProjectOptionsDialog(self, parent=None): |
1237 """ |
1294 """ |
1238 Public method to get a dialog to enter repository info for getting a |
1295 Public method to get a dialog to enter repository info for getting a |
1239 new project. |
1296 new project. |
1240 |
1297 |
1241 @param parent parent widget (QWidget) |
1298 @param parent parent widget |
|
1299 @type QWidget |
1242 @return reference to the instantiated options dialog |
1300 @return reference to the instantiated options dialog |
1243 (HgNewProjectOptionsDialog) |
1301 @rtype HgNewProjectOptionsDialog |
1244 """ |
1302 """ |
1245 from .HgNewProjectOptionsDialog import HgNewProjectOptionsDialog |
1303 from .HgNewProjectOptionsDialog import HgNewProjectOptionsDialog |
1246 |
1304 |
1247 return HgNewProjectOptionsDialog(self, parent) |
1305 return HgNewProjectOptionsDialog(self, parent) |
1248 |
1306 |
1249 def vcsRepositoryInfos(self, ppath): # noqa: U100 |
1307 def vcsRepositoryInfos(self, ppath): # noqa: U100 |
1250 """ |
1308 """ |
1251 Public method to retrieve information about the repository. |
1309 Public method to retrieve information about the repository. |
1252 |
1310 |
1253 @param ppath local path to get the repository infos (string) |
1311 @param ppath local path to get the repository infos |
1254 @return string with ready formated info for display (string) |
1312 @type str |
|
1313 @return string with ready formated info for display |
|
1314 @rtype str |
1255 """ |
1315 """ |
1256 args = self.initCommand("log") |
1316 args = self.initCommand("log") |
1257 args.extend( |
1317 args.extend( |
1258 [ |
1318 [ |
1259 "--template", |
1319 "--template", |
1333 def vcsSupportCommandOptions(self): |
1393 def vcsSupportCommandOptions(self): |
1334 """ |
1394 """ |
1335 Public method to signal the support of user settable command options. |
1395 Public method to signal the support of user settable command options. |
1336 |
1396 |
1337 @return flag indicating the support of user settable command options |
1397 @return flag indicating the support of user settable command options |
1338 (boolean) |
1398 @rtype bool |
1339 """ |
1399 """ |
1340 return False |
1400 return False |
1341 |
1401 |
1342 ########################################################################### |
1402 ########################################################################### |
1343 ## Private Mercurial specific methods are below. |
1403 ## Private Mercurial specific methods are below. |
1345 |
1405 |
1346 def hgNormalizeURL(self, url): |
1406 def hgNormalizeURL(self, url): |
1347 """ |
1407 """ |
1348 Public method to normalize a url for Mercurial. |
1408 Public method to normalize a url for Mercurial. |
1349 |
1409 |
1350 @param url url string (string) |
1410 @param url url string |
1351 @return properly normalized url for mercurial (string) |
1411 @type str |
|
1412 @return properly normalized url for mercurial |
|
1413 @rtype str |
1352 """ |
1414 """ |
1353 url = url.replace("\\", "/") |
1415 url = url.replace("\\", "/") |
1354 if url.endswith("/"): |
1416 if url.endswith("/"): |
1355 url = url[:-1] |
1417 url = url[:-1] |
1356 urll = url.split("//") |
1418 urll = url.split("//") |
1358 |
1420 |
1359 def hgCopy(self, name, project): |
1421 def hgCopy(self, name, project): |
1360 """ |
1422 """ |
1361 Public method used to copy a file/directory. |
1423 Public method used to copy a file/directory. |
1362 |
1424 |
1363 @param name file/directory name to be copied (string) |
1425 @param name file/directory name to be copied |
|
1426 @type str |
1364 @param project reference to the project object |
1427 @param project reference to the project object |
1365 @return flag indicating successful operation (boolean) |
1428 @type Project |
|
1429 @return flag indicating successful operation |
|
1430 @rtype bool |
1366 """ |
1431 """ |
1367 from .HgCopyDialog import HgCopyDialog |
1432 from .HgCopyDialog import HgCopyDialog |
1368 |
1433 |
1369 dlg = HgCopyDialog(name) |
1434 dlg = HgCopyDialog(name) |
1370 res = False |
1435 res = False |
1390 |
1455 |
1391 def hgGetTagsList(self, withType=False): |
1456 def hgGetTagsList(self, withType=False): |
1392 """ |
1457 """ |
1393 Public method to get the list of tags. |
1458 Public method to get the list of tags. |
1394 |
1459 |
1395 @param withType flag indicating to get the tag type as well (boolean) |
1460 @param withType flag indicating to get the tag type as well |
1396 @return list of tags (list of string) or list of tuples of |
1461 @type bool |
1397 tag name and flag indicating a local tag (list of tuple of string |
1462 @return list of tags or list of tuples of tag name and flag indicating |
1398 and boolean), if withType is True |
1463 a local tag, if withType is True |
|
1464 @rtype list of str or list of [(str, bool)] |
1399 """ |
1465 """ |
1400 args = self.initCommand("tags") |
1466 args = self.initCommand("tags") |
1401 args.append("--verbose") |
1467 args.append("--verbose") |
1402 |
1468 |
1403 output, error = self.__client.runcommand(args) |
1469 output, error = self.__client.runcommand(args) |
1471 def hgListTagBranch(self, tags=True): |
1537 def hgListTagBranch(self, tags=True): |
1472 """ |
1538 """ |
1473 Public method used to list the available tags or branches. |
1539 Public method used to list the available tags or branches. |
1474 |
1540 |
1475 @param tags flag indicating listing of branches or tags |
1541 @param tags flag indicating listing of branches or tags |
1476 (False = branches, True = tags) |
1542 (False = branches, True = tags) |
|
1543 @type bool |
1477 """ |
1544 """ |
1478 from .HgTagBranchListDialog import HgTagBranchListDialog |
1545 from .HgTagBranchListDialog import HgTagBranchListDialog |
1479 |
1546 |
1480 self.tagbranchList = HgTagBranchListDialog(self) |
1547 self.tagbranchList = HgTagBranchListDialog(self) |
1481 self.tagbranchList.show() |
1548 self.tagbranchList.show() |
1523 being edited and has unsaved modification, they can be saved or the |
1590 being edited and has unsaved modification, they can be saved or the |
1524 operation may be aborted. |
1591 operation may be aborted. |
1525 |
1592 |
1526 This method gives the chance to enter the revisions to be compared. |
1593 This method gives the chance to enter the revisions to be compared. |
1527 |
1594 |
1528 @param name file/directory name to be diffed (string) |
1595 @param name file/directory name to be diffed |
|
1596 @type str |
1529 """ |
1597 """ |
1530 from .HgDiffDialog import HgDiffDialog |
1598 from .HgDiffDialog import HgDiffDialog |
1531 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1599 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1532 |
1600 |
1533 names = name[:] if isinstance(name, list) else [name] |
1601 names = name[:] if isinstance(name, list) else [name] |
1557 def __hgGetFileForRevision(self, name, rev=""): |
1625 def __hgGetFileForRevision(self, name, rev=""): |
1558 """ |
1626 """ |
1559 Private method to get a file for a specific revision from the |
1627 Private method to get a file for a specific revision from the |
1560 repository. |
1628 repository. |
1561 |
1629 |
1562 @param name file name to get from the repository (string) |
1630 @param name file name to get from the repository |
1563 @param rev revision to retrieve (string) |
1631 @type str |
1564 @return contents of the file (string) and an error message (string) |
1632 @param rev revision to retrieve |
|
1633 @type str |
|
1634 @return contents of the file (string) and an error message |
|
1635 @rtype str |
1565 """ |
1636 """ |
1566 args = self.initCommand("cat") |
1637 args = self.initCommand("cat") |
1567 if rev: |
1638 if rev: |
1568 args.append("--rev") |
1639 args.append("--rev") |
1569 args.append(rev) |
1640 args.append(rev) |
1577 def vcsSbsDiff(self, name, extended=False, revisions=None): |
1648 def vcsSbsDiff(self, name, extended=False, revisions=None): |
1578 """ |
1649 """ |
1579 Public method used to view the difference of a file to the Mercurial |
1650 Public method used to view the difference of a file to the Mercurial |
1580 repository side-by-side. |
1651 repository side-by-side. |
1581 |
1652 |
1582 @param name file name to be diffed (string) |
1653 @param name file name to be diffed |
1583 @param extended flag indicating the extended variant (boolean) |
1654 @type str |
1584 @param revisions tuple of two revisions (tuple of strings) |
1655 @param extended flag indicating the extended variant |
|
1656 @type bool |
|
1657 @param revisions tuple of two revisions |
|
1658 @type tuple of (str, str) |
1585 @exception ValueError raised to indicate an invalid name parameter |
1659 @exception ValueError raised to indicate an invalid name parameter |
1586 """ |
1660 """ |
1587 from eric7.UI.CompareDialog import CompareDialog |
1661 from eric7.UI.CompareDialog import CompareDialog |
1588 |
1662 |
1589 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1663 from .HgRevisionsSelectionDialog import HgRevisionsSelectionDialog |
1646 def vcsLogBrowser(self, name=None, isFile=False): |
1720 def vcsLogBrowser(self, name=None, isFile=False): |
1647 """ |
1721 """ |
1648 Public method used to browse the log of a file/directory from the |
1722 Public method used to browse the log of a file/directory from the |
1649 Mercurial repository. |
1723 Mercurial repository. |
1650 |
1724 |
1651 @param name file/directory name to show the log of (string) |
1725 @param name file/directory name to show the log of |
|
1726 @type str |
1652 @param isFile flag indicating log for a file is to be shown |
1727 @param isFile flag indicating log for a file is to be shown |
1653 (boolean) |
1728 @type bool |
1654 """ |
1729 """ |
1655 from .HgLogBrowserDialog import HgLogBrowserDialog |
1730 from .HgLogBrowserDialog import HgLogBrowserDialog |
1656 |
1731 |
1657 if name == self.getClient().getRepository(): |
1732 if name == self.getClient().getRepository(): |
1658 name = None |
1733 name = None |
1735 |
1810 |
1736 def hgPush(self, force=False, newBranch=False, rev=None): |
1811 def hgPush(self, force=False, newBranch=False, rev=None): |
1737 """ |
1812 """ |
1738 Public method used to push changes to a remote Mercurial repository. |
1813 Public method used to push changes to a remote Mercurial repository. |
1739 |
1814 |
1740 @param force flag indicating a forced push (boolean) |
1815 @param force flag indicating a forced push |
1741 @param newBranch flag indicating to push a new branch (boolean) |
1816 @type bool |
1742 @param rev revision to be pushed (including all ancestors) (string) |
1817 @param newBranch flag indicating to push a new branch |
|
1818 @type bool |
|
1819 @param rev revision to be pushed (including all ancestors) |
|
1820 @type str |
1743 """ |
1821 """ |
1744 args = self.initCommand("push") |
1822 args = self.initCommand("push") |
1745 args.append("-v") |
1823 args.append("-v") |
1746 if force: |
1824 if force: |
1747 args.append("-f") |
1825 args.append("-f") |
1759 |
1837 |
1760 def hgInfo(self, mode="heads"): |
1838 def hgInfo(self, mode="heads"): |
1761 """ |
1839 """ |
1762 Public method to show information about the heads of the repository. |
1840 Public method to show information about the heads of the repository. |
1763 |
1841 |
1764 @param mode mode of the operation (string, one of heads, parents, |
1842 @param mode mode of the operation (one of 'heads', 'parents', 'tip') |
1765 tip) |
1843 @type str |
1766 """ |
1844 """ |
1767 if mode not in ("heads", "parents", "tip"): |
1845 if mode not in ("heads", "parents", "tip"): |
1768 mode = "heads" |
1846 mode = "heads" |
1769 |
1847 |
1770 info = [] |
1848 info = [] |
1871 |
1949 |
1872 def vcsResolved(self, name, unresolve=False): |
1950 def vcsResolved(self, name, unresolve=False): |
1873 """ |
1951 """ |
1874 Public method used to resolve conflicts of a file/directory. |
1952 Public method used to resolve conflicts of a file/directory. |
1875 |
1953 |
1876 @param name file/directory name to be resolved (string) |
1954 @param name file/directory name to be resolved |
|
1955 @type str |
1877 @param unresolve flag indicating to mark the file/directory as |
1956 @param unresolve flag indicating to mark the file/directory as |
1878 unresolved (boolean) |
1957 unresolved |
|
1958 @type bool |
1879 """ |
1959 """ |
1880 args = self.initCommand("resolve") |
1960 args = self.initCommand("resolve") |
1881 if unresolve: |
1961 if unresolve: |
1882 args.append("--unmark") |
1962 args.append("--unmark") |
1883 else: |
1963 else: |
1901 |
1981 |
1902 def hgAbortMerge(self): |
1982 def hgAbortMerge(self): |
1903 """ |
1983 """ |
1904 Public method to abort an uncommitted merge. |
1984 Public method to abort an uncommitted merge. |
1905 |
1985 |
1906 @return flag indicating, that the abortion contained an add |
1986 @return flag indicating, that the abortion contained an add or delete |
1907 or delete (boolean) |
1987 @rtype bool |
1908 """ |
1988 """ |
1909 if self.version >= (4, 5, 0): |
1989 if self.version >= (4, 5, 0): |
1910 args = self.initCommand("merge") |
1990 args = self.initCommand("merge") |
1911 args.append("--abort") |
1991 args.append("--abort") |
1912 else: |
1992 else: |
2093 |
2173 |
2094 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2174 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2095 """ |
2175 """ |
2096 Public method to create the ignore file. |
2176 Public method to create the ignore file. |
2097 |
2177 |
2098 @param name directory name to create the ignore file in (string) |
2178 @param name directory name to create the ignore file in |
2099 @param autoAdd flag indicating to add it automatically (boolean) |
2179 @type str |
|
2180 @param autoAdd flag indicating to add it automatically |
|
2181 @type bool |
2100 @return flag indicating success |
2182 @return flag indicating success |
|
2183 @rtype bool |
2101 """ |
2184 """ |
2102 status = False |
2185 status = False |
2103 ignorePatterns = [ |
2186 ignorePatterns = [ |
2104 "glob:.eric6project", |
2187 "glob:.eric6project", |
2105 "glob:.eric7project", |
2188 "glob:.eric7project", |
2437 def hgImport(self): |
2520 def hgImport(self): |
2438 """ |
2521 """ |
2439 Public method to import a patch file. |
2522 Public method to import a patch file. |
2440 |
2523 |
2441 @return flag indicating, that the import contained an add, a delete |
2524 @return flag indicating, that the import contained an add, a delete |
2442 or a change to the project file (boolean) |
2525 or a change to the project file |
|
2526 @rtype bool |
2443 """ |
2527 """ |
2444 from .HgImportDialog import HgImportDialog |
2528 from .HgImportDialog import HgImportDialog |
2445 |
2529 |
2446 dlg = HgImportDialog(self) |
2530 dlg = HgImportDialog(self) |
2447 if dlg.exec() == QDialog.DialogCode.Accepted: |
2531 if dlg.exec() == QDialog.DialogCode.Accepted: |
2535 def hgPhase(self, data=None): |
2619 def hgPhase(self, data=None): |
2536 """ |
2620 """ |
2537 Public method to change the phase of revisions. |
2621 Public method to change the phase of revisions. |
2538 |
2622 |
2539 @param data tuple giving phase data (list of revisions, phase, flag |
2623 @param data tuple giving phase data (list of revisions, phase, flag |
2540 indicating a forced operation) (list of strings, string, boolean) |
2624 indicating a forced operation) |
2541 @return flag indicating success (boolean) |
2625 @type tuple of (list of str, str, bool) |
|
2626 @return flag indicating success |
|
2627 @rtype bool |
2542 @exception ValueError raised to indicate an invalid phase |
2628 @exception ValueError raised to indicate an invalid phase |
2543 """ |
2629 """ |
2544 from .HgPhaseDialog import HgPhaseDialog |
2630 from .HgPhaseDialog import HgPhaseDialog |
2545 |
2631 |
2546 if data is None: |
2632 if data is None: |
2579 |
2665 |
2580 def hgGraft(self, revs=None): |
2666 def hgGraft(self, revs=None): |
2581 """ |
2667 """ |
2582 Public method to copy changesets from another branch. |
2668 Public method to copy changesets from another branch. |
2583 |
2669 |
2584 @param revs list of revisions to show in the revisions pane (list of |
2670 @param revs list of revisions to show in the revisions pane |
2585 strings) |
2671 @type list of str |
2586 @return flag indicating that the project should be reread (boolean) |
2672 @return flag indicating that the project should be reread |
|
2673 @rtype bool |
2587 """ |
2674 """ |
2588 from .HgGraftDialog import HgGraftDialog |
2675 from .HgGraftDialog import HgGraftDialog |
2589 |
2676 |
2590 res = False |
2677 res = False |
2591 dlg = HgGraftDialog(self, revs) |
2678 dlg = HgGraftDialog(self, revs) |
2733 def getHgSubPath(self): |
2820 def getHgSubPath(self): |
2734 """ |
2821 """ |
2735 Public method to get the path to the .hgsub file containing the |
2822 Public method to get the path to the .hgsub file containing the |
2736 definitions of sub-repositories. |
2823 definitions of sub-repositories. |
2737 |
2824 |
2738 @return full path of the .hgsub file (string) |
2825 @return full path of the .hgsub file |
|
2826 @rtype str |
2739 """ |
2827 """ |
2740 ppath = self.__projectHelper.getProject().getProjectPath() |
2828 ppath = self.__projectHelper.getProject().getProjectPath() |
2741 return os.path.join(ppath, ".hgsub") |
2829 return os.path.join(ppath, ".hgsub") |
2742 |
2830 |
2743 def hasSubrepositories(self): |
2831 def hasSubrepositories(self): |
2744 """ |
2832 """ |
2745 Public method to check, if the project might have sub-repositories. |
2833 Public method to check, if the project might have sub-repositories. |
2746 |
2834 |
2747 @return flag indicating the existence of sub-repositories (boolean) |
2835 @return flag indicating the existence of sub-repositories |
|
2836 @rtype bool |
2748 """ |
2837 """ |
2749 hgsub = self.getHgSubPath() |
2838 hgsub = self.getHgSubPath() |
2750 return os.path.isfile(hgsub) and os.stat(hgsub).st_size > 0 |
2839 return os.path.isfile(hgsub) and os.stat(hgsub).st_size > 0 |
2751 |
2840 |
2752 def hgAddSubrepository(self): |
2841 def hgAddSubrepository(self): |
2918 |
3007 |
2919 def canPull(self): |
3008 def canPull(self): |
2920 """ |
3009 """ |
2921 Public method to check, if pull is possible. |
3010 Public method to check, if pull is possible. |
2922 |
3011 |
2923 @return flag indicating pull capability (boolean) |
3012 @return flag indicating pull capability |
|
3013 @rtype bool |
2924 """ |
3014 """ |
2925 return self.__defaultConfigured |
3015 return self.__defaultConfigured |
2926 |
3016 |
2927 def canPush(self): |
3017 def canPush(self): |
2928 """ |
3018 """ |
2929 Public method to check, if push is possible. |
3019 Public method to check, if push is possible. |
2930 |
3020 |
2931 @return flag indicating push capability (boolean) |
3021 @return flag indicating push capability |
|
3022 @rtype bool |
2932 """ |
3023 """ |
2933 return self.__defaultPushConfigured or self.__defaultConfigured |
3024 return self.__defaultPushConfigured or self.__defaultConfigured |
2934 |
3025 |
2935 def __iniFileChanged(self, path): |
3026 def __iniFileChanged(self, path): |
2936 """ |
3027 """ |
2937 Private slot to handle a change of the Mercurial configuration file. |
3028 Private slot to handle a change of the Mercurial configuration file. |
2938 |
3029 |
2939 @param path name of the changed file (string) |
3030 @param path name of the changed file |
|
3031 @type str |
2940 """ |
3032 """ |
2941 if self.__client: |
3033 if self.__client: |
2942 ok, err = self.__client.restartServer() |
3034 ok, err = self.__client.restartServer() |
2943 if not ok: |
3035 if not ok: |
2944 EricMessageBox.warning( |
3036 EricMessageBox.warning( |
2999 |
3091 |
3000 def isExtensionActive(self, extensionName): |
3092 def isExtensionActive(self, extensionName): |
3001 """ |
3093 """ |
3002 Public method to check, if an extension is active. |
3094 Public method to check, if an extension is active. |
3003 |
3095 |
3004 @param extensionName name of the extension to check for (string) |
3096 @param extensionName name of the extension to check for |
3005 @return flag indicating an active extension (boolean) |
3097 @type str |
|
3098 @return flag indicating an active extension |
|
3099 @rtype bool |
3006 """ |
3100 """ |
3007 extensionName = extensionName.strip() |
3101 extensionName = extensionName.strip() |
3008 isActive = extensionName in self.__activeExtensions |
3102 isActive = extensionName in self.__activeExtensions |
3009 |
3103 |
3010 return isActive |
3104 return isActive |
3011 |
3105 |
3012 def getExtensionObject(self, extensionName): |
3106 def getExtensionObject(self, extensionName): |
3013 """ |
3107 """ |
3014 Public method to get a reference to an extension object. |
3108 Public method to get a reference to an extension object. |
3015 |
3109 |
3016 @param extensionName name of the extension (string) |
3110 @param extensionName name of the extension |
3017 @return reference to the extension object (boolean) |
3111 @type str |
|
3112 @return reference to the extension object |
|
3113 @rtype bool |
3018 """ |
3114 """ |
3019 return self.__extensions[extensionName] |
3115 return self.__extensions[extensionName] |
3020 |
3116 |
3021 ########################################################################### |
3117 ########################################################################### |
3022 ## Methods to get the helper objects are below. |
3118 ## Methods to get the helper objects are below. |
3026 """ |
3122 """ |
3027 Public method to instantiate a helper object for the different |
3123 Public method to instantiate a helper object for the different |
3028 project browsers. |
3124 project browsers. |
3029 |
3125 |
3030 @param browser reference to the project browser object |
3126 @param browser reference to the project browser object |
|
3127 @type ProjectBaseBrowser |
3031 @param project reference to the project object |
3128 @param project reference to the project object |
|
3129 @type Project |
3032 @param isTranslationsBrowser flag indicating, the helper is requested |
3130 @param isTranslationsBrowser flag indicating, the helper is requested |
3033 for the translations browser (this needs some special treatment) |
3131 for the translations browser (this needs some special treatment) |
|
3132 @type bool |
3034 @return the project browser helper object |
3133 @return the project browser helper object |
|
3134 @rtype HgProjectBrowserHelper |
3035 """ |
3135 """ |
3036 from .ProjectBrowserHelper import HgProjectBrowserHelper |
3136 from .ProjectBrowserHelper import HgProjectBrowserHelper |
3037 |
3137 |
3038 return HgProjectBrowserHelper(self, browser, project, isTranslationsBrowser) |
3138 return HgProjectBrowserHelper(self, browser, project, isTranslationsBrowser) |
3039 |
3139 |
3040 def vcsGetProjectHelper(self, project): |
3140 def vcsGetProjectHelper(self, project): |
3041 """ |
3141 """ |
3042 Public method to instantiate a helper object for the project. |
3142 Public method to instantiate a helper object for the project. |
3043 |
3143 |
3044 @param project reference to the project object |
3144 @param project reference to the project object |
|
3145 @type Project |
3045 @return the project helper object |
3146 @return the project helper object |
|
3147 @rtype HgProjectHelper |
3046 """ |
3148 """ |
3047 # find the root of the repo |
3149 # find the root of the repo |
3048 repodir = project.getProjectPath() |
3150 repodir = project.getProjectPath() |
3049 while repodir and not os.path.isdir(os.path.join(repodir, self.adminDir)): |
3151 while repodir and not os.path.isdir(os.path.join(repodir, self.adminDir)): |
3050 repodir = os.path.dirname(repodir) |
3152 repodir = os.path.dirname(repodir) |
3089 |
3191 |
3090 def getClient(self): |
3192 def getClient(self): |
3091 """ |
3193 """ |
3092 Public method to get a reference to the command server interface. |
3194 Public method to get a reference to the command server interface. |
3093 |
3195 |
3094 @return reference to the client (HgClient) |
3196 @return reference to the client |
|
3197 @rtype HgClient |
3095 """ |
3198 """ |
3096 if self.__client is None: |
3199 if self.__client is None: |
3097 self.__createClient(self.__repoDir) |
3200 self.__createClient(self.__repoDir) |
3098 |
3201 |
3099 return self.__client |
3202 return self.__client |
3114 """ |
3217 """ |
3115 Protected method to create an instance of the VCS status monitor |
3218 Protected method to create an instance of the VCS status monitor |
3116 thread. |
3219 thread. |
3117 |
3220 |
3118 @param interval check interval for the monitor thread in seconds |
3221 @param interval check interval for the monitor thread in seconds |
3119 (integer) |
3222 @type int |
3120 @param project reference to the project object (Project) |
3223 @param project reference to the project object |
3121 @return reference to the monitor thread (QThread) |
3224 @type Project |
|
3225 @return reference to the monitor thread |
|
3226 @rtype HgStatusMonitorThread |
3122 """ |
3227 """ |
3123 from .HgStatusMonitorThread import HgStatusMonitorThread |
3228 from .HgStatusMonitorThread import HgStatusMonitorThread |
3124 |
3229 |
3125 return HgStatusMonitorThread(interval, project, self) |
3230 return HgStatusMonitorThread(interval, project, self) |
3126 |
3231 |
3144 |
3249 |
3145 def hgGetBookmarksList(self): |
3250 def hgGetBookmarksList(self): |
3146 """ |
3251 """ |
3147 Public method to get the list of bookmarks. |
3252 Public method to get the list of bookmarks. |
3148 |
3253 |
3149 @return list of bookmarks (list of string) |
3254 @return list of bookmarks |
|
3255 @rtype list of str |
3150 """ |
3256 """ |
3151 args = self.initCommand("bookmarks") |
3257 args = self.initCommand("bookmarks") |
3152 |
3258 |
3153 client = self.getClient() |
3259 client = self.getClient() |
3154 output = client.runcommand(args)[0] |
3260 output = client.runcommand(args)[0] |
3168 |
3274 |
3169 def hgBookmarkDefine(self, revision=None, bookmark=None): |
3275 def hgBookmarkDefine(self, revision=None, bookmark=None): |
3170 """ |
3276 """ |
3171 Public method to define a bookmark. |
3277 Public method to define a bookmark. |
3172 |
3278 |
3173 @param revision revision to set bookmark for (string) |
3279 @param revision revision to set bookmark for |
3174 @param bookmark name of the bookmark (string) |
3280 @type str |
|
3281 @param bookmark name of the bookmark |
|
3282 @type str |
3175 """ |
3283 """ |
3176 from .HgBookmarkDialog import HgBookmarkDialog |
3284 from .HgBookmarkDialog import HgBookmarkDialog |
3177 |
3285 |
3178 if bool(revision) and bool(bookmark): |
3286 if bool(revision) and bool(bookmark): |
3179 ok = True |
3287 ok = True |
3256 |
3365 |
3257 def hgBookmarkMove(self, revision=None, bookmark=None): |
3366 def hgBookmarkMove(self, revision=None, bookmark=None): |
3258 """ |
3367 """ |
3259 Public method to move a bookmark. |
3368 Public method to move a bookmark. |
3260 |
3369 |
3261 @param revision revision to set bookmark for (string) |
3370 @param revision revision to set bookmark for |
3262 @param bookmark name of the bookmark (string) |
3371 @type str |
|
3372 @param bookmark name of the bookmark |
|
3373 @type str |
3263 """ |
3374 """ |
3264 from .HgBookmarkDialog import HgBookmarkDialog |
3375 from .HgBookmarkDialog import HgBookmarkDialog |
3265 |
3376 |
3266 if bool(revision) and bool(bookmark): |
3377 if bool(revision) and bool(bookmark): |
3267 ok = True |
3378 ok = True |
3317 |
3428 |
3318 def __getInOutBookmarks(self, incoming): |
3429 def __getInOutBookmarks(self, incoming): |
3319 """ |
3430 """ |
3320 Private method to get the list of incoming or outgoing bookmarks. |
3431 Private method to get the list of incoming or outgoing bookmarks. |
3321 |
3432 |
3322 @param incoming flag indicating to get incoming bookmarks (boolean) |
3433 @param incoming flag indicating to get incoming bookmarks |
3323 @return list of bookmarks (list of string) |
3434 @type bool |
|
3435 @return list of bookmarks |
|
3436 @rtype list of str |
3324 """ |
3437 """ |
3325 bookmarksList = [] |
3438 bookmarksList = [] |
3326 |
3439 |
3327 args = ( |
3440 args = ( |
3328 self.initCommand("incoming") if incoming else self.initCommand("outgoing") |
3441 self.initCommand("incoming") if incoming else self.initCommand("outgoing") |