Commits

Stefano Tortarolo committed 6843182

Add --keep option

Comments (0)

Files changed (2)

         if 'qtip' in repo.tags():
             updatemq(repo, state, skipped, **opts)
 
-        # Remove no more useful revisions
-        if (util.set(repo.changelog.descendants(min(state))) 
-                                                - util.set(state.keys())):
-            ui.warn(_("warning: new changesets detected on source branch, "
-                                                    "not stripping\n"))
-        else:
-            repair.strip(repo.ui, repo, repo[min(state)].node(), "strip")
+        if not opts.get('keep'):
+            # Remove no more useful revisions
+            if (util.set(repo.changelog.descendants(min(state))) 
+                                                    - util.set(state.keys())):
+                ui.warn(_("warning: new changesets detected on source branch, "
+                                                        "not stripping\n"))
+            else:
+                repair.strip(repo.ui, repo, repo[min(state)].node(), "strip")
 
         clearstatus(repo)
         ui.status(_("rebase completed\n"))
 "rebase":
         (rebase,
         [
+        ('', 'keep', False, _('keep original revisions')),
         ('s', 'source', '', _('rebase from a given revision')),
         ('b', 'base', '', _('rebase from the base of a given revision')),
         ('d', 'dest', '', _('rebase onto a given revision')),
         ('c', 'continue', False, _('continue an interrupted rebase')),
         ('a', 'abort', False, _('abort an interrupted rebase')),] +
          templateopts,
-        _('hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a]')),
+        _('hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a] | [--keep]')),
 }

tests/test-rebase-parameters.out

 
 % Use continue and abort
 hg rebase: cannot use both abort and continue
-hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a]
+hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a] | [--keep]
 
 move changeset (and descendants) to a different branch
 
 
 options:
 
+    --keep      keep original revisions
  -s --source    rebase from a given revision
  -b --base      rebase from the base of a given revision
  -d --dest      rebase onto a given revision
 
 % Use continue/abort and dest/source
 hg rebase: abort and continue do not allow specifying revisions
-hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a]
+hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a] | [--keep]
 
 move changeset (and descendants) to a different branch
 
 
 options:
 
+    --keep      keep original revisions
  -s --source    rebase from a given revision
  -b --base      rebase from the base of a given revision
  -d --dest      rebase onto a given revision
 
 % Use source and base
 hg rebase: cannot specify both a revision and a base
-hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a]
+hg rebase [-s rev | -b rev] [-d rev] | [-c] | [-a] | [--keep]
 
 move changeset (and descendants) to a different branch
 
 
 options:
 
+    --keep      keep original revisions
  -s --source    rebase from a given revision
  -b --base      rebase from the base of a given revision
  -d --dest      rebase onto a given revision