Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 41764:a4358f7345b4
context: introduce p[12]copies() methods and debugp[12]copies commands
As mentioned earlier, I'm working on support for storing copy metadata
in the changeset instead of in the filelog.
In order to transition a repo from storing metadata in filelogs to
storing it in the changeset, I'm going to provide a config option for
reading the metadata from the changeset, but falling back to getting
it from the filelog if it's not in the changeset. In this compatiblity
mode, the changeset-optmized algorithms will be used. We will then
need to convert the filelog copy metadata to look like that provided
by changeset copy metadata. This patch introduces methods that do just
that.
By having these methods here, we can start writing changeset-optimized
algorithms that should work already before we add any support for
storing the metadata in the changesets.
This commit also includes new debugp[12]copies commands and exercises
them in test-copies.t.
Differential Revision: https://phab.mercurial-scm.org/D5990
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 18 Jan 2019 13:13:30 -0800 |
parents | f96988680afe |
children | aaad36b88298 |
comparison
equal
deleted
inserted
replaced
41763:d5edb5d3a337 | 41764:a4358f7345b4 |
---|---|
1739 fm.startitem() | 1739 fm.startitem() |
1740 ind = i if opts.get('index') else None | 1740 ind = i if opts.get('index') else None |
1741 cmdutil.showmarker(fm, m, index=ind) | 1741 cmdutil.showmarker(fm, m, index=ind) |
1742 fm.end() | 1742 fm.end() |
1743 | 1743 |
1744 @command('debugp1copies', | |
1745 [('r', 'rev', '', _('revision to debug'), _('REV'))], | |
1746 _('[-r REV]')) | |
1747 def debugp1copies(ui, repo, **opts): | |
1748 """dump copy information compared to p1""" | |
1749 | |
1750 opts = pycompat.byteskwargs(opts) | |
1751 ctx = scmutil.revsingle(repo, opts.get('rev'), default=None) | |
1752 for dst, src in ctx.p1copies().items(): | |
1753 ui.write('%s -> %s\n' % (src, dst)) | |
1754 | |
1755 @command('debugp2copies', | |
1756 [('r', 'rev', '', _('revision to debug'), _('REV'))], | |
1757 _('[-r REV]')) | |
1758 def debugp1copies(ui, repo, **opts): | |
1759 """dump copy information compared to p2""" | |
1760 | |
1761 opts = pycompat.byteskwargs(opts) | |
1762 ctx = scmutil.revsingle(repo, opts.get('rev'), default=None) | |
1763 for dst, src in ctx.p2copies().items(): | |
1764 ui.write('%s -> %s\n' % (src, dst)) | |
1765 | |
1744 @command('debugpathcomplete', | 1766 @command('debugpathcomplete', |
1745 [('f', 'full', None, _('complete an entire path')), | 1767 [('f', 'full', None, _('complete an entire path')), |
1746 ('n', 'normal', None, _('show only normal files')), | 1768 ('n', 'normal', None, _('show only normal files')), |
1747 ('a', 'added', None, _('show only added files')), | 1769 ('a', 'added', None, _('show only added files')), |
1748 ('r', 'removed', None, _('show only removed files'))], | 1770 ('r', 'removed', None, _('show only removed files'))], |