/[adm]/puppet/deployment/mgagit/templates/git-post-receive-hook
ViewVC logotype

Diff of /puppet/deployment/mgagit/templates/git-post-receive-hook

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3411 by colin, Sun Feb 9 13:56:44 2014 UTC revision 3412 by colin, Mon Feb 10 09:25:52 2014 UTC
# Line 13  import xmlrpclib Line 13  import xmlrpclib
13  from cookielib import LWPCookieJar  from cookielib import LWPCookieJar
14  from bugz.bugzilla import BugzillaProxy  from bugz.bugzilla import BugzillaProxy
15    
16    import urllib2
17    
18  # When editing this list, remember to edit the same list in  # When editing this list, remember to edit the same list in
19  # modules/cgit/templates/filter.commit-links.sh  # modules/cgit/templates/filter.commit-links.sh
20  BUG_REFS = {  BUG_REFS = {
# Line 39  Mageia Git Monkeys. Line 41  Mageia Git Monkeys.
41  """  """
42  git_multimail.REVISION_FOOTER_TEMPLATE = git_multimail.FOOTER_TEMPLATE  git_multimail.REVISION_FOOTER_TEMPLATE = git_multimail.FOOTER_TEMPLATE
43    
44    REPO_NAME_RE = re.compile(r'^/git/(?P<name>.+?)(?:\.git)?$')
45    def repo_shortname():
46        basename = os.path.abspath(git_multimail.get_git_dir())
47        m = REPO_NAME_RE.match(basename)
48        if m:
49            return m.group('name')
50        else:
51            return basename
52    
53    
54  # Override the Environment class to generate an apporpriate short name which is  # Override the Environment class to generate an apporpriate short name which is
55  # used in git links and as an email prefix  # used in git links and as an email prefix
56  class LinksEnvironment(git_multimail.Environment):  class LinksEnvironment(git_multimail.Environment):
     REPO_NAME_RE = re.compile(r'^/git/(?P<name>.+?)(?:\.git)?$')  
   
57      def get_repo_shortname(self):      def get_repo_shortname(self):
58          """Use the last part of the repo path, with ".git" stripped off if present."""          return repo_shortname()
   
         basename = os.path.abspath(self.get_repo_path())  
         m = self.REPO_NAME_RE.match(basename)  
         if m:  
             return m.group('name')  
         else:  
             return basename  
   
59  git_multimail.Environment = LinksEnvironment  git_multimail.Environment = LinksEnvironment
60    
61  # Override the Reviesion class to inject gitweb/cgit links and any referenced  # Override the Reviesion class to inject gitweb/cgit links and any referenced
# Line 182  if __name__ == '__main__': Line 184  if __name__ == '__main__':
184      except Exception:      except Exception:
185          pass          pass
186    
187        try:
188            req = urllib2.Request('http://alamut.mageia.org:8000', repo_shortname())
189            req.add_header('Content-Type', 'x-git/repo')
190            fp = urllib2.urlopen(req)
191            if (fp)
192                fp.close()
193        except Exception:
194            pass
195    
196      git_multimail.main(sys.argv[1:])      git_multimail.main(sys.argv[1:])

Legend:
Removed from v.3411  
changed lines
  Added in v.3412

  ViewVC Help
Powered by ViewVC 1.1.30