hgext3rd/evolve/rewind.py
changeset 3872 bbc3cfdfe42b
parent 3871 2e32a1ef0c60
child 3873 b81fd1487e04
--- a/hgext3rd/evolve/rewind.py	Sun Jun 17 03:10:19 2018 +0200
+++ b/hgext3rd/evolve/rewind.py	Sun Jun 17 03:46:46 2018 +0200
@@ -43,6 +43,9 @@
     obsolete the changeset you rewind from). Rewinding "to" will restore the
     changeset you have selected (and obsolete their latest successors).
 
+    By default, we rewind from the working copy parents, restoring its
+    precursor.
+
     When we rewind to an obsolete version, we also rewind to all its obsolete
     ancestors. To only rewind to the explicitly selection changesets use the
     `--exact` flag. Using the `--exact` flag can restore some changesets as
@@ -120,10 +123,14 @@
     """
     unfi = repo.unfiltered()
     rewinded = set()
-    if opts.get('to'):
-        rewinded.update(scmutil.revrange(repo, opts.get('to')))
-    if opts.get('from'):
-        succs = scmutil.revrange(repo, opts.get('from'))
+    revsto = opts.get('to')
+    revsfrom = opts.get('from')
+    if not (revsto or revsfrom):
+        revsfrom.append('.')
+    if revsto:
+        rewinded.update(scmutil.revrange(repo, revsto))
+    if revsfrom:
+        succs = scmutil.revrange(repo, revsfrom)
         rewinded.update(unfi.revs('precursors(%ld)', succs))
 
     if not rewinded: