diff hggit/__init__.py @ 1024:78959c8e5e60

wlock: take wlock when writing map file Upstream Mercurial now has a devel-warning when writing to a file without taking a lock. Since we already need write access to write the map file, let's take the wlock as well.
author Durham Goode <durham@fb.com>
date Mon, 17 Jul 2017 05:49:23 -0700
parents f2118a7dd764
children e7a8a5710257
line wrap: on
line diff
--- a/hggit/__init__.py
+++ b/hggit/__init__.py
@@ -270,8 +270,9 @@
         gitsha, hgsha = line.strip().split(' ', 1)
         if hgsha in repo:
             new_map.append('%s %s\n' % (gitsha, hgsha))
-    f = repo.vfs(GitHandler.map_file, 'wb')
-    map(f.write, new_map)
+    with repo.wlock():
+        f = repo.vfs(GitHandler.map_file, 'wb')
+        map(f.write, new_map)
     ui.status(_('git commit map cleaned\n'))
 
 def findcommonoutgoing(orig, repo, other, *args, **kwargs):