[PATCH] Option --decode for hg cat to apply decode filters

Thomas Arendsen Hein thomas at intevation.de
Thu Feb 14 04:25:54 CST 2008


* Jesse Glick <Jesse.Glick at sun.com> [20080209 19:21]:
> # HG changeset patch
> # User Jesse Glick <jesse.glick at sun.com>
> # Date 1202580322 18000
> # Node ID b7a9b52d57edfa8e93f562185e62e4fc6437cd9e
> # Parent  e2cbdd93134105f9c11f05c6e2a4c32e5a0e6945
> Option --decode for hg cat to apply decode filters.

Pushed to crew followed by:

# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Date 1202984730 -3600
# Node ID 3998c1b0828f60d6ef84d8dc43ee763c4862cd63
# Parent  f5b00b6e426a058dd983585d4e070a523b420d01
cat --decode: Drop short option, use opts.get() instead of opts[]

- hg archive --no-decode has no short option, too, and maybe both could use
  -d in the future to select revisions by date.
- opts.get makes python scripts calling cat() happy, because they don't have
  to pass the new option.

diff -r f5b00b6e426a -r 3998c1b0828f mercurial/commands.py
--- a/mercurial/commands.py	Sat Feb 09 13:05:22 2008 -0500
+++ b/mercurial/commands.py	Thu Feb 14 11:25:30 2008 +0100
@@ -467,7 +467,7 @@ def cat(ui, repo, file1, *pats, **opts):
                                              ctx.node()):
         fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
         data = ctx.filectx(abs).data()
-        if opts['decode']:
+        if opts.get('decode'):
             data = repo.wwritedata(abs, data)
         fp.write(data)
         err = 0
@@ -2768,7 +2768,7 @@ table = {
         (cat,
          [('o', 'output', '', _('print output to file with formatted name')),
           ('r', 'rev', '', _('print the given revision')),
-          ('d', 'decode', None, _('apply any matching decode filter')),
+          ('', 'decode', None, _('apply any matching decode filter')),
          ] + walkopts,
          _('hg cat [OPTION]... FILE...')),
     "^clone":
diff -r f5b00b6e426a -r 3998c1b0828f tests/test-dispatch.out
--- a/tests/test-dispatch.out	Sat Feb 09 13:05:22 2008 -0500
+++ b/tests/test-dispatch.out	Thu Feb 14 11:25:30 2008 +0100
@@ -21,7 +21,7 @@ options:
 
  -o --output   print output to file with formatted name
  -r --rev      print the given revision
- -d --decode   apply any matching decode filter
+    --decode   apply any matching decode filter
  -I --include  include names matching the given patterns
  -X --exclude  exclude names matching the given patterns
 
diff -r f5b00b6e426a -r 3998c1b0828f tests/test-encode
--- a/tests/test-encode	Sat Feb 09 13:05:22 2008 -0500
+++ b/tests/test-encode	Thu Feb 14 11:25:30 2008 +0100
@@ -35,8 +35,8 @@ gunzip < a.gz
 
 echo %% check hg cat operation
 hg cat a.gz
-hg cat -d a.gz | gunzip
+hg cat --decode a.gz | gunzip
 mkdir subdir
 cd subdir
 hg -R .. cat ../a.gz
-hg -R .. cat -d ../a.gz | gunzip
+hg -R .. cat --decode ../a.gz | gunzip

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Osnabrueck - Register: Amtsgericht Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list