mercurial/localrepo.py
changeset 4059 431f3c1d3a37
parent 4022 bf329bda51a6
parent 4058 e7282dede8cd
child 4060 82eb0fafb56d
equal deleted inserted replaced
4051:022056263354 4059:431f3c1d3a37
   614         fp2 = manifest2.get(fn, nullid)
   614         fp2 = manifest2.get(fn, nullid)
   615 
   615 
   616         meta = {}
   616         meta = {}
   617         cp = self.dirstate.copied(fn)
   617         cp = self.dirstate.copied(fn)
   618         if cp:
   618         if cp:
       
   619             # Mark the new revision of this file as a copy of another
       
   620             # file.  This copy data will effectively act as a parent 
       
   621             # of this new revision.  If this is a merge, the first 
       
   622             # parent will be the nullid (meaning "look up the copy data")
       
   623             # and the second one will be the other parent.  For example:
       
   624             #
       
   625             # 0 --- 1 --- 3   rev1 changes file foo
       
   626             #   \       /     rev2 renames foo to bar and changes it
       
   627             #    \- 2 -/      rev3 should have bar with all changes and
       
   628             #                      should record that bar descends from
       
   629             #                      bar in rev2 and foo in rev1
       
   630             #
       
   631             # this allows this merge to succeed:
       
   632             #
       
   633             # 0 --- 1 --- 3   rev4 reverts the content change from rev2
       
   634             #   \       /     merging rev3 and rev4 should use bar@rev2
       
   635             #    \- 2 --- 4        as the merge base
       
   636             #
   619             meta["copy"] = cp
   637             meta["copy"] = cp
   620             if not manifest2: # not a branch merge
   638             if not manifest2: # not a branch merge
   621                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   639                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   622                 fp2 = nullid
   640                 fp2 = nullid
   623             elif fp2 != nullid: # copied on remote side
   641             elif fp2 != nullid: # copied on remote side
   624                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   642                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   625             elif fp1 != nullid: # copied on local side, reversed
   643             elif fp1 != nullid: # copied on local side, reversed
   626                 meta["copyrev"] = hex(manifest2.get(cp))
   644                 meta["copyrev"] = hex(manifest2.get(cp))
   627                 fp2 = nullid
   645                 fp2 = fp1
   628             else: # directory rename
   646             else: # directory rename
   629                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   647                 meta["copyrev"] = hex(manifest1.get(cp, nullid))
   630             self.ui.debug(_(" %s: copy %s:%s\n") %
   648             self.ui.debug(_(" %s: copy %s:%s\n") %
   631                           (fn, cp, meta["copyrev"]))
   649                           (fn, cp, meta["copyrev"]))
   632             fp1 = nullid
   650             fp1 = nullid