# HG changeset patch # User Pierre-Yves David # Date 1446853036 18000 # Node ID e080d2ae265602f8f9e77e3f36b64334080c28de # Parent c2a772ade409699130bbac1a31319c932b3858b5 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. diff -r c2a772ade409 -r e080d2ae2656 hgext/evolve.py --- 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")