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?
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With