Commits

TK Soh committed 41e13e8

update to Mercurial 1.6 (tracebace caused by new color ext)

Closes #12

  • Participants
  • Parent commits d95c583

Comments (0)

Files changed (1)

             except OSError:
                 pass
     fancyopts.fancyopts([], commands.commitopts, opts)
-    return cmdutil.commit(ui, repo, shelvefunc, pats, opts)
+    
+    # wrap ui.write so diff output can be labeled/colorized
+    def wrapwrite(orig, *args, **kw):
+        label = kw.pop('label', '')
+        for chunk, l in patch.difflabel(lambda: args):
+            orig(chunk, label=label + l)
+    oldwrite = ui.write
+    extensions.wrapfunction(ui, 'write', wrapwrite)
+    try:
+        return cmdutil.commit(ui, repo, shelvefunc, pats, opts)
+    finally:
+        ui.write = oldwrite
 
 def listshelves(ui, repo):
     # Check for shelve file at old location first
                 ui.status("unshelve completed\n")
     except IOError:
         ui.warn('nothing to unshelve\n')
-    
-_ui = None
-
-def uisetup(ui):
-    # FIXME: no ui object passed to extsetup()?
-    global _ui
-    _ui = ui
-
-
-def extsetup():
-    try:
-        # enable color diff in shelve command via Color extension
-        color = extensions.find('color')
-        color._setupcmd(_ui, 'shelve', cmdtable, color.colordiff,
-                        color._diff_effects)
-    except KeyError:
-        pass
 
 cmdtable = {
     "shelve":