comparison mercurial/commands.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
comparison
equal deleted inserted replaced
30945:8b83b626fb1e 30946:7103122495e2
1858 Returns 0 on success, 1 if errors are encountered. 1858 Returns 0 on success, 1 if errors are encountered.
1859 """ 1859 """
1860 with repo.wlock(False): 1860 with repo.wlock(False):
1861 return cmdutil.copy(ui, repo, pats, opts) 1861 return cmdutil.copy(ui, repo, pats, opts)
1862 1862
1863 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True)
1864 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1865 '''access the pushkey key/value protocol
1866
1867 With two args, list the keys in the given namespace.
1868
1869 With five args, set a key to new if it currently is set to old.
1870 Reports success or failure.
1871 '''
1872
1873 target = hg.peer(ui, {}, repopath)
1874 if keyinfo:
1875 key, old, new = keyinfo
1876 r = target.pushkey(namespace, key, old, new)
1877 ui.status(str(r) + '\n')
1878 return not r
1879 else:
1880 for k, v in sorted(target.listkeys(namespace).iteritems()):
1881 ui.write("%s\t%s\n" % (k.encode('string-escape'),
1882 v.encode('string-escape')))
1883
1884 @command('debugpvec', [], _('A B')) 1863 @command('debugpvec', [], _('A B'))
1885 def debugpvec(ui, repo, a, b=None): 1864 def debugpvec(ui, repo, a, b=None):
1886 ca = scmutil.revsingle(repo, a) 1865 ca = scmutil.revsingle(repo, a)
1887 cb = scmutil.revsingle(repo, b) 1866 cb = scmutil.revsingle(repo, b)
1888 pa = pvec.ctxpvec(ca) 1867 pa = pvec.ctxpvec(ca)