diff -r ddcc4bb6c4d4 -r 9906560f585e hgext/obsolete.py --- a/hgext/obsolete.py Wed Sep 14 17:55:17 2011 +0200 +++ b/hgext/obsolete.py Wed Sep 14 19:20:38 2011 +0200 @@ -86,6 +86,7 @@ from mercurial import pushkey from mercurial import discovery from mercurial import error +from mercurial import commands from mercurial.node import hex, bin, short from mercurial.lock import release @@ -228,6 +229,19 @@ cmdtable = {'debugobsolete': (cmddebugobsolete, [], ' ')} +### Altering existing command +############################# + +def wrapmayobsoletewc(origfn, ui, repo, *args, **opts): + res = origfn(ui, repo, *args, **opts) + if repo['.'].obsolete(): + ui.warn(_('Working directory parent is obsolete\n')) + return res + +def uisetup(ui): + extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) + extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) + ### serialisation #############################