diff mercurial/commands.py @ 6093:f5b00b6e426a

Option --decode for hg cat to apply decode filters. (Does not trigger expansion of keyword arguments when using keyword extension, though that might be desirable as well.)
author Jesse Glick <jesse.glick@sun.com>
date Sat, 09 Feb 2008 13:05:22 -0500
parents ea33f695304a
children 3998c1b0828f
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Feb 13 23:49:57 2008 +0100
+++ b/mercurial/commands.py	Sat Feb 09 13:05:22 2008 -0500
@@ -466,7 +466,10 @@
     for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts,
                                              ctx.node()):
         fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
-        fp.write(ctx.filectx(abs).data())
+        data = ctx.filectx(abs).data()
+        if opts['decode']:
+            data = repo.wwritedata(abs, data)
+        fp.write(data)
         err = 0
     return err
 
@@ -2765,6 +2768,7 @@
         (cat,
          [('o', 'output', '', _('print output to file with formatted name')),
           ('r', 'rev', '', _('print the given revision')),
+          ('d', 'decode', None, _('apply any matching decode filter')),
          ] + walkopts,
          _('hg cat [OPTION]... FILE...')),
     "^clone":