문제

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?

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top