Plugins/VcsPlugins/vcsMercurial/hg.py

changeset 2811
7b2ec3af3505
parent 2771
281c9b30dd91
child 2815
53c1d1f9ec86
equal deleted inserted replaced
2810:fe551b27f62e 2811:7b2ec3af3505
92 92
93 self.log = None 93 self.log = None
94 self.logBrowser = None 94 self.logBrowser = None
95 self.diff = None 95 self.diff = None
96 self.status = None 96 self.status = None
97 self.summary = None
97 self.tagbranchList = None 98 self.tagbranchList = None
98 self.annotate = None 99 self.annotate = None
99 self.repoEditor = None 100 self.repoEditor = None
100 self.userEditor = None 101 self.userEditor = None
101 self.serveDlg = None 102 self.serveDlg = None
157 self.logBrowser.close() 158 self.logBrowser.close()
158 if self.diff is not None: 159 if self.diff is not None:
159 self.diff.close() 160 self.diff.close()
160 if self.status is not None: 161 if self.status is not None:
161 self.status.close() 162 self.status.close()
163 if self.summary is not None:
164 self.summary.close()
162 if self.tagbranchList is not None: 165 if self.tagbranchList is not None:
163 self.tagbranchList.close() 166 self.tagbranchList.close()
164 if self.annotate is not None: 167 if self.annotate is not None:
165 self.annotate.close() 168 self.annotate.close()
166 if self.serveDlg is not None: 169 if self.serveDlg is not None:
819 from .HgStatusDialog import HgStatusDialog 822 from .HgStatusDialog import HgStatusDialog
820 self.status = HgStatusDialog(self) 823 self.status = HgStatusDialog(self)
821 self.status.show() 824 self.status.show()
822 self.status.start(name) 825 self.status.start(name)
823 826
827 def hgSummary(self, mq=False):
828 """
829 Public method used to show some summary information of the
830 working directory state.
831
832 @param mq flag indicating to show the queue status as well (boolean)
833 """
834 from .HgSummaryDialog import HgSummaryDialog
835 self.summary = HgSummaryDialog(self)
836 self.summary.show()
837 self.summary.start(self.__projectHelper.getProject().getProjectPath(), mq=mq)
838
824 def vcsTag(self, name): 839 def vcsTag(self, name):
825 """ 840 """
826 Public method used to set the tag in the Mercurial repository. 841 Public method used to set the tag in the Mercurial repository.
827 842
828 @param name file/directory name to be tagged (string) 843 @param name file/directory name to be tagged (string)
1248 Public method to retrieve information about the repository. 1263 Public method to retrieve information about the repository.
1249 1264
1250 @param ppath local path to get the repository infos (string) 1265 @param ppath local path to get the repository infos (string)
1251 @return string with ready formated info for display (string) 1266 @return string with ready formated info for display (string)
1252 """ 1267 """
1253 info = []
1254
1255 args = [] 1268 args = []
1256 args.append('parents') 1269 args.append('parents')
1257 args.append('--template') 1270 args.append('--template')
1258 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' 1271 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@'
1259 '{date|isodate}@@@{branches}@@@{bookmarks}\n') 1272 '{date|isodate}@@@{branches}@@@{bookmarks}\n')
1270 output = str(process.readAllStandardOutput(), 1283 output = str(process.readAllStandardOutput(),
1271 Preferences.getSystem("IOEncoding"), 'replace') 1284 Preferences.getSystem("IOEncoding"), 'replace')
1272 else: 1285 else:
1273 output, error = self.__client.runcommand(args) 1286 output, error = self.__client.runcommand(args)
1274 1287
1288 infoBlock = []
1275 if output: 1289 if output:
1276 index = 0 1290 index = 0
1277 for line in output.splitlines(): 1291 for line in output.splitlines():
1278 index += 1 1292 index += 1
1279 changeset, tags, author, date, branches, bookmarks = line.split("@@@") 1293 changeset, tags, author, date, branches, bookmarks = line.split("@@@")
1280 cdate, ctime = date.split()[:2] 1294 cdate, ctime = date.split()[:2]
1281 info.append("""<p><table>""") 1295 info = []
1282 info.append(QApplication.translate("mercurial", 1296 info.append(QApplication.translate("mercurial",
1283 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" 1297 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n"""
1284 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ 1298 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\
1285 .format(index, changeset)) 1299 .format(index, changeset))
1286 if tags: 1300 if tags:
1298 info.append(QApplication.translate("mercurial", 1312 info.append(QApplication.translate("mercurial",
1299 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" 1313 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n"""
1300 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" 1314 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n"""
1301 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ 1315 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\
1302 .format(author, cdate, ctime)) 1316 .format(author, cdate, ctime))
1303 info.append("""</table></p>""") 1317 infoBlock.append("\n".join(info))
1318 if infoBlock:
1319 infoStr = """<tr></tr>{0}""".format("<tr></tr>".join(infoBlock))
1320 else:
1321 infoStr = ""
1304 1322
1305 url = "" 1323 url = ""
1306 args = [] 1324 args = []
1307 args.append('showconfig') 1325 args.append('showconfig')
1308 args.append('paths.default') 1326 args.append('paths.default')
1329 """<h3>Repository information</h3>\n""" 1347 """<h3>Repository information</h3>\n"""
1330 """<p><table>\n""" 1348 """<p><table>\n"""
1331 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n""" 1349 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n"""
1332 """<tr></tr>\n""" 1350 """<tr></tr>\n"""
1333 """<tr><td><b>URL</b></td><td>{1}</td></tr>\n""" 1351 """<tr><td><b>URL</b></td><td>{1}</td></tr>\n"""
1352 """{2}"""
1334 """</table></p>\n""" 1353 """</table></p>\n"""
1335 """{2}""" 1354 ).format(self.versionStr, url, infoStr)
1336 ).format(self.versionStr, url, "\n".join(info))
1337 1355
1338 ############################################################################ 1356 ############################################################################
1339 ## Private Mercurial specific methods are below. 1357 ## Private Mercurial specific methods are below.
1340 ############################################################################ 1358 ############################################################################
1341 1359

eric ide

mercurial