hgext/largefiles/overrides.py
changeset 16578 43fb170a23bd
parent 16516 597ddcb41b32
child 16642 5cf18921bb7b
equal deleted inserted replaced
16576:eab32ab5cd65 16578:43fb170a23bd
   779             sub = ctx.sub(subpath)
   779             sub = ctx.sub(subpath)
   780             sub.archive(repo.ui, archiver, prefix)
   780             sub.archive(repo.ui, archiver, prefix)
   781 
   781 
   782     archiver.done()
   782     archiver.done()
   783 
   783 
       
   784 def hgsubrepoarchive(orig, repo, ui, archiver, prefix):
       
   785     rev = repo._state[1]
       
   786     ctx = repo._repo[rev]
       
   787 
       
   788     lfcommands.cachelfiles(ui, repo._repo, ctx.node())
       
   789 
       
   790     def write(name, mode, islink, getdata):
       
   791         if lfutil.isstandin(name):
       
   792             return
       
   793         data = getdata()
       
   794 
       
   795         archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
       
   796 
       
   797     for f in ctx:
       
   798         ff = ctx.flags(f)
       
   799         getdata = ctx[f].data
       
   800         if lfutil.isstandin(f):
       
   801             path = lfutil.findfile(repo._repo, getdata().strip())
       
   802             if path is None:
       
   803                 raise util.Abort(
       
   804                     _('largefile %s not found in repo store or system cache')
       
   805                     % lfutil.splitstandin(f))
       
   806             f = lfutil.splitstandin(f)
       
   807 
       
   808             def getdatafn():
       
   809                 fd = None
       
   810                 try:
       
   811                     fd = open(os.path.join(prefix, path), 'rb')
       
   812                     return fd.read()
       
   813                 finally:
       
   814                     if fd:
       
   815                         fd.close()
       
   816 
       
   817             getdata = getdatafn
       
   818 
       
   819         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
       
   820 
       
   821     for subpath in ctx.substate:
       
   822         sub = ctx.sub(subpath)
       
   823         sub.archive(repo.ui, archiver, prefix)
       
   824 
   784 # If a largefile is modified, the change is not reflected in its
   825 # If a largefile is modified, the change is not reflected in its
   785 # standin until a commit. cmdutil.bailifchanged() raises an exception
   826 # standin until a commit. cmdutil.bailifchanged() raises an exception
   786 # if the repo has uncommitted changes. Wrap it to also check if
   827 # if the repo has uncommitted changes. Wrap it to also check if
   787 # largefiles were changed. This is used by bisect and backout.
   828 # largefiles were changed. This is used by bisect and backout.
   788 def overridebailifchanged(orig, repo):
   829 def overridebailifchanged(orig, repo):