tag: make sure the repository is locked when tagging
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 02 Jul 2017 01:41:37 +0200
changeset 33255 4f3f08262eb4
parent 33254 9359cd9345a9
child 33256 4ea0b7a613f9
tag: make sure the repository is locked when tagging Otherwise, writing localtag can happen without the lock.
mercurial/tags.py
--- a/mercurial/tags.py	Sun Jul 02 01:38:08 2017 +0200
+++ b/mercurial/tags.py	Sun Jul 02 01:41:37 2017 +0200
@@ -539,9 +539,10 @@
             raise error.Abort(_('working copy of .hgtags is changed'),
                              hint=_('please commit .hgtags manually'))
 
-    repo.tags() # instantiate the cache
-    _tag(repo.unfiltered(), names, node, message, local, user, date,
-         editor=editor)
+    with repo.wlock():
+        repo.tags() # instantiate the cache
+        _tag(repo.unfiltered(), names, node, message, local, user, date,
+             editor=editor)
 
 def _tag(repo, names, node, message, local, user, date, extra=None,
          editor=False):