diff 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
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Jun 07 19:07:39 2012 +0200
+++ b/mercurial/commands.py	Thu Jun 07 19:15:23 2012 +0200
@@ -2049,6 +2049,21 @@
     flags = repo.known([bin(s) for s in ids])
     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):
+    """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()
+
 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
     '''access the pushkey key/value protocol