bundlerepo: reintroduce dirstate
authorMatt Mackall <mpm@selenic.com>
Tue, 17 Mar 2009 13:43:11 -0500
changeset 7853 af062a9fea9b
parent 7852 a8dccbed54ef
child 7854 423b4482c5cb
bundlerepo: reintroduce dirstate
hgext/keyword.py
mercurial/bundlerepo.py
tests/test-bundle
tests/test-bundle.out
--- a/hgext/keyword.py	Fri Mar 13 21:14:57 2009 +0100
+++ b/hgext/keyword.py	Tue Mar 17 13:43:11 2009 -0500
@@ -425,10 +425,14 @@
     keyword substitutions.
     Monkeypatches patch and webcommands.'''
 
-    if (not hasattr(repo, 'dirstate') or not kwtools['inc']
-        or kwtools['hgcmd'] in nokwcommands.split()
-        or '.hg' in util.splitpath(repo.root)):
-        return
+    try:
+        if (not repo.local() or not kwtools['inc']
+            or kwtools['hgcmd'] in nokwcommands.split()
+            or '.hg' in util.splitpath(repo.root)
+            or repo._url.startswith('bundle:')):
+            return
+    except AttributeError:
+        pass
 
     kwtools['templater'] = kwt = kwtemplater(ui, repo)
 
--- a/mercurial/bundlerepo.py	Fri Mar 13 21:14:57 2009 +0100
+++ b/mercurial/bundlerepo.py	Tue Mar 17 13:43:11 2009 -0500
@@ -226,7 +226,7 @@
             self.manifest
             return self.filestart
         else:
-            raise AttributeError(name)
+            return localrepo.localrepository.__getattr__(self, name)
 
     def url(self):
         return self._url
--- a/tests/test-bundle	Fri Mar 13 21:14:57 2009 +0100
+++ b/tests/test-bundle	Tue Mar 17 13:43:11 2009 -0500
@@ -34,6 +34,7 @@
 
 echo "====== Bundle --all"
 hg -R test bundle --all all.hg
+
 echo "====== Bundle test to full.hg"
 hg -R test bundle full.hg empty
 echo "====== Unbundle full.hg in test"
@@ -139,4 +140,10 @@
 # but, regular verify must continue to work
 hg -R orig verify
 
+echo "====== diff against bundle"
+hg init b
+cd b
+hg -R ../all.hg diff -r tip
+cd ..
 
+
--- a/tests/test-bundle.out	Fri Mar 13 21:14:57 2009 +0100
+++ b/tests/test-bundle.out	Tue Mar 17 13:43:11 2009 -0500
@@ -317,3 +317,12 @@
 crosschecking files in changesets and manifests
 checking files
 2 files, 2 changesets, 2 total revisions
+====== diff against bundle
+diff -r 836ac62537ab anotherfile
+--- a/anotherfile	Mon Jan 12 13:46:40 1970 +0000
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,4 +0,0 @@
+-0
+-1
+-2
+-3