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

Martin Pool mbp at canonical.com
Mon Jun 19 06:31:06 BST 2006


On 19 Jun 2006, Michael Ellerman <michael at ellerman.id.au> wrote:
> On 6/19/06, Kevin Smith <yarcs at qualitycode.com> wrote:

> >Would it be possible for rm to check to see if the working file matches
> >what's been checked in? If it does, then deleting the file is safe
> >because you can revert. If not, I would be ok with an error message
> >telling me that if I *really* want to remove it, I have to say --force
> >or something.
> >
> >It might also fail if the file is archived but not present locally,
> >again requiring a --force option. Or maybe --unversion for this case,
> >and --delete for the opposite case above.
> >
> >That way, rm could normlaly remove the file locally and from the
> >archive, which would be consistent with mv. I think it's the least
> >surprising action, personally.
> 
> I think that could be _more_ suprising, because sometimes the file
> will be deleted and sometimes not. It might be obvious to you and me
> why it gets deleted sometimes and not others, but it's likely that
> some users won't get it.
> 
> It could print out "not deleting foo because it's modified locally"
> though to alleviate that.
> 
> My point of view on this is we want a do-what-I-mean interface, BUT
> deleting files is _really fraught with danger_, so it should be _hard_
> to make bzr delete your data for you.

I don't think the command should switch between delete and unversion;
rather it should either delete or fail.

Remember that when this changeset is updated or merged into another tree
the file will be deleted there too (unless there's a conflict).

So bzr rm behaves like this:

  working file missing		remove from inventory
  working file unmodified	delete from tree and inventory
  working file modified		if forced: delete, otherwise error

If you try to remove a directory the test for modification must be
recursive.

If you remove an unmodified file, bzr revert should put it back with the
same text.  If you use --force to delete a modified file then you may
have lost the data.  We can consider in future renaming it to a backup~.

We could also in future consider 'bzr rm --missing' which would treat
any missing files as intentionally deleted.

-- 
Martin




More information about the bazaar mailing list