Commit meta data and extensions

Greg Ward greg-hg at gerg.ca
Thu Jan 7 15:38:01 CST 2010


On Thu, Jan 7, 2010 at 10:52 AM, Tory Patnoe <tpatnoe at cisco.com> wrote:
> I'm new to Mercurial and am looking for a way to track meta-data with each
> commit to a specific branch. The meta-data I'm looking to track is a task id
> and story id from an agile development system.
>
> We plan on working in a central-repo with gatekeeper work-flow.
>
> I saw the bugmap extension posting in the mailing lists but I'm thinking of
> something more integrated with mercurial. I think bugmap might work if the
> bugmap data could be pushed/pulled between repos. Is that possible with an
> extension? That way I could change/update meta-data without changing the
> history of a commit. Although this could lead to merge conflicts on the
> meta-data or even meta-data pointing to non-existent revisions.

When designing bugmap, I discussed this with a colleague.  The main
alternative design that we thought about was this:

  * put bug IDs (metadata) right in the commit message, with a hook to
enforce syntax
  * add a version-controlled file, .hgbugmap, that allows overriding
the bug ID for
    any particular changeset
  * wrap log-like commands (changectx.description(), to be precise) to look for
    overrides in .hgbugmap when displaying a changeset

So .hgbugmap would grow over time, but slowly: only when someone needs
to correct a bad bug ID in a commit message.  The unbounded growth did
not bother me, but it did bother my colleague.  But the *real* reason
we rejected this was that failure is non-obvious: if you don't have
the extension enabled, you will see some incorrect bug IDs.  With
bugmap as implemented, not enabling the extension means no bug IDs at
all, which is immediate and obvious.

One straw-man that we kicked down pretty quickly was:

  * no bug IDs in the commit message
  * every changeset/bug mapping stored in .hgbugmap
  * wrap changectx.description() similarly to above

But that's a horrible idea, since it means one commit to .hgbugmap for
every real changeset.  No thanks!

What would be *really* cool would be if it were possible for
extensions to extend the push/pull protocol and send additional data
(say, .hg/store/bugmap).  There was a start at adding this capability
a few months ago on the devel list, but it seems to have gone nowhere.

Greg


More information about the Mercurial mailing list