D1857: pull: re-run discovery and pullbundle2 if server didn't send all heads
joerg.sonnenberger (Joerg Sonnenberger)
phabricator at mercurial-scm.org
Sat Jan 13 00:14:54 UTC 2018
joerg.sonnenberger updated this revision to Diff 4813.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D1857?vs=4812&id=4813
REVISION DETAIL
https://phab.mercurial-scm.org/D1857
AFFECTED FILES
mercurial/exchange.py
tests/test-pull-r.t
CHANGE DETAILS
diff --git a/tests/test-pull-r.t b/tests/test-pull-r.t
--- a/tests/test-pull-r.t
+++ b/tests/test-pull-r.t
@@ -201,3 +201,40 @@
sending pullbundle "0.hg"
sending pullbundle "1.hg"
sending pullbundle "2.hg"
+
+Test pullbundle functionality for incremental pulls
+
+ $ cd repo
+ $ hg serve --debug -p $HGPORT2 --pid-file=../repo.pid > ../repo-server.txt 2>&1 &
+ $ while ! grep listening ../repo-server.txt > /dev/null; do sleep 1; done
+ $ cat ../repo.pid >> $DAEMON_PIDS
+ $ cd ..
+ $ hg clone http://localhost:$HGPORT2/ repo.pullbundle2
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files (+1 heads)
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 1 changesets with 1 changes to 1 files
+ new changesets bbd179dfa0a7:66e3ba28d0d7
+ updating to branch default
+ 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ killdaemons.py
+ $ grep 'sending pullbundle ' repo-server.txt
+ sending pullbundle "0.hg"
+ sending pullbundle "2.hg"
+ sending pullbundle "1.hg"
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1351,9 +1351,16 @@
# before discovery to avoid extra work.
_maybeapplyclonebundle(pullop)
streamclone.maybeperformlegacystreamclone(pullop)
- _pulldiscovery(pullop)
- if pullop.canusebundle2:
+ while True:
+ _pulldiscovery(pullop)
+ if not pullop.canusebundle2:
+ break
_pullbundle2(pullop)
+ if not pullop.cgresult or not pullop.rheads:
+ break
+ unficl = repo.unfiltered().changelog
+ if all(unficl.hasnode(n) for n in pullop.rheads):
+ break
_pullchangeset(pullop)
_pullphase(pullop)
_pullbookmarks(pullop)
To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list