we’re moving from Subversion to Mercurial now. In Subversion there was possibility to add custom column into log (e.g. bug id) and force user to fill this column on every commit.
Is it possible to implement such feature in Mercurial?
we’re moving from Subversion to Mercurial now. In Subversion there was possibility to add
Share
Yes it’s possible.
But before you go and do that, why isn’t it enough to require bug fix commit messages to uphold to a certain pattern?
i.e.
util: rename the util.localpath that uses url to urllocalpath (issue2875)(taken from Mercurial’s repo)Then you can install a hook on your central repository that scans incoming commit messages, and does whatever is needed when that pattern is found.
Furthermore, why would you want to force this on every commit? Is this for a QA team that should only commit bug fixes? If that’s the case, a pre-commit hook that greps the commit message for the pattern sounds appropriate.
If you still want the extra field: when Mercurial commits something, it is possible to pass it a dictionary of strings, which you can fill with anything. See the transplant extension on how you might do that. You would also need to wrap the
commitcommand and add a new command line option to it.But I strongly suggest you think twice before doing this, because aside from the time consuming work involved in coding, testing (and maintaining this between Mercurial releases), you would also need to ensure that it is deployed on every environment where Mercurial is used.