comparison hgext/largefiles/overrides.py @ 41631:3d9d5e612e67

subrepo: adjust subrepo prefix before calling subrepo.archive() (API) Differential Revision: https://phab.mercurial-scm.org/D5887
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Feb 2019 10:20:57 -0800
parents 7b2580e0dbbd
children f8b18583049f
comparison
equal deleted inserted replaced
41630:3d094bfaf885 41631:3d9d5e612e67
996 996
997 if subrepos: 997 if subrepos:
998 for subpath in sorted(ctx.substate): 998 for subpath in sorted(ctx.substate):
999 sub = ctx.workingsub(subpath) 999 sub = ctx.workingsub(subpath)
1000 submatch = matchmod.subdirmatcher(subpath, match) 1000 submatch = matchmod.subdirmatcher(subpath, match)
1001 subprefix = prefix + subpath + '/'
1001 sub._repo.lfstatus = True 1002 sub._repo.lfstatus = True
1002 sub.archive(archiver, prefix, submatch) 1003 sub.archive(archiver, subprefix, submatch)
1003 1004
1004 archiver.done() 1005 archiver.done()
1005 1006
1006 @eh.wrapfunction(subrepo.hgsubrepo, 'archive') 1007 @eh.wrapfunction(subrepo.hgsubrepo, 'archive')
1007 def hgsubrepoarchive(orig, repo, archiver, prefix, match=None, decode=True): 1008 def hgsubrepoarchive(orig, repo, archiver, prefix, match=None, decode=True):
1023 return 1024 return
1024 data = getdata() 1025 data = getdata()
1025 if decode: 1026 if decode:
1026 data = repo._repo.wwritedata(name, data) 1027 data = repo._repo.wwritedata(name, data)
1027 1028
1028 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) 1029 archiver.addfile(prefix + name, mode, islink, data)
1029 1030
1030 for f in ctx: 1031 for f in ctx:
1031 ff = ctx.flags(f) 1032 ff = ctx.flags(f)
1032 getdata = ctx[f].data 1033 getdata = ctx[f].data
1033 lfile = lfutil.splitstandin(f) 1034 lfile = lfutil.splitstandin(f)
1049 write(f, 'x' in ff and 0o755 or 0o644, 'l' in ff, getdata) 1050 write(f, 'x' in ff and 0o755 or 0o644, 'l' in ff, getdata)
1050 1051
1051 for subpath in sorted(ctx.substate): 1052 for subpath in sorted(ctx.substate):
1052 sub = ctx.workingsub(subpath) 1053 sub = ctx.workingsub(subpath)
1053 submatch = matchmod.subdirmatcher(subpath, match) 1054 submatch = matchmod.subdirmatcher(subpath, match)
1055 subprefix = prefix + subpath + '/'
1054 sub._repo.lfstatus = True 1056 sub._repo.lfstatus = True
1055 sub.archive(archiver, prefix + repo._path + '/', submatch, decode) 1057 sub.archive(archiver, subprefix, submatch, decode)
1056 1058
1057 # If a largefile is modified, the change is not reflected in its 1059 # If a largefile is modified, the change is not reflected in its
1058 # standin until a commit. cmdutil.bailifchanged() raises an exception 1060 # standin until a commit. cmdutil.bailifchanged() raises an exception
1059 # if the repo has uncommitted changes. Wrap it to also check if 1061 # if the repo has uncommitted changes. Wrap it to also check if
1060 # largefiles were changed. This is used by bisect, backout and fetch. 1062 # largefiles were changed. This is used by bisect, backout and fetch.