remove vs rm vs forget (was [MERGE] remove --new)

Robert Widhopf-Fenk hack at robf.de
Sun Jun 4 23:21:39 BST 2006


On Sunday, June 4, 2006 at 17:34:50, Martin Pool wrote:
> On 29 May 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> > This patch adds support for "bzr remove --new", as discussed
> > earlier on the list.  As is frequently the case, the tests are
> > longer than the tested code.
> 
> This looks reasonable, but it reminds me of something else:
> 
> At the moment, 'bzr rm foo' makes foo unversioned, but doesn't
> remove it from the working directory.  This is a bit weird.
> 
> So I propose to do this:
> 
>   bzr rm foo -- delete it from the working directory and inventory
>   bzr remove foo -- just remove from the inventory, leave the file
> 
> 'remove' is not such a great name for it.  I had been thinking
> 'unversion', or 'forget' which would be consistent with hg. 

"hg forget" will only undo a "hg add", if used on an already
versioned file it will not unversion it.  In order to
unversion a file you have to use "hg remove".  I like that
bzr has no extra command for this, but "bzr revert".

"rm" should be an alias of "remove", but not something
different and it should create backup files if the file is
not versioned or modified (or fail like hg/svn do).  Nothing
is more annoying than losing file content while you just
tried to get it out of version control.  So "forget" is IMHO
a good name for tlas "delete-id" while not being consistent
with hg ... as Matthew said probably an option --no-delete
will do as well.  Anyway it is also consistent that "rm"
will actually delete the file like a "rm" in the shell would
have done since this is consistent with the other "shell"
commands (mv, mkdir) in bzr, maybe "rmdir" should be an
alias for "rm" too.

BTW "bzr revert" (and "bzr remove") is so quiet while most
other commands provide some messages what they are doing,
but it does not seem to be one line change.

And then since the file currently is not delete from the
working tree one gets  the warning below which is kind of
odd if the file was not modified.

/tmp/a > bzr remove f
/tmp/a > bzr revert
bzr: WARNING: Conflict adding file f.  Moved existing file to f.moved.
/tmp/a > hg rm f
/tmp/a > hg revert
undeleting f
/tmp/a > echo abcd >> f
/tmp/a > hg rm f
not removing f: file is modified

Robert




More information about the bazaar mailing list