comparison mercurial/debugcommands.py @ 41529:7dc160a57025

debugcommands: add a debugpathcopies command I've been working on storing copy metadata in the changelog instead of the filelog and this has been useful for debugging. Do we usually add tests for these? Differential Revision: https://phab.mercurial-scm.org/D5791
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 25 Jan 2019 14:41:53 -0800
parents 876494fd967d
children be8741d42836
comparison
equal deleted inserted replaced
41528:888e8b36b8d9 41529:7dc160a57025
36 bundle2, 36 bundle2,
37 changegroup, 37 changegroup,
38 cmdutil, 38 cmdutil,
39 color, 39 color,
40 context, 40 context,
41 copies,
41 dagparser, 42 dagparser,
42 encoding, 43 encoding,
43 error, 44 error,
44 exchange, 45 exchange,
45 extensions, 46 extensions,
1801 files.update(f) 1802 files.update(f)
1802 dirs.update(d) 1803 dirs.update(d)
1803 files.update(dirs) 1804 files.update(dirs)
1804 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) 1805 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files)))
1805 ui.write('\n') 1806 ui.write('\n')
1807
1808 @command('debugpathcopies',
1809 cmdutil.walkopts,
1810 'hg debugcopies REV1 REV2 [FILE]',
1811 inferrepo=True)
1812 def debugpathcopies(ui, repo, rev1, rev2, *pats, **opts):
1813 """show copies between two revisions"""
1814 ctx1 = scmutil.revsingle(repo, rev1)
1815 ctx2 = scmutil.revsingle(repo, rev2)
1816 m = scmutil.match(ctx1, pats, opts)
1817 for dst, src in copies.pathcopies(ctx1, ctx2, m).items():
1818 ui.write('%s -> %s\n' % (src, dst))
1806 1819
1807 @command('debugpeer', [], _('PATH'), norepo=True) 1820 @command('debugpeer', [], _('PATH'), norepo=True)
1808 def debugpeer(ui, path): 1821 def debugpeer(ui, path):
1809 """establish a connection to a peer repository""" 1822 """establish a connection to a peer repository"""
1810 # Always enable peer request logging. Requires --debug to display 1823 # Always enable peer request logging. Requires --debug to display