How to restore from a mercurial backup

11,498

Solution 1

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).

Solution 2

Another possibility is simply using hg clone:

hg clone name.hg name/
Share:
11,498
devgp
Author by

devgp

Nut

Updated on June 03, 2022

Comments

  • devgp
    devgp about 2 years

    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