Revert implmentation and how to undo a bzr remove

Martin Pool mbp at sourcefrog.net
Mon Apr 11 02:30:50 BST 2005


On Sun, 2005-04-10 at 06:44 +1000, benjl at cse.unsw.edu.au wrote:
> Attached is an implementation of the revert command.
> 
> In implementing this I can upon two problems:
> 
> 1/ How to revert an add:
> 
> This isn't too bad, it is just a question of whether doing
> and "add" and then a "revert" should delete the file or
> not. Currently I've implemented the same behaviour as 
> would occur if you "add"ed a file and the "remove"d the file.
> E.g: Don't delete the file. This behaviour is also what is described
> in kill_version.txt:60.
> 
> Are there any arguments for actually deleting the file, so that the
> working copy is the same as repository copy?

I can imagine people wanting that, but not removing it is certainly
safer so let's go with that for now.

In some ways having remove not delete the file from the working
directory is quite nice.  It's reasonably common to have a file which
shouldn't be recorded, but which you don't want to delete either.  On
the other hand, when a remove arrives as part of an update presumably it
should remove the file.  This is a bit inconsistent.

> 2/ How to revert a remove:
> 
> I've got no idea how to do this. It seems that you currently
> can't:
> 
> bzr_test% touch foo                            
> bzr_test% bzr add foo
> bzr_test% bzr commit -m "Added foo"
> bzr_test% bzr status               
> bzr_test% bzr remove foo
> bzr_test% bzr status    
> ?       foo
> D       foo
> 
> Any advice on how this should be implemented?

It needs to put back the file-id that it previously had, by looking it
up in the basis inventory.  I think that's also what add should do, so
that you can use it to cancel a remove operation that is not yet
committed.

-- 
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050411/febec7e6/attachment.pgp 


More information about the bazaar mailing list