views:

45

answers:

1

I deleted a project in my solution, committed many times and now found out that I still need that deleted project. Is there a way to restore it with keeping it's history?

+1  A: 

Assuming what was deleted was actually tracked in the repository:

hg revert -r (last-revision-where-files-still-existed) path/to/files/that/were/deleted

By doing this, you are simply telling mercurial to bring back those files, as they were when you deleted them. No other files will be reverted, just take care to specify their previous locations correctly. You can find that just going through your history.

From the output of hg --help revert :

If a file has been deleted, it is restored. If the executable mode of a file was changed, it is reset.

And for reference (the options) [-r is what you want here]:

options:

 -a --all        revert all changes when no arguments given
 -d --date       tipmost revision matching date
 -r --rev        revision to revert to
    --no-backup  do not save backup copies of files
 -I --include    include names matching the given patterns
 -X --exclude    exclude names matching the given patterns
 -n --dry-run    do not perform actions, just print output

use "hg -v help revert" to show global options
Tim Post