What constitutes the "identity" of a changeset?
James Westby
jw+debian at jameswestby.net
Fri Mar 28 19:46:01 GMT 2008
On Fri, 2008-03-28 at 19:21 +0000, Paul Moore wrote:
> This may not be a valid question in the context of Bazaar, but bear with me...
>
> In Mercurial, a changeset is identified by its ID, which is a hash of
> all the data and metadata making up the changeset, plus the ID(s) of
> its parent(s). So changeset identity is directly related to the
> content of the change, and its history. I find this notion of identity
> very easy to understand. And it has the nice property that it does not
> include "where the changeset came from".
First, changeset is a loaded term, as a lot of people see it more like
a diff, whereas what bzr and mercurial deal in is snapshots, so
we usually prefer the term "revision". Mercurial uses the changeset
name, but I believe it is still snapshot based.
>
> The other day I hit a problem with Bazaar which makes me thing that
> changeset identity is handled differently in Bazaar, and I can't find
> a concise explanation of what constitutes identity in Bazaar.
>
> Just to explain, the problem I hit was in using the bzr-svn plugin. I
> was trying to start a branch from one place (a local svnclone mirror,
> IIRC) and then pull further changes from the original repository (over
> http). I got an error saying that the branches "were unrelated". But
> they were, in some fundamental sense, the same changes - only the
> source differed. In Mercurial terms, I believe they would have been
> the same. Possibly if the 2 sources had been pure Bazaar repositories
> they would have been the same - it may be that bzr-svn cannot make
> such strong changeset identity guarantees simply because of the
> limitations of Subversion.
That's exactly the problem. bzr-svn trades off somethings in return
for gaining others. It uses the repository to provide determinstic
revision ids so that bzr can identify two separate bzr-svn branches
as being related. However it can't match up revisions from two
separate svn repositories, as it has no idea whether they are related
or not.
>
> Hence my question - what *is* changeset identity to Bazaar? Is it a
> constant, or does it vary depending on the backend, somehow?
>
A revision is uniquely identified by it's revision id. Two revisions
with the same id must be identical, two revisions with different
ids are considered to be different.
The revision then ties this together with the tree state, and the
revision metadata, including the parents, just as in Mercurial.
The difference is the mercurial derives the name from the data,
bzr uses an arbitrary name and just associates it with the data.
> Paul.
>
> PS This is precisely the sort of "gory details" I would like to see in
> the manuals somewhere. As you can see from the Mercurial example, it
> doesn't have to be complex to state (although maybe it is) but it
> should be explained somewhere, so that people can hold a clear
> understanding in their mind of what it means for 2 changesets to be
> "the same".
I agree that it's important to have this, in particular to stress
that revisions are immutable, as a lot of people don't grasp that,
and then try and build their understanding on these shaky foundations.
Thanks,
James
More information about the bazaar
mailing list