Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
17073:3a79a5682af1 | 17074:178a2e85d426 |
---|---|
15 import sshserver, hgweb, hgweb.server, commandserver | 15 import sshserver, hgweb, hgweb.server, commandserver |
16 import merge as mergemod | 16 import merge as mergemod |
17 import minirst, revset, fileset | 17 import minirst, revset, fileset |
18 import dagparser, context, simplemerge | 18 import dagparser, context, simplemerge |
19 import random, setdiscovery, treediscovery, dagutil, pvec | 19 import random, setdiscovery, treediscovery, dagutil, pvec |
20 import phases | 20 import phases, obsolete |
21 | 21 |
22 table = {} | 22 table = {} |
23 | 23 |
24 command = cmdutil.command(table) | 24 command = cmdutil.command(table) |
25 | 25 |
2048 raise util.Abort("known() not supported by target repository") | 2048 raise util.Abort("known() not supported by target repository") |
2049 flags = repo.known([bin(s) for s in ids]) | 2049 flags = repo.known([bin(s) for s in ids]) |
2050 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) | 2050 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
2051 | 2051 |
2052 @command('debugobsolete', [] + commitopts2, | 2052 @command('debugobsolete', [] + commitopts2, |
2053 _('OBSOLETED [REPLACEMENT] [REPL...')) | 2053 _('[OBSOLETED [REPLACEMENT] [REPL... ]')) |
2054 def debugobsolete(ui, repo, precursor, *successors, **opts): | 2054 def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
2055 """create arbitrary obsolete marker""" | 2055 """create arbitrary obsolete marker""" |
2056 metadata = {} | 2056 if precursor is not None: |
2057 if 'date' in opts: | 2057 metadata = {} |
2058 metadata['date'] = opts['date'] | 2058 if 'date' in opts: |
2059 metadata['user'] = opts['user'] or ui.username() | 2059 metadata['date'] = opts['date'] |
2060 succs = tuple(bin(succ) for succ in successors) | 2060 metadata['user'] = opts['user'] or ui.username() |
2061 l = repo.lock() | 2061 succs = tuple(bin(succ) for succ in successors) |
2062 try: | 2062 l = repo.lock() |
2063 repo.obsstore.create(bin(precursor), succs, 0, metadata) | 2063 try: |
2064 finally: | 2064 repo.obsstore.create(bin(precursor), succs, 0, metadata) |
2065 l.release() | 2065 finally: |
2066 l.release() | |
2067 else: | |
2068 for mctx in obsolete.allmarkers(repo): | |
2069 ui.write(hex(mctx.precnode())) | |
2070 for repl in mctx.succnodes(): | |
2071 ui.write(' ') | |
2072 ui.write(hex(repl)) | |
2073 ui.write(' %X ' % mctx._data[2]) | |
2074 ui.write(mctx.metadata()) | |
2075 ui.write('\n') | |
2066 | 2076 |
2067 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) | 2077 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) |
2068 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): | 2078 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
2069 '''access the pushkey key/value protocol | 2079 '''access the pushkey key/value protocol |
2070 | 2080 |