cat --decode: Drop short option, use opts.get() instead of opts[]
authorThomas Arendsen Hein <thomas@intevation.de>
Thu, 14 Feb 2008 11:25:30 +0100
changeset 6094 3998c1b0828f
parent 6093 f5b00b6e426a
child 6095 a799a06778f3
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.
mercurial/commands.py
tests/test-dispatch.out
tests/test-encode
--- 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 @@
                                              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 @@
         (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":
--- 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 @@
 
  -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
 
--- 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 @@
 
 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