legacy: move 'debugrecordpruneparents' in the extensions
The transition is a couple of year old now, repository with the old format must
be quite hard to find by now.
--- a/README Thu Mar 16 21:16:57 2017 -0400
+++ b/README Wed Mar 22 03:00:11 2017 +0100
@@ -125,6 +125,9 @@
Using the extension will enable evolution, use 'experimental.evolution=!'
to disable obsmarkers echange. The old '__temporary__.advertiseobsolete'
option is no longer supported.
+- the 'debugrecordpruneparents' have been moved into the 'evolve.legacy'
+ separate extension. enable that extentions if you need to convert/update
+ markers in an old repository.
5.6.1 -- 2017-02-28
-------------------
--- a/hgext3rd/evolve/__init__.py Thu Mar 16 21:16:57 2017 -0400
+++ b/hgext3rd/evolve/__init__.py Wed Mar 22 03:00:11 2017 +0100
@@ -814,43 +814,6 @@
_deprecatealias('gup', 'next')
_deprecatealias('gdown', 'previous')
-@eh.command('debugrecordpruneparents', [], '')
-def cmddebugrecordpruneparents(ui, repo):
- """add parent data to prune markers when possible
-
- This command searches the repo for prune markers without parent information.
- If the pruned node is locally known, it creates a new marker with parent
- data.
- """
- pgop = 'reading markers'
-
- # lock from the beginning to prevent race
- wlock = lock = tr = None
- try:
- wlock = repo.wlock()
- lock = repo.lock()
- tr = repo.transaction('recordpruneparents')
- unfi = repo.unfiltered()
- nm = unfi.changelog.nodemap
- store = repo.obsstore
- pgtotal = len(store._all)
- for idx, mark in enumerate(list(store._all)):
- if not mark[1]:
- rev = nm.get(mark[0])
- if rev is not None:
- ctx = unfi[rev]
- parents = tuple(p.node() for p in ctx.parents())
- before = len(store._all)
- store.create(tr, mark[0], mark[1], mark[2], mark[3],
- parents=parents)
- if len(store._all) - before:
- ui.write(_('created new markers for %i\n') % rev)
- ui.progress(pgop, idx, total=pgtotal)
- tr.close()
- ui.progress(pgop, None)
- finally:
- lockmod.release(tr, lock, wlock)
-
@eh.command('debugobsstorestat', [], '')
def cmddebugobsstorestat(ui, repo):
"""print statistics about obsolescence markers in the repo"""
--- a/hgext3rd/evolve/legacy.py Thu Mar 16 21:16:57 2017 -0400
+++ b/hgext3rd/evolve/legacy.py Wed Mar 22 03:00:11 2017 +0100
@@ -26,6 +26,7 @@
from mercurial import cmdutil
from mercurial.i18n import _
+from mercurial import lock as lockmod
from mercurial.node import bin, nullid
from mercurial import util
@@ -163,3 +164,40 @@
ui.status('%i obsolete marker converted\n' % cnt)
if err:
ui.write_err('%i conversion failed. check you graph!\n' % err)
+
+@command('debugrecordpruneparents', [], '')
+def cmddebugrecordpruneparents(ui, repo):
+ """add parent data to prune markers when possible
+
+ This command searches the repo for prune markers without parent information.
+ If the pruned node is locally known, it creates a new marker with parent
+ data.
+ """
+ pgop = 'reading markers'
+
+ # lock from the beginning to prevent race
+ wlock = lock = tr = None
+ try:
+ wlock = repo.wlock()
+ lock = repo.lock()
+ tr = repo.transaction('recordpruneparents')
+ unfi = repo.unfiltered()
+ nm = unfi.changelog.nodemap
+ store = repo.obsstore
+ pgtotal = len(store._all)
+ for idx, mark in enumerate(list(store._all)):
+ if not mark[1]:
+ rev = nm.get(mark[0])
+ if rev is not None:
+ ctx = unfi[rev]
+ parents = tuple(p.node() for p in ctx.parents())
+ before = len(store._all)
+ store.create(tr, mark[0], mark[1], mark[2], mark[3],
+ parents=parents)
+ if len(store._all) - before:
+ ui.write(_('created new markers for %i\n') % rev)
+ ui.progress(pgop, idx, total=pgtotal)
+ tr.close()
+ ui.progress(pgop, None)
+ finally:
+ lockmod.release(tr, lock, wlock)