##// END OF EJS Templates
forget: pass around uipathfn and use instead of m.rel() (API)...
Martin von Zweigbergk -
r41802:16a49c77 default
parent child Browse files
Show More
@@ -1078,11 +1078,11 b' def postcommitstatus(orig, repo, *args, '
1078 repo.lfstatus = False
1078 repo.lfstatus = False
1079
1079
1080 @eh.wrapfunction(cmdutil, 'forget')
1080 @eh.wrapfunction(cmdutil, 'forget')
1081 def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun,
1081 def cmdutilforget(orig, ui, repo, match, prefix, uipathfn, explicitonly, dryrun,
1082 interactive):
1082 interactive):
1083 normalmatcher = composenormalfilematcher(match, repo[None].manifest())
1083 normalmatcher = composenormalfilematcher(match, repo[None].manifest())
1084 bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun,
1084 bad, forgot = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly,
1085 interactive)
1085 dryrun, interactive)
1086 m = composelargefilematcher(match, repo[None].manifest())
1086 m = composelargefilematcher(match, repo[None].manifest())
1087
1087
1088 try:
1088 try:
@@ -1098,12 +1098,12 b' def cmdutilforget(orig, ui, repo, match,'
1098 fstandin = lfutil.standin(f)
1098 fstandin = lfutil.standin(f)
1099 if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin):
1099 if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin):
1100 ui.warn(_('not removing %s: file is already untracked\n')
1100 ui.warn(_('not removing %s: file is already untracked\n')
1101 % m.rel(f))
1101 % uipathfn(f))
1102 bad.append(f)
1102 bad.append(f)
1103
1103
1104 for f in forget:
1104 for f in forget:
1105 if ui.verbose or not m.exact(f):
1105 if ui.verbose or not m.exact(f):
1106 ui.status(_('removing %s\n') % m.rel(f))
1106 ui.status(_('removing %s\n') % uipathfn(f))
1107
1107
1108 # Need to lock because standin files are deleted then removed from the
1108 # Need to lock because standin files are deleted then removed from the
1109 # repository and we could race in-between.
1109 # repository and we could race in-between.
@@ -2084,7 +2084,8 b' def addwebdirpath(repo, serverpath, webc'
2084 for subpath in ctx.substate:
2084 for subpath in ctx.substate:
2085 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2085 ctx.sub(subpath).addwebdirpath(serverpath, webconf)
2086
2086
2087 def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive):
2087 def forget(ui, repo, match, prefix, uipathfn, explicitonly, dryrun,
2088 interactive):
2088 if dryrun and interactive:
2089 if dryrun and interactive:
2089 raise error.Abort(_("cannot specify both --dry-run and --interactive"))
2090 raise error.Abort(_("cannot specify both --dry-run and --interactive"))
2090 bad = []
2091 bad = []
@@ -2101,14 +2102,16 b' def forget(ui, repo, match, prefix, expl'
2101 sub = wctx.sub(subpath)
2102 sub = wctx.sub(subpath)
2102 submatch = matchmod.subdirmatcher(subpath, match)
2103 submatch = matchmod.subdirmatcher(subpath, match)
2103 subprefix = repo.wvfs.reljoin(prefix, subpath)
2104 subprefix = repo.wvfs.reljoin(prefix, subpath)
2105 subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn)
2104 try:
2106 try:
2105 subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun,
2107 subbad, subforgot = sub.forget(submatch, subprefix, subuipathfn,
2108 dryrun=dryrun,
2106 interactive=interactive)
2109 interactive=interactive)
2107 bad.extend([subpath + '/' + f for f in subbad])
2110 bad.extend([subpath + '/' + f for f in subbad])
2108 forgot.extend([subpath + '/' + f for f in subforgot])
2111 forgot.extend([subpath + '/' + f for f in subforgot])
2109 except error.LookupError:
2112 except error.LookupError:
2110 ui.status(_("skipping missing subrepository: %s\n")
2113 ui.status(_("skipping missing subrepository: %s\n")
2111 % match.rel(subpath))
2114 % uipathfn(subpath))
2112
2115
2113 if not explicitonly:
2116 if not explicitonly:
2114 for f in match.files():
2117 for f in match.files():
@@ -2123,7 +2126,7 b' def forget(ui, repo, match, prefix, expl'
2123 continue
2126 continue
2124 ui.warn(_('not removing %s: '
2127 ui.warn(_('not removing %s: '
2125 'file is already untracked\n')
2128 'file is already untracked\n')
2126 % match.rel(f))
2129 % uipathfn(f))
2127 bad.append(f)
2130 bad.append(f)
2128
2131
2129 if interactive:
2132 if interactive:
@@ -2154,7 +2157,7 b' def forget(ui, repo, match, prefix, expl'
2154
2157
2155 for f in forget:
2158 for f in forget:
2156 if ui.verbose or not match.exact(f) or interactive:
2159 if ui.verbose or not match.exact(f) or interactive:
2157 ui.status(_('removing %s\n') % match.rel(f),
2160 ui.status(_('removing %s\n') % uipathfn(f),
2158 label='ui.addremove.removed')
2161 label='ui.addremove.removed')
2159
2162
2160 if not dryrun:
2163 if not dryrun:
@@ -2258,7 +2258,8 b' def forget(ui, repo, *pats, **opts):'
2258
2258
2259 m = scmutil.match(repo[None], pats, opts)
2259 m = scmutil.match(repo[None], pats, opts)
2260 dryrun, interactive = opts.get('dry_run'), opts.get('interactive')
2260 dryrun, interactive = opts.get('dry_run'), opts.get('interactive')
2261 rejected = cmdutil.forget(ui, repo, m, prefix="",
2261 uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True)
2262 rejected = cmdutil.forget(ui, repo, m, prefix="", uipathfn=uipathfn,
2262 explicitonly=False, dryrun=dryrun,
2263 explicitonly=False, dryrun=dryrun,
2263 interactive=interactive)[0]
2264 interactive=interactive)[0]
2264 return rejected and 1 or 0
2265 return rejected and 1 or 0
@@ -355,7 +355,7 b' class abstractsubrepo(object):'
355 matched by the match function
355 matched by the match function
356 '''
356 '''
357
357
358 def forget(self, match, prefix, dryrun, interactive):
358 def forget(self, match, prefix, uipathfn, dryrun, interactive):
359 return ([], [])
359 return ([], [])
360
360
361 def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos,
361 def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos,
@@ -836,8 +836,8 b' class hgsubrepo(abstractsubrepo):'
836 return ctx.walk(match)
836 return ctx.walk(match)
837
837
838 @annotatesubrepoerror
838 @annotatesubrepoerror
839 def forget(self, match, prefix, dryrun, interactive):
839 def forget(self, match, prefix, uipathfn, dryrun, interactive):
840 return cmdutil.forget(self.ui, self._repo, match, prefix,
840 return cmdutil.forget(self.ui, self._repo, match, prefix, uipathfn,
841 True, dryrun=dryrun, interactive=interactive)
841 True, dryrun=dryrun, interactive=interactive)
842
842
843 @annotatesubrepoerror
843 @annotatesubrepoerror
General Comments 0
You need to be logged in to leave comments. Login now