[PATCH 1 of 1] remove: add --keep-dirs option to disable removing empty directories

Greg Ward greg-hg at gerg.ca
Fri Aug 28 14:23:03 CDT 2009


On Fri, Aug 28, 2009 at 1:15 PM, <jonny.dee at gmx.net> wrote:
> # HG changeset patch
> # User Jonny Dee <jonny.dee at gmx.net>
> # Date 1251476544 -7200
> # Node ID 6c36cb2abb00c4cd80d1307a2ef701dfd0448985
> # Parent  7345fa5e572e029362bc6f2f96af452607ebb1ff
> 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.

Much better!  BTW, you don't need to give an intro email to a single
patch.  Just run "hg email -rtip" and let patchbomb do the right
thing.

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2374,6 +2374,9 @@
>       -A     W  W  W  R
>       -Af    R  R  R  R
>
> +    If --keep-dirs is used, the local directories getting empty by
> +    removing files will not be deleted.

Bad grammar; I suggest

  Normally, Mercurial removes directories that it are left empty
  by removing all the files in them.  Pass --keep-dirs to disable this.

(IOW, you put it just fine in the checkin comment, so let's reuse that
wording in the help.  That's the text that people will actually see,
after all.)

The code change looks just fine to me, although I have not tested it.
All you need to do now is add a test case, probably by modifying
tests/test-remove.

Looking very good so far!

Greg



More information about the Mercurial-devel mailing list