changeset 9093:0b2b269ba3d0

branch heads: fix regression introduced in e67e5b60e55f (issue1726) For merge nodes it is not adequate to only check a single possible branch head for whether it is an ancestor of the latest head, but it needs to be done for each possible branch head.
author Henrik Stuart <hg@hstuart.dk>
date Thu, 09 Jul 2009 20:49:02 +0200
parents 8ec39725d966
children 89ae64a4e2ec
files mercurial/localrepo.py tests/test-fetch tests/test-fetch.out
diffstat 3 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jul 09 11:59:18 2009 +0200
+++ b/mercurial/localrepo.py	Thu Jul 09 20:49:02 2009 +0200
@@ -473,7 +473,9 @@
                 latest = newnodes.pop()
                 if latest not in bheads:
                     continue
-                reachable = self.changelog.reachable(latest, bheads[0])
+                reachable = set()
+                for bh in bheads:
+                    reachable |= self.changelog.reachable(latest, bh)
                 bheads = [b for b in bheads if b not in reachable]
                 newbheads.insert(0, latest)
             bheads.extend(newbheads)
--- a/tests/test-fetch	Thu Jul 09 11:59:18 2009 +0200
+++ b/tests/test-fetch	Thu Jul 09 20:49:02 2009 +0200
@@ -185,6 +185,18 @@
 hg --cwd ib2 fetch ../ib1
 rm -fr ib1 ib2
 
+echo % test issue1726
+hg init i1726r1
+echo a > i1726r1/a
+hg --cwd i1726r1 ci -Am base
+hg clone i1726r1 i1726r2
+echo b > i1726r1/a
+hg --cwd i1726r1 ci -m second
+echo c > i1726r2/a
+hg --cwd i1726r2 ci -m third
+HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | sed 's/new changeset 3:[0-9a-zA-Z]\+/new changeset 3/'
+hg --cwd i1726r2 heads default --template '{rev}\n'
+
 "$TESTDIR/killdaemons.py"
 
 true
--- a/tests/test-fetch.out	Thu Jul 09 11:59:18 2009 +0200
+++ b/tests/test-fetch.out	Thu Jul 09 20:49:02 2009 +0200
@@ -190,3 +190,20 @@
 pulling from ../ib1
 searching for changes
 no changes found
+% test issue1726
+adding a
+updating working directory
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+pulling from ../i1726r1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+updating to 2:7837755a2789
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+merging with 1:d1f0c6c48ebd
+merging a
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+new changeset 3 merges remote changes with local
+3