[PATCH 0 of 1] Interest for convert option --contentsfilter?

Greg Ward greg at gerg.ca
Sat Apr 23 19:54:11 CDT 2011


On 18 April 2011, Jason Harris said:
> Hi All,
> 
> I was wondering if there was interest in an option --contentsfilter for convert.
> Here is a description:
> 
>     The contentsfilter can potentially transform the contents of every file at
>     every revision as the conversion happens. If the --contentsfilter scriptname
>     option is specified, then scriptname should be the full path name of a
>     script which takes three arguments - (i) original file name, (ii) the
>     original changeset hash, and (iii) the original contents of the file. The
>     script should transform the passed in file contents into the desired final
>     output form and write this to stdout. The result code returned should be 0
>     if the contents were modified and 1 if the contents did not need
>     modification.

Definitely!  However, invoking a child process for every file in every
converted changeset could be a bit expensive.  Please don't forget
that there are lots of people out there with 100,000+ changesets and
20,000+ source files.  (Just picking random numbers out of the air...)

So what about having the user provide a Python source file that
implements certain functions, e.g. contentfilter()?

Future additions to the interface could add stuff for selecting files,
mutating changelog metadata, etc.  (If you don't implement
selectfiles(), then convert doesn't call it.)  This would be a
much more general and powerful interface than filemap or authormap.

        Greg
-- 
Greg Ward                                http://www.gerg.ca/
I am deeply CONCERNED and I want something GOOD for BREAKFAST!


More information about the Mercurial-devel mailing list