Submitter | Mads Kiilerich |
---|---|
Date | Jan. 12, 2014, 4:08 p.m. |
Message ID | <770c4cb0644a1347264f.1389542885@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/3301/ |
State | Superseded |
Headers | show |
Comments
mads@kiilerich.com writes: > # HG changeset patch > # User Mads Kiilerich <madski@unity3d.com> > # Date 1384634789 18000 > # Sat Nov 16 15:46:29 2013 -0500 > # Node ID 770c4cb0644a1347264f57b7a74e46fd04d59037 > # Parent f404860eafe23627a4bb17884125985c44ddfcfd > tests: introduce test for rebasing on named branches with closed heads > * * * > rebase: improve algorithm for finding other branch head to rebase to (bc) Was this a folded changeset? > This is primarily a bug fix. Before, rebase would fail to rebase a to a closed > tip-most branch head and it would fail to rebase a tip-most branch head to a > lower branch head revision. It would also just silently do "something" when the > branch had multiple other branch heads. That made this history modifying > command more dependent on the topological ordering than necessary. > > This patch tweaks the behavior so it always and only will rebase if the branch > has one other branch head, no matter if it is closed or not or higher or lower. > It will show a notice if rebasing on top of a closed branch head. If there is > more than one other branch head it will fail and expect more clear > instructions. > > diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t > --- a/tests/test-rebase-named-branches.t > +++ b/tests/test-rebase-named-branches.t > @@ -240,3 +240,97 @@ Rebasing descendant onto ancestor across > @ 0: 'A' > > $ cd .. > + > +Rebase to other head on branch > + > +Set up a case: > + > + $ hg init case1 > + $ cd case1 > + $ touch f > + $ hg ci -qAm0 > + $ hg branch -q b > + $ echo >> f > + $ hg ci -qAm 'b1' > + $ hg up -qr -2 > + $ hg branch -qf b > + $ hg ci -qm 'b2' > + $ hg up -qr -3 > + $ hg branch -q c > + $ hg ci -m 'c1' > + > + $ hg tglog > + @ 3: 'c1' c > + | > + | o 2: 'b2' b > + |/ > + | o 1: 'b1' b > + |/ > + o 0: '0' > + > + $ hg clone -q . ../case2 > + > +rebase 'b2' to another lower branch head > + > + $ hg up -qr 2 > + $ hg rebase > + nothing to rebase - 792845bb77ee is both base and destination > + [1] > + $ hg tglog > + o 3: 'c1' c > + | > + | @ 2: 'b2' b > + |/ > + | o 1: 'b1' b > + |/ > + o 0: '0' > + > + > +rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1') > + > + $ cd ../case2 > + $ hg up -qr 1 > + $ hg rebase > + saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-backup.hg (glob) > + $ hg tglog > + @ 3: 'b1' b > + | > + | o 2: 'c1' c > + | | > + o | 1: 'b2' b > + |/ > + o 0: '0' > + > + > +rebase 'c1' to the branch head 'c2' that is closed > + > + $ hg branch -qf c > + $ hg ci -qm 'c2 closed' --close > + $ hg up -qr 2 > + $ hg tglog > + o 4: 'c2 closed' c > + | > + o 3: 'b1' b > + | > + | @ 2: 'c1' c > + | | > + o | 1: 'b2' b > + |/ > + o 0: '0' > + > + $ hg rebase > + nothing to rebase - c062e3ecd6c6 is both base and destination > + [1] > + $ hg tglog > + o 4: 'c2 closed' c > + | > + o 3: 'b1' b > + | > + | @ 2: 'c1' c > + | | > + o | 1: 'b2' b > + |/ > + o 0: '0' > + > + > + $ cd .. > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On 01/12/2014 06:25 PM, Sean Farley wrote: > mads@kiilerich.com writes: > >> # HG changeset patch >> # User Mads Kiilerich <madski@unity3d.com> >> # Date 1384634789 18000 >> # Sat Nov 16 15:46:29 2013 -0500 >> # Node ID 770c4cb0644a1347264f57b7a74e46fd04d59037 >> # Parent f404860eafe23627a4bb17884125985c44ddfcfd >> tests: introduce test for rebasing on named branches with closed heads >> * * * >> rebase: improve algorithm for finding other branch head to rebase to (bc) > Was this a folded changeset? Yes, the description could be improved a bit ;-) I assume there will be other reasons to resend and will wait for other comments. /Mads
Patch
diff --git a/tests/test-rebase-named-branches.t b/tests/test-rebase-named-branches.t --- a/tests/test-rebase-named-branches.t +++ b/tests/test-rebase-named-branches.t @@ -240,3 +240,97 @@ Rebasing descendant onto ancestor across @ 0: 'A' $ cd .. + +Rebase to other head on branch + +Set up a case: + + $ hg init case1 + $ cd case1 + $ touch f + $ hg ci -qAm0 + $ hg branch -q b + $ echo >> f + $ hg ci -qAm 'b1' + $ hg up -qr -2 + $ hg branch -qf b + $ hg ci -qm 'b2' + $ hg up -qr -3 + $ hg branch -q c + $ hg ci -m 'c1' + + $ hg tglog + @ 3: 'c1' c + | + | o 2: 'b2' b + |/ + | o 1: 'b1' b + |/ + o 0: '0' + + $ hg clone -q . ../case2 + +rebase 'b2' to another lower branch head + + $ hg up -qr 2 + $ hg rebase + nothing to rebase - 792845bb77ee is both base and destination + [1] + $ hg tglog + o 3: 'c1' c + | + | @ 2: 'b2' b + |/ + | o 1: 'b1' b + |/ + o 0: '0' + + +rebase 'b1' on top of the tip of the branch ('b2') - ignoring the tip branch ('c1') + + $ cd ../case2 + $ hg up -qr 1 + $ hg rebase + saved backup bundle to $TESTTMP/case2/.hg/strip-backup/40039acb7ca5-backup.hg (glob) + $ hg tglog + @ 3: 'b1' b + | + | o 2: 'c1' c + | | + o | 1: 'b2' b + |/ + o 0: '0' + + +rebase 'c1' to the branch head 'c2' that is closed + + $ hg branch -qf c + $ hg ci -qm 'c2 closed' --close + $ hg up -qr 2 + $ hg tglog + o 4: 'c2 closed' c + | + o 3: 'b1' b + | + | @ 2: 'c1' c + | | + o | 1: 'b2' b + |/ + o 0: '0' + + $ hg rebase + nothing to rebase - c062e3ecd6c6 is both base and destination + [1] + $ hg tglog + o 4: 'c2 closed' c + | + o 3: 'b1' b + | + | @ 2: 'c1' c + | | + o | 1: 'b2' b + |/ + o 0: '0' + + + $ cd ..