Mercurial > hg
changeset 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 | 911f5be5d159 |
children | 3998c1b0828f |
files | mercurial/commands.py tests/test-cat tests/test-cat.out tests/test-dispatch.out tests/test-encode tests/test-encode.out |
diffstat | 6 files changed, 21 insertions(+), 1 deletions(-) [+] |
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":
--- a/tests/test-cat Wed Feb 13 23:49:57 2008 +0100 +++ b/tests/test-cat Sat Feb 09 13:05:22 2008 -0500 @@ -8,6 +8,7 @@ hg ci -A -m m -d "1000000 0" hg rm a hg cat a +hg cat --decode a # more tests in test-encode sleep 1 # make sure mtime is changed echo 1 > b hg ci -m m -d "1000000 0"
--- a/tests/test-cat.out Wed Feb 13 23:49:57 2008 +0100 +++ b/tests/test-cat.out Sat Feb 09 13:05:22 2008 -0500 @@ -3,5 +3,6 @@ 0 0 0 +0 a: No such file in rev 03f6b0774996 1
--- a/tests/test-dispatch.out Wed Feb 13 23:49:57 2008 +0100 +++ b/tests/test-dispatch.out Sat Feb 09 13:05:22 2008 -0500 @@ -21,6 +21,7 @@ -o --output print output to file with formatted name -r --rev print the given revision + -d --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 Wed Feb 13 23:49:57 2008 +0100 +++ b/tests/test-encode Sat Feb 09 13:05:22 2008 -0500 @@ -32,3 +32,11 @@ echo %% uncompress our new working dir copy gunzip < a.gz + +echo %% check hg cat operation +hg cat a.gz +hg cat -d a.gz | gunzip +mkdir subdir +cd subdir +hg -R .. cat ../a.gz +hg -R .. cat -d ../a.gz | gunzip
--- a/tests/test-encode.out Wed Feb 13 23:49:57 2008 +0100 +++ b/tests/test-encode.out Sat Feb 09 13:05:22 2008 -0500 @@ -7,3 +7,8 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved %% uncompress our new working dir copy this is a test +%% check hg cat operation +this is a test +this is a test +this is a test +this is a test