Bazaar completely lost files by "revert"

John Arbash Meinel john at
Fri Feb 24 15:47:00 UTC 2012

Hash: SHA1

On 2/24/2012 4:24 PM, Artur Rataj wrote:
> Fortunately, revert appears to change only the local tree, so I
> have found the original files on the master tree.
> I am sorry for needlessly disturbing you.
> Cheers, Artur

bzr only saves ~1~ style files if you cannot reconstruct the text from
the committed revision. (eg if you do "bzr revert -r -2" and can get
back the original text with "bzr revert" then we don't save backup
files, because they are just noise.) If you have local changes to a
file, *then* we save the backup.

For example:

echo a > a
echo b > b
bzr init
bzr commit -m "start"
echo aa > a
echo bb > b
bzr commit -m "add aa and bb"

echo bbb > b
bzr revert -r -2

At this point, there should be a b.~1~ but not an a.~1~ because you
had content in B that cannot be reproduced (doing bzr revert will
restore a to what it was before the revert -r -2, but cannot restore
the content of b).

It is a little more complex than that, because after 'bzr merge' you
have files which may not be exactly the same as any committed
revision. But if you 'bzr revert' we don't create backups of all of
them, because you are able to just 'bzr merge' to get the content back
again. (Unless you did merge and then locally modified it, in which
case we *do* save a backup.)

I would agree that it could be documented more clearly in 'bzr help
revert', I'm not sure how to say it succinctly, though.


Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla -


More information about the bazaar mailing list