[Bug 87548] Re: bzr add and revert on symlink deletes symlink
Aaron Bentley
aaron.bentley at utoronto.ca
Mon Jul 16 14:02:07 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Kent Gibson wrote:
> Aaron Bentley wrote:
>> Kent Gibson wrote:
>
>>> All I want is some command that will undo an accidental add. For
>>> normal files that appears to be revert. For symlinks ???
>> For all files, it is "bzr remove --keep".
>
> So it does. Not being a big user of bzr remove, in fact I don't think
> I've ever used it, I hadn't thought of that.
>
> I'm still interested in the explanation for the inconsistent behaviour
> of bzr revert.
The purpose of revert is not to be an "undo" command. It is to restore
the files to some previous state. So originally, it deleted any files,
directories, or symlinks that were not present in the target state.
But some people were concerned that it could accidentally delete
valuable files. So they made me change it so that it files are
unversioned, rather than being deleted. Directories and symlinks are
not preserved, because they are trivial to recreate.
This lead to problems, because reverting could accumulate cruft: files
that should have been deleted, which remained in the way. More
recently, I have modified revert so that files which were automatically
created are not preserved.
> I'm also inclined to think the appropriate command to undo an
> accidental add should be revert.
You're wrong. Remove --keep has perfect symmetry with add. revert has
complicated behavior.
> To use other examples, if I
> accidentally remove a file then revert is used to put it back.
It won't put it back to the state it was in when you removed it. It
will put it back to the state it was in when you last committed. They
may be the same, but not necessarily.
> If I
> move a file accidentally, then revert will move it back.
It will also modify its content.
> That makes
> revert feel like an undo command
It's not, and was never meant to be.
, and, be it by accident or design,
> that is a feature I like.
I would love if someone would implement a real undo command. Revert
isn't it.
> I don't like having to think which commands
> revert does work for and which commands require a different undo
> command.
It would certainly be nice to have an undo command.
> And to add to the confusion, revert does work as I expect
> for normal files, but not symlinks.
I suspect revert does not work the way you expect for files. Were you
aware that it will delete files that were automatically added, but not
files that were user-added?
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGm2xP0F+nu1YWqI0RAlhNAJ92E3vdaAiGPR+guMpbww8JbIrjxACfSGAk
6Y/OcUut+8qEwEy6c/71mUA=
=siWW
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list