##// END OF EJS Templates
commit: some tidying...
Matt Mackall -
r8501:ab0e3f7e default
parent child Browse files
Show More
@@ -769,25 +769,19 b' class localrepository(repo.repository):'
769
769
770 def commit(self, files=None, text="", user=None, date=None, match=None,
770 def commit(self, files=None, text="", user=None, date=None, match=None,
771 force=False, editor=False, extra={}):
771 force=False, editor=False, extra={}):
772 wlock = None
773 if extra.get("close"):
774 force = True
775 if files:
776 files = list(set(files))
777
778 ret = None
772 ret = None
779 wlock = self.wlock()
773 wlock = self.wlock()
780 try:
774 try:
781 p1, p2 = self.dirstate.parents()
775 p1, p2 = self.dirstate.parents()
782
776
783 if (not force and p2 != nullid and
777 if (not force and p2 != nullid and match and
784 (match and (match.files() or match.anypats()))):
778 (match.files() or match.anypats())):
785 raise util.Abort(_('cannot partially commit a merge '
779 raise util.Abort(_('cannot partially commit a merge '
786 '(do not specify files or patterns)'))
780 '(do not specify files or patterns)'))
787
781
788 if files:
782 if files:
789 modified, removed = [], []
783 modified, removed = [], []
790 for f in files:
784 for f in sorted(set(files)):
791 s = self.dirstate[f]
785 s = self.dirstate[f]
792 if s in 'nma':
786 if s in 'nma':
793 modified.append(f)
787 modified.append(f)
@@ -799,9 +793,9 b' class localrepository(repo.repository):'
799 else:
793 else:
800 changes = self.status(match=match)
794 changes = self.status(match=match)
801
795
802 if (not (changes[0] or changes[1] or changes[2])
796 if (not force and not extra.get("close") and p2 == nullid
803 and not force and p2 == nullid and
797 and not (changes[0] or changes[1] or changes[2])
804 self[None].branch() == self['.'].branch()):
798 and self[None].branch() == self['.'].branch()):
805 self.ui.status(_("nothing changed\n"))
799 self.ui.status(_("nothing changed\n"))
806 return None
800 return None
807
801
General Comments 0
You need to be logged in to leave comments. Login now