[PATCH] keyword: do not set up kwrepo when pulling from bundlerepo

Christian Ebert blacktrash at gmx.net
Wed Feb 6 19:19:15 CST 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202347076 -3600
# Node ID f273efbc844c51d3ebf68a561d757e4ca4541c0f
# Parent  08b2daddeba4923890fac5305daeddbab765b820
keyword: do not set up kwrepo when pulling from bundlerepo

Issue spotted and test case provided by pmezard.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -410,8 +410,12 @@
     This is done for local repos only, and only if there are
     files configured at all for keyword substitution.'''
 
-    if not repo.local() or '.hg' in repo.root.split('/'):
-        return
+    try:
+        if (not repo.local() or '.hg' in repo.root.split('/')
+            or repo._url.startswith('bundle:')):
+            return
+    except AttributeError:
+        pass
 
     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
     if hgcmd in nokwcommands.split():
diff --git a/tests/test-keyword b/tests/test-keyword
--- a/tests/test-keyword
+++ b/tests/test-keyword
@@ -24,8 +24,8 @@
 
 hg --quiet kwdemo "Branch = {branches}"
 
-hg init Test
-cd Test
+hg init Test-bndl
+cd Test-bndl
 
 echo % kwshrink should exit silently in empty/invalid repo
 hg kwshrink
@@ -68,6 +68,16 @@
 sed -e '/\[hooks\]/,$ d' $HGRCPATH > $HGRCPATH.nohook
 mv $HGRCPATH.nohook $HGRCPATH
 rm hooktest
+
+echo % bundle
+hg bundle --base null ../kw.hg
+
+cd ..
+hg init Test
+cd Test
+
+echo % pull from bundle
+hg pull -u ../kw.hg
 
 echo % touch
 touch a b
diff --git a/tests/test-keyword.out b/tests/test-keyword.out
--- a/tests/test-keyword.out
+++ b/tests/test-keyword.out
@@ -138,6 +138,16 @@
 a
 % diff a hooktest
 % removing commit hook from config
+% bundle
+1 changesets found
+% pull from bundle
+pulling from ../kw.hg
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 3 changes to 3 files
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % touch
 % status
 % update


More information about the Mercurial-devel mailing list