mercurial/hg.py
changeset 26240 2b1434e5eaa0
parent 26219 ae33fff17c1e
child 26353 7c20d501709b
--- a/mercurial/hg.py	Thu Sep 10 19:45:46 2015 -0400
+++ b/mercurial/hg.py	Sat Sep 12 11:31:56 2015 -0700
@@ -887,8 +887,13 @@
         return tuple(state), maxmtime
 
     def copy(self):
-        """Obtain a copy of this class instance."""
-        c = cachedlocalrepo(self._repo)
+        """Obtain a copy of this class instance.
+
+        A new localrepository instance is obtained. The new instance should be
+        completely independent of the original.
+        """
+        repo = repository(self._repo.baseui, self._repo.origroot)
+        c = cachedlocalrepo(repo)
         c._state = self._state
         c.mtime = self.mtime
         return c