[BUG] Re: Adding and reverting a file deletes the file

Michael Ellerman michael at ellerman.id.au
Fri Oct 7 02:58:57 BST 2005


On Fri, 7 Oct 2005 11:24, Aaron Bentley wrote:
> Michael Ellerman wrote:
> > A little more clearly:
> >
> > concordia ~/test$ bzr init
> > concordia ~/test$ echo "priceless data" > text
> > concordia ~/test$ bzr commit -m unchanged --unchanged
> > concordia ~/test$ bzr add text
> > added text
> > concordia ~/test$ bzr revert
> > concordia ~/test$ cat text
> > cat: text: No such file or directory
> > concordia ~/test$
> >
> > That's a bug. At the time of the commit, "text" is unknown, so revert
> > should restore it to that state - not delete it.
>
> Unfortunately, it's not as clear-cut as that.
>
> First, 'revert' is not 'undo'.  It doesn't undo all operations since the
> last commit, it restores the tree to the state it was in at the last
> commit.  It's successfully accomplishing that.  Deleting potentially
> valuable data, but restoring the state.

I disagree, revert is being over zealous. At the time of the commit bzr knows 
nothing about the existence or non-existence of the file "text". "revert" is 
making the assumption that because bzr didn't know of the file at the time of 
the commit, the file didn't exist. That is wrong.

I agree that we don't have enough information to do the right thing. But we 
have two options. At the time of the commit the file either existed, or 
didn't exist - revert can chose one of those options. Currently it guesses 
that the file didn't exist, I think that's the wrong choice because it's 
lossy.

> But when we want to add a file that's not there, it's pretty clear that
> we've got to create it.  It's less clear what to do when we remove a
> file.  But if we always removed, never deleted, then merge would be a
> vector for installing unversioned files.

I think you're referring to foo.(THIS|OTHER|BASE) ? Isn't that just a 
"feature" of the merge code?

cheers

-- 
Michael Ellerman
IBM OzLabs

email: michael:ellerman.id.au
inmsg: mpe:jabber.org
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051007/bf076b6b/attachment.pgp 


More information about the bazaar mailing list