42 def __init__(self, plugin, parent=None, name=None): |
42 def __init__(self, plugin, parent=None, name=None): |
43 """ |
43 """ |
44 Constructor |
44 Constructor |
45 |
45 |
46 @param plugin reference to the plugin object |
46 @param plugin reference to the plugin object |
47 @param parent parent widget (QWidget) |
47 @type VcsGitPlugin |
48 @param name name of this object (string) |
48 @param parent parent widget |
|
49 @type QWidget |
|
50 @param name name of this object |
|
51 @type str |
49 """ |
52 """ |
50 VersionControl.__init__(self, parent, name) |
53 VersionControl.__init__(self, parent, name) |
51 self.defaultOptions = { |
54 self.defaultOptions = { |
52 "global": [""], |
55 "global": [""], |
53 "commit": [""], |
56 "commit": [""], |
163 |
167 |
164 def initCommand(self, command): |
168 def initCommand(self, command): |
165 """ |
169 """ |
166 Public method to initialize a command arguments list. |
170 Public method to initialize a command arguments list. |
167 |
171 |
168 @param command command name (string) |
172 @param command command name |
169 @return list of command options (list of string) |
173 @type str |
|
174 @return list of command options |
|
175 @rtype list of str |
170 """ |
176 """ |
171 args = [command] |
177 args = [command] |
172 return args |
178 return args |
173 |
179 |
174 def vcsExists(self): |
180 def vcsExists(self): |
175 """ |
181 """ |
176 Public method used to test for the presence of the git executable. |
182 Public method used to test for the presence of the git executable. |
177 |
183 |
178 @return flag indicating the existance (boolean) and an error message |
184 @return flag indicating the existance and an error message |
179 (string) |
185 @rtype tuple of (bool, str) |
180 """ |
186 """ |
181 self.versionStr = "" |
187 self.versionStr = "" |
182 errMsg = "" |
188 errMsg = "" |
183 ioEncoding = Preferences.getSystem("IOEncoding") |
189 ioEncoding = Preferences.getSystem("IOEncoding") |
184 |
190 |
222 |
228 |
223 The initialization is done, when a project is converted into a |
229 The initialization is done, when a project is converted into a |
224 Git controlled project. Therefore we always return TRUE without |
230 Git controlled project. Therefore we always return TRUE without |
225 doing anything. |
231 doing anything. |
226 |
232 |
227 @param vcsDir name of the VCS directory (string) |
233 @param vcsDir name of the VCS directory |
228 @param noDialog flag indicating quiet operations (boolean) |
234 @type str |
229 @return always TRUE |
235 @param noDialog flag indicating quiet operations |
|
236 @type bool |
|
237 @return always True |
|
238 @rtype bool |
230 """ |
239 """ |
231 return True |
240 return True |
232 |
241 |
233 def vcsConvertProject(self, vcsDataDict, project, addAll=True): |
242 def vcsConvertProject(self, vcsDataDict, project, addAll=True): |
234 """ |
243 """ |
262 """ |
271 """ |
263 Public method used to import the project into the Git repository. |
272 Public method used to import the project into the Git repository. |
264 |
273 |
265 @param vcsDataDict dictionary of data required for the import |
274 @param vcsDataDict dictionary of data required for the import |
266 @type dict |
275 @type dict |
267 @param projectDir project directory (string) |
276 @param projectDir project directory |
268 @type str |
277 @type str |
269 @param noDialog flag indicating quiet operations |
278 @param noDialog flag indicating quiet operations |
270 @type bool |
279 @type bool |
271 @param addAll flag indicating to add all files to the repository |
280 @param addAll flag indicating to add all files to the repository |
272 @type bool |
281 @type bool |
316 """ |
325 """ |
317 Public method used to check the project out of a Git repository |
326 Public method used to check the project out of a Git repository |
318 (clone). |
327 (clone). |
319 |
328 |
320 @param vcsDataDict dictionary of data required for the checkout |
329 @param vcsDataDict dictionary of data required for the checkout |
321 @param projectDir project directory to create (string) |
330 @type dict |
|
331 @param projectDir project directory to create |
|
332 @type str |
322 @param noDialog flag indicating quiet operations |
333 @param noDialog flag indicating quiet operations |
323 @return flag indicating an execution without errors (boolean) |
334 @type bool |
|
335 @return flag indicating an execution without errors |
|
336 @rtype bool |
324 """ |
337 """ |
325 noDialog = False |
338 noDialog = False |
326 vcsUrl = self.gitNormalizeURL(vcsDataDict["url"]) |
339 vcsUrl = self.gitNormalizeURL(vcsDataDict["url"]) |
327 |
340 |
328 args = self.initCommand("clone") |
341 args = self.initCommand("clone") |
341 def vcsExport(self, vcsDataDict, projectDir): |
354 def vcsExport(self, vcsDataDict, projectDir): |
342 """ |
355 """ |
343 Public method used to export a directory from the Git repository. |
356 Public method used to export a directory from the Git repository. |
344 |
357 |
345 @param vcsDataDict dictionary of data required for the checkout |
358 @param vcsDataDict dictionary of data required for the checkout |
346 @param projectDir project directory to create (string) |
359 @type dict |
347 @return flag indicating an execution without errors (boolean) |
360 @param projectDir project directory to create |
|
361 @type str |
|
362 @return flag indicating an execution without errors |
|
363 @rtype bool |
348 """ |
364 """ |
349 status = self.vcsCheckout(vcsDataDict, projectDir) |
365 status = self.vcsCheckout(vcsDataDict, projectDir) |
350 adminPath = os.path.join(projectDir, self.adminDirOrFile) |
366 adminPath = os.path.join(projectDir, self.adminDirOrFile) |
351 if os.path.isdir(adminPath): |
367 if os.path.isdir(adminPath): |
352 shutil.rmtree(adminPath, ignore_errors=True) |
368 shutil.rmtree(adminPath, ignore_errors=True) |
359 def vcsCommit(self, name, message="", noDialog=False, commitAll=True, amend=False): |
375 def vcsCommit(self, name, message="", noDialog=False, commitAll=True, amend=False): |
360 """ |
376 """ |
361 Public method used to make the change of a file/directory permanent |
377 Public method used to make the change of a file/directory permanent |
362 in the Git repository. |
378 in the Git repository. |
363 |
379 |
364 @param name file/directory name to be committed (string or list of |
380 @param name file/directory name to be committed |
365 strings) |
381 @type str or list of str |
366 @param message message for this operation (string) |
382 @param message message for this operation |
367 @param noDialog flag indicating quiet operations (boolean) |
383 @type str |
368 @param commitAll flag indicating to commit all local changes (boolean) |
384 @param noDialog flag indicating quiet operations |
369 @param amend flag indicating to amend the HEAD commit (boolean) |
385 @type bool |
|
386 @param commitAll flag indicating to commit all local changes |
|
387 @type bool |
|
388 @param amend flag indicating to amend the HEAD commit |
|
389 @type bool |
370 """ |
390 """ |
371 from .GitCommitDialog import GitCommitDialog |
391 from .GitCommitDialog import GitCommitDialog |
372 |
392 |
373 if not noDialog: |
393 if not noDialog: |
374 # call CommitDialog and get message from there |
394 # call CommitDialog and get message from there |
530 def vcsUpdate(self, name, noDialog=False, revision=None): |
550 def vcsUpdate(self, name, noDialog=False, revision=None): |
531 """ |
551 """ |
532 Public method used to update a file/directory with the Git |
552 Public method used to update a file/directory with the Git |
533 repository. |
553 repository. |
534 |
554 |
535 @param name file/directory name to be updated (string or list of |
555 @param name file/directory name to be updated |
536 strings) |
556 @type str or list of str |
537 @param noDialog flag indicating quiet operations (boolean) |
557 @param noDialog flag indicating quiet operations |
538 @param revision revision to update to (string) |
558 @type bool |
539 @return flag indicating, that the update contained an add |
559 @param revision revision to update to |
540 or delete (boolean) |
560 @type str |
|
561 @return flag indicating, that the update contained an add or delete |
|
562 @rtype bool |
541 """ |
563 """ |
542 args = self.initCommand("checkout") |
564 args = self.initCommand("checkout") |
543 if revision: |
565 if revision: |
544 res = EricMessageBox.yesNo( |
566 res = EricMessageBox.yesNo( |
545 None, |
567 None, |
582 |
604 |
583 def vcsAdd(self, name, isDir=False, noDialog=False): |
605 def vcsAdd(self, name, isDir=False, noDialog=False): |
584 """ |
606 """ |
585 Public method used to add a file/directory to the Git repository. |
607 Public method used to add a file/directory to the Git repository. |
586 |
608 |
587 @param name file/directory name to be added (string) |
609 @param name file/directory name to be added |
588 @param isDir flag indicating name is a directory (boolean) |
610 @type str |
|
611 @param isDir flag indicating name is a directory |
|
612 @type bool |
589 @param noDialog flag indicating quiet operations |
613 @param noDialog flag indicating quiet operations |
|
614 @type bool |
590 """ |
615 """ |
591 args = self.initCommand("add") |
616 args = self.initCommand("add") |
592 args.append("-v") |
617 args.append("-v") |
593 |
618 |
594 if isinstance(name, list): |
619 if isinstance(name, list): |
625 def vcsAddBinary(self, name, isDir=False): |
650 def vcsAddBinary(self, name, isDir=False): |
626 """ |
651 """ |
627 Public method used to add a file/directory in binary mode to the |
652 Public method used to add a file/directory in binary mode to the |
628 Git repository. |
653 Git repository. |
629 |
654 |
630 @param name file/directory name to be added (string) |
655 @param name file/directory name to be added |
631 @param isDir flag indicating name is a directory (boolean) |
656 @type str |
|
657 @param isDir flag indicating name is a directory |
|
658 @type bool |
632 """ |
659 """ |
633 self.vcsAdd(name, isDir) |
660 self.vcsAdd(name, isDir) |
634 |
661 |
635 def vcsAddTree(self, path): |
662 def vcsAddTree(self, path): |
636 """ |
663 """ |
637 Public method to add a directory tree rooted at path to the Git |
664 Public method to add a directory tree rooted at path to the Git |
638 repository. |
665 repository. |
639 |
666 |
640 @param path root directory of the tree to be added (string or list of |
667 @param path root directory of the tree to be added |
641 strings)) |
668 @type str or list of str |
642 """ |
669 """ |
643 self.vcsAdd(path, isDir=False) |
670 self.vcsAdd(path, isDir=False) |
644 |
671 |
645 def vcsRemove( |
672 def vcsRemove( |
646 self, name, project=False, noDialog=False, stageOnly=False # noqa: U100 |
673 self, name, project=False, noDialog=False, stageOnly=False # noqa: U100 |
649 Public method used to remove a file/directory from the Git |
676 Public method used to remove a file/directory from the Git |
650 repository. |
677 repository. |
651 |
678 |
652 The default operation is to remove the local copy as well. |
679 The default operation is to remove the local copy as well. |
653 |
680 |
654 @param name file/directory name to be removed (string or list of |
681 @param name file/directory name to be removed |
655 strings)) |
682 @type str or list of str |
656 @param project flag indicating deletion of a project tree (boolean) |
683 @param project flag indicating deletion of a project tree |
657 (not needed) |
684 @type bool |
658 @param noDialog flag indicating quiet operations (boolean) |
685 @param noDialog flag indicating quiet operations |
|
686 @type bool |
659 @param stageOnly flag indicating to just remove the file from the |
687 @param stageOnly flag indicating to just remove the file from the |
660 staging area (boolean) |
688 staging area |
661 @return flag indicating successful operation (boolean) |
689 @type bool |
|
690 @return flag indicating successful operation |
|
691 @rtype bool |
662 """ |
692 """ |
663 args = self.initCommand("rm") |
693 args = self.initCommand("rm") |
664 if noDialog and "--force" not in args: |
694 if noDialog and "--force" not in args: |
665 args.append("--force") |
695 args.append("--force") |
666 if stageOnly: |
696 if stageOnly: |
710 |
740 |
711 def vcsMove(self, name, project, target=None, noDialog=False): |
741 def vcsMove(self, name, project, target=None, noDialog=False): |
712 """ |
742 """ |
713 Public method used to move a file/directory. |
743 Public method used to move a file/directory. |
714 |
744 |
715 @param name file/directory name to be moved (string) |
745 @param name file/directory name to be moved |
|
746 @type str |
716 @param project reference to the project object |
747 @param project reference to the project object |
717 @param target new name of the file/directory (string) |
748 @type Project |
|
749 @param target new name of the file/directory |
|
750 @type str |
718 @param noDialog flag indicating quiet operations |
751 @param noDialog flag indicating quiet operations |
719 @return flag indicating successful operation (boolean) |
752 @type bool |
|
753 @return flag indicating successful operation |
|
754 @rtype bool |
720 """ |
755 """ |
721 from .GitCopyDialog import GitCopyDialog |
756 from .GitCopyDialog import GitCopyDialog |
722 |
757 |
723 isDir = os.path.isdir(name) |
758 isDir = os.path.isdir(name) |
724 |
759 |
772 def vcsLogBrowser(self, name, isFile=False): |
807 def vcsLogBrowser(self, name, isFile=False): |
773 """ |
808 """ |
774 Public method used to browse the log of a file/directory from the |
809 Public method used to browse the log of a file/directory from the |
775 Git repository. |
810 Git repository. |
776 |
811 |
777 @param name file/directory name to show the log of (string) |
812 @param name file/directory name to show the log of |
|
813 @type str |
778 @param isFile flag indicating log for a file is to be shown |
814 @param isFile flag indicating log for a file is to be shown |
779 (boolean) |
815 @type bool |
780 """ |
816 """ |
781 from .GitLogBrowserDialog import GitLogBrowserDialog |
817 from .GitLogBrowserDialog import GitLogBrowserDialog |
782 |
818 |
783 if self.logBrowser is None: |
819 if self.logBrowser is None: |
784 self.logBrowser = GitLogBrowserDialog(self) |
820 self.logBrowser = GitLogBrowserDialog(self) |
788 |
824 |
789 def gitReflogBrowser(self, projectDir): |
825 def gitReflogBrowser(self, projectDir): |
790 """ |
826 """ |
791 Public method used to browse the reflog of the project. |
827 Public method used to browse the reflog of the project. |
792 |
828 |
793 @param projectDir name of the project directory (string) |
829 @param projectDir name of the project directory |
|
830 @type str |
794 """ |
831 """ |
795 from .GitReflogBrowserDialog import GitReflogBrowserDialog |
832 from .GitReflogBrowserDialog import GitReflogBrowserDialog |
796 |
833 |
797 if self.reflogBrowser is None: |
834 if self.reflogBrowser is None: |
798 self.reflogBrowser = GitReflogBrowserDialog(self) |
835 self.reflogBrowser = GitReflogBrowserDialog(self) |
808 If name is a directory and is the project directory, all project files |
845 If name is a directory and is the project directory, all project files |
809 are saved first. If name is a file (or list of files), which is/are |
846 are saved first. If name is a file (or list of files), which is/are |
810 being edited and has unsaved modification, they can be saved or the |
847 being edited and has unsaved modification, they can be saved or the |
811 operation may be aborted. |
848 operation may be aborted. |
812 |
849 |
813 @param name file/directory name to be diffed (string) |
850 @param name file/directory name to be diffed |
|
851 @type str |
814 """ |
852 """ |
815 from .GitDiffDialog import GitDiffDialog |
853 from .GitDiffDialog import GitDiffDialog |
816 |
854 |
817 names = name[:] if isinstance(name, list) else [name] |
855 names = name[:] if isinstance(name, list) else [name] |
818 for nam in names: |
856 for nam in names: |
835 """ |
873 """ |
836 Public method used to view the status of files/directories in the |
874 Public method used to view the status of files/directories in the |
837 Git repository. |
875 Git repository. |
838 |
876 |
839 @param name file/directory name(s) to show the status of |
877 @param name file/directory name(s) to show the status of |
840 (string or list of strings) |
878 @type str or list of str |
841 """ |
879 """ |
842 from .GitStatusDialog import GitStatusDialog |
880 from .GitStatusDialog import GitStatusDialog |
843 |
881 |
844 if self.status is None: |
882 if self.status is None: |
845 self.status = GitStatusDialog(self) |
883 self.status = GitStatusDialog(self) |
849 |
887 |
850 def gitUnstage(self, name): |
888 def gitUnstage(self, name): |
851 """ |
889 """ |
852 Public method used to unstage a file/directory. |
890 Public method used to unstage a file/directory. |
853 |
891 |
854 @param name file/directory name to be reverted (string) |
892 @param name file/directory name to be reverted |
855 @return flag indicating, that the update contained an add |
893 @type str |
856 or delete (boolean) |
894 @return flag indicating, that the update contained an add or delete |
|
895 @rtype bool |
857 """ |
896 """ |
858 if isinstance(name, list): |
897 if isinstance(name, list): |
859 dname, fnames = self.splitPathList(name) |
898 dname, fnames = self.splitPathList(name) |
860 else: |
899 else: |
861 dname, fname = self.splitPath(name) |
900 dname, fname = self.splitPath(name) |
946 |
985 |
947 def vcsMerge(self, name): |
986 def vcsMerge(self, name): |
948 """ |
987 """ |
949 Public method used to merge a URL/revision into the local project. |
988 Public method used to merge a URL/revision into the local project. |
950 |
989 |
951 @param name file/directory name to be merged (string) |
990 @param name file/directory name to be merged |
|
991 @type str |
952 """ |
992 """ |
953 from .GitMergeDialog import GitMergeDialog |
993 from .GitMergeDialog import GitMergeDialog |
954 |
994 |
955 dname, fname = self.splitPath(name) |
995 dname, fname = self.splitPath(name) |
956 |
996 |
994 def vcsSwitch(self, name): |
1034 def vcsSwitch(self, name): |
995 """ |
1035 """ |
996 Public method used to switch a working directory to a different |
1036 Public method used to switch a working directory to a different |
997 revision. |
1037 revision. |
998 |
1038 |
999 @param name directory name to be switched (string) |
1039 @param name directory name to be switched |
1000 @return flag indicating, that the switch contained an add |
1040 @type str |
1001 or delete (boolean) |
1041 @return flag indicating, that the switch contained an add or delete |
|
1042 @rtype bool |
1002 """ |
1043 """ |
1003 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
1044 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
1004 |
1045 |
1005 dname, fname = self.splitPath(name) |
1046 dname, fname = self.splitPath(name) |
1006 |
1047 |
1023 |
1064 |
1024 def vcsRegisteredState(self, name): |
1065 def vcsRegisteredState(self, name): |
1025 """ |
1066 """ |
1026 Public method used to get the registered state of a file in the vcs. |
1067 Public method used to get the registered state of a file in the vcs. |
1027 |
1068 |
1028 @param name filename to check (string) |
1069 @param name filename to check |
1029 @return a combination of canBeCommited and canBeAdded |
1070 @type str |
|
1071 @return registered state (one of canBeCommited and canBeAdded) |
|
1072 @rtype int |
1030 """ |
1073 """ |
1031 if name.endswith(os.sep): |
1074 if name.endswith(os.sep): |
1032 name = name[:-1] |
1075 name = name[:-1] |
1033 name = os.path.normcase(name) |
1076 name = os.path.normcase(name) |
1034 dname, fname = self.splitPath(name) |
1077 dname, fname = self.splitPath(name) |
1089 <b>Note:</b> If a shortcut is to be taken, the code will only check, |
1132 <b>Note:</b> If a shortcut is to be taken, the code will only check, |
1090 if the named directory has been scanned already. If so, it is assumed, |
1133 if the named directory has been scanned already. If so, it is assumed, |
1091 that the states for all files have been populated by the previous run. |
1134 that the states for all files have been populated by the previous run. |
1092 |
1135 |
1093 @param names dictionary with all filenames to be checked as keys |
1136 @param names dictionary with all filenames to be checked as keys |
1094 @param dname directory to check in (string) |
1137 @type dict |
1095 @param shortcut flag indicating a shortcut should be taken (boolean) |
1138 @param dname directory to check in |
|
1139 @type str |
|
1140 @param shortcut flag indicating a shortcut should be taken |
|
1141 @type bool |
1096 @return the received dictionary completed with a combination of |
1142 @return the received dictionary completed with a combination of |
1097 canBeCommited and canBeAdded or None in order to signal an error |
1143 canBeCommited and canBeAdded or None in order to signal an error |
|
1144 @rtype dict |
1098 """ |
1145 """ |
1099 if dname.endswith(os.sep): |
1146 if dname.endswith(os.sep): |
1100 dname = dname[:-1] |
1147 dname = dname[:-1] |
1101 dname = os.path.normcase(dname) |
1148 dname = os.path.normcase(dname) |
1102 |
1149 |
1166 |
1213 |
1167 def vcsName(self): |
1214 def vcsName(self): |
1168 """ |
1215 """ |
1169 Public method returning the name of the vcs. |
1216 Public method returning the name of the vcs. |
1170 |
1217 |
1171 @return always 'Git' (string) |
1218 @return always 'Git' |
|
1219 @rtype str |
1172 """ |
1220 """ |
1173 return "Git" |
1221 return "Git" |
1174 |
1222 |
1175 def vcsInitConfig(self, project): |
1223 def vcsInitConfig(self, project): |
1176 """ |
1224 """ |
1177 Public method to initialize the VCS configuration. |
1225 Public method to initialize the VCS configuration. |
1178 |
1226 |
1179 This method ensures, that an ignore file exists. |
1227 This method ensures, that an ignore file exists. |
1180 |
1228 |
1181 @param project reference to the project (Project) |
1229 @param project reference to the project |
|
1230 @type Project |
1182 """ |
1231 """ |
1183 ppath = project.getProjectPath() |
1232 ppath = project.getProjectPath() |
1184 if ppath: |
1233 if ppath: |
1185 ignoreName = os.path.join(ppath, Git.IgnoreFileName) |
1234 ignoreName = os.path.join(ppath, Git.IgnoreFileName) |
1186 if not os.path.exists(ignoreName): |
1235 if not os.path.exists(ignoreName): |
1188 |
1237 |
1189 def vcsCleanup(self, name): |
1238 def vcsCleanup(self, name): |
1190 """ |
1239 """ |
1191 Public method used to cleanup the working directory. |
1240 Public method used to cleanup the working directory. |
1192 |
1241 |
1193 @param name directory name to be cleaned up (string) |
1242 @param name directory name to be cleaned up |
|
1243 @type str |
1194 """ |
1244 """ |
1195 patterns = self.__plugin.getPreferences("CleanupPatterns").split() |
1245 patterns = self.__plugin.getPreferences("CleanupPatterns").split() |
1196 |
1246 |
1197 entries = [] |
1247 entries = [] |
1198 for pat in patterns: |
1248 for pat in patterns: |
1204 |
1254 |
1205 def vcsCommandLine(self, name): |
1255 def vcsCommandLine(self, name): |
1206 """ |
1256 """ |
1207 Public method used to execute arbitrary Git commands. |
1257 Public method used to execute arbitrary Git commands. |
1208 |
1258 |
1209 @param name directory name of the working directory (string) |
1259 @param name directory name of the working directory |
|
1260 @type str |
1210 """ |
1261 """ |
1211 from .GitCommandDialog import GitCommandDialog |
1262 from .GitCommandDialog import GitCommandDialog |
1212 |
1263 |
1213 dlg = GitCommandDialog(self.commandHistory, name) |
1264 dlg = GitCommandDialog(self.commandHistory, name) |
1214 if dlg.exec() == QDialog.DialogCode.Accepted: |
1265 if dlg.exec() == QDialog.DialogCode.Accepted: |
1239 ): |
1290 ): |
1240 """ |
1291 """ |
1241 Public method to get a dialog to enter repository info. |
1292 Public method to get a dialog to enter repository info. |
1242 |
1293 |
1243 @param project reference to the project object |
1294 @param project reference to the project object |
1244 @param archive name of the project in the repository (string) |
1295 @type Project |
|
1296 @param archive name of the project in the repository |
|
1297 @type str |
1245 @param editable flag indicating that the project name is editable |
1298 @param editable flag indicating that the project name is editable |
1246 (boolean) |
1299 @type bool |
1247 @param parent parent widget (QWidget) |
1300 @param parent parent widget |
1248 @return reference to the instantiated options dialog (GitOptionsDialog) |
1301 @type QWidget |
|
1302 @return reference to the instantiated options dialog |
|
1303 @rtype GitOptionsDialog |
1249 """ |
1304 """ |
1250 from .GitOptionsDialog import GitOptionsDialog |
1305 from .GitOptionsDialog import GitOptionsDialog |
1251 |
1306 |
1252 return GitOptionsDialog(self, project, parent) |
1307 return GitOptionsDialog(self, project, parent) |
1253 |
1308 |
1254 def vcsNewProjectOptionsDialog(self, parent=None): |
1309 def vcsNewProjectOptionsDialog(self, parent=None): |
1255 """ |
1310 """ |
1256 Public method to get a dialog to enter repository info for getting a |
1311 Public method to get a dialog to enter repository info for getting a |
1257 new project. |
1312 new project. |
1258 |
1313 |
1259 @param parent parent widget (QWidget) |
1314 @param parent parent widget |
|
1315 @type QWidget |
1260 @return reference to the instantiated options dialog |
1316 @return reference to the instantiated options dialog |
1261 (GitNewProjectOptionsDialog) |
1317 @rtype GitNewProjectOptionsDialog |
1262 """ |
1318 """ |
1263 from .GitNewProjectOptionsDialog import GitNewProjectOptionsDialog |
1319 from .GitNewProjectOptionsDialog import GitNewProjectOptionsDialog |
1264 |
1320 |
1265 return GitNewProjectOptionsDialog(self, parent) |
1321 return GitNewProjectOptionsDialog(self, parent) |
1266 |
1322 |
1267 def vcsRepositoryInfos(self, ppath): |
1323 def vcsRepositoryInfos(self, ppath): |
1268 """ |
1324 """ |
1269 Public method to retrieve information about the repository. |
1325 Public method to retrieve information about the repository. |
1270 |
1326 |
1271 @param ppath local path to get the repository infos (string) |
1327 @param ppath local path to get the repository infos |
1272 @return string with ready formated info for display (string) |
1328 @type str |
|
1329 @return string with ready formated info for display |
|
1330 @rtype str |
1273 """ |
1331 """ |
1274 formatTemplate = ( |
1332 formatTemplate = ( |
1275 "format:" |
1333 "format:" |
1276 "%h%n" |
1334 "%h%n" |
1277 "%p%n" |
1335 "%p%n" |
1392 def vcsSupportCommandOptions(self): |
1450 def vcsSupportCommandOptions(self): |
1393 """ |
1451 """ |
1394 Public method to signal the support of user settable command options. |
1452 Public method to signal the support of user settable command options. |
1395 |
1453 |
1396 @return flag indicating the support of user settable command options |
1454 @return flag indicating the support of user settable command options |
1397 (boolean) |
1455 @rtype bool |
1398 """ |
1456 """ |
1399 return False |
1457 return False |
1400 |
1458 |
1401 ########################################################################### |
1459 ########################################################################### |
1402 ## Git specific methods are below. |
1460 ## Git specific methods are below. |
1404 |
1462 |
1405 def gitNormalizeURL(self, url): |
1463 def gitNormalizeURL(self, url): |
1406 """ |
1464 """ |
1407 Public method to normalize a url for Git. |
1465 Public method to normalize a url for Git. |
1408 |
1466 |
1409 @param url url string (string) |
1467 @param url url string |
1410 @return properly normalized url for git (string) |
1468 @type str |
|
1469 @return properly normalized url for git |
|
1470 @rtype str |
1411 """ |
1471 """ |
1412 url = url.replace("\\", "/") |
1472 url = url.replace("\\", "/") |
1413 if url.endswith("/"): |
1473 if url.endswith("/"): |
1414 url = url[:-1] |
1474 url = url[:-1] |
1415 urll = url.split("//") |
1475 urll = url.split("//") |
1420 |
1480 |
1421 def gitCreateIgnoreFile(self, name, autoAdd=False): |
1481 def gitCreateIgnoreFile(self, name, autoAdd=False): |
1422 """ |
1482 """ |
1423 Public method to create the ignore file. |
1483 Public method to create the ignore file. |
1424 |
1484 |
1425 @param name directory name to create the ignore file in (string) |
1485 @param name directory name to create the ignore file in |
1426 @param autoAdd flag indicating to add it automatically (boolean) |
1486 @type str |
|
1487 @param autoAdd flag indicating to add it automatically |
|
1488 @type bool |
1427 @return flag indicating success |
1489 @return flag indicating success |
|
1490 @rtype bool |
1428 """ |
1491 """ |
1429 status = False |
1492 status = False |
1430 ignorePatterns = [ |
1493 ignorePatterns = [ |
1431 ".eric6project/", |
1494 ".eric6project/", |
1432 ".eric7project/", |
1495 ".eric7project/", |
1484 |
1547 |
1485 def gitCopy(self, name, project): |
1548 def gitCopy(self, name, project): |
1486 """ |
1549 """ |
1487 Public method used to copy a file/directory. |
1550 Public method used to copy a file/directory. |
1488 |
1551 |
1489 @param name file/directory name to be copied (string) |
1552 @param name file/directory name to be copied |
|
1553 @type str |
1490 @param project reference to the project object |
1554 @param project reference to the project object |
1491 @return flag indicating successful operation (boolean) |
1555 @type Project |
|
1556 @return flag indicating successful operation |
|
1557 @rtype bool |
1492 """ |
1558 """ |
1493 from .GitCopyDialog import GitCopyDialog |
1559 from .GitCopyDialog import GitCopyDialog |
1494 |
1560 |
1495 dlg = GitCopyDialog(name) |
1561 dlg = GitCopyDialog(name) |
1496 if dlg.exec() == QDialog.DialogCode.Accepted: |
1562 if dlg.exec() == QDialog.DialogCode.Accepted: |
1560 being edited and has unsaved modification, they can be saved or the |
1626 being edited and has unsaved modification, they can be saved or the |
1561 operation may be aborted. |
1627 operation may be aborted. |
1562 |
1628 |
1563 This method gives the chance to enter the revisions to be compared. |
1629 This method gives the chance to enter the revisions to be compared. |
1564 |
1630 |
1565 @param name file/directory name to be diffed (string) |
1631 @param name file/directory name to be diffed |
|
1632 @type str |
1566 """ |
1633 """ |
1567 from .GitDiffDialog import GitDiffDialog |
1634 from .GitDiffDialog import GitDiffDialog |
1568 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1635 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1569 |
1636 |
1570 if isinstance(name, list): |
1637 if isinstance(name, list): |
1602 def __gitGetFileForRevision(self, name, rev=""): |
1669 def __gitGetFileForRevision(self, name, rev=""): |
1603 """ |
1670 """ |
1604 Private method to get a file for a specific revision from the |
1671 Private method to get a file for a specific revision from the |
1605 repository. |
1672 repository. |
1606 |
1673 |
1607 @param name file name to get from the repository (string) |
1674 @param name file name to get from the repository |
1608 @param rev revision to retrieve (string) |
1675 @type str |
1609 @return contents of the file (string) and an error message (string) |
1676 @param rev revision to retrieve |
|
1677 @type str |
|
1678 @return contents of the file (string) and an error message |
|
1679 @rtype str |
1610 """ |
1680 """ |
1611 # find the root of the repo |
1681 # find the root of the repo |
1612 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1682 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1613 if not repodir: |
1683 if not repodir: |
1614 return False |
1684 return False |
1653 def vcsSbsDiff(self, name, extended=False, revisions=None): |
1723 def vcsSbsDiff(self, name, extended=False, revisions=None): |
1654 """ |
1724 """ |
1655 Public method used to view the difference of a file to the Git |
1725 Public method used to view the difference of a file to the Git |
1656 repository side-by-side. |
1726 repository side-by-side. |
1657 |
1727 |
1658 @param name file name to be diffed (string) |
1728 @param name file name to be diffed |
1659 @param extended flag indicating the extended variant (boolean) |
1729 @type str |
1660 @param revisions tuple of two revisions (tuple of strings) |
1730 @param extended flag indicating the extended variant |
|
1731 @type bool |
|
1732 @param revisions tuple of two revisions |
|
1733 @type tuple of (str, str) |
1661 @exception ValueError raised to indicate an invalid name parameter |
1734 @exception ValueError raised to indicate an invalid name parameter |
1662 """ |
1735 """ |
1663 from eric7.UI.CompareDialog import CompareDialog |
1736 from eric7.UI.CompareDialog import CompareDialog |
1664 |
1737 |
1665 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1738 from .GitRevisionsSelectionDialog import GitRevisionsSelectionDialog |
1725 |
1798 |
1726 def gitFetch(self, name): |
1799 def gitFetch(self, name): |
1727 """ |
1800 """ |
1728 Public method to fetch changes from a remote repository. |
1801 Public method to fetch changes from a remote repository. |
1729 |
1802 |
1730 @param name directory name (string) |
1803 @param name directory name |
|
1804 @type str |
1731 """ |
1805 """ |
1732 from .GitFetchDialog import GitFetchDialog |
1806 from .GitFetchDialog import GitFetchDialog |
1733 |
1807 |
1734 # find the root of the repo |
1808 # find the root of the repo |
1735 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1809 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1771 |
1845 |
1772 def gitPull(self, name): |
1846 def gitPull(self, name): |
1773 """ |
1847 """ |
1774 Public method used to pull changes from a remote Git repository. |
1848 Public method used to pull changes from a remote Git repository. |
1775 |
1849 |
1776 @param name directory name of the project to be pulled to (string) |
1850 @param name directory name of the project to be pulled to |
1777 @return flag indicating, that the update contained an add |
1851 @type str |
1778 or delete (boolean) |
1852 @return flag indicating, that the update contained an add or delete |
|
1853 @rtype bool |
1779 """ |
1854 """ |
1780 from .GitPullDialog import GitPullDialog |
1855 from .GitPullDialog import GitPullDialog |
1781 |
1856 |
1782 # find the root of the repo |
1857 # find the root of the repo |
1783 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1858 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1811 |
1886 |
1812 def gitPush(self, name): |
1887 def gitPush(self, name): |
1813 """ |
1888 """ |
1814 Public method used to push changes to a remote Git repository. |
1889 Public method used to push changes to a remote Git repository. |
1815 |
1890 |
1816 @param name directory name of the project to be pushed from (string) |
1891 @param name directory name of the project to be pushed from |
|
1892 @type str |
1817 """ |
1893 """ |
1818 from .GitPushDialog import GitPushDialog |
1894 from .GitPushDialog import GitPushDialog |
1819 |
1895 |
1820 # find the root of the repo |
1896 # find the root of the repo |
1821 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1897 repodir = self.findRepoRoot(self.splitPath(name)[0]) |
1846 |
1922 |
1847 def gitCommitMerge(self, name): |
1923 def gitCommitMerge(self, name): |
1848 """ |
1924 """ |
1849 Public method to commit a failed merge. |
1925 Public method to commit a failed merge. |
1850 |
1926 |
1851 @param name file/directory name (string) |
1927 @param name file/directory name |
|
1928 @type str |
1852 """ |
1929 """ |
1853 dname, fname = self.splitPath(name) |
1930 dname, fname = self.splitPath(name) |
1854 |
1931 |
1855 # find the root of the repo |
1932 # find the root of the repo |
1856 repodir = self.findRepoRoot(dname) |
1933 repodir = self.findRepoRoot(dname) |
1875 |
1952 |
1876 def gitCancelMerge(self, name): |
1953 def gitCancelMerge(self, name): |
1877 """ |
1954 """ |
1878 Public method to cancel an uncommitted or failed merge. |
1955 Public method to cancel an uncommitted or failed merge. |
1879 |
1956 |
1880 @param name file/directory name (string) |
1957 @param name file/directory name |
1881 @return flag indicating, that the cancellation contained an add |
1958 @type str |
1882 or delete (boolean) |
1959 @return flag indicating, that the cancellation contained an add or delete |
|
1960 @rtype bool |
1883 """ |
1961 """ |
1884 dname, fname = self.splitPath(name) |
1962 dname, fname = self.splitPath(name) |
1885 |
1963 |
1886 # find the root of the repo |
1964 # find the root of the repo |
1887 repodir = self.findRepoRoot(dname) |
1965 repodir = self.findRepoRoot(dname) |
1901 |
1979 |
1902 def gitApply(self, repodir, patchFile, cached=False, reverse=False, noDialog=False): |
1980 def gitApply(self, repodir, patchFile, cached=False, reverse=False, noDialog=False): |
1903 """ |
1981 """ |
1904 Public method to apply a patch stored in a given file. |
1982 Public method to apply a patch stored in a given file. |
1905 |
1983 |
1906 @param repodir directory name of the repository (string) |
1984 @param repodir directory name of the repository |
1907 @param patchFile name of the patch file (string) |
1985 @type str |
|
1986 @param patchFile name of the patch file |
|
1987 @type str |
1908 @param cached flag indicating to apply the patch to the staging area |
1988 @param cached flag indicating to apply the patch to the staging area |
1909 (boolean) |
1989 @type bool |
1910 @param reverse flag indicating to apply the patch in reverse (boolean) |
1990 @param reverse flag indicating to apply the patch in reverse |
1911 @param noDialog flag indicating quiet operations (boolean) |
1991 @type bool |
|
1992 @param noDialog flag indicating quiet operations |
|
1993 @type bool |
1912 """ |
1994 """ |
1913 args = self.initCommand("apply") |
1995 args = self.initCommand("apply") |
1914 if cached: |
1996 if cached: |
1915 args.append("--index") |
1997 args.append("--index") |
1916 args.append("--cached") |
1998 args.append("--cached") |
1929 def gitApplyCheckPatches(self, projectDir, check=False): |
2011 def gitApplyCheckPatches(self, projectDir, check=False): |
1930 """ |
2012 """ |
1931 Public method to apply a list of patch files or check, if they would |
2013 Public method to apply a list of patch files or check, if they would |
1932 apply cleanly. |
2014 apply cleanly. |
1933 |
2015 |
1934 @param projectDir directory name of the project (string) |
2016 @param projectDir directory name of the project |
1935 @param check flag indicating to perform a check operation (boolean) |
2017 @type str |
|
2018 @param check flag indicating to perform a check operation |
|
2019 @type bool |
1936 """ |
2020 """ |
1937 from .GitPatchFilesDialog import GitPatchFilesDialog |
2021 from .GitPatchFilesDialog import GitPatchFilesDialog |
1938 |
2022 |
1939 # find the root of the repo |
2023 # find the root of the repo |
1940 repodir = self.findRepoRoot(projectDir) |
2024 repodir = self.findRepoRoot(projectDir) |
1974 |
2058 |
1975 def gitShowPatchesStatistics(self, projectDir): |
2059 def gitShowPatchesStatistics(self, projectDir): |
1976 """ |
2060 """ |
1977 Public method to show statistics for a set of patch files. |
2061 Public method to show statistics for a set of patch files. |
1978 |
2062 |
1979 @param projectDir directory name of the project (string) |
2063 @param projectDir directory name of the project |
|
2064 @type str |
1980 """ |
2065 """ |
1981 from .GitPatchStatisticsDialog import GitPatchStatisticsDialog |
2066 from .GitPatchStatisticsDialog import GitPatchStatisticsDialog |
1982 |
2067 |
1983 if self.patchStatisticsDialog is None: |
2068 if self.patchStatisticsDialog is None: |
1984 self.patchStatisticsDialog = GitPatchStatisticsDialog(self) |
2069 self.patchStatisticsDialog = GitPatchStatisticsDialog(self) |
1994 def vcsTag(self, name, revision=None, tagName=None): |
2079 def vcsTag(self, name, revision=None, tagName=None): |
1995 """ |
2080 """ |
1996 Public method used to set/remove a tag in the Git repository. |
2081 Public method used to set/remove a tag in the Git repository. |
1997 |
2082 |
1998 @param name file/directory name to determine the repo root from |
2083 @param name file/directory name to determine the repo root from |
1999 (string) |
2084 @type str |
2000 @param revision revision to set tag for (string) |
2085 @param revision revision to set tag for |
2001 @param tagName name of the tag (string) |
2086 @type str |
2002 @return flag indicating a performed tag action (boolean) |
2087 @param tagName name of the tag |
|
2088 @type str |
|
2089 @return flag indicating a performed tag action |
|
2090 @rtype bool |
2003 """ |
2091 """ |
2004 from .GitTagDialog import GitTagDialog |
2092 from .GitTagDialog import GitTagDialog |
2005 |
2093 |
2006 dname, fname = self.splitPath(name) |
2094 dname, fname = self.splitPath(name) |
2007 |
2095 |
2046 |
2134 |
2047 def gitGetTagsList(self, repodir): |
2135 def gitGetTagsList(self, repodir): |
2048 """ |
2136 """ |
2049 Public method to get the list of tags. |
2137 Public method to get the list of tags. |
2050 |
2138 |
2051 @param repodir directory name of the repository (string) |
2139 @param repodir directory name of the repository |
2052 @return list of tags (list of string) or list of tuples of |
2140 @type str |
2053 tag name and flag indicating a local tag (list of tuple of string |
2141 @return list of tags or list of tuples of tag name and flag indicating |
2054 and boolean), if withType is True |
2142 a local tag, if withType is True |
|
2143 @rtype list of str or list of tuple of (str, bool) |
2055 """ |
2144 """ |
2056 args = self.initCommand("tag") |
2145 args = self.initCommand("tag") |
2057 args.append("--list") |
2146 args.append("--list") |
2058 |
2147 |
2059 output = "" |
2148 output = "" |
2080 |
2169 |
2081 def gitListTagBranch(self, path, tags=True, listAll=True, merged=True): |
2170 def gitListTagBranch(self, path, tags=True, listAll=True, merged=True): |
2082 """ |
2171 """ |
2083 Public method used to list the available tags or branches. |
2172 Public method used to list the available tags or branches. |
2084 |
2173 |
2085 @param path directory name of the project (string) |
2174 @param path directory name of the project |
|
2175 @type str |
2086 @param tags flag indicating listing of branches or tags |
2176 @param tags flag indicating listing of branches or tags |
2087 (False = branches, True = tags) |
2177 (False = branches, True = tags) |
2088 @param listAll flag indicating to show all tags or branches (boolean) |
2178 @type bool |
2089 @param merged flag indicating to show only merged or non-merged |
2179 @param listAll flag indicating to show all tags or branches |
2090 branches (boolean) |
2180 @type bool |
|
2181 @param merged flag indicating to show only merged or non-merged branches |
|
2182 @type bool |
2091 """ |
2183 """ |
2092 from .GitTagBranchListDialog import GitTagBranchListDialog |
2184 from .GitTagBranchListDialog import GitTagBranchListDialog |
2093 |
2185 |
2094 if self.tagbranchList is None: |
2186 if self.tagbranchList is None: |
2095 self.tagbranchList = GitTagBranchListDialog(self) |
2187 self.tagbranchList = GitTagBranchListDialog(self) |
2108 self, repodir, withMain=False, allBranches=False, remotes=False |
2200 self, repodir, withMain=False, allBranches=False, remotes=False |
2109 ): |
2201 ): |
2110 """ |
2202 """ |
2111 Public method to get the list of branches. |
2203 Public method to get the list of branches. |
2112 |
2204 |
2113 @param repodir directory name of the repository (string) |
2205 @param repodir directory name of the repository |
2114 @param withMain flag indicating to get 'main' as well (boolean) |
2206 @type str |
2115 @param allBranches flag indicating to return all branches (boolean) |
2207 @param withMain flag indicating to get 'main' as well |
2116 @param remotes flag indicating to return remote branches only (boolean) |
2208 @type bool |
2117 @return list of branches (list of string) |
2209 @param allBranches flag indicating to return all branches |
|
2210 @type bool |
|
2211 @param remotes flag indicating to return remote branches only |
|
2212 @type bool |
|
2213 @return list of branches |
|
2214 @rtype list of str |
2118 """ |
2215 """ |
2119 args = self.initCommand("branch") |
2216 args = self.initCommand("branch") |
2120 args.append("--list") |
2217 args.append("--list") |
2121 if allBranches: |
2218 if allBranches: |
2122 args.append("--all") |
2219 args.append("--all") |
2153 |
2250 |
2154 def gitGetCurrentBranch(self, repodir): |
2251 def gitGetCurrentBranch(self, repodir): |
2155 """ |
2252 """ |
2156 Public method used to show the current branch of the working directory. |
2253 Public method used to show the current branch of the working directory. |
2157 |
2254 |
2158 @param repodir directory name of the repository (string) |
2255 @param repodir directory name of the repository |
2159 @return name of the current branch (string) |
2256 @type str |
|
2257 @return name of the current branch |
|
2258 @rtype str |
2160 """ |
2259 """ |
2161 args = self.initCommand("branch") |
2260 args = self.initCommand("branch") |
2162 args.append("--list") |
2261 args.append("--list") |
2163 |
2262 |
2164 branchName = "" |
2263 branchName = "" |
2190 def gitBranch(self, name, revision=None, branchName=None, branchOp=None): |
2289 def gitBranch(self, name, revision=None, branchName=None, branchOp=None): |
2191 """ |
2290 """ |
2192 Public method used to create, delete or move a branch in the Git |
2291 Public method used to create, delete or move a branch in the Git |
2193 repository. |
2292 repository. |
2194 |
2293 |
2195 @param name file/directory name to be branched (string) |
2294 @param name file/directory name to be branched |
2196 @param revision revision to set tag for (string) |
2295 @type str |
2197 @param branchName name of the branch (string) |
2296 @param revision revision to set tag for |
2198 @param branchOp desired branch operation (integer) |
2297 @type str |
2199 @return flag indicating a performed branch action (boolean) and |
2298 @param branchName name of the branch |
2200 a flag indicating, that the branch operation contained an add |
2299 @type str |
2201 or delete (boolean) |
2300 @param branchOp desired branch operation |
|
2301 @type int |
|
2302 @return flag indicating a performed branch action and a flag indicating, |
|
2303 that the branch operation contained an add or delete |
|
2304 @rtype tuple of (bool, bool) |
2202 """ |
2305 """ |
2203 from .GitBranchDialog import GitBranchDialog |
2306 from .GitBranchDialog import GitBranchDialog |
2204 |
2307 |
2205 dname, fname = self.splitPath(name) |
2308 dname, fname = self.splitPath(name) |
2206 |
2309 |
2298 |
2401 |
2299 def gitDeleteRemoteBranch(self, name): |
2402 def gitDeleteRemoteBranch(self, name): |
2300 """ |
2403 """ |
2301 Public method to delete a branch from a remote repository. |
2404 Public method to delete a branch from a remote repository. |
2302 |
2405 |
2303 @param name file/directory name (string) |
2406 @param name file/directory name |
|
2407 @type str |
2304 """ |
2408 """ |
2305 from .GitBranchPushDialog import GitBranchPushDialog |
2409 from .GitBranchPushDialog import GitBranchPushDialog |
2306 |
2410 |
2307 dname, fname = self.splitPath(name) |
2411 dname, fname = self.splitPath(name) |
2308 |
2412 |
2330 |
2434 |
2331 def gitShowBranch(self, name): |
2435 def gitShowBranch(self, name): |
2332 """ |
2436 """ |
2333 Public method used to show the current branch of the working directory. |
2437 Public method used to show the current branch of the working directory. |
2334 |
2438 |
2335 @param name file/directory name (string) |
2439 @param name file/directory name |
|
2440 @type str |
2336 """ |
2441 """ |
2337 dname, fname = self.splitPath(name) |
2442 dname, fname = self.splitPath(name) |
2338 |
2443 |
2339 # find the root of the repo |
2444 # find the root of the repo |
2340 repodir = self.findRepoRoot(dname) |
2445 repodir = self.findRepoRoot(dname) |
2354 |
2459 |
2355 def gitBundle(self, projectDir): |
2460 def gitBundle(self, projectDir): |
2356 """ |
2461 """ |
2357 Public method to create a bundle file. |
2462 Public method to create a bundle file. |
2358 |
2463 |
2359 @param projectDir name of the project directory (string) |
2464 @param projectDir name of the project directory |
|
2465 @type str |
2360 """ |
2466 """ |
2361 from .GitBundleDialog import GitBundleDialog |
2467 from .GitBundleDialog import GitBundleDialog |
2362 |
2468 |
2363 # find the root of the repo |
2469 # find the root of the repo |
2364 repodir = self.findRepoRoot(projectDir) |
2470 repodir = self.findRepoRoot(projectDir) |
2416 |
2522 |
2417 def gitVerifyBundle(self, projectDir): |
2523 def gitVerifyBundle(self, projectDir): |
2418 """ |
2524 """ |
2419 Public method to verify a bundle file. |
2525 Public method to verify a bundle file. |
2420 |
2526 |
2421 @param projectDir name of the project directory (string) |
2527 @param projectDir name of the project directory |
|
2528 @type str |
2422 """ |
2529 """ |
2423 # find the root of the repo |
2530 # find the root of the repo |
2424 repodir = self.findRepoRoot(projectDir) |
2531 repodir = self.findRepoRoot(projectDir) |
2425 if not repodir: |
2532 if not repodir: |
2426 return |
2533 return |
2445 |
2552 |
2446 def gitBundleListHeads(self, projectDir): |
2553 def gitBundleListHeads(self, projectDir): |
2447 """ |
2554 """ |
2448 Public method to list the heads contained in a bundle file. |
2555 Public method to list the heads contained in a bundle file. |
2449 |
2556 |
2450 @param projectDir name of the project directory (string) |
2557 @param projectDir name of the project directory |
|
2558 @type str |
2451 """ |
2559 """ |
2452 # find the root of the repo |
2560 # find the root of the repo |
2453 repodir = self.findRepoRoot(projectDir) |
2561 repodir = self.findRepoRoot(projectDir) |
2454 if not repodir: |
2562 if not repodir: |
2455 return |
2563 return |
2474 |
2582 |
2475 def gitGetBundleHeads(self, repodir, bundleFile): |
2583 def gitGetBundleHeads(self, repodir, bundleFile): |
2476 """ |
2584 """ |
2477 Public method to get a list of heads contained in a bundle file. |
2585 Public method to get a list of heads contained in a bundle file. |
2478 |
2586 |
2479 @param repodir directory name of the repository (string) |
2587 @param repodir directory name of the repository |
2480 @param bundleFile file name of a git bundle file (string) |
2588 @type str |
2481 @return list of heads (list of strings) |
2589 @param bundleFile file name of a git bundle file |
|
2590 @type str |
|
2591 @return list of heads |
|
2592 @rtype list of str |
2482 """ |
2593 """ |
2483 args = self.initCommand("bundle") |
2594 args = self.initCommand("bundle") |
2484 args.append("list-heads") |
2595 args.append("list-heads") |
2485 args.append(bundleFile) |
2596 args.append(bundleFile) |
2486 |
2597 |
2509 def gitBundleFetch(self, projectDir): |
2620 def gitBundleFetch(self, projectDir): |
2510 """ |
2621 """ |
2511 Public method to fetch a head of a bundle file into the local |
2622 Public method to fetch a head of a bundle file into the local |
2512 repository. |
2623 repository. |
2513 |
2624 |
2514 @param projectDir name of the project directory (string) |
2625 @param projectDir name of the project directory |
|
2626 @type str |
2515 """ |
2627 """ |
2516 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2628 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2517 |
2629 |
2518 # find the root of the repo |
2630 # find the root of the repo |
2519 repodir = self.findRepoRoot(projectDir) |
2631 repodir = self.findRepoRoot(projectDir) |
2553 def gitBundlePull(self, projectDir): |
2665 def gitBundlePull(self, projectDir): |
2554 """ |
2666 """ |
2555 Public method to pull a head of a bundle file into the local |
2667 Public method to pull a head of a bundle file into the local |
2556 repository and working area. |
2668 repository and working area. |
2557 |
2669 |
2558 @param projectDir name of the project directory (string) |
2670 @param projectDir name of the project directory |
2559 @return flag indicating, that the update contained an add |
2671 @type str |
2560 or delete (boolean) |
2672 @return flag indicating, that the update contained an add or delete |
|
2673 @rtype bool |
2561 """ |
2674 """ |
2562 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2675 from .GitApplyBundleDataDialog import GitApplyBundleDataDialog |
2563 |
2676 |
2564 # find the root of the repo |
2677 # find the root of the repo |
2565 repodir = self.findRepoRoot(projectDir) |
2678 repodir = self.findRepoRoot(projectDir) |
2605 |
2718 |
2606 def gitBisect(self, projectDir, subcommand): |
2719 def gitBisect(self, projectDir, subcommand): |
2607 """ |
2720 """ |
2608 Public method to perform bisect commands. |
2721 Public method to perform bisect commands. |
2609 |
2722 |
2610 @param projectDir name of the project directory (string) |
2723 @param projectDir name of the project directory |
2611 @param subcommand name of the subcommand (string, one of 'start', |
2724 @type str |
|
2725 @param subcommand name of the subcommand (one of 'start', |
2612 'start_extended', 'good', 'bad', 'skip' or 'reset') |
2726 'start_extended', 'good', 'bad', 'skip' or 'reset') |
2613 @return flag indicating, that the update contained an add |
2727 @type str |
2614 or delete (boolean) |
2728 @return flag indicating, that the update contained an add or delete |
|
2729 @rtype bool |
2615 @exception ValueError raised to indicate an invalid bisect subcommand |
2730 @exception ValueError raised to indicate an invalid bisect subcommand |
2616 """ |
2731 """ |
2617 from .GitBisectStartDialog import GitBisectStartDialog |
2732 from .GitBisectStartDialog import GitBisectStartDialog |
2618 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
2733 from .GitRevisionSelectionDialog import GitRevisionSelectionDialog |
2619 |
2734 |
2680 |
2795 |
2681 def gitBisectLogBrowser(self, projectDir): |
2796 def gitBisectLogBrowser(self, projectDir): |
2682 """ |
2797 """ |
2683 Public method used to browse the bisect log of the project. |
2798 Public method used to browse the bisect log of the project. |
2684 |
2799 |
2685 @param projectDir name of the project directory (string) |
2800 @param projectDir name of the project directory |
|
2801 @type str |
2686 """ |
2802 """ |
2687 from .GitBisectLogBrowserDialog import GitBisectLogBrowserDialog |
2803 from .GitBisectLogBrowserDialog import GitBisectLogBrowserDialog |
2688 |
2804 |
2689 if self.bisectlogBrowser is None: |
2805 if self.bisectlogBrowser is None: |
2690 self.bisectlogBrowser = GitBisectLogBrowserDialog(self) |
2806 self.bisectlogBrowser = GitBisectLogBrowserDialog(self) |
2694 |
2810 |
2695 def gitBisectCreateReplayFile(self, projectDir): |
2811 def gitBisectCreateReplayFile(self, projectDir): |
2696 """ |
2812 """ |
2697 Public method used to create a bisect replay file for the project. |
2813 Public method used to create a bisect replay file for the project. |
2698 |
2814 |
2699 @param projectDir name of the project directory (string) |
2815 @param projectDir name of the project directory |
|
2816 @type str |
2700 """ |
2817 """ |
2701 # find the root of the repo |
2818 # find the root of the repo |
2702 repodir = self.findRepoRoot(projectDir) |
2819 repodir = self.findRepoRoot(projectDir) |
2703 if not repodir: |
2820 if not repodir: |
2704 return |
2821 return |
2777 |
2894 |
2778 def gitBisectEditReplayFile(self, projectDir): |
2895 def gitBisectEditReplayFile(self, projectDir): |
2779 """ |
2896 """ |
2780 Public method used to edit a bisect replay file. |
2897 Public method used to edit a bisect replay file. |
2781 |
2898 |
2782 @param projectDir name of the project directory (string) |
2899 @param projectDir name of the project directory |
|
2900 @type str |
2783 """ |
2901 """ |
2784 # find the root of the repo |
2902 # find the root of the repo |
2785 repodir = self.findRepoRoot(projectDir) |
2903 repodir = self.findRepoRoot(projectDir) |
2786 if not repodir: |
2904 if not repodir: |
2787 return |
2905 return |
2800 |
2918 |
2801 def gitBisectReplay(self, projectDir): |
2919 def gitBisectReplay(self, projectDir): |
2802 """ |
2920 """ |
2803 Public method to replay a bisect session. |
2921 Public method to replay a bisect session. |
2804 |
2922 |
2805 @param projectDir name of the project directory (string) |
2923 @param projectDir name of the project directory |
2806 @return flag indicating, that the update contained an add |
2924 @type str |
2807 or delete (boolean) |
2925 @return flag indicating, that the update contained an add or delete |
|
2926 @rtype bool |
2808 """ |
2927 """ |
2809 # find the root of the repo |
2928 # find the root of the repo |
2810 repodir = self.findRepoRoot(projectDir) |
2929 repodir = self.findRepoRoot(projectDir) |
2811 if not repodir: |
2930 if not repodir: |
2812 return False |
2931 return False |
2840 |
2959 |
2841 def gitGetRemotesList(self, repodir): |
2960 def gitGetRemotesList(self, repodir): |
2842 """ |
2961 """ |
2843 Public method to get the list of remote repos. |
2962 Public method to get the list of remote repos. |
2844 |
2963 |
2845 @param repodir directory name of the repository (string) |
2964 @param repodir directory name of the repository |
2846 @return list of remote repos (list of string) |
2965 @type str |
|
2966 @return list of remote repos |
|
2967 @rtype list of str |
2847 """ |
2968 """ |
2848 args = self.initCommand("remote") |
2969 args = self.initCommand("remote") |
2849 |
2970 |
2850 output = "" |
2971 output = "" |
2851 process = QProcess() |
2972 process = QProcess() |
2871 |
2992 |
2872 def gitGetRemoteUrlsList(self, repodir, forFetch=True): |
2993 def gitGetRemoteUrlsList(self, repodir, forFetch=True): |
2873 """ |
2994 """ |
2874 Public method to get the list of remote repos and their URLs. |
2995 Public method to get the list of remote repos and their URLs. |
2875 |
2996 |
2876 @param repodir directory name of the repository (string) |
2997 @param repodir directory name of the repository |
2877 @param forFetch flag indicating to get Fetch info (string) |
2998 @type str |
2878 @return list of tuples of remote repo name and repo URL (list of |
2999 @param forFetch flag indicating to get Fetch info |
2879 tuple of two strings) |
3000 @type str |
|
3001 @return list of tuples of remote repo name and repo URL |
|
3002 @rtype list of [(str, str)] |
2880 """ |
3003 """ |
2881 args = self.initCommand("remote") |
3004 args = self.initCommand("remote") |
2882 args.append("--verbose") |
3005 args.append("--verbose") |
2883 |
3006 |
2884 output = "" |
3007 output = "" |
2940 |
3063 |
2941 def gitGetRemoteBranchesList(self, repodir, remote): |
3064 def gitGetRemoteBranchesList(self, repodir, remote): |
2942 """ |
3065 """ |
2943 Public method to get the list of a remote repository branches. |
3066 Public method to get the list of a remote repository branches. |
2944 |
3067 |
2945 @param repodir directory name of the repository (string) |
3068 @param repodir directory name of the repository |
2946 @param remote remote repository name (string) |
3069 @type str |
2947 @return list of remote repository branches (list of string) |
3070 @param remote remote repository name |
|
3071 @type str |
|
3072 @return list of remote repository branches |
|
3073 @rtype list of str |
2948 """ |
3074 """ |
2949 args = self.initCommand("ls-remote") |
3075 args = self.initCommand("ls-remote") |
2950 args.append("--heads") |
3076 args.append("--heads") |
2951 args.append(remote) |
3077 args.append(remote) |
2952 |
3078 |
2974 |
3100 |
2975 def gitShowRemote(self, projectDir, remoteName): |
3101 def gitShowRemote(self, projectDir, remoteName): |
2976 """ |
3102 """ |
2977 Public method to show information about a remote repository. |
3103 Public method to show information about a remote repository. |
2978 |
3104 |
2979 @param projectDir name of the project directory (string) |
3105 @param projectDir name of the project directory |
2980 @param remoteName name of the remote repository (string) |
3106 @type str |
|
3107 @param remoteName name of the remote repository |
|
3108 @type str |
2981 """ |
3109 """ |
2982 # find the root of the repo |
3110 # find the root of the repo |
2983 repodir = self.findRepoRoot(projectDir) |
3111 repodir = self.findRepoRoot(projectDir) |
2984 if not repodir: |
3112 if not repodir: |
2985 return |
3113 return |
2995 |
3123 |
2996 def gitShowRemotes(self, projectDir): |
3124 def gitShowRemotes(self, projectDir): |
2997 """ |
3125 """ |
2998 Public method to show available remote repositories. |
3126 Public method to show available remote repositories. |
2999 |
3127 |
3000 @param projectDir name of the project directory (string) |
3128 @param projectDir name of the project directory |
|
3129 @type str |
3001 """ |
3130 """ |
3002 from .GitRemoteRepositoriesDialog import GitRemoteRepositoriesDialog |
3131 from .GitRemoteRepositoriesDialog import GitRemoteRepositoriesDialog |
3003 |
3132 |
3004 if self.remotesDialog is None: |
3133 if self.remotesDialog is None: |
3005 self.remotesDialog = GitRemoteRepositoriesDialog(self) |
3134 self.remotesDialog = GitRemoteRepositoriesDialog(self) |
3009 |
3138 |
3010 def gitAddRemote(self, projectDir): |
3139 def gitAddRemote(self, projectDir): |
3011 """ |
3140 """ |
3012 Public method to add a remote repository. |
3141 Public method to add a remote repository. |
3013 |
3142 |
3014 @param projectDir name of the project directory (string) |
3143 @param projectDir name of the project directory |
|
3144 @type str |
3015 """ |
3145 """ |
3016 from .GitAddRemoteDialog import GitAddRemoteDialog |
3146 from .GitAddRemoteDialog import GitAddRemoteDialog |
3017 |
3147 |
3018 # find the root of the repo |
3148 # find the root of the repo |
3019 repodir = self.findRepoRoot(projectDir) |
3149 repodir = self.findRepoRoot(projectDir) |
3032 |
3162 |
3033 def gitRenameRemote(self, projectDir, remoteName): |
3163 def gitRenameRemote(self, projectDir, remoteName): |
3034 """ |
3164 """ |
3035 Public method to rename a remote repository. |
3165 Public method to rename a remote repository. |
3036 |
3166 |
3037 @param projectDir name of the project directory (string) |
3167 @param projectDir name of the project directory |
3038 @param remoteName name of the remote repository (string) |
3168 @type str |
|
3169 @param remoteName name of the remote repository |
|
3170 @type str |
3039 """ |
3171 """ |
3040 # find the root of the repo |
3172 # find the root of the repo |
3041 repodir = self.findRepoRoot(projectDir) |
3173 repodir = self.findRepoRoot(projectDir) |
3042 if not repodir: |
3174 if not repodir: |
3043 return |
3175 return |
3126 |
3258 |
3127 def gitRemoveRemote(self, projectDir, remoteName): |
3259 def gitRemoveRemote(self, projectDir, remoteName): |
3128 """ |
3260 """ |
3129 Public method to remove a remote repository. |
3261 Public method to remove a remote repository. |
3130 |
3262 |
3131 @param projectDir name of the project directory (string) |
3263 @param projectDir name of the project directory |
3132 @param remoteName name of the remote repository (string) |
3264 @type str |
|
3265 @param remoteName name of the remote repository |
|
3266 @type str |
3133 """ |
3267 """ |
3134 # find the root of the repo |
3268 # find the root of the repo |
3135 repodir = self.findRepoRoot(projectDir) |
3269 repodir = self.findRepoRoot(projectDir) |
3136 if not repodir: |
3270 if not repodir: |
3137 return |
3271 return |
3144 |
3278 |
3145 def gitPruneRemote(self, projectDir, remoteName): |
3279 def gitPruneRemote(self, projectDir, remoteName): |
3146 """ |
3280 """ |
3147 Public method to prune stale remote-tracking branches. |
3281 Public method to prune stale remote-tracking branches. |
3148 |
3282 |
3149 @param projectDir name of the project directory (string) |
3283 @param projectDir name of the project directory |
3150 @param remoteName name of the remote repository (string) |
3284 @type str |
|
3285 @param remoteName name of the remote repository |
|
3286 @type str |
3151 """ |
3287 """ |
3152 # find the root of the repo |
3288 # find the root of the repo |
3153 repodir = self.findRepoRoot(projectDir) |
3289 repodir = self.findRepoRoot(projectDir) |
3154 if not repodir: |
3290 if not repodir: |
3155 return |
3291 return |
3166 def gitShortlog(self, projectDir, commit): |
3302 def gitShortlog(self, projectDir, commit): |
3167 """ |
3303 """ |
3168 Public method to show a short log suitable for inclusion in release |
3304 Public method to show a short log suitable for inclusion in release |
3169 announcements. |
3305 announcements. |
3170 |
3306 |
3171 @param projectDir name of the project directory (string) |
3307 @param projectDir name of the project directory |
3172 @param commit commit to start the log at (strings) |
3308 @type str |
|
3309 @param commit commit to start the log at |
|
3310 @type str |
3173 """ |
3311 """ |
3174 # find the root of the repo |
3312 # find the root of the repo |
3175 repodir = self.findRepoRoot(projectDir) |
3313 repodir = self.findRepoRoot(projectDir) |
3176 if not repodir: |
3314 if not repodir: |
3177 return |
3315 return |
3187 |
3325 |
3188 def gitDescribe(self, projectDir, commits): |
3326 def gitDescribe(self, projectDir, commits): |
3189 """ |
3327 """ |
3190 Public method to find the most recent tag reachable from each commit. |
3328 Public method to find the most recent tag reachable from each commit. |
3191 |
3329 |
3192 @param projectDir name of the project directory (string) |
3330 @param projectDir name of the project directory |
|
3331 @type str |
3193 @param commits list of commits to start the search from |
3332 @param commits list of commits to start the search from |
3194 (list of strings) |
3333 @type list of str |
3195 """ |
3334 """ |
3196 from .GitDescribeDialog import GitDescribeDialog |
3335 from .GitDescribeDialog import GitDescribeDialog |
3197 |
3336 |
3198 if self.describeDialog is None: |
3337 if self.describeDialog is None: |
3199 self.describeDialog = GitDescribeDialog(self) |
3338 self.describeDialog = GitDescribeDialog(self) |
3208 def gitCherryPick(self, projectDir, commits=None): |
3347 def gitCherryPick(self, projectDir, commits=None): |
3209 """ |
3348 """ |
3210 Public method to cherry pick commits and apply them to the current |
3349 Public method to cherry pick commits and apply them to the current |
3211 branch. |
3350 branch. |
3212 |
3351 |
3213 @param projectDir name of the project directory (string) |
3352 @param projectDir name of the project directory |
3214 @param commits list of commits to be applied (list of strings) |
3353 @type str |
3215 @return flag indicating that the project should be reread (boolean) |
3354 @param commits list of commits to be applied |
|
3355 @type list of str |
|
3356 @return flag indicating that the project should be reread |
|
3357 @rtype bool |
3216 """ |
3358 """ |
3217 from .GitCherryPickDialog import GitCherryPickDialog |
3359 from .GitCherryPickDialog import GitCherryPickDialog |
3218 |
3360 |
3219 # find the root of the repo |
3361 # find the root of the repo |
3220 repodir = self.findRepoRoot(projectDir) |
3362 repodir = self.findRepoRoot(projectDir) |
3248 def gitCherryPickContinue(self, projectDir): |
3390 def gitCherryPickContinue(self, projectDir): |
3249 """ |
3391 """ |
3250 Public method to continue the last copying session after conflicts |
3392 Public method to continue the last copying session after conflicts |
3251 were resolved. |
3393 were resolved. |
3252 |
3394 |
3253 @param projectDir name of the project directory (string) |
3395 @param projectDir name of the project directory |
3254 @return flag indicating that the project should be reread (boolean) |
3396 @type str |
|
3397 @return flag indicating that the project should be reread |
|
3398 @rtype bool |
3255 """ |
3399 """ |
3256 # find the root of the repo |
3400 # find the root of the repo |
3257 repodir = self.findRepoRoot(projectDir) |
3401 repodir = self.findRepoRoot(projectDir) |
3258 if not repodir: |
3402 if not repodir: |
3259 return False |
3403 return False |
3278 |
3422 |
3279 def gitCherryPickQuit(self, projectDir): |
3423 def gitCherryPickQuit(self, projectDir): |
3280 """ |
3424 """ |
3281 Public method to quit the current copying operation. |
3425 Public method to quit the current copying operation. |
3282 |
3426 |
3283 @param projectDir name of the project directory (string) |
3427 @param projectDir name of the project directory |
3284 @return flag indicating that the project should be reread (boolean) |
3428 @type str |
|
3429 @return flag indicating that the project should be reread |
|
3430 @rtype bool |
3285 """ |
3431 """ |
3286 # find the root of the repo |
3432 # find the root of the repo |
3287 repodir = self.findRepoRoot(projectDir) |
3433 repodir = self.findRepoRoot(projectDir) |
3288 if not repodir: |
3434 if not repodir: |
3289 return False |
3435 return False |
3302 def gitCherryPickAbort(self, projectDir): |
3448 def gitCherryPickAbort(self, projectDir): |
3303 """ |
3449 """ |
3304 Public method to cancel the last copying session and return to |
3450 Public method to cancel the last copying session and return to |
3305 the previous state. |
3451 the previous state. |
3306 |
3452 |
3307 @param projectDir name of the project directory (string) |
3453 @param projectDir name of the project directory |
3308 @return flag indicating that the project should be reread (boolean) |
3454 @type str |
|
3455 @return flag indicating that the project should be reread |
|
3456 @rtype bool |
3309 """ |
3457 """ |
3310 # find the root of the repo |
3458 # find the root of the repo |
3311 repodir = self.findRepoRoot(projectDir) |
3459 repodir = self.findRepoRoot(projectDir) |
3312 if not repodir: |
3460 if not repodir: |
3313 return False |
3461 return False |
3329 |
3477 |
3330 def __gitGetStashesList(self, projectDir): |
3478 def __gitGetStashesList(self, projectDir): |
3331 """ |
3479 """ |
3332 Private method to get a list of stash names. |
3480 Private method to get a list of stash names. |
3333 |
3481 |
3334 @param projectDir name of the project directory (string) |
3482 @param projectDir name of the project directory |
3335 @return list of available stashes (list of string) |
3483 @type str |
|
3484 @return list of available stashes |
|
3485 @rtype list of str |
3336 """ |
3486 """ |
3337 # find the root of the repo |
3487 # find the root of the repo |
3338 repodir = self.findRepoRoot(projectDir) |
3488 repodir = self.findRepoRoot(projectDir) |
3339 if not repodir: |
3489 if not repodir: |
3340 return [] |
3490 return [] |
3365 |
3515 |
3366 def gitStashSave(self, projectDir): |
3516 def gitStashSave(self, projectDir): |
3367 """ |
3517 """ |
3368 Public method to save the current changes to a new stash. |
3518 Public method to save the current changes to a new stash. |
3369 |
3519 |
3370 @param projectDir name of the project directory (string) |
3520 @param projectDir name of the project directory |
3371 @return flag indicating, that the save contained an add |
3521 @type str |
3372 or delete (boolean) |
3522 @return flag indicating, that the save contained an add or delete |
|
3523 @rtype bool |
3373 """ |
3524 """ |
3374 from .GitStashDataDialog import GitStashDataDialog |
3525 from .GitStashDataDialog import GitStashDataDialog |
3375 |
3526 |
3376 # find the root of the repo |
3527 # find the root of the repo |
3377 repodir = self.findRepoRoot(projectDir) |
3528 repodir = self.findRepoRoot(projectDir) |
3403 |
3554 |
3404 def gitStashBrowser(self, projectDir): |
3555 def gitStashBrowser(self, projectDir): |
3405 """ |
3556 """ |
3406 Public method used to browse the stashed changes. |
3557 Public method used to browse the stashed changes. |
3407 |
3558 |
3408 @param projectDir name of the project directory (string) |
3559 @param projectDir name of the project directory |
|
3560 @type str |
3409 """ |
3561 """ |
3410 from .GitStashBrowserDialog import GitStashBrowserDialog |
3562 from .GitStashBrowserDialog import GitStashBrowserDialog |
3411 |
3563 |
3412 if self.stashBrowser is None: |
3564 if self.stashBrowser is None: |
3413 self.stashBrowser = GitStashBrowserDialog(self) |
3565 self.stashBrowser = GitStashBrowserDialog(self) |
3417 |
3569 |
3418 def gitStashShowPatch(self, projectDir, stashName=""): |
3570 def gitStashShowPatch(self, projectDir, stashName=""): |
3419 """ |
3571 """ |
3420 Public method to show the contents of a stash. |
3572 Public method to show the contents of a stash. |
3421 |
3573 |
3422 @param projectDir name of the project directory (string) |
3574 @param projectDir name of the project directory |
3423 @param stashName name of a stash (string) |
3575 @type str |
|
3576 @param stashName name of a stash |
|
3577 @type str |
3424 """ |
3578 """ |
3425 from .GitDiffDialog import GitDiffDialog |
3579 from .GitDiffDialog import GitDiffDialog |
3426 |
3580 |
3427 # find the root of the repo |
3581 # find the root of the repo |
3428 repodir = self.findRepoRoot(projectDir) |
3582 repodir = self.findRepoRoot(projectDir) |
3450 |
3604 |
3451 def gitStashApply(self, projectDir, stashName=""): |
3605 def gitStashApply(self, projectDir, stashName=""): |
3452 """ |
3606 """ |
3453 Public method to apply a stash but keep it. |
3607 Public method to apply a stash but keep it. |
3454 |
3608 |
3455 @param projectDir name of the project directory (string) |
3609 @param projectDir name of the project directory |
3456 @param stashName name of a stash (string) |
3610 @type str |
3457 @return flag indicating, that the restore contained an add |
3611 @param stashName name of a stash |
3458 or delete (boolean) |
3612 @type str |
|
3613 @return flag indicating, that the restore contained an add or delete |
|
3614 @rtype bool |
3459 """ |
3615 """ |
3460 # find the root of the repo |
3616 # find the root of the repo |
3461 repodir = self.findRepoRoot(projectDir) |
3617 repodir = self.findRepoRoot(projectDir) |
3462 if not repodir: |
3618 if not repodir: |
3463 return False |
3619 return False |
3490 |
3646 |
3491 def gitStashPop(self, projectDir, stashName=""): |
3647 def gitStashPop(self, projectDir, stashName=""): |
3492 """ |
3648 """ |
3493 Public method to apply a stash and delete it. |
3649 Public method to apply a stash and delete it. |
3494 |
3650 |
3495 @param projectDir name of the project directory (string) |
3651 @param projectDir name of the project directory |
3496 @param stashName name of a stash (string) |
3652 @type str |
3497 @return flag indicating, that the restore contained an add |
3653 @param stashName name of a stash |
3498 or delete (boolean) |
3654 @type str |
|
3655 @return flag indicating, that the restore contained an add or delete |
|
3656 @rtype bool |
3499 """ |
3657 """ |
3500 # find the root of the repo |
3658 # find the root of the repo |
3501 repodir = self.findRepoRoot(projectDir) |
3659 repodir = self.findRepoRoot(projectDir) |
3502 if not repodir: |
3660 if not repodir: |
3503 return False |
3661 return False |
3530 |
3688 |
3531 def gitStashBranch(self, projectDir, stashName=""): |
3689 def gitStashBranch(self, projectDir, stashName=""): |
3532 """ |
3690 """ |
3533 Public method to create a branch from a stash. |
3691 Public method to create a branch from a stash. |
3534 |
3692 |
3535 @param projectDir name of the project directory (string) |
3693 @param projectDir name of the project directory |
3536 @param stashName name of a stash (string) |
3694 @type str |
3537 @return flag indicating, that the restore contained an add |
3695 @param stashName name of a stash |
3538 or delete (boolean) |
3696 @type str |
|
3697 @return flag indicating, that the restore contained an add or delete |
|
3698 @rtype bool |
3539 """ |
3699 """ |
3540 # find the root of the repo |
3700 # find the root of the repo |
3541 repodir = self.findRepoRoot(projectDir) |
3701 repodir = self.findRepoRoot(projectDir) |
3542 if not repodir: |
3702 if not repodir: |
3543 return False |
3703 return False |
3580 |
3740 |
3581 def gitStashDrop(self, projectDir, stashName=""): |
3741 def gitStashDrop(self, projectDir, stashName=""): |
3582 """ |
3742 """ |
3583 Public method to delete a stash. |
3743 Public method to delete a stash. |
3584 |
3744 |
3585 @param projectDir name of the project directory (string) |
3745 @param projectDir name of the project directory |
3586 @param stashName name of a stash (string) |
3746 @type str |
3587 @return flag indicating a successful deletion (boolean) |
3747 @param stashName name of a stash |
|
3748 @type str |
|
3749 @return flag indicating a successful deletion |
|
3750 @rtype bool |
3588 """ |
3751 """ |
3589 # find the root of the repo |
3752 # find the root of the repo |
3590 repodir = self.findRepoRoot(projectDir) |
3753 repodir = self.findRepoRoot(projectDir) |
3591 if not repodir: |
3754 if not repodir: |
3592 return False |
3755 return False |
3625 |
3788 |
3626 def gitStashClear(self, projectDir): |
3789 def gitStashClear(self, projectDir): |
3627 """ |
3790 """ |
3628 Public method to delete all stashes. |
3791 Public method to delete all stashes. |
3629 |
3792 |
3630 @param projectDir name of the project directory (string) |
3793 @param projectDir name of the project directory |
3631 @return flag indicating a successful deletion (boolean) |
3794 @type str |
|
3795 @return flag indicating a successful deletion |
|
3796 @rtype bool |
3632 """ |
3797 """ |
3633 # find the root of the repo |
3798 # find the root of the repo |
3634 repodir = self.findRepoRoot(projectDir) |
3799 repodir = self.findRepoRoot(projectDir) |
3635 if not repodir: |
3800 if not repodir: |
3636 return False |
3801 return False |
3652 |
3817 |
3653 def gitEditConfig(self, projectDir): |
3818 def gitEditConfig(self, projectDir): |
3654 """ |
3819 """ |
3655 Public method used to edit the repository configuration file. |
3820 Public method used to edit the repository configuration file. |
3656 |
3821 |
3657 @param projectDir name of the project directory (string) |
3822 @param projectDir name of the project directory |
|
3823 @type str |
3658 """ |
3824 """ |
3659 # find the root of the repo |
3825 # find the root of the repo |
3660 repodir = self.findRepoRoot(projectDir) |
3826 repodir = self.findRepoRoot(projectDir) |
3661 if not repodir: |
3827 if not repodir: |
3662 return |
3828 return |
3692 |
3858 |
3693 def gitShowConfig(self, projectDir): |
3859 def gitShowConfig(self, projectDir): |
3694 """ |
3860 """ |
3695 Public method to show the combined configuration. |
3861 Public method to show the combined configuration. |
3696 |
3862 |
3697 @param projectDir name of the project directory (string) |
3863 @param projectDir name of the project directory |
|
3864 @type str |
3698 """ |
3865 """ |
3699 # find the root of the repo |
3866 # find the root of the repo |
3700 repodir = self.findRepoRoot(projectDir) |
3867 repodir = self.findRepoRoot(projectDir) |
3701 if not repodir: |
3868 if not repodir: |
3702 return |
3869 return |
3712 def gitVerify(self, projectDir): |
3879 def gitVerify(self, projectDir): |
3713 """ |
3880 """ |
3714 Public method to verify the connectivity and validity of objects |
3881 Public method to verify the connectivity and validity of objects |
3715 of the database. |
3882 of the database. |
3716 |
3883 |
3717 @param projectDir name of the project directory (string) |
3884 @param projectDir name of the project directory |
|
3885 @type str |
3718 """ |
3886 """ |
3719 # find the root of the repo |
3887 # find the root of the repo |
3720 repodir = self.findRepoRoot(projectDir) |
3888 repodir = self.findRepoRoot(projectDir) |
3721 if not repodir: |
3889 if not repodir: |
3722 return |
3890 return |
3733 |
3901 |
3734 def gitHouseKeeping(self, projectDir): |
3902 def gitHouseKeeping(self, projectDir): |
3735 """ |
3903 """ |
3736 Public method to cleanup and optimize the local repository. |
3904 Public method to cleanup and optimize the local repository. |
3737 |
3905 |
3738 @param projectDir name of the project directory (string) |
3906 @param projectDir name of the project directory |
|
3907 @type str |
3739 """ |
3908 """ |
3740 # find the root of the repo |
3909 # find the root of the repo |
3741 repodir = self.findRepoRoot(projectDir) |
3910 repodir = self.findRepoRoot(projectDir) |
3742 if not repodir: |
3911 if not repodir: |
3743 return |
3912 return |
3754 |
3923 |
3755 def gitStatistics(self, projectDir): |
3924 def gitStatistics(self, projectDir): |
3756 """ |
3925 """ |
3757 Public method to show some statistics of the local repository. |
3926 Public method to show some statistics of the local repository. |
3758 |
3927 |
3759 @param projectDir name of the project directory (string) |
3928 @param projectDir name of the project directory |
|
3929 @type str |
3760 """ |
3930 """ |
3761 # find the root of the repo |
3931 # find the root of the repo |
3762 repodir = self.findRepoRoot(projectDir) |
3932 repodir = self.findRepoRoot(projectDir) |
3763 if not repodir: |
3933 if not repodir: |
3764 return |
3934 return |
3842 |
4012 |
3843 def gitGetArchiveFormats(self, repodir): |
4013 def gitGetArchiveFormats(self, repodir): |
3844 """ |
4014 """ |
3845 Public method to get a list of supported archive formats. |
4015 Public method to get a list of supported archive formats. |
3846 |
4016 |
3847 @param repodir directory name of the repository (string) |
4017 @param repodir directory name of the repository |
3848 @return list of supported archive formats (list of strings) |
4018 @type str |
|
4019 @return list of supported archive formats |
|
4020 @rtype list of str |
3849 """ |
4021 """ |
3850 args = self.initCommand("archive") |
4022 args = self.initCommand("archive") |
3851 args.append("--list") |
4023 args.append("--list") |
3852 |
4024 |
3853 output = "" |
4025 output = "" |
3874 |
4046 |
3875 def gitCreateArchive(self, projectDir): |
4047 def gitCreateArchive(self, projectDir): |
3876 """ |
4048 """ |
3877 Public method to show some statistics of the local repository. |
4049 Public method to show some statistics of the local repository. |
3878 |
4050 |
3879 @param projectDir name of the project directory (string) |
4051 @param projectDir name of the project directory |
|
4052 @type str |
3880 """ |
4053 """ |
3881 from .GitArchiveDataDialog import GitArchiveDataDialog |
4054 from .GitArchiveDataDialog import GitArchiveDataDialog |
3882 |
4055 |
3883 # find the root of the repo |
4056 # find the root of the repo |
3884 repodir = self.findRepoRoot(projectDir) |
4057 repodir = self.findRepoRoot(projectDir) |
4295 """ |
4468 """ |
4296 Public method to instantiate a helper object for the different |
4469 Public method to instantiate a helper object for the different |
4297 project browsers. |
4470 project browsers. |
4298 |
4471 |
4299 @param browser reference to the project browser object |
4472 @param browser reference to the project browser object |
|
4473 @type ProjectBaseBrowser |
4300 @param project reference to the project object |
4474 @param project reference to the project object |
|
4475 @type Project |
4301 @param isTranslationsBrowser flag indicating, the helper is requested |
4476 @param isTranslationsBrowser flag indicating, the helper is requested |
4302 for the translations browser (this needs some special treatment) |
4477 for the translations browser (this needs some special treatment) |
|
4478 @type bool |
4303 @return the project browser helper object |
4479 @return the project browser helper object |
|
4480 @rtype GitProjectBrowserHelper |
4304 """ |
4481 """ |
4305 from .ProjectBrowserHelper import GitProjectBrowserHelper |
4482 from .ProjectBrowserHelper import GitProjectBrowserHelper |
4306 |
4483 |
4307 return GitProjectBrowserHelper(self, browser, project, isTranslationsBrowser) |
4484 return GitProjectBrowserHelper(self, browser, project, isTranslationsBrowser) |
4308 |
4485 |
4309 def vcsGetProjectHelper(self, project): |
4486 def vcsGetProjectHelper(self, project): |
4310 """ |
4487 """ |
4311 Public method to instantiate a helper object for the project. |
4488 Public method to instantiate a helper object for the project. |
4312 |
4489 |
4313 @param project reference to the project object |
4490 @param project reference to the project object |
|
4491 @type Project |
4314 @return the project helper object |
4492 @return the project helper object |
|
4493 @rtype GitProjectHelper |
4315 """ |
4494 """ |
4316 self.__projectHelper = self.__plugin.getProjectHelper() |
4495 self.__projectHelper = self.__plugin.getProjectHelper() |
4317 self.__projectHelper.setObjects(self, project) |
4496 self.__projectHelper.setObjects(self, project) |
4318 return self.__projectHelper |
4497 return self.__projectHelper |
4319 |
4498 |
4325 """ |
4504 """ |
4326 Protected method to create an instance of the VCS status monitor |
4505 Protected method to create an instance of the VCS status monitor |
4327 thread. |
4506 thread. |
4328 |
4507 |
4329 @param interval check interval for the monitor thread in seconds |
4508 @param interval check interval for the monitor thread in seconds |
4330 (integer) |
4509 @type int |
4331 @param project reference to the project object (Project) |
4510 @param project reference to the project object |
4332 @return reference to the monitor thread (QThread) |
4511 @type Project |
|
4512 @return reference to the monitor thread |
|
4513 @rtype GitStatusMonitorThread |
4333 """ |
4514 """ |
4334 from .GitStatusMonitorThread import GitStatusMonitorThread |
4515 from .GitStatusMonitorThread import GitStatusMonitorThread |
4335 |
4516 |
4336 return GitStatusMonitorThread(interval, project, self) |
4517 return GitStatusMonitorThread(interval, project, self) |
4337 |
4518 |