Question

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?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top