0

Git has a "filter" feature, which makes it possible to check in a processed version of files. E.g., this answer shows how IPython notebook files can be filtered so that embedded output data is excluded from commits. Basically:

  1. Create a filter script, e.g., dropoutput, and put it in your path.

  2. Create the file ~/.gitattributes, with the following content

    *.ipynb    filter=ipynb_filter
    
  3. Run some more configuration commands to put it all together ("ipynb_filter" is just a symbolic name, so it needs to be pointed to the filter script.)

The effect is that when you try to check in a .ipynb file, you actually check in the filtered version. The file in the working directory is not altered (but presumably has status "clean" since it has just been committed).

So: Is there a way to get the same functionality in mercurial? I googled and dug around the help a little but nothing came up.

Community
  • 1
  • 1
alexis
  • 48,685
  • 16
  • 101
  • 161
  • Thanks, indeed that question comes pretty close. The `[encode]`/`[decode]` device is tagged as an "unloved" feature (aka "we'd deprecate it if we could"), but that doesn't disqualify it as an answer I guess... – alexis Nov 13 '15 at 10:24
  • Just marked my own question as duplicate. I really like this new(?) feature! :-) (The action shows as [Community](http://stackoverflow.com/users/-1/community) for some reason). – alexis Nov 13 '15 at 10:25

0 Answers0