##// 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 b' class memctx(object):'
747 747 def __nonzero__(self):
748 748 return True
749 749
750 def __getitem__(self, key):
751 return self.filectx(key)
752
750 753 def user(self): return self._user or self._repo.ui.username()
751 754 def date(self): return self._date
752 755 def description(self): return self._text
@@ -705,7 +705,7 b' class localrepository(repo.repository):'
705 705 self._wlockref = weakref.ref(l)
706 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 710 commit an individual file as part of a larger transaction
711 711 """
@@ -714,7 +714,7 b' class localrepository(repo.repository):'
714 714 text = fctx.data()
715 715 flog = self.file(fname)
716 716 fparent1 = manifest1.get(fname, nullid)
717 fparent2 = manifest2.get(fname, nullid)
717 fparent2 = fparent2o = manifest2.get(fname, nullid)
718 718
719 719 meta = {}
720 720 copy = fctx.renamed()
@@ -769,12 +769,16 b' class localrepository(repo.repository):'
769 769 elif fparentancestor == fparent2:
770 770 fparent2 = nullid
771 771
772 # is the file unmodified from the parent? report existing entry
773 if fparent2 == nullid and not flog.cmp(fparent1, text) and not meta:
774 return fparent1
772 # is the file changed?
773 if fparent2 != nullid or flog.cmp(fparent1, text) or meta:
774 changelist.append(fname)
775 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
775 776
776 changelist.append(fname)
777 return flog.add(text, meta, tr, linkrev, fparent1, fparent2)
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
778 782
779 783 def commit(self, files=None, text="", user=None, date=None,
780 784 match=None, force=False, force_editor=False,
@@ -877,17 +881,10 b' class localrepository(repo.repository):'
877 881 for f in commit:
878 882 self.ui.note(f + "\n")
879 883 try:
880 fctx = ctx.filectx(f)
881 newflags = fctx.flags()
882 new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed)
883 if ((not changed or changed[-1] != f) and
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)
884 fctx = ctx[f]
885 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
886 changed)
887 m1.set(f, fctx.flags())
891 888 if working:
892 889 self.dirstate.normal(f)
893 890
General Comments 0
You need to be logged in to leave comments. Login now