Commits

Eduard-Cristian Stefan committed 4359249

Added colored output support for Mercurial 1.6+

For colored output on Mercurial 1.6+ the following options must be set:
[color]
mode = ansi

[pager]
hg16mode = yes

Comments (0)

Files changed (1)

   attend = annotate, cat, diff, export, glog, help, log, qdiff, status, tip
 
 Setting pager.attend to an empty value will disable paging.
+
+For colored output on Mercurial 1.6+ the following options must be set::
+
+  [color]
+  mode = ansi
+
+  [pager]
+  hg16mode = yes
 '''
 
 
         if not t:
             return orig(ui, options, cmd, cmdfunc)
 
+        # check Mercurial 1.6+ mode
+        hg16mode = ui.config('pager', 'hg16mode', 'no')
+
         # check for pager app and valid command
         p = ui.config('pager', 'pager', os.environ.get('PAGER'))
 
 
         ui.pushbuffer()
         exitcode = orig(ui, options, cmd, cmdfunc)
-        pcontent = ui.popbuffer()
+
+        if hg16mode == 'yes':
+            pcontent = ui.popbuffer(True)
+        else:
+            pcontent = ui.popbuffer()
 
         fname = tempfile.NamedTemporaryFile().name