forget: pass around uipathfn and use instead of m.rel() (API)
Differential Revision: https://phab.mercurial-scm.org/D5911
--- a/hgext/largefiles/overrides.py Thu Feb 07 23:25:39 2019 -0800
+++ b/hgext/largefiles/overrides.py Fri Feb 08 13:08:01 2019 -0800
@@ -1078,11 +1078,11 @@
repo.lfstatus = False
@eh.wrapfunction(cmdutil, 'forget')
-def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun,
+def cmdutilforget(orig, ui, repo, match, prefix, uipathfn, explicitonly, dryrun,
interactive):
normalmatcher = composenormalfilematcher(match, repo[None].manifest())
- bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun,
- interactive)
+ bad, forgot = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly,
+ dryrun, interactive)
m = composelargefilematcher(match, repo[None].manifest())
try:
@@ -1098,12 +1098,12 @@
fstandin = lfutil.standin(f)
if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin):
ui.warn(_('not removing %s: file is already untracked\n')
- % m.rel(f))
+ % uipathfn(f))
bad.append(f)
for f in forget:
if ui.verbose or not m.exact(f):
- ui.status(_('removing %s\n') % m.rel(f))
+ ui.status(_('removing %s\n') % uipathfn(f))
# Need to lock because standin files are deleted then removed from the
# repository and we could race in-between.
--- a/mercurial/cmdutil.py Thu Feb 07 23:25:39 2019 -0800
+++ b/mercurial/cmdutil.py Fri Feb 08 13:08:01 2019 -0800
@@ -2084,7 +2084,8 @@
for subpath in ctx.substate:
ctx.sub(subpath).addwebdirpath(serverpath, webconf)
-def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive):
+def forget(ui, repo, match, prefix, uipathfn, explicitonly, dryrun,
+ interactive):
if dryrun and interactive:
raise error.Abort(_("cannot specify both --dry-run and --interactive"))
bad = []
@@ -2101,14 +2102,16 @@
sub = wctx.sub(subpath)
submatch = matchmod.subdirmatcher(subpath, match)
subprefix = repo.wvfs.reljoin(prefix, subpath)
+ subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
try:
- subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun,
+ subbad, subforgot = sub.forget(submatch, subprefix, subuipathfn,
+ dryrun=dryrun,
interactive=interactive)
bad.extend([subpath + '/' + f for f in subbad])
forgot.extend([subpath + '/' + f for f in subforgot])
except error.LookupError:
ui.status(_("skipping missing subrepository: %s\n")
- % match.rel(subpath))
+ % uipathfn(subpath))
if not explicitonly:
for f in match.files():
@@ -2123,7 +2126,7 @@
continue
ui.warn(_('not removing %s: '
'file is already untracked\n')
- % match.rel(f))
+ % uipathfn(f))
bad.append(f)
if interactive:
@@ -2154,7 +2157,7 @@
for f in forget:
if ui.verbose or not match.exact(f) or interactive:
- ui.status(_('removing %s\n') % match.rel(f),
+ ui.status(_('removing %s\n') % uipathfn(f),
label='ui.addremove.removed')
if not dryrun:
--- a/mercurial/commands.py Thu Feb 07 23:25:39 2019 -0800
+++ b/mercurial/commands.py Fri Feb 08 13:08:01 2019 -0800
@@ -2258,7 +2258,8 @@
m = scmutil.match(repo[None], pats, opts)
dryrun, interactive = opts.get('dry_run'), opts.get('interactive')
- rejected = cmdutil.forget(ui, repo, m, prefix="",
+ uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True)
+ rejected = cmdutil.forget(ui, repo, m, prefix="", uipathfn=uipathfn,
explicitonly=False, dryrun=dryrun,
interactive=interactive)[0]
return rejected and 1 or 0
--- a/mercurial/subrepo.py Thu Feb 07 23:25:39 2019 -0800
+++ b/mercurial/subrepo.py Fri Feb 08 13:08:01 2019 -0800
@@ -355,7 +355,7 @@
matched by the match function
'''
- def forget(self, match, prefix, dryrun, interactive):
+ def forget(self, match, prefix, uipathfn, dryrun, interactive):
return ([], [])
def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos,
@@ -836,8 +836,8 @@
return ctx.walk(match)
@annotatesubrepoerror
- def forget(self, match, prefix, dryrun, interactive):
- return cmdutil.forget(self.ui, self._repo, match, prefix,
+ def forget(self, match, prefix, uipathfn, dryrun, interactive):
+ return cmdutil.forget(self.ui, self._repo, match, prefix, uipathfn,
True, dryrun=dryrun, interactive=interactive)
@annotatesubrepoerror