hgext/obsolete.py
changeset 79 9906560f585e
parent 75 d7b11772f0b5
child 80 5d029a358252
--- 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, [], '<subject> <object>')}
 
+### 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
 #############################