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

Christian Ebert blacktrash at gmx.net
Sat Feb 9 16:22:32 CST 2008

Hi Jesse,

* Jesse Glick on Saturday, February 09, 2008 at 13:13:20 -0500
> # 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.
> (Does not trigger expansion of keyword arguments when using keyword
> extension, though that might be desirable as well.)


keywords are expanded for "hg cat" because expansion happens
before applying any filters. That's still the behaviour after I
cancelled a different approach inspired by you (was not working
with update).

iirc, you would have preferred "hg cat" to *not* expand keywords,
but this is not the case, unless you use one of my broken

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -466,7 +466,10 @@ def cat(ui, repo, file1, *pats, **opts):
>     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()

ctx.filectx(abs).data() reads filelog, which is actually
kwfilelog for files matching [keyword] config pattern, and thus
contains data with keywords expanded.

Or do you want keywords expanded for "hg cat -d" even for files
/not/ configured in [keyword] section?

[...] wirklich! wie ich jetzt bin,
hab ich keinen Namen für die Dinge
und es ist mir alles ungewiß.
_HÖLDERLIN: H Y P E R I O N_ <http://www.blacktrash.org/hyperion/>

More information about the Mercurial-devel mailing list