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