[PATCH 2 of 4] Make bundlerepo.instance() follow the "bundle://parentrepo+bundlefile" convention

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Mon Nov 5 01:32:14 CST 2007


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1194086384 -3600
# Node ID d460070461511c421892293efecd630311fa6a29
# Parent  cac289e3d760a758ac9dfa4dfc0b6f6ca0108933
Make bundlerepo.instance() follow the "bundle://parentrepo+bundlefile" convention
also used by bundlerepository.__init__(). Add test.
Fixes http://www.selenic.com/mercurial/bts/issue821.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -261,9 +261,9 @@ def instance(ui, path, create):
         path = util.drop_scheme('bundle', path)
         s = path.split("+", 1)
         if len(s) == 1:
-            repopath, bundlename = "", s[0]
+            bundlename, repopath = s[0], ""
         else:
-            repopath, bundlename = s
+            bundlename, repopath = s
     else:
-        repopath, bundlename = '', path
+        bundlename, repopath = path, ''
     return bundlerepository(ui, repopath, bundlename)
diff --git a/tests/test-bundle b/tests/test-bundle
--- a/tests/test-bundle
+++ b/tests/test-bundle
@@ -63,6 +63,17 @@ hg pull bundle://../full.hg
 hg pull bundle://../full.hg
 cd ..
 
+echo "====== Pull ../full.hg+. into empty (with hook)"
+rm -r empty
+hg init empty
+cd empty
+echo '[hooks]' >> .hg/hgrc
+echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
+#doesn't work (yet ?)
+#hg -R bundle://../full.hg verify
+hg pull bundle://../full.hg+.
+cd ..
+
 echo "====== Create partial clones"
 rm -r empty
 hg init empty
diff --git a/tests/test-bundle.out b/tests/test-bundle.out
--- a/tests/test-bundle.out
+++ b/tests/test-bundle.out
@@ -99,6 +99,15 @@ summary:     0.0
 ====== Pull ../full.hg into empty (with hook)
 changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:../full.hg 
 pulling from bundle://../full.hg
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 9 changesets with 7 changes to 4 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+====== Pull ../full.hg+. into empty (with hook)
+changegroup hook: HG_NODE=5649c9d34dd87d0ecb5fd39672128376e83b22e1 HG_SOURCE=pull HG_URL=bundle:../full.hg+. 
+pulling from bundle://../full.hg+.
 requesting all changes
 adding changesets
 adding manifests


More information about the Mercurial-devel mailing list