Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 30973:5b09e9bc0902
debugcommands: move 'debugsetparents' in the new module
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 02 Feb 2017 10:04:02 +0100 |
parents | 85c3c879c43a |
children | dad968920130 |
comparison
equal
deleted
inserted
replaced
30972:85c3c879c43a | 30973:5b09e9bc0902 |
---|---|
1833 if ui.verbose: | 1833 if ui.verbose: |
1834 ui.note(("* set:\n"), smartset.prettyformat(revs), "\n") | 1834 ui.note(("* set:\n"), smartset.prettyformat(revs), "\n") |
1835 for c in revs: | 1835 for c in revs: |
1836 ui.write("%s\n" % c) | 1836 ui.write("%s\n" % c) |
1837 | 1837 |
1838 @command('debugsetparents', [], _('REV1 [REV2]')) | |
1839 def debugsetparents(ui, repo, rev1, rev2=None): | |
1840 """manually set the parents of the current working directory | |
1841 | |
1842 This is useful for writing repository conversion tools, but should | |
1843 be used with care. For example, neither the working directory nor the | |
1844 dirstate is updated, so file status may be incorrect after running this | |
1845 command. | |
1846 | |
1847 Returns 0 on success. | |
1848 """ | |
1849 | |
1850 r1 = scmutil.revsingle(repo, rev1).node() | |
1851 r2 = scmutil.revsingle(repo, rev2, 'null').node() | |
1852 | |
1853 with repo.wlock(): | |
1854 repo.setparents(r1, r2) | |
1855 | |
1838 @command('debugupgraderepo', [ | 1856 @command('debugupgraderepo', [ |
1839 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), | 1857 ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), |
1840 ('', 'run', False, _('performs an upgrade')), | 1858 ('', 'run', False, _('performs an upgrade')), |
1841 ]) | 1859 ]) |
1842 def debugupgraderepo(ui, repo, run=False, optimize=None): | 1860 def debugupgraderepo(ui, repo, run=False, optimize=None): |