Home | History | Annotate | Download | only in support
      1 #!/usr/bin/env python
      2 # Update the coverity branch from the master branch.
      3 # It is not done automatically because Coverity Scan limits
      4 # the number of submissions per day.
      5 
      6 from __future__ import print_function
      7 import shutil, tempfile
      8 from subprocess import check_output, STDOUT
      9 
     10 class Git:
     11     def __init__(self, dir):
     12         self.dir = dir
     13 
     14     def __call__(self, *args):
     15         output = check_output(['git'] + list(args), cwd=self.dir, stderr=STDOUT)
     16         print(output)
     17         return output
     18 
     19 dir = tempfile.mkdtemp()
     20 try:
     21     git = Git(dir)
     22     git('clone', '-b', 'coverity', 'git (at] github.com:fmtlib/fmt.git', dir)
     23     output = git('merge', '-X', 'theirs', '--no-commit', 'origin/master')
     24     if 'Fast-forward' not in output:
     25         git('reset', 'HEAD', '.travis.yml')
     26         git('checkout', '--', '.travis.yml')
     27         git('commit', '-m', 'Update coverity branch')
     28     git('push')
     29 finally:
     30     shutil.rmtree(dir)
     31