Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 41670:ecf7f4ef52fb
debugwalk: avoid match.rel() and use repo.pathto() instead
I'm about to delete match.rel()
Differential Revision: https://phab.mercurial-scm.org/D5909
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 08 Feb 2019 13:27:54 -0800 |
parents | be8741d42836 |
children | 34ae00a14783 |
comparison
equal
deleted
inserted
replaced
41669:727f0be3539a | 41670:ecf7f4ef52fb |
---|---|
2018 ctx = scmutil.revsingle(repo, opts.get('rev')) | 2018 ctx = scmutil.revsingle(repo, opts.get('rev')) |
2019 m = scmutil.match(ctx, (file1,) + pats, opts) | 2019 m = scmutil.match(ctx, (file1,) + pats, opts) |
2020 for abs in ctx.walk(m): | 2020 for abs in ctx.walk(m): |
2021 fctx = ctx[abs] | 2021 fctx = ctx[abs] |
2022 o = fctx.filelog().renamed(fctx.filenode()) | 2022 o = fctx.filelog().renamed(fctx.filenode()) |
2023 rel = m.rel(abs) | 2023 rel = repo.pathto(abs) |
2024 if o: | 2024 if o: |
2025 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) | 2025 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
2026 else: | 2026 else: |
2027 ui.write(_("%s not renamed\n") % rel) | 2027 ui.write(_("%s not renamed\n") % rel) |
2028 | 2028 |
2794 f = lambda fn: fn | 2794 f = lambda fn: fn |
2795 if ui.configbool('ui', 'slash') and pycompat.ossep != '/': | 2795 if ui.configbool('ui', 'slash') and pycompat.ossep != '/': |
2796 f = lambda fn: util.normpath(fn) | 2796 f = lambda fn: util.normpath(fn) |
2797 fmt = 'f %%-%ds %%-%ds %%s' % ( | 2797 fmt = 'f %%-%ds %%-%ds %%s' % ( |
2798 max([len(abs) for abs in items]), | 2798 max([len(abs) for abs in items]), |
2799 max([len(m.rel(abs)) for abs in items])) | 2799 max([len(repo.pathto(abs)) for abs in items])) |
2800 for abs in items: | 2800 for abs in items: |
2801 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') | 2801 line = fmt % (abs, f(repo.pathto(abs)), m.exact(abs) and 'exact' or '') |
2802 ui.write("%s\n" % line.rstrip()) | 2802 ui.write("%s\n" % line.rstrip()) |
2803 | 2803 |
2804 @command('debugwhyunstable', [], _('REV')) | 2804 @command('debugwhyunstable', [], _('REV')) |
2805 def debugwhyunstable(ui, repo, rev): | 2805 def debugwhyunstable(ui, repo, rev): |
2806 """explain instabilities of a changeset""" | 2806 """explain instabilities of a changeset""" |