# HG changeset patch # User Siddharth Agarwal # Date 1392185614 28800 # Node ID a836fc8f6c76a2451556606a9141da40c8e62f3e # Parent 5998a6ddc704c29ee725af3995e259396c0b161a git_handler: don't bail on multiple octopus merges in succession Consider two octopus merges, one of which is a child of the other. Without this patch, get_git_parents() called on the second octopus merge checks that each p1 is neither in the middle of an octopus merge nor the end of it. Since the end of the first octopus merge is a p1 of the second one, this asserts. Change the sanity check to only make sure that p1 is not in the middle of an octopus merge. diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -529,7 +529,7 @@ part = ctx while is_octopus_part(part): (p1, p2) = part.parents() - assert not is_octopus_part(p1) + assert ctx.extra().get('hg-git', None) != 'octopus' parents.append(p1) part = p2 parents.append(p2) diff --git a/tests/test-octopus.t b/tests/test-octopus.t --- a/tests/test-octopus.t +++ b/tests/test-octopus.t @@ -20,6 +20,18 @@ $ git add gamma $ fn_git_commit -m 'add gamma' + $ git checkout -b branch3 master 2>&1 | sed s/\'/\"/g + Switched to a new branch "branch3" + $ echo epsilon > epsilon + $ git add epsilon + $ fn_git_commit -m 'add epsilon' + + $ git checkout -b branch4 master 2>&1 | sed s/\'/\"/g + Switched to a new branch "branch4" + $ echo zeta > zeta + $ git add zeta + $ fn_git_commit -m 'add zeta' + $ git checkout master 2>&1 | sed s/\'/\"/g Switched to branch "master" $ echo delta > delta @@ -36,23 +48,45 @@ create mode 100644 beta create mode 100644 gamma + $ git merge branch3 branch4 | sed "s/the '//;s/' strategy//" | sed 's/^Merge.*octopus.*$/Merge successful/;s/, 0 deletions.*//' | sed 's/| */| /' + Trying simple merge with branch3 + Trying simple merge with branch4 + Merge successful + epsilon | 1 + + zeta | 1 + + 2 files changed, 2 insertions(+) + create mode 100644 epsilon + create mode 100644 zeta + $ cd .. $ git init --bare gitrepo2 Initialized empty Git repository in $TESTTMP/gitrepo2/ $ hg clone gitrepo hgrepo | grep -v '^updating' importing git objects into hg - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + 6 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd hgrepo $ hg log --graph --style compact | sed 's/\[.*\]//g' - @ 5:3,4 6523aa9f4775 2007-01-01 00:00 +0000 test - |\ Merge branches 'branch1' and 'branch2' + @ 9:7,8 9c1d2aac0643 2007-01-01 00:00 +0000 test + |\ Merge branches 'branch3' and 'branch4' | | - | o 4:1,2 7f6c791a169f 2007-01-01 00:00 +0000 test - | |\ Merge branches 'branch1' and 'branch2' + | o 8:3,4 c5ea839ce0aa 2007-01-01 00:00 +0000 test + | |\ Merge branches 'branch3' and 'branch4' | | | - o | | 3:0 1436150b86c2 2007-01-01 00:00 +0000 test - | | | add delta + o | | 7:5,6 fb41ad5568ee 2007-01-01 00:00 +0000 test + |\ \ \ Merge branches 'branch1' and 'branch2' + | | | | + | o | | 6:1,2 2bd73a80b472 2007-01-01 00:00 +0000 test + | |\ \ \ Merge branches 'branch1' and 'branch2' + | | | | | + o | | | | 5:0 71cbde26f242 2007-01-01 00:00 +0000 test + | | | | | add delta + | | | | | + +-------o 4:0 fdf749fb5963 2007-01-01 00:00 +0000 test + | | | | add zeta + | | | | + +-----o 3:0 19e973b01564 2007-01-01 00:00 +0000 test + | | | add epsilon | | | +---o 2:0 37c124f2d0a0 2007-01-01 00:00 +0000 test | | add gamma @@ -70,22 +104,41 @@ pushing to ../gitrepo2 searching for changes adding objects - added 5 commits with 5 trees and 4 blobs + added 8 commits with 8 trees and 6 blobs $ cd .. $ git --git-dir=gitrepo2 log --pretty=medium | sed s/\\.\\.\\.//g - commit f0c7ec180419a130636d0c333fc34c1462cab4b5 - Merge: d8e22dd 9497a4e e5023f9 + commit b32ff845df61df998206b630e4370a44f9b36845 + Merge: 9ac68f9 7e9cd9f e695849 + Author: test + Date: Mon Jan 1 00:00:15 2007 +0000 + + Merge branches 'branch3' and 'branch4' + + commit 9ac68f982ae7426d9597ff16c74afb4e6053c582 + Merge: d40f375 9497a4e e5023f9 + Author: test + Date: Mon Jan 1 00:00:15 2007 +0000 + + Merge branches 'branch1' and 'branch2' + + commit d40f375a81b7d033e92cbad89487115fe2dd472f + Author: test + Date: Mon Jan 1 00:00:15 2007 +0000 + + add delta + + commit e695849087f6c320c1a447620492b29a82ca41b1 + Author: test + Date: Mon Jan 1 00:00:14 2007 +0000 + + add zeta + + commit 7e9cd9f90b6d2c60579375eb796ce706d2d8bbe6 Author: test Date: Mon Jan 1 00:00:13 2007 +0000 - Merge branches 'branch1' and 'branch2' - - commit d8e22ddb015d06460ccbb4508d2184c12c8a7c4c - Author: test - Date: Mon Jan 1 00:00:13 2007 +0000 - - add delta + add epsilon commit e5023f9e5cb24fdcec7b6c127cec45d8888e35a9 Author: test