Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of Mercurial hg bundle and hg export vs merging?

When exactly would you use hg export and hg bundle?

These commands are listed on the Mercurial quick start guide but we're not clear when to use them.

Currently we manage dev by having different repositiories and merging between them. Ie:

cd myapp-1.01
hg pull ../myapp-1.0
hg merge
hg commit
hg push

When would you use export and bundle instead of the approach we use?

like image 655
Marcus Leon Avatar asked Mar 02 '11 15:03

Marcus Leon


2 Answers

The primary difference is whether or not the parent changeset exists in the destination repository. If for example your source repo has this:

[A]--[B]---[C]

and your destination has this:

[A]--[B]

and you want to send [C] you could use bundle (or just push/pull).

If, however, your destination repository had:

[A]--[D]

and you wanted to add [C] to it you'd have to use export and import.

In brief: bundle is for when you want to do push/pull but don't have a good network path, and export is for when you want to send the logical contents of a changeset rather than that specific, exact changeset.

like image 96
Ry4an Brase Avatar answered Nov 15 '22 23:11

Ry4an Brase


  • Bundle is better fit to save a specified range of changesets into a file for easy transfer (such as, sending them by email to be applied to a different repository somewhere else).

    From hg --help bundle:

    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.

  • Export seems to generate a list of headers+diffs for some range of changesets, but the helpfile doesn't mention if this helps automate transferring them somewhere else.

    Moreover the file output argument for export is formattable according to revision number etc, which leads me to believe that the command would be commonly used to save revisions in a way that makes it easier for you to look at them (as files).

like image 40
Dan Avatar answered Nov 16 '22 00:11

Dan