Peg revisions

Eric Siegerman lists08-bzr at davor.org
Wed Feb 9 09:44:05 UTC 2011


On Tue, 2011-02-08 at 20:03 -0600, John Arbash Meinel wrote:
> I'm guessing [--name-from-revision] was added to force looking in the
revision before
> the working tree.

This seems like an ad-hoc attempt at Subversion's concept of "peg
revisions".  I've thought for some time that Bazaar could benefit
from the same idea, but have hesitated to suggest it because it
would entail a pretty thorough going-over of many (most?) of the
command syntaxes.  Since such a going-over seems to be in the
process of being born, though, now's the time :-)

Subversion distinguishes between what they call "peg" and
"operative" revisions.  The latter are what svn and bzr both mean
by "-rREV", i.e. the revision on which the command is supposed to
operate (cat, merge from, revert to, whatever).

One specifies a peg revision using the syntax "PATHNAME at PEG"; it
means "the file that had name PATHNAME in revision PEG".  It is
used *only* for what, in bzr terms, would be mapping the pathname
to a file-id.  The gist is that:
    svn cat -rOPER PATHNAME at PEG
does (their equivalent of) this:
  - maps (PATHNAME, PEG) to a FILE-ID
  - cats revision OPER's version the file with id FILE-ID

(Note that svn lets you express a thought that, in general, bzr
doesn't: "cat r16 of the file that, at r20, had name foo".)

There would have to be some adaptation to Bazaar's view of the
world, but a generic way to specify "the file that had this name
at revision X" would be *really* useful.

Peg and operative revisions are described in detail at:
http://svnbook.red-bean.com/en/1.5/svn.advanced.pegrevs.html,
including the algorithms involved, and the defaults for both
kinds of revisions if the user doesn't specify them.

(That page's "concept directory" example doesn't itself make much
sense in a Bazaar context.  To get the idea of it, consider as an
analogy a thing that one wouldn't ever do in Bazaar, but that
kind of makes sense in SVN: using a single mega-branch (analogous
to the SVN repo) to contain all of the (possibly unrelated)
projects one has ever put under version control.)

In summary, since people are thinking about looking deeply into
how Bazaar maps pathnames and revspecs to file-ids, and all the
corner cases thereof, and regularizing the various bzr
subcommands to do it the same way, please consider introducing
a peg-revision concept into the mix.  I think that, in the end,
it might simplify things for the people doing the work -- and I
strongly believe that it will do so for end users.

  - Eric





More information about the bazaar mailing list