Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: how to add a hook on pull

I've searched awhile for this and haven't seen anything. Which could mean, it's not supposed to be done or it just can't be done.

I looked at a list of hooks for mercurial and I could not seem to find (or get one working) that executed a script after you give the hg pull command.

Thank you

like image 421
Muradin007 Avatar asked Jan 31 '26 04:01

Muradin007


1 Answers

From the hgrc docs section on "hooks" -

"incoming"
  Run after a changeset has been pulled, pushed, or unbundled into the
  local repository. The ID of the newly arrived changeset is in
  "$HG_NODE". URL that was source of changes came is in "$HG_URL".

or...

"post-<command>"
  Run after successful invocations of the associated command. The contents
  of the command line are passed as "$HG_ARGS" and the result code in
  "$HG_RESULT". Parsed command line arguments are passed as "$HG_PATS" and
  "$HG_OPTS". These contain string representations of the python data
  internally passed to <command>. "$HG_OPTS" is a dictionary of options
  (with unspecified options set to their defaults). "$HG_PATS" is a list
  of arguments. Hook failure is ignored.

(The documentation also goes into detail about what the config should actually look like and how hook scripts are called.)

like image 163
Amber Avatar answered Feb 02 '26 08:02

Amber



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!