Plugins/VcsPlugins/vcsMercurial/HgSummaryDialog.py

changeset 3315
bd1a25ead18d
parent 3302
e92f0dd51979
child 3359
6b6c224d67d6
equal deleted inserted replaced
3314:be841c05a7f3 3315:bd1a25ead18d
57 QTimer.singleShot(2000, self.process.kill) 57 QTimer.singleShot(2000, self.process.kill)
58 self.process.waitForFinished(3000) 58 self.process.waitForFinished(3000)
59 59
60 e.accept() 60 e.accept()
61 61
62 def start(self, path, mq=False): 62 def start(self, path, mq=False, largefiles=False):
63 """ 63 """
64 Public slot to start the hg summary command. 64 Public slot to start the hg summary command.
65 65
66 @param path path name of the working directory (string) 66 @param path path name of the working directory (string)
67 @param mq flag indicating to show the queue status as well (boolean) 67 @param mq flag indicating to show the queue status as well (boolean)
68 @param mq flag indicating to show the largefiles status as well
69 (boolean)
68 """ 70 """
69 self.errorGroup.hide() 71 self.errorGroup.hide()
70 self.__path = path 72 self.__path = path
71 self.__mq = mq 73 self.__mq = mq
74 self.__largefiles = largefiles
72 75
73 args = self.vcs.initCommand("summary") 76 args = self.vcs.initCommand("summary")
74 args.append("--remote") 77 args.append("--remote")
75 if self.__mq: 78 if self.__mq:
76 args.append("--mq") 79 args.append("--mq")
80 if self.__largefiles:
81 args.append("--large")
77 82
78 # find the root of the repo 83 # find the root of the repo
79 repodir = self.__path 84 repodir = self.__path
80 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 85 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
81 repodir = os.path.dirname(repodir) 86 repodir = os.path.dirname(repodir)
204 infoDict = {} 209 infoDict = {}
205 210
206 # step 1: parse the output 211 # step 1: parse the output
207 while output: 212 while output:
208 line = output.pop(0) 213 line = output.pop(0)
214 if ':' not in line:
215 continue
209 name, value = line.split(": ", 1) 216 name, value = line.split(": ", 1)
210 value = value.strip() 217 value = value.strip()
211 218
212 if name == "parent": 219 if name == "parent":
213 if " " in value: 220 if " " in value:
294 if category == "applied": 301 if category == "applied":
295 applied = int(count) 302 applied = int(count)
296 elif category == "unapplied": 303 elif category == "unapplied":
297 unapplied = int(count) 304 unapplied = int(count)
298 value = (applied, unapplied) 305 value = (applied, unapplied)
306 elif name == "largefiles":
307 if not value[0].isdigit():
308 value = 0
309 else:
310 value = int(value.split(None, 1)[0])
299 else: 311 else:
300 # ignore unknown entries 312 # ignore unknown entries
301 continue 313 continue
302 314
303 infoDict[name] = value 315 infoDict[name] = value
438 .format(infoDict["mq"][1])) 450 .format(infoDict["mq"][1]))
439 qinfo = "<br/>".join(li) 451 qinfo = "<br/>".join(li)
440 info.append(self.tr( 452 info.append(self.tr(
441 "<tr><td><b>Queues Status</b></td><td>{0}</td></tr>") 453 "<tr><td><b>Queues Status</b></td><td>{0}</td></tr>")
442 .format(qinfo)) 454 .format(qinfo))
455 if "largefiles" in infoDict:
456 if infoDict["largefiles"] == 0:
457 lfInfo = self.tr("No files to upload")
458 else:
459 lfInfo = self.tr("%n file(s) to upload", "",
460 infoDict["largefiles"])
461 info.append(self.tr(
462 "<tr><td><b>Large Files</b></td><td>{0}</td></tr>")
463 .format(lfInfo))
443 info.append("</table>") 464 info.append("</table>")
444 else: 465 else:
445 info = [self.tr("<p>No status information available.</p>")] 466 info = [self.tr("<p>No status information available.</p>")]
446 467
447 self.summary.insertHtml("\n".join(info)) 468 self.summary.insertHtml("\n".join(info))

eric ide

mercurial