[PATCH 4 of 5] Fix hg import --exact bug that hangs hg on failure
hopper at omnifarious.org
hopper at omnifarious.org
Thu May 17 16:44:01 UTC 2007
# HG changeset patch
# User Eric Hopper <hopper at omnifarious.org>
# Date 1179419370 25200
# Node ID 9011e30244966538e71fe261d4e40cedaa1007a1
# Parent 218c2a41d33f4fe408f69615f6fae4f8aa2b5755
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"))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20070517/3f405a82/attachment.asc>
More information about the Mercurial-devel
mailing list