3

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

Muradin007
  • 158
  • 14

1 Answers1

3

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.)

Amber
  • 507,862
  • 82
  • 626
  • 550
  • 1
    There is also `pretxnchangegroup` which is run after the changesets are pulled, but before they are made permanent in the local repo. This is useful if you need to verify something about incoming changesets before they are accepted. – Tim Henigan Apr 11 '13 at 16:02
  • I did have a chance to read this, however this will pull only when new changesets are found. What if I wanted a hook to run every single time you execute hg pull? Even on occurrences when no changes are found – Muradin007 Apr 11 '13 at 16:54
  • The post- did what I was looking for, I didn't immediately realize it though. – Muradin007 Apr 11 '13 at 19:23