remove: add --keep-dirs option to disable removing empty directories

JonnyDee jonny.dee at gmx.net
Tue Sep 1 17:14:08 CDT 2009


On Sep 1, 10:21 pm, Jonny Dee <jonny.... at gmx.net> wrote:
> Matt Mackall schrieb:
> > On Sat, 2009-08-29 at 02:31 +0200, jonny.... at gmx.net wrote:
> >> # HG changeset patch
> >> # User Jonny Dee <jonny.... at gmx.net>
> >> # Date 1251504955 -7200
> >> # Node ID 34a07e4df72be5cd59bd3acddcf193f9ebab16ca
> >> # Parent  3a78bbc5766064b0338859b25e183ea9514f4ec3
> >> remove: add --keep-dirs option to disable removing empty directories.
>
> >> Mercurial normally deletes empty directories when removing files
> >> would leave them empty. This patch will add a new option --keep-dirs
> >> to the 'remove' command which, when specified on command line, will
> >> make Mercurial keep local empty directories.
>
> > Not sure how I feel about this option. There are about five other places
> > we'd need to add this option for consistency (update/revert/import..). I
> > think that puts it over the edge of too complex/too obscure to be a
> > command line option.
>
> > Also, this command either requires the user have foresight (in which
> > case they don't really need it) or use [defaults]/[aliases] to be
> > useful. Which makes it look like it wants to be a config option.
>
> [...]
>
> If I knew a patch for an implementation using the config variant would
> have a real chance for getting accepted I would try to implement it
> consistently by taking into account update/revert/import and other commands
> I am not aware of at the moment. However, if you know in advance it's not
> worth giving it a try I will just forget my wish...and try to get used to
> Mercurial's own way of handling empty directories...

I had a look into the Mercurial code and I think I'm not able to
extend
Mercurial in that way without a considerable amount of time. I checked
an
extension approach as well as the simpler solution to change Mercurial
directly. But both approaches require much deeper insight into
Mercurial's
internals (w.r.t. update/revert/import command) than my 'remove' only
solution I suggested in my patch.

So I think I will give up here... But thanks anyway to all who helped
me
develop my suggested patch.

Best regards,
Jonny Dee



More information about the Mercurial-devel mailing list