hgext/largefiles/lfutil.py
changeset 31616 10561eb97c7f
parent 31615 f0f316cb8259
child 31617 1f6c932862e5
equal deleted inserted replaced
31615:f0f316cb8259 31616:10561eb97c7f
   243                      % (filename, path, gothash))
   243                      % (filename, path, gothash))
   244         wvfs.unlink(filename)
   244         wvfs.unlink(filename)
   245         return False
   245         return False
   246     return True
   246     return True
   247 
   247 
   248 def copytostore(repo, rev, file, uploaded=False):
   248 def copytostore(repo, revorctx, file, uploaded=False):
   249     wvfs = repo.wvfs
   249     wvfs = repo.wvfs
   250     hash = readstandin(repo, file, rev)
   250     hash = readstandin(repo, file, revorctx)
   251     if instore(repo, hash):
   251     if instore(repo, hash):
   252         return
   252         return
   253     if wvfs.exists(file):
   253     if wvfs.exists(file):
   254         copytostoreabsolute(repo, wvfs.join(file), hash)
   254         copytostoreabsolute(repo, wvfs.join(file), hash)
   255     else:
   255     else:
   261 
   261 
   262     ctx = repo[node]
   262     ctx = repo[node]
   263     for filename in ctx.files():
   263     for filename in ctx.files():
   264         realfile = splitstandin(filename)
   264         realfile = splitstandin(filename)
   265         if realfile is not None and filename in ctx.manifest():
   265         if realfile is not None and filename in ctx.manifest():
   266             copytostore(repo, ctx.node(), realfile)
   266             copytostore(repo, ctx, realfile)
   267 
   267 
   268 def copytostoreabsolute(repo, file, hash):
   268 def copytostoreabsolute(repo, file, hash):
   269     if inusercache(repo.ui, hash):
   269     if inusercache(repo.ui, hash):
   270         link(usercachepath(repo.ui, hash), storepath(repo, hash))
   270         link(usercachepath(repo.ui, hash), storepath(repo, hash))
   271     else:
   271     else:
   483         if lfile is not None:
   483         if lfile is not None:
   484             synclfdirstate(repo, lfdirstate, lfile, False)
   484             synclfdirstate(repo, lfdirstate, lfile, False)
   485     lfdirstate.write()
   485     lfdirstate.write()
   486 
   486 
   487     # As part of committing, copy all of the largefiles into the cache.
   487     # As part of committing, copy all of the largefiles into the cache.
       
   488     #
       
   489     # Using "node" instead of "ctx" implies additional "repo[node]"
       
   490     # lookup while copyalltostore(), but can omit redundant check for
       
   491     # files comming from the 2nd parent, which should exist in store
       
   492     # at merging.
   488     copyalltostore(repo, node)
   493     copyalltostore(repo, node)
   489 
   494 
   490 def getlfilestoupdate(oldstandins, newstandins):
   495 def getlfilestoupdate(oldstandins, newstandins):
   491     changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
   496     changedstandins = set(oldstandins).symmetric_difference(set(newstandins))
   492     filelist = []
   497     filelist = []