Mercurial > evolve
changeset 1971:ec4924ea8bc6
topic: make sure we have the 'wlock' when setting topic
We where writing the '.hg/topic' file without a lot. That was bad.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Thu, 11 Aug 2016 22:50:58 +0200 |
parents | 076baad148d9 |
children | 04ce84b7b9d1 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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)