GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — instrumentation-java/check-git-history.py at master · android-fork/instrumentation-java Expand file tree/ Copy pathcheck-git-history.pyMore file actions 42 lines (36 loc) · 1.35 KB / Copy pathcheck-git-history.pyFile metadata and controls42 lines (36 loc) · 1.35 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 import os import sys import traceback def main(argv): # Only check the history if the build is running on a pull request. if is_travis_pull_request(): # This function assumes that HEAD^1 is the base branch and HEAD^2 is the # pull request. exit_if_pull_request_has_merge_commits() print 'Checked pull request history: SUCCEEDED' else: print 'Skipped history check.' def is_travis_pull_request(): '''Returns true if TRAVIS_PULL_REQUEST is set to indicate a pull request.''' return os.environ['TRAVIS_PULL_REQUEST'] != 'false' def exit_if_pull_request_has_merge_commits(): '''Exits with an error if any of the commits added by the pull request are merge commits.''' # Print the parents of each commit added by the pull request. git_command = 'git log --format="%P" HEAD^1..HEAD^2' for line in os.popen(git_command): parents = line.split() assert len(parents) >= 1, line if len(parents) > 1: print 'Pull request contains a merge commit:' print_history() print 'Checked pull request history: FAILED' sys.exit(1) def print_history(): os.system('git log HEAD^1 HEAD^2 -30 --graph --oneline --decorate') def read_process(command): '''Runs a command and returns everything printed to stdout.''' with os.popen(command, 'r') as fd: return fd.read() if __name__ == '__main__': main(sys.argv) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |