[PATCH 6 of 7 v2] rebase: remove old code for handling empty rebaseset

Mads Kiilerich mads at kiilerich.com
Tue Jan 14 20:24:45 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1384634789 18000
#      Sat Nov 16 15:46:29 2013 -0500
# Node ID f380b191e0855ccf2e1fcc836aa3bbb9a1e108d8
# Parent  dc5157841361044c84d8c3c987a186e2ac4d4510
rebase: remove old code for handling empty rebaseset

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -262,38 +262,32 @@ def rebase(ui, repo, **opts):
                         ui.status(_('nothing to rebase from %s to %s\n') %
                                   ('+'.join(str(repo[r]) for r in base), dest))
                     return 1
-            if rebaseset:
-                root = min(rebaseset)
-            else:
-                root = None
 
-            if not rebaseset:
-                repo.ui.debug('base is ancestor of destination\n')
-                result = None
-            elif (not (keepf or obsolete._enabled)
+            if (not (keepf or obsolete._enabled)
                   and repo.revs('first(children(%ld) - %ld)',
                                 rebaseset, rebaseset)):
                 raise util.Abort(
                     _("can't remove original changesets with"
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
-            else:
-                result = buildstate(repo, dest, rebaseset, collapsef)
 
+            result = buildstate(repo, dest, rebaseset, collapsef)
             if not result:
                 # Empty state built, nothing to rebase
                 ui.status(_('nothing to rebase\n'))
                 return 1
-            elif not keepf and not repo[root].mutable():
+
+            root = min(rebaseset)
+            if not keepf and not repo[root].mutable():
                 raise util.Abort(_("can't rebase immutable changeset %s")
                                  % repo[root],
                                  hint=_('see hg help phases for details'))
-            else:
-                originalwd, target, state = result
-                if collapsef:
-                    targetancestors = repo.changelog.ancestors([target],
-                                                               inclusive=True)
-                    external = externalparent(repo, state, targetancestors)
+
+            originalwd, target, state = result
+            if collapsef:
+                targetancestors = repo.changelog.ancestors([target],
+                                                           inclusive=True)
+                external = externalparent(repo, state, targetancestors)
 
         if keepbranchesf:
             # insert _savebranch at the start of extrafns so if
@@ -308,7 +302,6 @@ def rebase(ui, repo, **opts):
                         raise util.Abort(_('cannot collapse multiple named '
                             'branches'))
 
-
         # Rebase
         if not targetancestors:
             targetancestors = repo.changelog.ancestors([target], inclusive=True)


More information about the Mercurial-devel mailing list