Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 17074:178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
author | Pierre-Yves.David@ens-lyon.org |
---|---|
date | Thu, 07 Jun 2012 19:20:44 +0200 |
parents | 11f26e2669aa |
children | 8e030168b09e |
line wrap: on
line diff
--- a/mercurial/commands.py Mon Jun 04 00:50:19 2012 +0200 +++ b/mercurial/commands.py Thu Jun 07 19:20:44 2012 +0200 @@ -17,7 +17,7 @@ import minirst, revset, fileset import dagparser, context, simplemerge import random, setdiscovery, treediscovery, dagutil, pvec -import phases +import phases, obsolete table = {} @@ -2050,19 +2050,29 @@ ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) @command('debugobsolete', [] + commitopts2, - _('OBSOLETED [REPLACEMENT] [REPL...')) -def debugobsolete(ui, repo, precursor, *successors, **opts): + _('[OBSOLETED [REPLACEMENT] [REPL... ]')) +def debugobsolete(ui, repo, precursor=None, *successors, **opts): """create arbitrary obsolete marker""" - metadata = {} - if 'date' in opts: - metadata['date'] = opts['date'] - metadata['user'] = opts['user'] or ui.username() - succs = tuple(bin(succ) for succ in successors) - l = repo.lock() - try: - repo.obsstore.create(bin(precursor), succs, 0, metadata) - finally: - l.release() + if precursor is not None: + metadata = {} + if 'date' in opts: + metadata['date'] = opts['date'] + metadata['user'] = opts['user'] or ui.username() + succs = tuple(bin(succ) for succ in successors) + l = repo.lock() + try: + repo.obsstore.create(bin(precursor), succs, 0, metadata) + finally: + l.release() + else: + for mctx in obsolete.allmarkers(repo): + ui.write(hex(mctx.precnode())) + for repl in mctx.succnodes(): + ui.write(' ') + ui.write(hex(repl)) + ui.write(' %X ' % mctx._data[2]) + ui.write(mctx.metadata()) + ui.write('\n') @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):