3

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?

Geoffrey Zheng
  • 6,562
  • 2
  • 38
  • 47
Tom Bell
  • 1,120
  • 2
  • 16
  • 33

1 Answers1

6

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

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169