Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore from a mercurial backup

Tags:

mercurial

I created a backup of my mercurial repository using

hg bundle --all name.hg

Now, how would i restore my repository using the backup file? Say if my whole repository is corrupted and all i have is just this *.hg file., Is it possible to restore my repository(assuming that is what backup is supposed to be for., but did i miss any step while backing up the repository ?)

Could someone please help me with this.

Thanks in advance

like image 997
devgp Avatar asked Nov 29 '11 01:11

devgp


2 Answers

To quote the help page:

The bundle file can then be transferred using conventional means and applied to another repository with the unbundle or pull command. This is useful when direct push and pull are not available or when exporting an entire repository is undesirable.

So you would be creating a new empty repository and pull from your backup file.

hg unbundle [-u] FILE...

apply one or more changegroup files

    Apply one or more compressed changegroup files generated by the
    bundle command.

options:

 -u --update  update to new tip if changesets were unbundled

Note that you can also use regular file system tools to backup your repository. Bundles are useful when you need to transfer a set of changes somewhere else (or when disk space for the backup is an issue, because they are compressed and smaller than the on-disk repo itself).

like image 169
Thilo Avatar answered Oct 01 '22 06:10

Thilo


Another possibility is simply using hg clone:

hg clone name.hg name/
like image 41
c4baf058 Avatar answered Oct 01 '22 05:10

c4baf058