The fix is to pass in a "subuipathfn" as we do everywhere else.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
The fix is to pass in a "subuipathfn" as we do everywhere else.
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/cmdutil.py (7 lines) | |||
| M | mercurial/commands.py (4 lines) | |||
| M | mercurial/subrepo.py (6 lines) | |||
| M | tests/test-subrepo.t (2 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Feb 17 2019, 12:12 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz |
| label='ui.addremove.removed') | label='ui.addremove.removed') | ||||
| if not dryrun: | if not dryrun: | ||||
| rejected = wctx.forget(forget, prefix) | rejected = wctx.forget(forget, prefix) | ||||
| bad.extend(f for f in rejected if f in match.files()) | bad.extend(f for f in rejected if f in match.files()) | ||||
| forgot.extend(f for f in forget if f not in rejected) | forgot.extend(f for f in forget if f not in rejected) | ||||
| return bad, forgot | return bad, forgot | ||||
| def files(ui, ctx, m, fm, fmt, subrepos): | def files(ui, ctx, m, uipathfn, fm, fmt, subrepos): | ||||
| ret = 1 | ret = 1 | ||||
| needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint() | needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint() | ||||
| uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True) | |||||
| for f in ctx.matches(m): | for f in ctx.matches(m): | ||||
| fm.startitem() | fm.startitem() | ||||
| fm.context(ctx=ctx) | fm.context(ctx=ctx) | ||||
| if needsfctx: | if needsfctx: | ||||
| fc = ctx[f] | fc = ctx[f] | ||||
| fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) | fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) | ||||
| fm.data(path=f) | fm.data(path=f) | ||||
| fm.plain(fmt % uipathfn(f)) | fm.plain(fmt % uipathfn(f)) | ||||
| ret = 0 | ret = 0 | ||||
| for subpath in sorted(ctx.substate): | for subpath in sorted(ctx.substate): | ||||
| submatch = matchmod.subdirmatcher(subpath, m) | submatch = matchmod.subdirmatcher(subpath, m) | ||||
| subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) | |||||
| if (subrepos or m.exact(subpath) or any(submatch.files())): | if (subrepos or m.exact(subpath) or any(submatch.files())): | ||||
| sub = ctx.sub(subpath) | sub = ctx.sub(subpath) | ||||
| try: | try: | ||||
| recurse = m.exact(subpath) or subrepos | recurse = m.exact(subpath) or subrepos | ||||
| if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0: | if sub.printfiles(ui, submatch, subuipathfn, fm, fmt, | ||||
| recurse) == 0: | |||||
| ret = 0 | ret = 0 | ||||
| except error.LookupError: | except error.LookupError: | ||||
| ui.status(_("skipping missing subrepository: %s\n") | ui.status(_("skipping missing subrepository: %s\n") | ||||
| % uipathfn(subpath)) | % uipathfn(subpath)) | ||||
| return ret | return ret | ||||
| def remove(ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, | def remove(ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, | ||||
| end = '\n' | end = '\n' | ||||
| if opts.get('print0'): | if opts.get('print0'): | ||||
| end = '\0' | end = '\0' | ||||
| fmt = '%s' + end | fmt = '%s' + end | ||||
| m = scmutil.match(ctx, pats, opts) | m = scmutil.match(ctx, pats, opts) | ||||
| ui.pager('files') | ui.pager('files') | ||||
| uipathfn = scmutil.getuipathfn(ctx.repo(), legacyrelativevalue=True) | |||||
| with ui.formatter('files', opts) as fm: | with ui.formatter('files', opts) as fm: | ||||
| return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos')) | return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, | ||||
| opts.get('subrepos')) | |||||
| @command( | @command( | ||||
| 'forget', | 'forget', | ||||
| [('i', 'interactive', None, _('use interactive mode')), | [('i', 'interactive', None, _('use interactive mode')), | ||||
| ] + walkopts + dryrunopts, | ] + walkopts + dryrunopts, | ||||
| _('[OPTION]... FILE...'), | _('[OPTION]... FILE...'), | ||||
| helpcategory=command.CATEGORY_WORKING_DIRECTORY, | helpcategory=command.CATEGORY_WORKING_DIRECTORY, | ||||
| helpbasic=True, inferrepo=True) | helpbasic=True, inferrepo=True) | ||||
| def fileflags(self, name): | def fileflags(self, name): | ||||
| """return file flags""" | """return file flags""" | ||||
| return '' | return '' | ||||
| def matchfileset(self, expr, badfn=None): | def matchfileset(self, expr, badfn=None): | ||||
| """Resolve the fileset expression for this repo""" | """Resolve the fileset expression for this repo""" | ||||
| return matchmod.never(badfn=badfn) | return matchmod.never(badfn=badfn) | ||||
| def printfiles(self, ui, m, fm, fmt, subrepos): | def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): | ||||
| """handle the files command for this subrepo""" | """handle the files command for this subrepo""" | ||||
| return 1 | return 1 | ||||
| def archive(self, archiver, prefix, match=None, decode=True): | def archive(self, archiver, prefix, match=None, decode=True): | ||||
| if match is not None: | if match is not None: | ||||
| files = [f for f in self.files() if match(f)] | files = [f for f in self.files() if match(f)] | ||||
| else: | else: | ||||
| files = self.files() | files = self.files() | ||||
| return data | return data | ||||
| def fileflags(self, name): | def fileflags(self, name): | ||||
| rev = self._state[1] | rev = self._state[1] | ||||
| ctx = self._repo[rev] | ctx = self._repo[rev] | ||||
| return ctx.flags(name) | return ctx.flags(name) | ||||
| @annotatesubrepoerror | @annotatesubrepoerror | ||||
| def printfiles(self, ui, m, fm, fmt, subrepos): | def printfiles(self, ui, m, uipathfn, fm, fmt, subrepos): | ||||
| # If the parent context is a workingctx, use the workingctx here for | # If the parent context is a workingctx, use the workingctx here for | ||||
| # consistency. | # consistency. | ||||
| if self._ctx.rev() is None: | if self._ctx.rev() is None: | ||||
| ctx = self._repo[None] | ctx = self._repo[None] | ||||
| else: | else: | ||||
| rev = self._state[1] | rev = self._state[1] | ||||
| ctx = self._repo[rev] | ctx = self._repo[rev] | ||||
| return cmdutil.files(ui, ctx, m, fm, fmt, subrepos) | return cmdutil.files(ui, ctx, m, uipathfn, fm, fmt, subrepos) | ||||
| @annotatesubrepoerror | @annotatesubrepoerror | ||||
| def matchfileset(self, expr, badfn=None): | def matchfileset(self, expr, badfn=None): | ||||
| if self._ctx.rev() is None: | if self._ctx.rev() is None: | ||||
| ctx = self._repo[None] | ctx = self._repo[None] | ||||
| else: | else: | ||||
| rev = self._state[1] | rev = self._state[1] | ||||
| ctx = self._repo[rev] | ctx = self._repo[rev] | ||||
| a | a | ||||
| s/a | s/a | ||||
| `hg files` respects ui.relative-paths | `hg files` respects ui.relative-paths | ||||
| BROKEN: shows subrepo paths relative to the subrepo | BROKEN: shows subrepo paths relative to the subrepo | ||||
| $ hg files -S --config ui.relative-paths=no | $ hg files -S --config ui.relative-paths=no | ||||
| .hgsub | .hgsub | ||||
| a | a | ||||
| a | s/a | ||||
| $ hg -R s ci -Ams0 | $ hg -R s ci -Ams0 | ||||
| $ hg sum | $ hg sum | ||||
| parent: 0:f7b1eb17ad24 tip | parent: 0:f7b1eb17ad24 tip | ||||
| 0 | 0 | ||||
| branch: default | branch: default | ||||
| commit: 1 added, 1 subrepos | commit: 1 added, 1 subrepos | ||||
| update: (current) | update: (current) | ||||