changeset 15875:7eca9db689d6

debugbuilddag: lock repo before starting transaction
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 13 Jan 2012 01:19:07 +0100
parents 2305baff673f
children 2de1244361aa
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jan 13 01:19:07 2012 +0100
+++ b/mercurial/commands.py	Fri Jan 13 01:19:07 2012 +0100
@@ -1368,8 +1368,10 @@
 
     tags = []
 
-    tr = repo.transaction("builddag")
+    lock = tr = None
     try:
+        lock = repo.lock()
+        tr = repo.transaction("builddag")
 
         at = -1
         atbranch = 'default'
@@ -1445,12 +1447,12 @@
                 atbranch = data
             ui.progress(_('building'), id, unit=_('revisions'), total=total)
         tr.close()
+
+        if tags:
+            repo.opener.write("localtags", "".join(tags))
     finally:
         ui.progress(_('building'), None)
-        tr.release()
-
-    if tags:
-        repo.opener.write("localtags", "".join(tags))
+        release(tr, lock)
 
 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
 def debugbundle(ui, bundlepath, all=None, **opts):