Skip to content

Commit

Permalink
Stop the stability checker running on multiple commits on master.
Browse files Browse the repository at this point in the history
The stability checker tried to work out which commits to test by
looking at all the commits on the current branch that aren't on
another branch. But if the current branch is e.g. master then this
will produce many more commits than intended. To fix this use the
merge-base with master when it's closer to HEAD than the last commit
not on another branch.
  • Loading branch information
jgraham committed Mar 24, 2017
1 parent 309b9ea commit 39948b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions check_stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,18 @@ def get_branch_point(user):
commits = git("rev-list", "HEAD", *not_heads).split("\n")
first_commit = commits[-1]
branch_point = git("rev-parse", first_commit + "^")
# The above can produce a too-early commit if we are e.g. on master and there are
# preceding changes that were rebased and so aren't on any other branch. To avoid
# this issue we check for the later of the above branch point and the merge-base
# with master
merge_base = git("merge-base", "HEAD", "origin/master")
if (branch_point != merge_base and
not git("log", "--oneline", "%s..%s" % (merge_base, branch_point)).strip()):
logger.debug("Using merge-base as the branch point")
branch_point = merge_base
else:
logger.debug("Using first commit on another branch as the branch point")

logger.debug("Branch point from master: %s" % branch_point)
return branch_point

Expand Down

0 comments on commit 39948b2

Please sign in to comment.