| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 | #!/bin/env pythonimport datetime"""If you are using github.com frank works pretty much with github's own hooks, which will submit a JSON to your listening server. If you don't feel like working with github you can host your repository at the same place where you host frank, and then you can simply run this script directly after your push.If this not the case you will need to invoke the script with the correct parameters.See below."""# List changed in the last commit# git diff-tree --no-commit-id --name-only -r $(git rev-list HEAD^..HEAD)# Python version# [patch.new_file_path for patch in repo.diff('HEAD', 'HEAD~1'))]SUBMIT_HOST = '192.168.1.100'SUBMIT_PORT = 5000GIT_URL = "git@yourhost.domain:oz123/frank.git""""This scripts submit a very simplified json record witht the following information::	{	 'repository': full_path_on_file_system	 'commit':  1481a2de7b2a7d02428ad93446ab166be7793fbb 	 'branch': branch_name	 "committer":{		    "email":"lolwut@noway.biz",		    "name":"Garen Torikian",		 },	 "author": {		 "email":"lolwut@noway.biz",		 "name":"Garen Torikian",		 },	 "url": "host.domain.full_path"     	}"""from pygit2 import Repositoryrepo = Repository('..')head = repo.headcommit = head.get_object()json_to_submit = {}json_to_submit['commit'] = head.idjson_to_submit['branch'] = repo.head.shorthandjson_to_submit['committer'] = {'email': commit.committer.email,                                'name', commit.committer.name}json_to_submit['author'] = {'email': commit.author.email,                             'name', commit.author.name}json_to_sumbit['url'] = GIT_URLjson_to_submit['time'] = datetime.datetime.now()
 |