mercurial/copies.py
changeset 24011 d7d08337b3f6
parent 24010 a63c2b159df4
child 24184 cd66080ef6d4
equal deleted inserted replaced
24010:a63c2b159df4 24011:d7d08337b3f6
   142     for k in c.keys():
   142     for k in c.keys():
   143         if ds[k] not in 'anm':
   143         if ds[k] not in 'anm':
   144             del c[k]
   144             del c[k]
   145     return c
   145     return c
   146 
   146 
       
   147 def _computeforwardmissing(a, b):
       
   148     """Computes which files are in b but not a.
       
   149     This is its own function so extensions can easily wrap this call to see what
       
   150     files _forwardcopies is about to process.
       
   151     """
       
   152     missing = set(b.manifest().iterkeys())
       
   153     missing.difference_update(a.manifest().iterkeys())
       
   154     return missing
       
   155 
   147 def _forwardcopies(a, b):
   156 def _forwardcopies(a, b):
   148     '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
   157     '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
   149 
   158 
   150     # check for working copy
   159     # check for working copy
   151     w = None
   160     w = None
   165 
   174 
   166     # find where new files came from
   175     # find where new files came from
   167     # we currently don't try to find where old files went, too expensive
   176     # we currently don't try to find where old files went, too expensive
   168     # this means we can miss a case like 'hg rm b; hg cp a b'
   177     # this means we can miss a case like 'hg rm b; hg cp a b'
   169     cm = {}
   178     cm = {}
   170     missing = set(b.manifest().iterkeys())
   179     missing = _computeforwardmissing(a, b)
   171     missing.difference_update(a.manifest().iterkeys())
       
   172 
       
   173     ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
   180     ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
   174     for f in missing:
   181     for f in missing:
   175         fctx = b[f]
   182         fctx = b[f]
   176         fctx._ancestrycontext = ancestrycontext
   183         fctx._ancestrycontext = ancestrycontext
   177         ofctx = _tracefile(fctx, am, limit)
   184         ofctx = _tracefile(fctx, am, limit)