##// END OF EJS Templates
filecommit: swallow some bits from _commitctx, add _
Matt Mackall -
r8401:ca7dc47e default
parent child Browse files
Show More
@@ -747,6 +747,9 class memctx(object):
747 def __nonzero__(self):
747 def __nonzero__(self):
748 return True
748 return True
749
749
750 def __getitem__(self, key):
751 return self.filectx(key)
752
750 def user(self): return self._user or self._repo.ui.username()
753 def user(self): return self._user or self._repo.ui.username()
751 def date(self): return self._date
754 def date(self): return self._date
752 def description(self): return self._text
755 def description(self): return self._text
@@ -705,7 +705,7 class localrepository(repo.repository):
705 self._wlockref = weakref.ref(l)
705 self._wlockref = weakref.ref(l)
706 return l
706 return l
707
707
708 def filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
708 def _filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
709 """
709 """
710 commit an individual file as part of a larger transaction
710 commit an individual file as part of a larger transaction
711 """
711 """
@@ -714,7 +714,7 class localrepository(repo.repository):
714 text = fctx.data()
714 text = fctx.data()
715 flog = self.file(fname)
715 flog = self.file(fname)
716 fparent1 = manifest1.get(fname, nullid)
716 fparent1 = manifest1.get(fname, nullid)
717 fparent2 = manifest2.get(fname, nullid)
717 fparent2 = fparent2o = manifest2.get(fname, nullid)
718
718
719 meta = {}
719 meta = {}
720 copy = fctx.renamed()
720 copy = fctx.renamed()
@@ -769,13 +769,17 class localrepository(repo.repository):
769 elif fparentancestor == fparent2:
769 elif fparentancestor == fparent2:
770 fparent2 = nullid
770 fparent2 = nullid
771
771
772 # is the file unmodified from the parent? report existing entry
772 # is the file changed?
773 if fparent2 == nullid and not flog.cmp(fparent1, text) and not meta:
773 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
774 return fparent1
775
776 changelist.append(fname)
774 changelist.append(fname)
777 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
775 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
778
776
777 # are just the flags changed during merge?
778 if fparent1 != fparent2o and manifest1.flags(fname) != fctx.flags():
779 changelist.append(fname)
780
781 return fparent1
782
779 def commit(self, files=None, text="", user=None, date=None,
783 def commit(self, files=None, text="", user=None, date=None,
780 match=None, force=False, force_editor=False,
784 match=None, force=False, force_editor=False,
781 p1=None, p2=None, extra={}, empty_ok=False):
785 p1=None, p2=None, extra={}, empty_ok=False):
@@ -877,17 +881,10 class localrepository(repo.repository):
877 for f in commit:
881 for f in commit:
878 self.ui.note(f + "\n")
882 self.ui.note(f + "\n")
879 try:
883 try:
880 fctx = ctx.filectx(f)
884 fctx = ctx[f]
881 newflags = fctx.flags()
885 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
882 new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed)
886 changed)
883 if ((not changed or changed[-1] != f) and
887 m1.set(f, fctx.flags())
884 m2.get(f) != new[f]):
885 # mention the file in the changelog if some
886 # flag changed, even if there was no content
887 # change.
888 if m1.flags(f) != newflags:
889 changed.append(f)
890 m1.set(f, newflags)
891 if working:
888 if working:
892 self.dirstate.normal(f)
889 self.dirstate.normal(f)
893
890
General Comments 0
You need to be logged in to leave comments. Login now