Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial outgoing Hook

I'm looking to create a Mercurial hook that pushes to a backup remote repository when I push to a local repository. I thought I could hook the 'outgoing' hook, but this creates a infinite loop that isn't pretty. So is there like a post-push hook, or would it be best to have the repository I am pushing to have an 'incoming' hook to push the to the remote backup instead?


1 Answers

There does exist a post-X and pre-X hook for every core command (X).

That said, if the goal is to create a remote backup of the local destination repository, I would do it in a 'changegroup' hook on the local destination repository.

When solving this problem in the past I've just set up cron jobs to do a push from local to backup periodically, which might lag a big, but doesn't leave the pushing user waiting for the push (hooks are executed in process in the foreground).

like image 102
Ry4an Brase Avatar answered Dec 23 '25 07:12

Ry4an Brase



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!