# HG changeset patch # User Eric Hopper # Date 1179419370 25200 # Node ID 3900f684a150ba9a847c499dd7bf6bf139070866 # Parent a210b40d0860b8fa6b5762e1542dfdc9ee61b4f5 Fix hg import --exact bug that hangs hg on failure. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1565,7 +1565,7 @@ def import_(ui, repo, patch1, *patches, n = repo.commit(files, message, user, date, wlock=wlock, lock=lock) if opts.get('exact'): if hex(n) != nodeid: - repo.rollback() + repo.rollback(wlock=wlock, lock=lock) raise util.Abort(_('patch is damaged or loses information')) finally: os.unlink(tmpname) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -586,10 +586,11 @@ class localrepository(repo.repository): self.ui.warn(_("no interrupted transaction available\n")) return False - def rollback(self, wlock=None): + def rollback(self, wlock=None, lock=None): if not wlock: wlock = self.wlock() - l = self.lock() + if not lock: + lock = self.lock() if os.path.exists(self.sjoin("undo")): self.ui.status(_("rolling back last transaction\n")) transaction.rollback(self.sopener, self.sjoin("undo"))