Changing commit text on push

Trevor Watson Trevor.Watson at Sun.COM
Fri Jan 26 10:59:33 UTC 2007


Benoit Boissinot wrote:
> On 1/25/07, Trevor Watson <Trevor.Watson at sun.com> wrote:
>> Before I start, let me say that I'm a complete newbie to Mercurial, 
>> although I
>> have plenty of SCCS and cvs experience.
>>
>> I'd like to operate Mercurial in a similar mode to CVS because that's 
>> what our
>> engineers are familiar with, and it also serves the project well.
>>
>> I have a central repository set up which will be the "master" if you 
>> like and
>> all developers will push changesets to this repository.
>>
>> What I want to be able to do is to validate that the changeset is 
>> approved for
>> commit before the push transaction is completed. I have a 
>> pretxnchangegroup
>> hook set up for this. Validation means checking that the first line of 
>> the
>> commit text contains a construct like:
>>
>> IN=nnnnnn
>>
>> or
>>
>> IN=auto
>>
>> In the former case, the developer will have obtained an approval 
>> number from
>> our validation system, and we simply need to check this is a valid 
>> number (and
>> approved). In the latter case, we auto-generate the approval number 
>> and I need
>> to replace "auto" with the number in the commit text.
>>
>> I have had a quick peek at the source code and can't see a way to 
>> change the
>> commit text for a changegroup in this way.
>>
> History is immutable, so you cannot change a commit message in the
> changegroup (it would invalidate the hash).

Ah, okay. I'd pretty much figured out that I wasn't going to be able to change 
the commit text when the chageset is pushed to another repository.

>> Am I missing something or can you recommend another way to approach this
>> problem?
>>
> Some other way have to be found, why not take the cset hash if IN=auto
> is specified ?

I'm thinking about having the developers install a pretxncommit hook in their 
own copies of the repository which does this. Then in the master copy, we just 
validate the nnnnnn number from IN=nnnnnn somewhere in the commit text in the 
pretxnchangegroup hook.

Of course, this puts some work onto the developers and assumes that they have 
access to the server which holds the IN approval numbers, but it might be 
worth that little bit of pain :)

Thanks anyway,
Trev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3253 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20070126/6beb4333/attachment-0001.bin>


More information about the Mercurial mailing list