Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py

branch
5_3_x
changeset 2582
d56b8f649745
parent 2568
b66f1577c6b9
child 3163
9f50365a0870
equal deleted inserted replaced
2568:b66f1577c6b9 2582:d56b8f649745
370 @return list of parent revisions (list of integers) 370 @return list of parent revisions (list of integers)
371 """ 371 """
372 errMsg = "" 372 errMsg = ""
373 parents = [-1] 373 parents = [-1]
374 374
375 args = [] 375 if int(rev) > 0:
376 args.append("parents") 376 args = []
377 if self.commandMode == "incoming": 377 args.append("parents")
378 if self.bundle: 378 if self.commandMode == "incoming":
379 args.append("--repository") 379 if self.bundle:
380 args.append(self.bundle) 380 args.append("--repository")
381 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): 381 args.append(self.bundle)
382 args.append("--repository") 382 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile):
383 args.append(self.vcs.bundleFile) 383 args.append("--repository")
384 args.append("--template") 384 args.append(self.vcs.bundleFile)
385 args.append("{rev}\n") 385 args.append("--template")
386 args.append("-r") 386 args.append("{rev}\n")
387 args.append(rev) 387 args.append("-r")
388 if not self.projectMode: 388 args.append(rev)
389 args.append(self.filename) 389 if not self.projectMode:
390 390 args.append(self.filename)
391 output = "" 391
392 if self.__hgClient: 392 output = ""
393 output, errMsg = self.__hgClient.runcommand(args) 393 if self.__hgClient:
394 else: 394 output, errMsg = self.__hgClient.runcommand(args)
395 process = QProcess() 395 else:
396 process.setWorkingDirectory(self.repodir) 396 process = QProcess()
397 process.start('hg', args) 397 process.setWorkingDirectory(self.repodir)
398 procStarted = process.waitForStarted() 398 process.start('hg', args)
399 if procStarted: 399 procStarted = process.waitForStarted()
400 finished = process.waitForFinished(30000) 400 if procStarted:
401 if finished and process.exitCode() == 0: 401 finished = process.waitForFinished(30000)
402 output = \ 402 if finished and process.exitCode() == 0:
403 str(process.readAllStandardOutput(), 403 output = \
404 Preferences.getSystem("IOEncoding"), 404 str(process.readAllStandardOutput(),
405 'replace') 405 Preferences.getSystem("IOEncoding"),
406 'replace')
407 else:
408 if not finished:
409 errMsg = self.trUtf8(
410 "The hg process did not finish within 30s.")
406 else: 411 else:
407 if not finished: 412 errMsg = self.trUtf8("Could not start the hg executable.")
408 errMsg = self.trUtf8( 413
409 "The hg process did not finish within 30s.") 414 if errMsg:
410 else: 415 E5MessageBox.critical(self,
411 errMsg = self.trUtf8("Could not start the hg executable.") 416 self.trUtf8("Mercurial Error"),
412 417 errMsg)
413 if errMsg: 418
414 E5MessageBox.critical(self, 419 if output:
415 self.trUtf8("Mercurial Error"), 420 parents = [int(p) for p in output.strip().splitlines()]
416 errMsg)
417
418 if output:
419 parents = [int(p) for p in output.strip().splitlines()]
420 421
421 return parents 422 return parents
422 423
423 def __identifyProject(self): 424 def __identifyProject(self):
424 """ 425 """

eric ide

mercurial