From patchwork Sun Jan 12 16:08:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06,of,10] rebase: remove old code for handling empty rebaseset From: Mads Kiilerich X-Patchwork-Id: 3300 Message-Id: To: mercurial-devel@selenic.com Date: Sun, 12 Jan 2014 17:08:04 +0100 # HG changeset patch # User Mads Kiilerich # Date 1384634789 18000 # Sat Nov 16 15:46:29 2013 -0500 # Node ID f404860eafe23627a4bb17884125985c44ddfcfd # Parent 34f07528358d4bd02fbdc966f981e54704953796 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 @@ -255,38 +255,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 @@ -301,7 +295,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)