Restoring history of a "bzr remove"d file

Forest Bond forest at alittletooquiet.net
Sat Feb 5 12:54:26 UTC 2011


Hi Eli,

On Sat, Feb 05, 2011 at 01:09:47PM +0200, Eli Zaretskii wrote:
> Recently, someone made a mistake in Emacs development: instead of
> using "bzr mv" to move a file to another directory, she used "bzr rm"
> followed by "bzr add" in the new directory.  This effectively lost all
> the history of the file prior to that.
> 
> To restore the lost history, the following procedure was used:
> 
>   . Reverse cherry-pick (with "bzr merge -r R1..R2") the offending
>     revisions.
>   . "bzr revert" everything except the file that was moved.
>   . "bzr rm" the file in its new directory.
>   . "bzr mv" the file from the old to the new directory.
>   . "bzr commit"
> 
> The problem is with the second step: it needs to manually specify a
> potentially long list of files, gleaned from "bzr status" or some
> such.
> 
> Is there a better way of doing the above?

I would do this:

  bzr merge -r R1..R2 old-path
  rm new-path                       # OR bzr merge --force -r R1..R2 new-path
  bzr mv old-path new-path
  bzr commit

[Note that the original revision may also have introduced changes to the
contents of the file, as well.  These changes are not preserved by any of the
methods we're discussing, but it would be relatively easy to do this.]

Hope this helps.

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110205/6c544af3/attachment.pgp>


More information about the bazaar mailing list