Show More
@@ -683,19 +683,21 b' class localrepository(repo.repository):' | |||||
683 | self._wlockref = weakref.ref(l) |
|
683 | self._wlockref = weakref.ref(l) | |
684 | return l |
|
684 | return l | |
685 |
|
685 | |||
686 |
def filecommit(self, f |
|
686 | def filecommit(self, fctx, manifest1, manifest2, linkrev, tr, changelist): | |
687 | """ |
|
687 | """ | |
688 | commit an individual file as part of a larger transaction |
|
688 | commit an individual file as part of a larger transaction | |
689 | """ |
|
689 | """ | |
690 |
|
690 | |||
691 |
|
|
691 | fn = fctx.path() | |
|
692 | t = fctx.data() | |||
692 | fl = self.file(fn) |
|
693 | fl = self.file(fn) | |
693 | fp1 = manifest1.get(fn, nullid) |
|
694 | fp1 = manifest1.get(fn, nullid) | |
694 | fp2 = manifest2.get(fn, nullid) |
|
695 | fp2 = manifest2.get(fn, nullid) | |
695 |
|
696 | |||
696 | meta = {} |
|
697 | meta = {} | |
697 | cp = self.dirstate.copied(fn) |
|
698 | cp = fctx.renamed() | |
698 | if cp and cp != fn: |
|
699 | if cp and cp[0] != fn: | |
|
700 | cp = cp[0] | |||
699 | # Mark the new revision of this file as a copy of another |
|
701 | # Mark the new revision of this file as a copy of another | |
700 | # file. This copy data will effectively act as a parent |
|
702 | # file. This copy data will effectively act as a parent | |
701 | # of this new revision. If this is a merge, the first |
|
703 | # of this new revision. If this is a merge, the first | |
@@ -768,6 +770,20 b' class localrepository(repo.repository):' | |||||
768 | extra = extra.copy() |
|
770 | extra = extra.copy() | |
769 |
|
771 | |||
770 | if use_dirstate: |
|
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 | if files: |
|
787 | if files: | |
772 | for f in files: |
|
788 | for f in files: | |
773 | s = self.dirstate[f] |
|
789 | s = self.dirstate[f] | |
@@ -785,25 +801,13 b' class localrepository(repo.repository):' | |||||
785 | else: |
|
801 | else: | |
786 | commit = files |
|
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 | c1 = self.changelog.read(p1) |
|
804 | c1 = self.changelog.read(p1) | |
801 | c2 = self.changelog.read(p2) |
|
805 | c2 = self.changelog.read(p2) | |
802 | m1 = self.manifest.read(c1[0]).copy() |
|
806 | m1 = self.manifest.read(c1[0]).copy() | |
803 | m2 = self.manifest.read(c2[0]) |
|
807 | m2 = self.manifest.read(c2[0]) | |
804 |
|
808 | |||
805 | if use_dirstate: |
|
809 | if use_dirstate: | |
806 |
branchname = |
|
810 | branchname = wctx.branch() | |
807 | try: |
|
811 | try: | |
808 | branchname = branchname.decode('UTF-8').encode('UTF-8') |
|
812 | branchname = branchname.decode('UTF-8').encode('UTF-8') | |
809 | except UnicodeDecodeError: |
|
813 | except UnicodeDecodeError: | |
@@ -831,14 +835,13 b' class localrepository(repo.repository):' | |||||
831 | new = {} |
|
835 | new = {} | |
832 | linkrev = self.changelog.count() |
|
836 | linkrev = self.changelog.count() | |
833 | commit.sort() |
|
837 | commit.sort() | |
834 | is_exec = util.execfunc(self.root, m1.execf) |
|
|||
835 | is_link = util.linkfunc(self.root, m1.linkf) |
|
|||
836 | for f in commit: |
|
838 | for f in commit: | |
837 | self.ui.note(f + "\n") |
|
839 | self.ui.note(f + "\n") | |
|
840 | fctx = wctx.filectx(f) | |||
838 | try: |
|
841 | try: | |
839 | new[f] = self.filecommit(f, m1, m2, linkrev, trp, changed) |
|
842 | new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed) | |
840 |
new_exec = is |
|
843 | new_exec = fctx.isexec() | |
841 |
new_link = is |
|
844 | new_link = fctx.islink() | |
842 | if ((not changed or changed[-1] != f) and |
|
845 | if ((not changed or changed[-1] != f) and | |
843 | m2.get(f) != new[f]): |
|
846 | m2.get(f) != new[f]): | |
844 | # mention the file in the changelog if some |
|
847 | # mention the file in the changelog if some |
General Comments 0
You need to be logged in to leave comments.
Login now