##// END OF EJS Templates
localrepo: replace dirstate by workingfilectx in filecommit()
Patrick Mezard -
r6706:716a1296 default
parent child Browse files
Show More
@@ -683,19 +683,21 b' class localrepository(repo.repository):'
683 683 self._wlockref = weakref.ref(l)
684 684 return l
685 685
686 def filecommit(self, fn, manifest1, manifest2, linkrev, tr, changelist):
686 def filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist):
687 687 """
688 688 commit an individual file as part of a larger transaction
689 689 """
690 690
691 t = self.wread(fn)
691 fn = fctx.path()
692 t = fctx.data()
692 693 fl = self.file(fn)
693 694 fp1 = manifest1.get(fn, nullid)
694 695 fp2 = manifest2.get(fn, nullid)
695 696
696 697 meta = {}
697 cp = self.dirstate.copied(fn)
698 if cp and cp != fn:
698 cp = fctx.renamed()
699 if cp and cp[0] != fn:
700 cp = cp[0]
699 701 # Mark the new revision of this file as a copy of another
700 702 # file. This copy data will effectively act as a parent
701 703 # of this new revision. If this is a merge, the first
@@ -768,6 +770,20 b' class localrepository(repo.repository):'
768 770 extra = extra.copy()
769 771
770 772 if use_dirstate:
773 p1, p2 = self.dirstate.parents()
774 update_dirstate = True
775
776 if (not force and p2 != nullid and
777 (match and (match.files() or match.anypats()))):
778 raise util.Abort(_('cannot partially commit a merge '
779 '(do not specify files or patterns)'))
780 else:
781 p1, p2 = p1, p2 or nullid
782 update_dirstate = (self.dirstate.parents()[0] == p1)
783
784 wctx = self.workingctx((p1, p2))
785
786 if use_dirstate:
771 787 if files:
772 788 for f in files:
773 789 s = self.dirstate[f]
@@ -785,25 +801,13 b' class localrepository(repo.repository):'
785 801 else:
786 802 commit = files
787 803
788 if use_dirstate:
789 p1, p2 = self.dirstate.parents()
790 update_dirstate = True
791
792 if (not force and p2 != nullid and
793 (match and (match.files() or match.anypats()))):
794 raise util.Abort(_('cannot partially commit a merge '
795 '(do not specify files or patterns)'))
796 else:
797 p1, p2 = p1, p2 or nullid
798 update_dirstate = (self.dirstate.parents()[0] == p1)
799
800 804 c1 = self.changelog.read(p1)
801 805 c2 = self.changelog.read(p2)
802 806 m1 = self.manifest.read(c1[0]).copy()
803 807 m2 = self.manifest.read(c2[0])
804 808
805 809 if use_dirstate:
806 branchname = self.workingctx().branch()
810 branchname = wctx.branch()
807 811 try:
808 812 branchname = branchname.decode('UTF-8').encode('UTF-8')
809 813 except UnicodeDecodeError:
@@ -831,14 +835,13 b' class localrepository(repo.repository):'
831 835 new = {}
832 836 linkrev = self.changelog.count()
833 837 commit.sort()
834 is_exec = util.execfunc(self.root, m1.execf)
835 is_link = util.linkfunc(self.root, m1.linkf)
836 838 for f in commit:
837 839 self.ui.note(f + "\n")
840 fctx = wctx.filectx(f)
838 841 try:
839 new[f] = self.filecommit(f, m1, m2, linkrev, trp, changed)
840 new_exec = is_exec(f)
841 new_link = is_link(f)
842 new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed)
843 new_exec = fctx.isexec()
844 new_link = fctx.islink()
842 845 if ((not changed or changed[-1] != f) and
843 846 m2.get(f) != new[f]):
844 847 # mention the file in the changelog if some
General Comments 0
You need to be logged in to leave comments. Login now