Mercurial > evolve
diff hgext/evolve.py @ 1527:e080d2ae2656 stable
parents: avoid locking the repository during 'hg parents'
The wrapping code was initially written for update and pull who need the lock
anyway. We duplicated the logic in the parent case to remove the need for
locking.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 06 Nov 2015 18:37:16 -0500 |
parents | c15d6168412f |
children | afb0a33c4f6c |
line wrap: on
line diff
--- a/hgext/evolve.py Fri Nov 06 18:02:05 2015 -0500 +++ b/hgext/evolve.py Fri Nov 06 18:37:16 2015 -0500 @@ -678,16 +678,19 @@ # This section take care of issue warning to the user when troubles appear + +def _warnobsoletewc(ui, repo): + if repo['.'].obsolete(): + ui.warn(_('working directory parent is obsolete!\n')) + if (not ui.quiet) and obsolete.isenabled(repo, commandopt): + ui.warn(_('(use "hg evolve" to update to its successor)\n')) + @eh.wrapcommand("update") -@eh.wrapcommand("parents") @eh.wrapcommand("pull") def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): """Warn that the working directory parent is an obsolete changeset""" def warnobsolete(): - if repo['.'].obsolete(): - ui.warn(_('working directory parent is obsolete!\n')) - if (not ui.quiet) and obsolete.isenabled(repo, commandopt): - ui.warn(_('(use "hg evolve" to update to its successor)\n')) + _warnobsoletewc(ui, repo) wlock = None try: wlock = repo.wlock() @@ -697,6 +700,12 @@ lockmod.release(wlock) return res +@eh.wrapcommand("parents") +def wrapparents(origfn, ui, repo, *args, **opts): + res = origfn(ui, repo, *args, **opts) + _warnobsoletewc(ui, repo) + return res + # XXX this could wrap transaction code # XXX (but this is a bit a layer violation) @eh.wrapcommand("commit")