How to hook SVN update with Subgit

1.2k views Asked by At

I set up Subgit to sync between SVN and Git.
Subgit run a daemon process to listen SVN updating.

I want to run something after the daemon merge the SVN to Git repository,
What should I do?

1

There are 1 answers

1
vadishev On BEST ANSWER

SubGit 2.0.x doesn't trigger any hooks when it fetches new revisions from Subversion repository. There is a feature request for that, feel free to upvote it: SGT-360.

As a workaround I'd suggest you to use a cron job that periodically runs the following command:

subgit fetch <GIT_REPO>
SubGit <version>
Translating SVN revisions to Git commits...
  rN => <hash>
Done.

You can also trigger Git-SVN sync remotely by running the following command:

$ cd <working_tree> && git push <remote> +:refs/subgit/command/fetch-sync
remote: Synchronizing SVN and Git...
remote:   translating SVN revisions to Git commits...
remote:     translated revision N to commit <hash>
remote: ... done.

It's possible to understand whether SubGit fetched new SVN revisions by parsing its output.

If you're going to use such periodical jobs, it makes sense to disable background translation process as it's not required anymore:

$ edit <GIT_REPO>/subgit/config
# [daemon]
#     idleTimeout = 0
$ subgit install <GIT_REPO>