Add -i/--interactive switch to "hg add"

Jordi Gutiérrez Hermoso jordigh at octave.org
Tue Mar 18 09:05:19 CDT 2014


On Thu, 2014-03-13 at 12:20 +0400, Anton Gogolev wrote:
> To cut to the chase: wouldn't it be cool to have an "interactive add"
> session, when in response for "hg add *.* -i", Mercurial would ask for
> every untracked file what would you like to do with it:
> 
> - a - Add
> - i - Ignore (and add to .hgignore)
> - d - Delete
> - s - Skip

I really dislike this kind of UI, and I think most other people would
as well. The problem, I think, is that it's not very good navigation.
You can't go back and forth between the files, but you have to
linearly through all of them robotically answering questions, trying
to keep all of the context memorised in your head. Consider record vs
crecord; most people would agree that crecord is the superior
interface, because you can go back and forth *and* review what you're
doing as you're doing while you're doing it, and you have all of the
context immediately visible. Even better, with crecord at the end you
can still review one more time the patch that's about to be committed
and even edit it in the editor before it is.

Supposing you agree that crecord is a far better UI than record, a
more fundamental question is, an interactive mode like what you're
planning truly necessary? I find it very easy to pick which files to
add with shell globs if I'm using a CLI, or with thg's interface if
I'm using a GUI. For the CLI, several iterations of `hg add
SOME*GLOB*` followed by `hg status` and `hg status -i` are sufficient
UI to polish the added files and the .hgignore file (which I don't
think should be done automatically, as you almost always have to write
globs or regexps). Once I'm happy with what's getting added and
ignored, the rest gets deleted with `hg purge` (usually after I do a
commit).

You really think my CLI approach is not the best UI? Is there
something here that needs to be fixed?

- Jordi G. H.





More information about the Mercurial-devel mailing list