Mercurial > public > mercurial-scm > hg
diff mercurial/debugcommands.py @ 30946:7103122495e2
debugcommands: move 'debugpushkey' in the new module
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 01 Feb 2017 17:48:30 +0100 |
parents | c8081ea63591 |
children | 3c766ca89377 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Sun Feb 12 03:06:38 2017 -0800 +++ b/mercurial/debugcommands.py Wed Feb 01 17:48:30 2017 +0100 @@ -1414,6 +1414,27 @@ ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) ui.write('\n') +@command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) +def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): + '''access the pushkey key/value protocol + + With two args, list the keys in the given namespace. + + With five args, set a key to new if it currently is set to old. + Reports success or failure. + ''' + + target = hg.peer(ui, {}, repopath) + if keyinfo: + key, old, new = keyinfo + r = target.pushkey(namespace, key, old, new) + ui.status(str(r) + '\n') + return not r + else: + for k, v in sorted(target.listkeys(namespace).iteritems()): + ui.write("%s\t%s\n" % (k.encode('string-escape'), + v.encode('string-escape'))) + @command('debugupgraderepo', [ ('o', 'optimize', [], _('extra optimization to perform'), _('NAME')), ('', 'run', False, _('performs an upgrade')),