how to undelete a file

Asked by pdf23ds

How do I get a file back that I deleted a few revisions ago, with history? If there's currently not a way to do this, it would be a good use case for "bzr copy" besides the normal "split a file" scenario. (I can think of a couple more use cases, but don't know where to put them.)

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Martin Pool (mbp) said :
#1

On Wed, Nov 12, 2008 at 12:19 PM, pdf23ds
<email address hidden> wrote:
> New question #51092 on Bazaar:
> https://answers.launchpad.net/bzr/+question/51092
>
> How do I get a file back that I deleted a few revisions ago, with history? If there's currently not a way to do this, it would be a good use case for "bzr copy" besides the normal "split a file" scenario. (I can think of a couple more use cases, but don't know where to put them.)

bzr revert -r 1234 goo.py

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Magnus Blåudd (msvensson) said :
#2

It can be hard to find the revision where it disappears. To avoid the need to find which revision you can use "last" in the revision specifier.

bzr revert -r last:2 <file>

For example I wanted to resurrect outfile.result and tried the below commmands until it showed up again.

msvensson@pilot:~/mysql/6.2-merge$ bzr revert mysql-test/r/outfile.result
bzr: ERROR: Path(s) are not versioned: mysql-test/r/outfile.result

msvensson@pilot:~/mysql/6.2-merge$ bzr revert -r last:1 mysql-test/r/outfile.result
bzr: ERROR: Path(s) are not versioned: mysql-test/r/outfile.result

msvensson@pilot:~/mysql/6.2-merge$ bzr revert -r last:2 mysql-test/r/outfile.result
+N mysql-test/r/outfile.result

Aha! There it is. :)

Revision history for this message
Martin Pool (mbp) said :
#3

As it happens someone just posted http://launchpad.net/bzr-undelete to
help with this

--
Martin <http://launchpad.net/~mbp/>

Can you help with this problem?

Provide an answer of your own, or ask pdf23ds for more information if necessary.

To post a message you must log in.