[PATCH STABLE] incoming: fix incoming when a local head is remotely filtered (issue3805)o

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Feb 5 18:40:29 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1360110306 0
# Branch stable
# Node ID ea40a57484ec948e29749bcadd4bcc89388cf5fb
# Parent  b31e0be96c79156b8236b12315a6f699c1bf992a
incoming: fix incoming when a local head is remotely filtered (issue3805)o

In its current state discovery may returns (remotely) filtered elements in
"common". This has usually no impact as "missing" in kept clear of filtered
elements. However when the "remote" repo is a local repo (disk accessible, and
directly created in memory) the incoming codes takes a shortcut and directly
use the "remote" repo to generate the incoming output. When some common elements
are filtered this led to a crash. We now ensure to use and unfiltered repository
to generates the incoming output. This does not changes the behavior as missing
is clear of filtered revision.

Now that we have proper low level filtering; incoming code need a deeper cleanup
but it is already planned.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -365,10 +365,15 @@ def getremotechanges(ui, repo, other, on
         if not localrepo:
             # use the created uncompressed bundlerepo
             localrepo = bundlerepo = bundlerepository(ui, repo.root, fname)
             # this repo contains local and other now, so filter out local again
             common = repo.heads()
+    if localrepo:
+        # part of common may be remotly filtered
+        # use an unfiltered version
+        # The discovery process probaly need cleanup to avoid that
+        localrepo = localrepo.unfiltered()
 
     csets = localrepo.changelog.findmissing(common, rheads)
 
     def cleanup():
         if bundlerepo:
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -774,6 +774,88 @@ Checking _enable=False warning if obsole
   parent:      7:50c51b361e60
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add celestine
   
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+
 #endif
+
+Test incoming/oucoming with changeset obsolete remotly, known locally
+
+  $ hg init repo-issue3805
+  $ cd repo-issue3805
+  $ echo "foo" > foo
+  $ hg ci -Am "A"
+  adding foo
+  $ hg clone . ../other-issue3805
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "bar" >> foo
+  $ hg ci --amend
+  $ cd ../other-issue3805
+  $ hg log -G
+  @  changeset:   0:193e9254ce7e
+     tag:         tip
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  $ hg log -G -R ../repo-issue3805
+  @  changeset:   2:3816541e5485
+     tag:         tip
+     parent:      -1:000000000000
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     A
+  
+  $ hg incoming
+  comparing with $TESTTMP/tmpe/repo-issue3805
+  searching for changes
+  changeset:   2:3816541e5485
+  tag:         tip
+  parent:      -1:000000000000
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     A
+  
+  $ hg incoming --bundle ../issue3805.hg
+  comparing with $TESTTMP/tmpe/repo-issue3805
+  searching for changes
+  changeset:   2:3816541e5485
+  tag:         tip
+  parent:      -1:000000000000
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     A
+  
+  $ hg outgoing
+  comparing with $TESTTMP/tmpe/repo-issue3805
+  searching for changes
+  no changes found
+  [1]
+
+#if serve
+
+  $ hg serve -R ../repo-issue3805 -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg incoming http://localhost:$HGPORT
+  comparing with http://localhost:$HGPORT/
+  searching for changes
+  changeset:   1:3816541e5485
+  tag:         tip
+  parent:      -1:000000000000
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     A
+  
+  $ hg outgoing http://localhost:$HGPORT
+  comparing with http://localhost:$HGPORT/
+  searching for changes
+  no changes found
+  [1]
+
+  $ kill `cat hg.pid`
+
+#endif


More information about the Mercurial-devel mailing list