diff --git a/hgext/rebase.py b/hgext/rebase.py
index c027641f8a835b116c37ebc9dfa5b436d48a62e5_aGdleHQvcmViYXNlLnB5..1755e1d9d1c330745374166d181147d699c3b538_aGdleHQvcmViYXNlLnB5 100644
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -63,6 +63,12 @@
             c(ctx, extra)
     return extrafn
 
+def _destrebase(repo):
+    # Destination defaults to the latest revision in the
+    # current branch
+    branch = repo[None].branch()
+    return repo[branch].rev()
+
 def _rebasedefaultdest(repo, subset, x):
     # ``_rebasedefaultdest()``
 
@@ -73,10 +79,7 @@
     # # XXX: - probably merging with the merge destination.
     # i18n: "_rebasedefaultdest" is a keyword
     revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments"))
-    # Destination defaults to the latest revision in the
-    # current branch
-    branch = repo[None].branch()
-    return subset & revset.baseset([repo[branch].rev()])
+    return subset & revset.baseset([_destrebase(repo)])
 
 @command('rebase',
     [('s', 'source', '',