46 from .ProjectBrowserHelper import HgProjectBrowserHelper |
48 from .ProjectBrowserHelper import HgProjectBrowserHelper |
47 |
49 |
48 import Preferences |
50 import Preferences |
49 import Utilities |
51 import Utilities |
50 |
52 |
|
53 |
51 class Hg(VersionControl): |
54 class Hg(VersionControl): |
52 """ |
55 """ |
53 Class implementing the version control systems interface to Mercurial. |
56 Class implementing the version control systems interface to Mercurial. |
54 |
57 |
55 @signal committed() emitted after the commit action has completed |
58 @signal committed() emitted after the commit action has completed |
56 """ |
59 """ |
57 committed = pyqtSignal() |
60 committed = pyqtSignal() |
58 |
61 |
59 def __init__(self, plugin, parent = None, name = None): |
62 def __init__(self, plugin, parent=None, name=None): |
60 """ |
63 """ |
61 Constructor |
64 Constructor |
62 |
65 |
63 @param plugin reference to the plugin object |
66 @param plugin reference to the plugin object |
64 @param parent parent widget (QWidget) |
67 @param parent parent widget (QWidget) |
65 @param name name of this object (string) |
68 @param name name of this object (string) |
66 """ |
69 """ |
67 VersionControl.__init__(self, parent, name) |
70 VersionControl.__init__(self, parent, name) |
68 self.defaultOptions = { |
71 self.defaultOptions = { |
69 'global' : [''], |
72 'global': [''], |
70 'commit' : [''], |
73 'commit': [''], |
71 'checkout' : [''], |
74 'checkout': [''], |
72 'update' : [''], |
75 'update': [''], |
73 'add' : [''], |
76 'add': [''], |
74 'remove' : [''], |
77 'remove': [''], |
75 'diff' : [''], |
78 'diff': [''], |
76 'log' : [''], |
79 'log': [''], |
77 'history' : [''], |
80 'history': [''], |
78 'status' : [''], |
81 'status': [''], |
79 'tag' : [''], |
82 'tag': [''], |
80 'export' : [''] |
83 'export': [''] |
81 } |
84 } |
82 |
85 |
83 self.__plugin = plugin |
86 self.__plugin = plugin |
84 self.__ui = parent |
87 self.__ui = parent |
85 |
88 |
302 shutil.rmtree(os.path.join(projectDir, self.adminDir), True) |
305 shutil.rmtree(os.path.join(projectDir, self.adminDir), True) |
303 if os.path.exists(os.path.join(projectDir, '.hgignore')): |
306 if os.path.exists(os.path.join(projectDir, '.hgignore')): |
304 os.remove(os.path.join(projectDir, '.hgignore')) |
307 os.remove(os.path.join(projectDir, '.hgignore')) |
305 return status |
308 return status |
306 |
309 |
307 def vcsCommit(self, name, message, noDialog = False, closeBranch = False): |
310 def vcsCommit(self, name, message, noDialog=False, closeBranch=False): |
308 """ |
311 """ |
309 Public method used to make the change of a file/directory permanent in the |
312 Public method used to make the change of a file/directory permanent in the |
310 Mercurial repository. |
313 Mercurial repository. |
311 |
314 |
312 @param name file/directory name to be committed (string or list of strings) |
315 @param name file/directory name to be committed (string or list of strings) |
390 for name in self.__forgotNames: |
393 for name in self.__forgotNames: |
391 model.updateVCSStatus(name) |
394 model.updateVCSStatus(name) |
392 self.__forgotNames = [] |
395 self.__forgotNames = [] |
393 self.checkVCSStatus() |
396 self.checkVCSStatus() |
394 |
397 |
395 def vcsUpdate(self, name, noDialog = False, revision = None): |
398 def vcsUpdate(self, name, noDialog=False, revision=None): |
396 """ |
399 """ |
397 Public method used to update a file/directory with the Mercurial repository. |
400 Public method used to update a file/directory with the Mercurial repository. |
398 |
401 |
399 @param name file/directory name to be updated (string or list of strings) |
402 @param name file/directory name to be updated (string or list of strings) |
400 @param noDialog flag indicating quiet operations (boolean) |
403 @param noDialog flag indicating quiet operations (boolean) |
612 project.removeFile(name) |
615 project.removeFile(name) |
613 return res |
616 return res |
614 |
617 |
615 def vcsLog(self, name): |
618 def vcsLog(self, name): |
616 """ |
619 """ |
617 Public method used to view the log of a file/directory from the |
620 Public method used to view the log of a file/directory from the |
618 Mercurial repository. |
621 Mercurial repository. |
619 |
622 |
620 @param name file/directory name to show the log of (string) |
623 @param name file/directory name to show the log of (string) |
621 """ |
624 """ |
622 self.log = HgLogDialog(self) |
625 self.log = HgLogDialog(self) |
623 self.log.show() |
626 self.log.show() |
624 self.log.start(name) |
627 self.log.start(name) |
625 |
628 |
626 def vcsDiff(self, name): |
629 def vcsDiff(self, name): |
627 """ |
630 """ |
628 Public method used to view the difference of a file/directory to the |
631 Public method used to view the difference of a file/directory to the |
629 Mercurial repository. |
632 Mercurial repository. |
630 |
633 |
631 If name is a directory and is the project directory, all project files |
634 If name is a directory and is the project directory, all project files |
632 are saved first. If name is a file (or list of files), which is/are being edited |
635 are saved first. If name is a file (or list of files), which is/are being edited |
633 and has unsaved modification, they can be saved or the operation may be aborted. |
636 and has unsaved modification, they can be saved or the operation may be aborted. |
634 |
637 |
635 @param name file/directory name to be diffed (string) |
638 @param name file/directory name to be diffed (string) |
636 """ |
639 """ |
637 if isinstance(name, list): |
640 if isinstance(name, list): |
842 if absname == name: |
845 if absname == name: |
843 return self.canBeCommitted |
846 return self.canBeCommitted |
844 |
847 |
845 return self.canBeAdded |
848 return self.canBeAdded |
846 |
849 |
847 def vcsAllRegisteredStates(self, names, dname, shortcut = True): |
850 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
848 """ |
851 """ |
849 Public method used to get the registered states of a number of files in the vcs. |
852 Public method used to get the registered states of a number of files in the vcs. |
850 |
853 |
851 <b>Note:</b> If a shortcut is to be taken, the code will only check, if the named |
854 <b>Note:</b> If a shortcut is to be taken, the code will only check, if the named |
852 directory has been scanned already. If so, it is assumed, that the states for |
855 directory has been scanned already. If so, it is assumed, that the states for |
853 all files have been populated by the previous run. |
856 all files have been populated by the previous run. |
854 |
857 |
855 @param names dictionary with all filenames to be checked as keys |
858 @param names dictionary with all filenames to be checked as keys |
856 @param dname directory to check in (string) |
859 @param dname directory to check in (string) |
857 @param shortcut flag indicating a shortcut should be taken (boolean) |
860 @param shortcut flag indicating a shortcut should be taken (boolean) |
858 @return the received dictionary completed with a combination of |
861 @return the received dictionary completed with a combination of |
859 canBeCommited and canBeAdded or None in order to signal an error |
862 canBeCommited and canBeAdded or None in order to signal an error |
860 """ |
863 """ |
861 if dname.endswith(os.sep): |
864 if dname.endswith(os.sep): |
862 dname = dname[:-1] |
865 dname = dname[:-1] |
863 dname = os.path.normcase(dname) |
866 dname = os.path.normcase(dname) |
979 dia = HgDialog(self.trUtf8('Mercurial command')) |
982 dia = HgDialog(self.trUtf8('Mercurial command')) |
980 res = dia.startProcess(args, repodir) |
983 res = dia.startProcess(args, repodir) |
981 if res: |
984 if res: |
982 dia.exec_() |
985 dia.exec_() |
983 |
986 |
984 def vcsOptionsDialog(self, project, archive, editable = False, parent = None): |
987 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): |
985 """ |
988 """ |
986 Public method to get a dialog to enter repository info. |
989 Public method to get a dialog to enter repository info. |
987 |
990 |
988 @param project reference to the project object |
991 @param project reference to the project object |
989 @param archive name of the project in the repository (string) |
992 @param archive name of the project in the repository (string) |
990 @param editable flag indicating that the project name is editable (boolean) |
993 @param editable flag indicating that the project name is editable (boolean) |
991 @param parent parent widget (QWidget) |
994 @param parent parent widget (QWidget) |
992 """ |
995 """ |
993 return HgOptionsDialog(self, project, parent) |
996 return HgOptionsDialog(self, project, parent) |
994 |
997 |
995 def vcsNewProjectOptionsDialog(self, parent = None): |
998 def vcsNewProjectOptionsDialog(self, parent=None): |
996 """ |
999 """ |
997 Public method to get a dialog to enter repository info for getting a new project. |
1000 Public method to get a dialog to enter repository info for getting a new project. |
998 |
1001 |
999 @param parent parent widget (QWidget) |
1002 @param parent parent widget (QWidget) |
1000 """ |
1003 """ |
1019 process.start('hg', args) |
1022 process.start('hg', args) |
1020 procStarted = process.waitForStarted() |
1023 procStarted = process.waitForStarted() |
1021 if procStarted: |
1024 if procStarted: |
1022 finished = process.waitForFinished(30000) |
1025 finished = process.waitForFinished(30000) |
1023 if finished and process.exitCode() == 0: |
1026 if finished and process.exitCode() == 0: |
1024 output = str(process.readAllStandardOutput(), |
1027 output = str(process.readAllStandardOutput(), |
1025 Preferences.getSystem("IOEncoding"), 'replace') |
1028 Preferences.getSystem("IOEncoding"), 'replace') |
1026 index = 0 |
1029 index = 0 |
1027 for line in output.splitlines(): |
1030 for line in output.splitlines(): |
1028 index += 1 |
1031 index += 1 |
1029 changeset, tags, author, date, branches = line.split("@@@") |
1032 changeset, tags, author, date, branches = line.split("@@@") |
1030 cdate, ctime = date.split()[:2] |
1033 cdate, ctime = date.split()[:2] |
1031 info.append("""<p><table>""") |
1034 info.append("""<p><table>""") |
1032 info.append(QApplication.translate("mercurial", |
1035 info.append(QApplication.translate("mercurial", |
1033 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1036 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1034 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
1037 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
1035 .format(index, changeset)) |
1038 .format(index, changeset)) |
1036 if tags: |
1039 if tags: |
1037 info.append(QApplication.translate("mercurial", |
1040 info.append(QApplication.translate("mercurial", |
1038 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1041 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1039 .format('<br/>'.join(tags.split()))) |
1042 .format('<br/>'.join(tags.split()))) |
1040 if branches: |
1043 if branches: |
1041 info.append(QApplication.translate("mercurial", |
1044 info.append(QApplication.translate("mercurial", |
1042 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1045 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1043 .format('<br/>'.join(branches.split()))) |
1046 .format('<br/>'.join(branches.split()))) |
1044 info.append(QApplication.translate("mercurial", |
1047 info.append(QApplication.translate("mercurial", |
1045 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1048 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1046 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1049 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1047 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
1050 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
1048 .format(author, cdate, ctime)) |
1051 .format(author, cdate, ctime)) |
1049 info.append("""</table></p>""") |
1052 info.append("""</table></p>""") |
1050 |
1053 |
1051 url = "" |
1054 url = "" |
1052 args = [] |
1055 args = [] |
1053 args.append('showconfig') |
1056 args.append('showconfig') |
1054 args.append('paths.default') |
1057 args.append('paths.default') |
1055 process.setWorkingDirectory(ppath) |
1058 process.setWorkingDirectory(ppath) |
1056 process.start('hg', args) |
1059 process.start('hg', args) |
1057 procStarted = process.waitForStarted() |
1060 procStarted = process.waitForStarted() |
1058 if procStarted: |
1061 if procStarted: |
1059 finished = process.waitForFinished(30000) |
1062 finished = process.waitForFinished(30000) |
1060 if finished and process.exitCode() == 0: |
1063 if finished and process.exitCode() == 0: |
1061 output = str(process.readAllStandardOutput(), |
1064 output = str(process.readAllStandardOutput(), |
1062 Preferences.getSystem("IOEncoding"), 'replace') |
1065 Preferences.getSystem("IOEncoding"), 'replace') |
1063 if output: |
1066 if output: |
1064 url = output.splitlines()[0].strip() |
1067 url = output.splitlines()[0].strip() |
1065 else: |
1068 else: |
1066 url = "" |
1069 url = "" |
1090 url = url.split(':', 2) |
1093 url = url.split(':', 2) |
1091 if len(url) == 4: |
1094 if len(url) == 4: |
1092 scheme = url[0] |
1095 scheme = url[0] |
1093 user = url[1] |
1096 user = url[1] |
1094 host = url[2] |
1097 host = url[2] |
1095 port, path = url[3].split("/",1) |
1098 port, path = url[3].split("/", 1) |
1096 return "{0}:{1}:{2}:{3}/{4}".format( |
1099 return "{0}:{1}:{2}:{3}/{4}".format( |
1097 scheme, user, host, port, urllib.parse.quote(path)) |
1100 scheme, user, host, port, urllib.parse.quote(path)) |
1098 elif len(url) == 3: |
1101 elif len(url) == 3: |
1099 scheme = url[0] |
1102 scheme = url[0] |
1100 host = url[1] |
1103 host = url[1] |
1101 port, path = url[2].split("/",1) |
1104 port, path = url[2].split("/", 1) |
1102 return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) |
1105 return "{0}:{1}:{2}/{3}".format(scheme, host, port, urllib.parse.quote(path)) |
1103 else: |
1106 else: |
1104 scheme = url[0] |
1107 scheme = url[0] |
1105 if scheme == "file": |
1108 if scheme == "file": |
1106 return "{0}:{1}".format(scheme, urllib.parse.quote(url[1])) |
1109 return "{0}:{1}".format(scheme, urllib.parse.quote(url[1])) |
1107 else: |
1110 else: |
1108 host, path = url[1][2:].split("/",1) |
1111 host, path = url[1][2:].split("/", 1) |
1109 return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) |
1112 return "{0}://{1}/{2}".format(scheme, host, urllib.parse.quote(path)) |
1110 |
1113 |
1111 def hgNormalizeURL(self, url): |
1114 def hgNormalizeURL(self, url): |
1112 """ |
1115 """ |
1113 Public method to normalize a url for Mercurial. |
1116 Public method to normalize a url for Mercurial. |
1178 self.showedTags = True |
1181 self.showedTags = True |
1179 allTagsBranchesList = self.allTagsBranchesList |
1182 allTagsBranchesList = self.allTagsBranchesList |
1180 else: |
1183 else: |
1181 self.tagsList = [] |
1184 self.tagsList = [] |
1182 allTagsBranchesList = None |
1185 allTagsBranchesList = None |
1183 self.tagbranchList.start(path, tags, |
1186 self.tagbranchList.start(path, tags, |
1184 self.tagsList, allTagsBranchesList) |
1187 self.tagsList, allTagsBranchesList) |
1185 else: |
1188 else: |
1186 if not self.showedBranches: |
1189 if not self.showedBranches: |
1187 self.showedBranches = True |
1190 self.showedBranches = True |
1188 allTagsBranchesList = self.allTagsBranchesList |
1191 allTagsBranchesList = self.allTagsBranchesList |
1189 else: |
1192 else: |
1190 self.branchesList = [] |
1193 self.branchesList = [] |
1191 allTagsBranchesList = None |
1194 allTagsBranchesList = None |
1192 self.tagbranchList.start(path, tags, |
1195 self.tagbranchList.start(path, tags, |
1193 self.branchesList, self.allTagsBranchesList) |
1196 self.branchesList, self.allTagsBranchesList) |
1194 |
1197 |
1195 def hgAnnotate(self, name): |
1198 def hgAnnotate(self, name): |
1196 """ |
1199 """ |
1197 Public method to show the output of the hg annotate command. |
1200 Public method to show the output of the hg annotate command. |
1202 self.annotate.show() |
1205 self.annotate.show() |
1203 self.annotate.start(name) |
1206 self.annotate.start(name) |
1204 |
1207 |
1205 def hgExtendedDiff(self, name): |
1208 def hgExtendedDiff(self, name): |
1206 """ |
1209 """ |
1207 Public method used to view the difference of a file/directory to the |
1210 Public method used to view the difference of a file/directory to the |
1208 Mercurial repository. |
1211 Mercurial repository. |
1209 |
1212 |
1210 If name is a directory and is the project directory, all project files |
1213 If name is a directory and is the project directory, all project files |
1211 are saved first. If name is a file (or list of files), which is/are being edited |
1214 are saved first. If name is a file (or list of files), which is/are being edited |
1212 and has unsaved modification, they can be saved or the operation may be aborted. |
1215 and has unsaved modification, they can be saved or the operation may be aborted. |
1213 |
1216 |
1214 This method gives the chance to enter the revisions to be compared. |
1217 This method gives the chance to enter the revisions to be compared. |
1215 |
1218 |
1216 @param name file/directory name to be diffed (string) |
1219 @param name file/directory name to be diffed (string) |
1252 self.log.show() |
1255 self.log.show() |
1253 self.log.start(name, noEntries) |
1256 self.log.start(name, noEntries) |
1254 |
1257 |
1255 def hgLogBrowser(self, path): |
1258 def hgLogBrowser(self, path): |
1256 """ |
1259 """ |
1257 Public method used to browse the log of a file/directory from the |
1260 Public method used to browse the log of a file/directory from the |
1258 Mercurial repository. |
1261 Mercurial repository. |
1259 |
1262 |
1260 @param path file/directory name to show the log of (string) |
1263 @param path file/directory name to show the log of (string) |
1261 """ |
1264 """ |
1262 self.logBrowser = HgLogBrowserDialog(self) |
1265 self.logBrowser = HgLogBrowserDialog(self) |
1263 self.logBrowser.show() |
1266 self.logBrowser.show() |
1264 self.logBrowser.start(path) |
1267 self.logBrowser.start(path) |
1265 |
1268 |
1266 def hgIncoming(self, name): |
1269 def hgIncoming(self, name): |
1267 """ |
1270 """ |
1268 Public method used to view the log of incoming changes from the |
1271 Public method used to view the log of incoming changes from the |
1269 Mercurial repository. |
1272 Mercurial repository. |
1270 |
1273 |
1271 @param name file/directory name to show the log of (string) |
1274 @param name file/directory name to show the log of (string) |
1272 """ |
1275 """ |
1273 if self.getPlugin().getPreferences("UseLogBrowser"): |
1276 if self.getPlugin().getPreferences("UseLogBrowser"): |
1274 self.logBrowser = HgLogBrowserDialog(self, mode = "incoming") |
1277 self.logBrowser = HgLogBrowserDialog(self, mode="incoming") |
1275 self.logBrowser.show() |
1278 self.logBrowser.show() |
1276 self.logBrowser.start(name) |
1279 self.logBrowser.start(name) |
1277 else: |
1280 else: |
1278 self.log = HgLogDialog(self, mode = "incoming") |
1281 self.log = HgLogDialog(self, mode="incoming") |
1279 self.log.show() |
1282 self.log.show() |
1280 self.log.start(name) |
1283 self.log.start(name) |
1281 |
1284 |
1282 def hgOutgoing(self, name): |
1285 def hgOutgoing(self, name): |
1283 """ |
1286 """ |
1284 Public method used to view the log of outgoing changes from the |
1287 Public method used to view the log of outgoing changes from the |
1285 Mercurial repository. |
1288 Mercurial repository. |
1286 |
1289 |
1287 @param name file/directory name to show the log of (string) |
1290 @param name file/directory name to show the log of (string) |
1288 """ |
1291 """ |
1289 if self.getPlugin().getPreferences("UseLogBrowser"): |
1292 if self.getPlugin().getPreferences("UseLogBrowser"): |
1290 self.logBrowser = HgLogBrowserDialog(self, mode = "outgoing") |
1293 self.logBrowser = HgLogBrowserDialog(self, mode="outgoing") |
1291 self.logBrowser.show() |
1294 self.logBrowser.show() |
1292 self.logBrowser.start(name) |
1295 self.logBrowser.start(name) |
1293 else: |
1296 else: |
1294 self.log = HgLogDialog(self, mode = "outgoing") |
1297 self.log = HgLogDialog(self, mode="outgoing") |
1295 self.log.show() |
1298 self.log.show() |
1296 self.log.start(name) |
1299 self.log.start(name) |
1297 |
1300 |
1298 def hgPull(self, name): |
1301 def hgPull(self, name): |
1299 """ |
1302 """ |
1383 process.start('hg', args) |
1386 process.start('hg', args) |
1384 procStarted = process.waitForStarted() |
1387 procStarted = process.waitForStarted() |
1385 if procStarted: |
1388 if procStarted: |
1386 finished = process.waitForFinished(30000) |
1389 finished = process.waitForFinished(30000) |
1387 if finished and process.exitCode() == 0: |
1390 if finished and process.exitCode() == 0: |
1388 output = str(process.readAllStandardOutput(), |
1391 output = str(process.readAllStandardOutput(), |
1389 Preferences.getSystem("IOEncoding"), 'replace') |
1392 Preferences.getSystem("IOEncoding"), 'replace') |
1390 index = 0 |
1393 index = 0 |
1391 for line in output.splitlines(): |
1394 for line in output.splitlines(): |
1392 index += 1 |
1395 index += 1 |
1393 changeset, tags, author, date, branches, parents = line.split("@@@") |
1396 changeset, tags, author, date, branches, parents = line.split("@@@") |
1394 cdate, ctime = date.split()[:2] |
1397 cdate, ctime = date.split()[:2] |
1395 info.append("""<p><table>""") |
1398 info.append("""<p><table>""") |
1396 if mode == "heads": |
1399 if mode == "heads": |
1397 info.append(QApplication.translate("mercurial", |
1400 info.append(QApplication.translate("mercurial", |
1398 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
1401 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
1399 .format(index, changeset))) |
1402 .format(index, changeset))) |
1400 elif mode == "parents": |
1403 elif mode == "parents": |
1401 info.append(QApplication.translate("mercurial", |
1404 info.append(QApplication.translate("mercurial", |
1402 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1405 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1403 .format(index, changeset))) |
1406 .format(index, changeset))) |
1404 elif mode == "tip": |
1407 elif mode == "tip": |
1405 info.append(QApplication.translate("mercurial", |
1408 info.append(QApplication.translate("mercurial", |
1406 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
1409 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
1407 info.append(QApplication.translate("mercurial", |
1410 info.append(QApplication.translate("mercurial", |
1408 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
1411 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
1409 .format(changeset)) |
1412 .format(changeset)) |
1410 if tags: |
1413 if tags: |
1411 info.append(QApplication.translate("mercurial", |
1414 info.append(QApplication.translate("mercurial", |
1412 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1415 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1413 .format('<br/>'.join(tags.split()))) |
1416 .format('<br/>'.join(tags.split()))) |
1414 if branches: |
1417 if branches: |
1415 info.append(QApplication.translate("mercurial", |
1418 info.append(QApplication.translate("mercurial", |
1416 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1419 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1417 .format('<br/>'.join(branches.split()))) |
1420 .format('<br/>'.join(branches.split()))) |
1418 if parents: |
1421 if parents: |
1419 info.append(QApplication.translate("mercurial", |
1422 info.append(QApplication.translate("mercurial", |
1420 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
1423 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
1421 .format('<br/>'.join(parents.split()))) |
1424 .format('<br/>'.join(parents.split()))) |
1422 info.append(QApplication.translate("mercurial", |
1425 info.append(QApplication.translate("mercurial", |
1423 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1426 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1424 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1427 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1425 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
1428 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
1426 """</table></p>""")\ |
1429 """</table></p>""")\ |
1427 .format(author, cdate, ctime)) |
1430 .format(author, cdate, ctime)) |
1655 dia = HgDialog(self.trUtf8('Identifying project directory')) |
1658 dia = HgDialog(self.trUtf8('Identifying project directory')) |
1656 res = dia.startProcess(args, repodir, False) |
1659 res = dia.startProcess(args, repodir, False) |
1657 if res: |
1660 if res: |
1658 dia.exec_() |
1661 dia.exec_() |
1659 |
1662 |
1660 def hgCreateIgnoreFile(self, name, autoAdd = False): |
1663 def hgCreateIgnoreFile(self, name, autoAdd=False): |
1661 """ |
1664 """ |
1662 Public method to create the ignore file. |
1665 Public method to create the ignore file. |
1663 |
1666 |
1664 @param name directory name to create the ignore file in (string) |
1667 @param name directory name to create the ignore file in (string) |
1665 @param autoAdd flag indicating to add it automatically (boolean) |
1668 @param autoAdd flag indicating to add it automatically (boolean) |
1666 @return flag indicating success |
1669 @return flag indicating success |
1667 """ |
1670 """ |
1668 status = False |
1671 status = False |
1669 ignorePatterns = [ |
1672 ignorePatterns = [ |
1670 "glob:.eric5project", |
1673 "glob:.eric5project", |
1671 "glob:.ropeproject", |
1674 "glob:.ropeproject", |
1672 "glob:.directory", |
1675 "glob:.directory", |
1673 "glob:**.pyc", |
1676 "glob:**.pyc", |
1674 "glob:**.orig", |
1677 "glob:**.orig", |
1675 "glob:**.bak", |
1678 "glob:**.bak", |
1676 ] |
1679 ] |
1677 |
1680 |
1678 ignoreName = os.path.join(name, ".hgignore") |
1681 ignoreName = os.path.join(name, ".hgignore") |
1679 if os.path.exists(ignoreName): |
1682 if os.path.exists(ignoreName): |
1680 res = E5MessageBox.yesNo(self.__ui, |
1683 res = E5MessageBox.yesNo(self.__ui, |
1681 self.trUtf8("Create .hgignore file"), |
1684 self.trUtf8("Create .hgignore file"), |
1682 self.trUtf8("""<p>The file <b>{0}</b> exists already.""" |
1685 self.trUtf8("""<p>The file <b>{0}</b> exists already.""" |
1683 """ Overwrite it?</p>""").format(ignoreName), |
1686 """ Overwrite it?</p>""").format(ignoreName), |
1684 icon = E5MessageBox.Warning) |
1687 icon=E5MessageBox.Warning) |
1685 else: |
1688 else: |
1686 res = True |
1689 res = True |
1687 if res: |
1690 if res: |
1688 try: |
1691 try: |
1689 # create a .hgignore file |
1692 # create a .hgignore file |
1787 repodir, |
1790 repodir, |
1788 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
1791 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
1789 if file: |
1792 if file: |
1790 if self.getPlugin().getPreferences("UseLogBrowser"): |
1793 if self.getPlugin().getPreferences("UseLogBrowser"): |
1791 self.logBrowser = \ |
1794 self.logBrowser = \ |
1792 HgLogBrowserDialog(self, mode = "incoming", bundle = file) |
1795 HgLogBrowserDialog(self, mode="incoming", bundle=file) |
1793 self.logBrowser.show() |
1796 self.logBrowser.show() |
1794 self.logBrowser.start(name) |
1797 self.logBrowser.start(name) |
1795 else: |
1798 else: |
1796 self.log = HgLogDialog(self, mode = "incoming", bundle = file) |
1799 self.log = HgLogDialog(self, mode="incoming", bundle=file) |
1797 self.log.show() |
1800 self.log.show() |
1798 self.log.start(name) |
1801 self.log.start(name) |
1799 |
1802 |
1800 def hgIdentifyBundle(self, name): |
1803 def hgIdentifyBundle(self, name): |
1801 """ |
1804 """ |
2006 |
2009 |
2007 ############################################################################ |
2010 ############################################################################ |
2008 ## Methods to get the helper objects are below. |
2011 ## Methods to get the helper objects are below. |
2009 ############################################################################ |
2012 ############################################################################ |
2010 |
2013 |
2011 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser = False): |
2014 def vcsGetProjectBrowserHelper(self, browser, project, isTranslationsBrowser=False): |
2012 """ |
2015 """ |
2013 Public method to instanciate a helper object for the different project browsers. |
2016 Public method to instanciate a helper object for the different project browsers. |
2014 |
2017 |
2015 @param browser reference to the project browser object |
2018 @param browser reference to the project browser object |
2016 @param project reference to the project object |
2019 @param project reference to the project object |