[PATCH 2 of 2 V2] extdiff: add --mode option

Ludovic Chabant ludovic at chabant.com
Sat Jan 12 12:26:25 EST 2019


Thanks for the comments!

> Maybe need to check the .gui flag of the tool. Otherwise the console
> would be messed up if the tool wasn't a GUI program.

Good point, although the existing extdiff code doesn't seem to be checking that, no? So should I do that in a separate patch?
 

> Well, I think it will produce 8 modes,
> dir-or-file x revpair-or-revrage x prompt-or-not.
> 
> And we can even get rid of the dir-or-file mode from command flags by
> registering two tools, one for dir-diff and the other for per-file-diff.
> I don't know if that is a better idea, but we'll never use the per-file
> mode if the tool had a decent support for directory diff. So it's a tool-
> specific property at some level.

It's not super important, but I disagree about the second-to-last-point here, since I actually wrote this patch with the intent of using per-file diffs with tools like BeyondCompare and vim+DirDiff, which both handle dir diffs pretty well. It's just that 95% of the time I want to see the diff of _all_ the files in a revision, and going through a dir-diff UI just adds unnecessary actions/clicks to get all those diffs to open.
The only times I want a dir-diff where I'm going to only look at _some_ of the files is when diffing a big merge.

As a result, I was indeed planning on configuring per-file-diffing by default in my .hgrc for those tools, while occasionally passing a dir-diff argument when appropriate. Sure, I could make 2 different tools in my .hgrc if we didn't want to expose new options to the CLI, but for some reason it feels wrong to force users to edit their .hgrc for that.

I see your point about modes vs flags. Like I said, I don't have very strong opinions about it so I guess I'll change the second patch and use some flags instead. Are we going for --per-file and --confirm then?

Note that the tool config in .hgrc would look a bit less elegant as a result, like this:

cmd.blah=/path/to/blah
opts.blah=--some-option -z
per-file.blah=true
confirm.blah=true

So instead I'm proposing a new config that specifies options for the hg extdiff command itself, like this:

cmd.blah=/path/to/blah
opts.blah=--some-option -z
hgopts.blah=--per-file --confirm

...but I don't know if that opens up potential abuse or something.  What do you think?

> A prompt could be shown for the directory diff. I don't think it's useful
> right now, but if we had a per-revision-diff mode, it would make some sense
> to show prompt to skip some revisions.

I would personally just ignore the prompt when showing only one revision in dir-diff mode, but yes, for a revision range dir-diff, it would definitely show a prompt between each revision.

-- 
 l u d o .
 . 8 0 17 80


More information about the Mercurial-devel mailing list