mercurial/copies.py
changeset 41415 dc50121126ae
parent 41414 b80af0707066
child 41416 75e753a26806
equal deleted inserted replaced
41414:b80af0707066 41415:dc50121126ae
    22 )
    22 )
    23 from .utils import (
    23 from .utils import (
    24     stringutil,
    24     stringutil,
    25 )
    25 )
    26 
    26 
    27 def _findlimit(repo, a, b):
    27 def _findlimit(repo, ctxa, ctxb):
    28     """
    28     """
    29     Find the last revision that needs to be checked to ensure that a full
    29     Find the last revision that needs to be checked to ensure that a full
    30     transitive closure for file copies can be properly calculated.
    30     transitive closure for file copies can be properly calculated.
    31     Generally, this means finding the earliest revision number that's an
    31     Generally, this means finding the earliest revision number that's an
    32     ancestor of a or b but not both, except when a or b is a direct descendent
    32     ancestor of a or b but not both, except when a or b is a direct descendent
    43     #   - track number of interesting revs that might still be on a side
    43     #   - track number of interesting revs that might still be on a side
    44     #   - track the lowest interesting rev seen
    44     #   - track the lowest interesting rev seen
    45     #   - quit when interesting revs is zero
    45     #   - quit when interesting revs is zero
    46 
    46 
    47     cl = repo.changelog
    47     cl = repo.changelog
       
    48     a = ctxa.rev()
       
    49     b = ctxb.rev()
    48     if a is None:
    50     if a is None:
    49         a = node.wdirrev
    51         a = node.wdirrev
    50     if b is None:
    52     if b is None:
    51         b = node.wdirrev
    53         b = node.wdirrev
    52 
    54 
   160     debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
   162     debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
   161     dbg = repo.ui.debug
   163     dbg = repo.ui.debug
   162     if debug:
   164     if debug:
   163         dbg('debug.copies:    looking into rename from %s to %s\n'
   165         dbg('debug.copies:    looking into rename from %s to %s\n'
   164             % (a, b))
   166             % (a, b))
   165     limit = _findlimit(repo, a.rev(), b.rev())
   167     limit = _findlimit(repo, a, b)
   166     if debug:
   168     if debug:
   167         dbg('debug.copies:      search limit: %d\n' % limit)
   169         dbg('debug.copies:      search limit: %d\n' % limit)
   168     am = a.manifest()
   170     am = a.manifest()
   169 
   171 
   170     # find where new files came from
   172     # find where new files came from
   454     graft = dirtyc1 or dirtyc2
   456     graft = dirtyc1 or dirtyc2
   455     tca = base
   457     tca = base
   456     if graft:
   458     if graft:
   457         tca = _c1.ancestor(_c2)
   459         tca = _c1.ancestor(_c2)
   458 
   460 
   459     limit = _findlimit(repo, c1.rev(), c2.rev())
   461     limit = _findlimit(repo, c1, c2)
   460     repo.ui.debug("  searching for copies back to rev %d\n" % limit)
   462     repo.ui.debug("  searching for copies back to rev %d\n" % limit)
   461 
   463 
   462     m1 = c1.manifest()
   464     m1 = c1.manifest()
   463     m2 = c2.manifest()
   465     m2 = c2.manifest()
   464     mb = base.manifest()
   466     mb = base.manifest()