Mercurial > evolve
comparison hgext/evolve.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 | ebcf23fe3032 |
children | 31e96036acd3 |
comparison
equal
deleted
inserted
replaced
1302:ebcf23fe3032 | 1303:508f9911b042 |
---|---|
614 @eh.wrapcommand("update") | 614 @eh.wrapcommand("update") |
615 @eh.wrapcommand("parents") | 615 @eh.wrapcommand("parents") |
616 @eh.wrapcommand("pull") | 616 @eh.wrapcommand("pull") |
617 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): | 617 def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): |
618 """Warn that the working directory parent is an obsolete changeset""" | 618 """Warn that the working directory parent is an obsolete changeset""" |
619 res = origfn(ui, repo, *args, **opts) | 619 def warnobsolete(): |
620 if repo['.'].obsolete(): | 620 if repo['.'].obsolete(): |
621 ui.warn(_('working directory parent is obsolete!\n')) | 621 ui.warn(_('working directory parent is obsolete!\n')) |
622 wlock = None | |
623 try: | |
624 wlock = repo.wlock() | |
625 repo._afterlock(warnobsolete) | |
626 res = origfn(ui, repo, *args, **opts) | |
627 finally: | |
628 lockmod.release(wlock) | |
622 return res | 629 return res |
623 | 630 |
624 # XXX this could wrap transaction code | 631 # XXX this could wrap transaction code |
625 # XXX (but this is a bit a layer violation) | 632 # XXX (but this is a bit a layer violation) |
626 @eh.wrapcommand("commit") | 633 @eh.wrapcommand("commit") |