# HG changeset patch # User Pierre-Yves David # Date 1470948658 -7200 # Node ID ec4924ea8bc688711a4c6ac71695ebf3bf81cdf5 # Parent 076baad148d9cfb9f11e9d636428fb53cd8b0003 topic: make sure we have the 'wlock' when setting topic We where writing the '.hg/topic' file without a lot. That was bad. diff -r 076baad148d9 -r ec4924ea8bc6 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Jul 13 16:19:41 2016 +0200 +++ b/hgext3rd/topic/__init__.py Thu Aug 11 22:50:58 2016 +0200 @@ -259,8 +259,9 @@ repo.vfs.unlink('topic') return if topic: - with repo.vfs.open('topic', 'w') as f: - f.write(topic) + with repo.wlock(): + with repo.vfs.open('topic', 'w') as f: + f.write(topic) return current = repo.currenttopic for t in sorted(repo.topics): @@ -275,11 +276,12 @@ ui.write(_("topic: %s\n") % t) def commitwrap(orig, ui, repo, *args, **opts): - if opts.get('topic'): - t = opts['topic'] - with repo.vfs.open('topic', 'w') as f: - f.write(t) - return orig(ui, repo, *args, **opts) + with repo.wlock(): + if opts.get('topic'): + t = opts['topic'] + with repo.vfs.open('topic', 'w') as f: + f.write(t) + return orig(ui, repo, *args, **opts) def committextwrap(orig, repo, ctx, subs, extramsg): ret = orig(repo, ctx, subs, extramsg)