comparison mercurial/commands.py @ 17071:11f26e2669aa

command: creation of obsolete marker * add metadata encoding/decoding ability * add a method to obsstore to help creating marker * add a debug command to create marker
author Pierre-Yves.David@ens-lyon.org
date Thu, 07 Jun 2012 19:15:23 +0200
parents fba17a64fa49
children 178a2e85d426
comparison
equal deleted inserted replaced
17070:ad0d6c2b3279 17071:11f26e2669aa
2046 repo = hg.peer(ui, opts, repopath) 2046 repo = hg.peer(ui, opts, repopath)
2047 if not repo.capable('known'): 2047 if not repo.capable('known'):
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
2052 @command('debugobsolete', [] + commitopts2,
2053 _('OBSOLETED [REPLACEMENT] [REPL...'))
2054 def debugobsolete(ui, repo, precursor, *successors, **opts):
2055 """create arbitrary obsolete marker"""
2056 metadata = {}
2057 if 'date' in opts:
2058 metadata['date'] = opts['date']
2059 metadata['user'] = opts['user'] or ui.username()
2060 succs = tuple(bin(succ) for succ in successors)
2061 l = repo.lock()
2062 try:
2063 repo.obsstore.create(bin(precursor), succs, 0, metadata)
2064 finally:
2065 l.release()
2051 2066
2052 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) 2067 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
2053 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): 2068 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
2054 '''access the pushkey key/value protocol 2069 '''access the pushkey key/value protocol
2055 2070