I'm writing a series of changegroup and commit hooks using the native Python implementation of the Mercurial API. Part of this requires me to save certain bits of information that are specific to my hooks, such as the last revision ID that my hooks actually saw.
I want to do this in a way where all external meta data is saved within the repository, but not actually tracked or ignored. I'd like to make sure this data never becomes a part of the history.
My first thought was just to use the existing .hg/hgrc
configuration since I only need to store simple strings and integers, and that's where the few configuration lines my hooks use currently live. The API provides an easy means to read this configuration via ui.config*
, but it seems no means are provided to actually change or write it.
It's easy enough for me to just get the configuration list, append or modify it then write it using a config module, but I really feel like I might be overlooking something that the API offers. I keep thinking "if there is no obvious means of doing this in a mature API, I could be going about it the wrong way."
Is there a 'proper' way to do this, perhaps using the API? Or, perhaps something I haven't found within the API to manage this sort of data without using hgrc
? My chief concern is races between multiple people pushing at once.