hgext/largefiles/lfcommands.py
changeset 47012 d55b71393907
parent 46113 59fa3890d40a
child 47651 40811cc7fa56
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
    15 
    15 
    16 from mercurial.i18n import _
    16 from mercurial.i18n import _
    17 from mercurial.node import (
    17 from mercurial.node import (
    18     bin,
    18     bin,
    19     hex,
    19     hex,
    20     nullid,
       
    21 )
    20 )
    22 
    21 
    23 from mercurial import (
    22 from mercurial import (
    24     cmdutil,
    23     cmdutil,
    25     context,
    24     context,
   113         # Use a generator instead of a list to decrease memory usage
   112         # Use a generator instead of a list to decrease memory usage
   114         ctxs = (
   113         ctxs = (
   115             rsrc[ctx]
   114             rsrc[ctx]
   116             for ctx in rsrc.changelog.nodesbetween(None, rsrc.heads())[0]
   115             for ctx in rsrc.changelog.nodesbetween(None, rsrc.heads())[0]
   117         )
   116         )
   118         revmap = {nullid: nullid}
   117         revmap = {rsrc.nullid: rdst.nullid}
   119         if tolfile:
   118         if tolfile:
   120             # Lock destination to prevent modification while it is converted to.
   119             # Lock destination to prevent modification while it is converted to.
   121             # Don't need to lock src because we are just reading from its
   120             # Don't need to lock src because we are just reading from its
   122             # history which can't change.
   121             # history which can't change.
   123             dstwlock = rdst.wlock()
   122             dstwlock = rdst.wlock()
   338 
   337 
   339 
   338 
   340 # Generate list of changed files
   339 # Generate list of changed files
   341 def _getchangedfiles(ctx, parents):
   340 def _getchangedfiles(ctx, parents):
   342     files = set(ctx.files())
   341     files = set(ctx.files())
   343     if nullid not in parents:
   342     if ctx.repo().nullid not in parents:
   344         mc = ctx.manifest()
   343         mc = ctx.manifest()
   345         for pctx in ctx.parents():
   344         for pctx in ctx.parents():
   346             for fn in pctx.manifest().diff(mc):
   345             for fn in pctx.manifest().diff(mc):
   347                 files.add(fn)
   346                 files.add(fn)
   348     return files
   347     return files
   352 def _convertparents(ctx, revmap):
   351 def _convertparents(ctx, revmap):
   353     parents = []
   352     parents = []
   354     for p in ctx.parents():
   353     for p in ctx.parents():
   355         parents.append(revmap[p.node()])
   354         parents.append(revmap[p.node()])
   356     while len(parents) < 2:
   355     while len(parents) < 2:
   357         parents.append(nullid)
   356         parents.append(ctx.repo().nullid)
   358     return parents
   357     return parents
   359 
   358 
   360 
   359 
   361 # Get memfilectx for a normal file
   360 # Get memfilectx for a normal file
   362 def _getnormalcontext(repo, ctx, f, revmap):
   361 def _getnormalcontext(repo, ctx, f, revmap):