##// END OF EJS Templates
commit: simplify file copy logic
Matt Mackall -
r6874:8dc21876 default
parent child Browse files
Show More
@@ -687,8 +687,8 b' class localrepository(repo.repository):'
687 fp2 = manifest2.get(fn, nullid)
687 fp2 = manifest2.get(fn, nullid)
688
688
689 meta = {}
689 meta = {}
690 cp = self.dirstate.copied(fn)
690 cf = self.dirstate.copied(fn)
691 if cp and cp != fn:
691 if cf and cf != fn:
692 # Mark the new revision of this file as a copy of another
692 # Mark the new revision of this file as a copy of another
693 # file. This copy data will effectively act as a parent
693 # file. This copy data will effectively act as a parent
694 # of this new revision. If this is a merge, the first
694 # of this new revision. If this is a merge, the first
@@ -707,22 +707,20 b' class localrepository(repo.repository):'
707 # \ / merging rev3 and rev4 should use bar@rev2
707 # \ / merging rev3 and rev4 should use bar@rev2
708 # \- 2 --- 4 as the merge base
708 # \- 2 --- 4 as the merge base
709 #
709 #
710 meta["copy"] = cp
710
711 if not manifest2: # not a branch merge
711 cr = manifest1.get(cf, nullid)
712 meta["copyrev"] = hex(manifest1[cp])
712 nfp = fp2
713 fp2 = nullid
713
714 elif fp2 != nullid: # copied on remote side
714 if manifest2: # branch merge
715 meta["copyrev"] = hex(manifest1[cp])
715 if fp2 == nullid: # copied on remote side
716 elif fp1 != nullid: # copied on local side, reversed
716 if fp1 != nullid or cf in manifest2:
717 meta["copyrev"] = hex(manifest2[cp])
717 cr = manifest2[cf]
718 fp2 = fp1
718 nfp = fp1
719 elif cp in manifest2: # directory rename on local side
719
720 meta["copyrev"] = hex(manifest2[cp])
720 self.ui.debug(_(" %s: copy %s:%s\n") % (fn, cf, hex(cr)))
721 else: # directory rename on remote side
721 meta["copy"] = cf
722 meta["copyrev"] = hex(manifest1[cp])
722 meta["copyrev"] = hex(cr)
723 self.ui.debug(_(" %s: copy %s:%s\n") %
723 fp1, fp2 = nullid, nfp
724 (fn, cp, meta["copyrev"]))
725 fp1 = nullid
726 elif fp2 != nullid:
724 elif fp2 != nullid:
727 # is one parent an ancestor of the other?
725 # is one parent an ancestor of the other?
728 fpa = fl.ancestor(fp1, fp2)
726 fpa = fl.ancestor(fp1, fp2)
General Comments 0
You need to be logged in to leave comments. Login now