508 """ changes. Shall the commit be continued?"""), |
508 """ changes. Shall the commit be continued?"""), |
509 icon=E5MessageBox.Warning) |
509 icon=E5MessageBox.Warning) |
510 if not res: |
510 if not res: |
511 return |
511 return |
512 |
512 |
|
513 if isinstance(name, list): |
|
514 dname, fnames = self.splitPathList(name) |
|
515 else: |
|
516 dname, fname = self.splitPath(name) |
|
517 |
|
518 # find the root of the repo |
|
519 repodir = dname |
|
520 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
521 repodir = os.path.dirname(repodir) |
|
522 if os.path.splitdrive(repodir)[1] == os.sep: |
|
523 return |
|
524 |
513 if self.__commitDialog is not None: |
525 if self.__commitDialog is not None: |
514 msg = self.__commitDialog.logMessage() |
526 msg = self.__commitDialog.logMessage() |
515 amend = self.__commitDialog.amend() |
527 amend = self.__commitDialog.amend() |
516 commitSubrepositories = self.__commitDialog.commitSubrepositories() |
528 commitSubrepositories = self.__commitDialog.commitSubrepositories() |
517 self.__commitDialog.deleteLater() |
529 self.__commitDialog.deleteLater() |
518 self.__commitDialog = None |
530 self.__commitDialog = None |
|
531 if amend and not msg: |
|
532 msg = self.__getMostRecentCommitMessage(repodir) |
519 else: |
533 else: |
520 amend = False |
534 amend = False |
521 commitSubrepositories = False |
535 commitSubrepositories = False |
522 |
536 |
523 if not msg and not amend: |
537 if not msg and not amend: |
535 if commitSubrepositories: |
549 if commitSubrepositories: |
536 args.append("--subrepos") |
550 args.append("--subrepos") |
537 if msg: |
551 if msg: |
538 args.append("--message") |
552 args.append("--message") |
539 args.append(msg) |
553 args.append(msg) |
540 if isinstance(name, list): |
|
541 dname, fnames = self.splitPathList(name) |
|
542 else: |
|
543 dname, fname = self.splitPath(name) |
|
544 |
|
545 # find the root of the repo |
|
546 repodir = dname |
|
547 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
548 repodir = os.path.dirname(repodir) |
|
549 if os.path.splitdrive(repodir)[1] == os.sep: |
|
550 return |
|
551 |
|
552 if self.__client: |
554 if self.__client: |
553 if isinstance(name, list): |
555 if isinstance(name, list): |
554 self.addArguments(args, name) |
556 self.addArguments(args, name) |
555 else: |
557 else: |
556 if dname != repodir or fname != ".": |
558 if dname != repodir or fname != ".": |
576 model = e5App().getObject("Project").getModel() |
578 model = e5App().getObject("Project").getModel() |
577 for name in self.__forgotNames: |
579 for name in self.__forgotNames: |
578 model.updateVCSStatus(name) |
580 model.updateVCSStatus(name) |
579 self.__forgotNames = [] |
581 self.__forgotNames = [] |
580 self.checkVCSStatus() |
582 self.checkVCSStatus() |
|
583 |
|
584 def __getMostRecentCommitMessage(self, repodir): |
|
585 """ |
|
586 Private method to get the most recent commit message. |
|
587 |
|
588 Note: This message is extracted from the parent commit of the |
|
589 working directory. |
|
590 |
|
591 @param repodir path containing the repository |
|
592 @type str |
|
593 @return most recent commit message |
|
594 @rtype str |
|
595 """ |
|
596 args = self.initCommand("log") |
|
597 args.append("--rev") |
|
598 args.append(".") |
|
599 args.append('--template') |
|
600 args.append('{desc}') |
|
601 |
|
602 output = "" |
|
603 if self.__client is None: |
|
604 process = QProcess() |
|
605 process.setWorkingDirectory(repodir) |
|
606 process.start('hg', args) |
|
607 procStarted = process.waitForStarted(5000) |
|
608 if procStarted: |
|
609 finished = process.waitForFinished(30000) |
|
610 if finished and process.exitCode() == 0: |
|
611 output = str(process.readAllStandardOutput(), |
|
612 self.getEncoding(), 'replace') |
|
613 else: |
|
614 output, error = self.__client.runcommand(args) |
|
615 |
|
616 return output |
581 |
617 |
582 def vcsUpdate(self, name, noDialog=False, revision=None): |
618 def vcsUpdate(self, name, noDialog=False, revision=None): |
583 """ |
619 """ |
584 Public method used to update a file/directory with the Mercurial |
620 Public method used to update a file/directory with the Mercurial |
585 repository. |
621 repository. |