# HG changeset patch # User Durham Goode # Date 1415645082 28800 # Node ID 643c58303fb0ec020907af28b9e486be299ba043 # Parent d33a90cb2a3202451ee3fd9ecddb0c119611d114 rebase: fix rebase with no common ancestors (issue4446) The new rebase revset didn't check for the case when there are no common ancestors. Now it does. The new behavior should be the same as the pre-3.2 behavior. Added a test. diff -r d33a90cb2a32 -r 643c58303fb0 hgext/rebase.py --- a/hgext/rebase.py Thu Nov 06 10:57:13 2014 -0500 +++ b/hgext/rebase.py Mon Nov 10 10:44:42 2014 -0800 @@ -274,8 +274,12 @@ "can't compute rebase set\n")) return 1 commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first() - rebaseset = repo.revs('(%d::(%ld) - %d)::', - commonanc, base, commonanc) + if commonanc is not None: + rebaseset = repo.revs('(%d::(%ld) - %d)::', + commonanc, base, commonanc) + else: + rebaseset = [] + if not rebaseset: # transform to list because smartsets are not comparable to # lists. This should be improved to honor lazyness of diff -r d33a90cb2a32 -r 643c58303fb0 tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters.t Thu Nov 06 10:57:13 2014 -0500 +++ b/tests/test-rebase-parameters.t Mon Nov 10 10:44:42 2014 -0800 @@ -468,3 +468,17 @@ [255] $ cd .. + +No common ancestor + + $ hg init separaterepo + $ cd separaterepo + $ touch a + $ hg commit -Aqm a + $ hg up -q null + $ touch b + $ hg commit -Aqm b + $ hg rebase -d 0 + nothing to rebase from d7486e00c6f1 to 3903775176ed + [1] + $ cd ..