bundlerepo doesn't really have a dirstate, throw AttributeError if requested
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Thu, 27 Nov 2008 16:07:17 +0100
changeset 7435 5e13df32fb74
parent 7434 cf7741aa1e96
child 7436 07faba78cf5a
bundlerepo doesn't really have a dirstate, throw AttributeError if requested
hgext/graphlog.py
mercurial/bundlerepo.py
mercurial/localrepo.py
--- a/hgext/graphlog.py	Thu Nov 27 16:07:13 2008 +0100
+++ b/hgext/graphlog.py	Thu Nov 27 16:07:17 2008 +0100
@@ -435,7 +435,7 @@
 
         chlist = other.changelog.nodesbetween(incoming, revs)[0]
         revdag = incoming_revs(other, chlist, opts)
-        other_parents = other.dirstate.parents()
+        other_parents = []
         displayer = show_changeset(ui, other, opts, buffered=True)
         def graphabledag():
             for (ctx, parents) in revdag:
--- a/mercurial/bundlerepo.py	Thu Nov 27 16:07:13 2008 +0100
+++ b/mercurial/bundlerepo.py	Thu Nov 27 16:07:17 2008 +0100
@@ -13,7 +13,7 @@
 from node import hex, nullid, short
 from i18n import _
 import changegroup, util, os, struct, bz2, zlib, tempfile, shutil, mdiff
-import repo, localrepo, changelog, manifest, filelog, revlog
+import repo, localrepo, changelog, manifest, filelog, revlog, context
 
 class bundlerevlog(revlog.revlog):
     def __init__(self, opener, indexfile, bundlefile,
@@ -213,19 +213,20 @@
             self.changelog = bundlechangelog(self.sopener, self.bundlefile)
             self.manstart = self.bundlefile.tell()
             return self.changelog
-        if name == 'manifest':
+        elif name == 'manifest':
             self.bundlefile.seek(self.manstart)
             self.manifest = bundlemanifest(self.sopener, self.bundlefile,
                                            self.changelog.rev)
             self.filestart = self.bundlefile.tell()
             return self.manifest
-        if name == 'manstart':
+        elif name == 'manstart':
             self.changelog
             return self.manstart
-        if name == 'filestart':
+        elif name == 'filestart':
             self.manifest
             return self.filestart
-        return localrepo.localrepository.__getattr__(self, name)
+        else:
+            raise AttributeError(name)
 
     def url(self):
         return self._url
@@ -267,6 +268,9 @@
     def cancopy(self):
         return False
 
+    def getcwd(self):
+        return os.getcwd() # always outside the repo
+
 def instance(ui, path, create):
     if create:
         raise util.Abort(_('cannot create new bundle repository'))
--- a/mercurial/localrepo.py	Thu Nov 27 16:07:13 2008 +0100
+++ b/mercurial/localrepo.py	Thu Nov 27 16:07:17 2008 +0100
@@ -982,7 +982,7 @@
         else:
             ctx2 = self[node2]
 
-        working = ctx2 == self[None]
+        working = ctx2.rev() is None
         parentworking = working and ctx1 == self['.']
         match = match or match_.always(self.root, self.getcwd())
         listignored, listclean, listunknown = ignored, clean, unknown