comparison mercurial/cmdutil.py @ 41748:980e05204ed8

subrepo: use root-repo-relative path from `hg files` with ui.relative-paths=no The fix is to pass in a "subuipathfn" as we do everywhere else. Differential Revision: https://phab.mercurial-scm.org/D5978
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Feb 2019 09:12:30 -0800
parents b81ecf3571d5
children aaad36b88298
comparison
equal deleted inserted replaced
41747:31b84c72ada0 41748:980e05204ed8
2169 rejected = wctx.forget(forget, prefix) 2169 rejected = wctx.forget(forget, prefix)
2170 bad.extend(f for f in rejected if f in match.files()) 2170 bad.extend(f for f in rejected if f in match.files())
2171 forgot.extend(f for f in forget if f not in rejected) 2171 forgot.extend(f for f in forget if f not in rejected)
2172 return bad, forgot 2172 return bad, forgot
2173 2173
2174 def files(ui, ctx, m, fm, fmt, subrepos): 2174 def files(ui, ctx, m, uipathfn, fm, fmt, subrepos):
2175 ret = 1 2175 ret = 1
2176 2176
2177 needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint() 2177 needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint()
2178 uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True)
2179 for f in ctx.matches(m): 2178 for f in ctx.matches(m):
2180 fm.startitem() 2179 fm.startitem()
2181 fm.context(ctx=ctx) 2180 fm.context(ctx=ctx)
2182 if needsfctx: 2181 if needsfctx:
2183 fc = ctx[f] 2182 fc = ctx[f]
2186 fm.plain(fmt % uipathfn(f)) 2185 fm.plain(fmt % uipathfn(f))
2187 ret = 0 2186 ret = 0
2188 2187
2189 for subpath in sorted(ctx.substate): 2188 for subpath in sorted(ctx.substate):
2190 submatch = matchmod.subdirmatcher(subpath, m) 2189 submatch = matchmod.subdirmatcher(subpath, m)
2190 subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
2191 if (subrepos or m.exact(subpath) or any(submatch.files())): 2191 if (subrepos or m.exact(subpath) or any(submatch.files())):
2192 sub = ctx.sub(subpath) 2192 sub = ctx.sub(subpath)
2193 try: 2193 try:
2194 recurse = m.exact(subpath) or subrepos 2194 recurse = m.exact(subpath) or subrepos
2195 if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0: 2195 if sub.printfiles(ui, submatch, subuipathfn, fm, fmt,
2196 recurse) == 0:
2196 ret = 0 2197 ret = 0
2197 except error.LookupError: 2198 except error.LookupError:
2198 ui.status(_("skipping missing subrepository: %s\n") 2199 ui.status(_("skipping missing subrepository: %s\n")
2199 % uipathfn(subpath)) 2200 % uipathfn(subpath))
2200 2201