605 fp2 = manifest2.get(fn, nullid) |
605 fp2 = manifest2.get(fn, nullid) |
606 |
606 |
607 meta = {} |
607 meta = {} |
608 cp = self.dirstate.copied(fn) |
608 cp = self.dirstate.copied(fn) |
609 if cp: |
609 if cp: |
|
610 # Mark the new revision of this file as a copy of another |
|
611 # file. This copy data will effectively act as a parent |
|
612 # of this new revision. If this is a merge, the first |
|
613 # parent will be the nullid (meaning "look up the copy data") |
|
614 # and the second one will be the other parent. For example: |
|
615 # |
|
616 # 0 --- 1 --- 3 rev1 changes file foo |
|
617 # \ / rev2 renames foo to bar and changes it |
|
618 # \- 2 -/ rev3 should have bar with all changes and |
|
619 # should record that bar descends from |
|
620 # bar in rev2 and foo in rev1 |
|
621 # |
|
622 # this allows this merge to succeed: |
|
623 # |
|
624 # 0 --- 1 --- 3 rev4 reverts the content change from rev2 |
|
625 # \ / merging rev3 and rev4 should use bar@rev2 |
|
626 # \- 2 --- 4 as the merge base |
|
627 # |
610 meta["copy"] = cp |
628 meta["copy"] = cp |
611 if not manifest2: # not a branch merge |
629 if not manifest2: # not a branch merge |
612 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
630 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
613 fp2 = nullid |
631 fp2 = nullid |
614 elif fp2 != nullid: # copied on remote side |
632 elif fp2 != nullid: # copied on remote side |
615 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
633 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
616 elif fp1 != nullid: # copied on local side, reversed |
634 elif fp1 != nullid: # copied on local side, reversed |
617 meta["copyrev"] = hex(manifest2.get(cp)) |
635 meta["copyrev"] = hex(manifest2.get(cp)) |
618 fp2 = nullid |
636 fp2 = fp1 |
619 else: # directory rename |
637 else: # directory rename |
620 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
638 meta["copyrev"] = hex(manifest1.get(cp, nullid)) |
621 self.ui.debug(_(" %s: copy %s:%s\n") % |
639 self.ui.debug(_(" %s: copy %s:%s\n") % |
622 (fn, cp, meta["copyrev"])) |
640 (fn, cp, meta["copyrev"])) |
623 fp1 = nullid |
641 fp1 = nullid |