Preupdate hook

Jensen, Aaron ajensen at webmd.net
Mon Jul 18 23:15:50 UTC 2016


Graft changesets have a source key in its extra information. You can check for the presence of it using the extras keyword in a template:

                > hg log -r REV --template '{get(extras,''source'')}\n'

If a changeset was a graft, this will return the source changeset ID followed by a newline. If it doesn’t, it will return just a newline.

More information on templating: https://www.selenic.com/hg/help/templates



From: Mercurial [mailto:mercurial-bounces at mercurial-scm.org] On Behalf Of Peter Kronenberg
Sent: Monday, July 18, 2016 3:31 PM
To: mercurial at mercurial-scm.org
Subject: Preupdate hook

I've written a preupdate hook to disallow 'backward' merges.  The problem I'm having is that it is also called for grafts and I don't want to disallow grafts.  Is there a way I can tell in the hook which command initiated it?
I also tried looking for the .hg/graftstate file, but that seems to be created only after the preupdate hook is called.
Any help would be appreciated.
thanks
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20160718/349df3c0/attachment-0002.html>


More information about the Mercurial mailing list