bundle->patch

Matt Mackall mpm at selenic.com
Wed May 18 22:38:35 UTC 2011


On Wed, 2011-05-18 at 22:12 +0000, Haszlakiewicz, Eric wrote:
> > -----Original Message-----
> > From: Matt Mackall [mailto:mpm at selenic.com]
> > 
> > Theoretically, no, you can't, as it's delta-encoded against earlier
> > changelog entries. Because -everything- in a bundle is deltas against
> > stuff external to the bundle, they're generally useless on their own.
> > 
> > Practically, yes, you could probably extract most of the changelog
> > because most changelog deltas are "drop all the previous text, add new
> > text". But no tools exist.
> 
> The BundleFormat page says:
> Each non-null chunk in the Changelog group contains in its Data
> section a patch against a text that is only stored in the form of
> other patches, beginning with a patch against the empty string ("").
> 
> Which I'm interpreting as meaning that the changelog group for any bundle stands on its own.

No, that's simply saying that the null revision is considered to be an
empty string. So bundles against an empty repo have a defined basis.

> Are you saying that stuff like the commit message for rev N is actually a patch against the commit message for revision N-1?

Yes. Because it's a revlog, and revlogs store things as deltas.

> hmm... I also don't quite understand how the final text for the
> changelog group can have only a single filename if you're supposed to
> be able to have multiple files in one commit.  I must be missing
> something.

All parts of history in Mercurial are stored in revlogs, which are
mostly delta encoded; all bundle streams are delta-encoded and are
generated by calling revlog.group(), which is oblivious to the
differences between changelogs, manifests, and filelogs. So the stuff on
BundleFormat discussing changelog format is both incomplete and out of
place.

The actual textual format of a changelog entry is something like:

<manifest hash>\n
<author>\n
<seconds since epoch> <timezone> [<specially-escaped extra fields>]\n
<file 1>\n
<file 2>\n
...
\n
<multi-line description>

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list