[PATCH] color: enabled color support for export command (issue1507)

Matt Mackall mpm at selenic.com
Tue Sep 4 12:51:49 CDT 2012

On Sun, 2012-09-02 at 08:56 +0200, Gilles Moris wrote:
> On Thursday 30 August 2012 11:25:15 pm Matt Mackall wrote:
> > > color: enabled color support for export command (issue1507)
> > >
> > > The export command didn't output the diffs in color, even when color
> > > support was enabled. This patch fixes that by making the export command
> > > use the default ui.write method, instead of directly manipulating the
> > > ui.fout file object. Also added a test case to verify color output to
> > > test-export.t.
> >
> > I guess this is ok. Historically, 'hg export' exists to work with
> > 'patch' or 'hg import', being pretty is not a goal. But I guess I
> > occasionally use 'hg export' to look at patches rather than 'hg log
> > -vpr'.
> I don't like that. Normally "color" is shut down for non tty output.
> But this increase the risk that export creates a non usable export patch if 
> this detection fails for some reasons.
> We have "hg log -pvr" that does the job for coloring output, and "hg export" 
> should be just for exports. I don't see the point of risking to break scripts 
> when we already have a solution.

Because people have decided that 'hg export' is useful for visually
inspecting diffs. As I said above, I can't argue with them: I use it

Nor do I think that there is any argument that can draw a useful
distinction between the intended purposes of 'hg diff' and 'hg export'
that would justify the former supporteing color and the latter not.
After all, the former says 'diff' right on the tin, so it had better
produce a valid diff whenever we hand its output to patch.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list