From 09098d4c429f7c96eef1ea58230d9f50dbdc90d4 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Mon, 10 Feb 2014 09:25:52 +0000 Subject: alamut: Remove rsyncing from git. Add in notification of the 'on-the-pull' system for mirroring in post-commit hook. --- deployment/mgagit/templates/git-post-receive-hook | 33 +++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'deployment/mgagit') diff --git a/deployment/mgagit/templates/git-post-receive-hook b/deployment/mgagit/templates/git-post-receive-hook index c8265767..04b746cd 100755 --- a/deployment/mgagit/templates/git-post-receive-hook +++ b/deployment/mgagit/templates/git-post-receive-hook @@ -13,6 +13,8 @@ import xmlrpclib from cookielib import LWPCookieJar from bugz.bugzilla import BugzillaProxy +import urllib2 + # When editing this list, remember to edit the same list in # modules/cgit/templates/filter.commit-links.sh BUG_REFS = { @@ -39,21 +41,21 @@ Mageia Git Monkeys. """ git_multimail.REVISION_FOOTER_TEMPLATE = git_multimail.FOOTER_TEMPLATE +REPO_NAME_RE = re.compile(r'^/git/(?P.+?)(?:\.git)?$') +def repo_shortname(): + basename = os.path.abspath(git_multimail.get_git_dir()) + m = REPO_NAME_RE.match(basename) + if m: + return m.group('name') + else: + return basename + + # Override the Environment class to generate an apporpriate short name which is # used in git links and as an email prefix class LinksEnvironment(git_multimail.Environment): - REPO_NAME_RE = re.compile(r'^/git/(?P.+?)(?:\.git)?$') - def get_repo_shortname(self): - """Use the last part of the repo path, with ".git" stripped off if present.""" - - basename = os.path.abspath(self.get_repo_path()) - m = self.REPO_NAME_RE.match(basename) - if m: - return m.group('name') - else: - return basename - + return repo_shortname() git_multimail.Environment = LinksEnvironment # Override the Reviesion class to inject gitweb/cgit links and any referenced @@ -182,4 +184,13 @@ if __name__ == '__main__': except Exception: pass + try: + req = urllib2.Request('http://alamut.mageia.org:8000', repo_shortname()) + req.add_header('Content-Type', 'x-git/repo') + fp = urllib2.urlopen(req) + if (fp) + fp.close() + except Exception: + pass + git_multimail.main(sys.argv[1:]) -- cgit v1.2.1