Mercurial > evolve
comparison hgext/inhibit.py @ 1303:508f9911b042
inhibit: updating to a obsolete commit prints warning message
We move the inhibition marker in the same wlock than the update operation, this
clears the warning message. To make it work we display the warning message on
lock release in evolve.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Mon, 20 Apr 2015 13:39:18 -0700 |
parents | 51ec3610968c |
children | 8fa74845eb1f |
comparison
equal
deleted
inserted
replaced
1302:ebcf23fe3032 | 1303:508f9911b042 |
---|---|
29 from mercurial import revset | 29 from mercurial import revset |
30 from mercurial import error | 30 from mercurial import error |
31 from mercurial import commands | 31 from mercurial import commands |
32 from mercurial import lock as lockmod | 32 from mercurial import lock as lockmod |
33 from mercurial import bookmarks | 33 from mercurial import bookmarks |
34 from mercurial import lock as lockmod | |
34 from mercurial.i18n import _ | 35 from mercurial.i18n import _ |
35 | 36 |
36 cmdtable = {} | 37 cmdtable = {} |
37 command = cmdutil.command(cmdtable) | 38 command = cmdutil.command(cmdtable) |
38 | 39 |
66 """ | 67 """ |
67 When moving to a commit we want to inhibit any obsolete commit affecting | 68 When moving to a commit we want to inhibit any obsolete commit affecting |
68 the changeset we are updating to. In other words we don't want any visible | 69 the changeset we are updating to. In other words we don't want any visible |
69 commit to be obsolete. | 70 commit to be obsolete. |
70 """ | 71 """ |
71 res = orig(ui, repo, *args, **kwargs) | 72 wlock = None |
72 newhead = repo['.'].node() | 73 try: |
73 _inhibitmarkers(repo, [newhead]) | 74 # Evolve is running a hook on lock release to display a warning message |
74 return res | 75 # if the workind dir's parent is obsolete. |
76 # We take the lock here to make sure that we inhibit the parent before | |
77 # that hook get a chance to run. | |
78 wlock = repo.wlock() | |
79 res = orig(ui, repo, *args, **kwargs) | |
80 newhead = repo['.'].node() | |
81 _inhibitmarkers(repo, [newhead]) | |
82 return res | |
83 finally: | |
84 lockmod.release(wlock) | |
75 | 85 |
76 def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs): | 86 def _bookmarkchanged(orig, bkmstoreinst, *args, **kwargs): |
77 """ Add inhibition markers to every obsolete bookmarks """ | 87 """ Add inhibition markers to every obsolete bookmarks """ |
78 repo = bkmstoreinst._repo | 88 repo = bkmstoreinst._repo |
79 bkmstorenodes = [repo[v].node() for v in bkmstoreinst.values()] | 89 bkmstorenodes = [repo[v].node() for v in bkmstoreinst.values()] |