bundle->patch
Haszlakiewicz, Eric
EHASZLA at transunion.com
Wed May 18 21:04:10 UTC 2011
> -----Original Message-----
> From: mercurial-bounces at selenic.com [mailto:mercurial-
>
> On Tue, 2011-05-17 at 17:20 -0400, Sam Steingold wrote:
> > is there a way to extract information from a bundle?
> > e.g., convert it to a patch, find out the changelog...
> > thanks!
>
> If and only if you have a repo it applies to. Then you can do:
>
> hg -R bundle.hg <any command>
>
> ..which will act as if the bundle had been unbundled.
Theoretically you should be able to get at least the changelog information (commit message, user, etc...) out w/o having the repository, but I don't know if there's an easy to use implementation that will dump that for you. I'll bet it wouldn't be too hard to implement something like a "hg bundle --info mybundle" command that can dump that out for you.
If you're just eyeballing it, it's not too hard to figure out what the commit message is just by running this:
dd bs=4 skip=1 if=mybundle | bzip2 -c -d - | more
The "patch" part of the bundle is a series of chunks that describe what to remove from a file and from where, and what to replace it with (if anything). While some of that could be useful on its own (e.g. text being added), you can't produce a normal patch like the "diff" command would w/o having the original files. Especially lacking will be any of the removed bytes, since the bundle will only indicate the range of bytes that were removed, not what used to be there.
http://mercurial.selenic.com/wiki/BundleFormat has all the gory details.
eric
More information about the Mercurial
mailing list