# HG changeset patch # User Pierre-Yves David # Date 1393297272 28800 # Node ID acfa2b67cff64fdef593a1e5574f7ea99001b1a1 # Parent de20d550057122328ff17958e315c7eeded04d96 evolve: add a cmddebugrecordpruneparents command This command can be used to create prune marker with parent information from prune marker on changeset known locally. diff -r de20d5500571 -r acfa2b67cff6 hgext/evolve.py --- a/hgext/evolve.py Mon Feb 24 17:44:12 2014 -0800 +++ b/hgext/evolve.py Mon Feb 24 19:01:12 2014 -0800 @@ -860,6 +860,44 @@ _('record the specified user in metadata'), _('USER')), ] +@command('debugrecordpruneparents', [], '') +def cmddebugrecordpruneparents(ui, repo): + """add parents data to prune markers when possible + + This commands search the repo for prune markers without parent information. + If the pruned node is locally known, a new markers with parent data is + created.""" + 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] + meta = obsolete.decodemeta(mark[3]) + for i, p in enumerate(ctx.parents(), 1): + meta['p%i' % i] = p.hex() + before = len(store._all) + store.create(tr, mark[0], mark[1], mark[2], meta) + 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: + if tr is not None: + tr.release() + lockmod.release(lock, wlock) @command('debugobsstorestat', [], '') def cmddebugobsstorestat(ui, repo):