diff -r f39953663cc9 -r 2b1434e5eaa0 mercurial/hg.py --- 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