Commits

Denis Laxalde committed f752089

add a duplicate option in touch

  • Participants
  • Parent commits ebcfd72
  • Branches stable

Comments (0)

Files changed (3)

 - prune: various minor improvements
 - amend: drop deprecated --change option for amend
 - alias: add a grab aliast to be used instead of graft -O
+- touch: add a --duplicate option to *not* obsolete the old version
 
 3.0.0 -- 2013-02-02
 
             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):
 
     This is used to "resurrect" changesets
     """
+    duplicate = opts['duplicate']
     revs = list(revs)
     revs.extend(opts['rev'])
     if not revs:
     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:
                 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)

tests/test-touch.t

   
   $ hg prune 3
   1 changesets pruned
+
+Duplicate
+
+  $ hg touch --duplicate .
+  $ hg log -G
+  @  5:[0-9a-f]{12} a (re)
+  
+  o  4:[0-9a-f]{12} a (re)
+