diff hgext/evolve.py @ 701:f752089479ce stable

add a duplicate option in touch
author Denis Laxalde <denis.laxalde@logilab.fr>
date Fri, 08 Feb 2013 22:12:46 +0000
parents dba3ed9f2c4f
children b5a85a8909d3
line wrap: on
line diff
--- a/hgext/evolve.py	Fri Feb 08 22:09:42 2013 +0000
+++ b/hgext/evolve.py	Fri Feb 08 22:12:46 2013 +0000
@@ -1568,7 +1568,9 @@
             lock.release()
 
 @command('^touch',
-    [('r', 'rev', [], 'revision to update'),],
+    [('r', 'rev', [], 'revision to update'),
+     ('D', 'duplicate', False,
+      'do not mark the new revision as successor of the old one')],
     # allow to choose the seed ?
     _('[-r] revs'))
 def touch(ui, repo, *revs, **opts):
@@ -1576,6 +1578,7 @@
 
     This is used to "resurrect" changesets
     """
+    duplicate = opts['duplicate']
     revs = list(revs)
     revs.extend(opts['rev'])
     if not revs:
@@ -1584,7 +1587,7 @@
     if not revs:
         ui.write_err('no revision to touch\n')
         return 1
-    if repo.revs('public() and %ld', revs):
+    if not duplicate and repo.revs('public() and %ld', revs):
         raise util.Abort("can't touch public revision")
     wlock = lock = None
     try:
@@ -1599,7 +1602,8 @@
                 new, _ = rewrite(repo, ctx, [], ctx,
                                  [ctx.p1().node(), ctx.p2().node()],
                                  commitopts={'extra': extra})
-                createmarkers(repo, [(ctx, (repo[new],))])
+                if not duplicate:
+                    createmarkers(repo, [(ctx, (repo[new],))])
                 phases.retractboundary(repo, ctx.phase(), [new])
                 if ctx in repo[None].parents():
                     repo.dirstate.setparents(new, node.nullid)