Check for unpushed commits only on the current branch

This commit is contained in:
Steve Rowe 2016-05-23 15:40:44 -04:00
parent 71169d5f86
commit b4cc5a56fc
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,8 @@ def getGitRev():
status = os.popen('git status').read().strip() status = os.popen('git status').read().strip()
if 'nothing to commit, working directory clean' not in status: if 'nothing to commit, working directory clean' not in status:
raise RuntimeError('git clone is dirty:\n\n%s' % status) raise RuntimeError('git clone is dirty:\n\n%s' % status)
unpushedCommits = os.popen('git log origin..').read().strip() branch = os.popen('git rev-parse --abbrev-ref HEAD')
unpushedCommits = os.popen('git log origin/%s..' % branch).read().strip()
if len(unpushedCommits) > 0: if len(unpushedCommits) > 0:
raise RuntimeError('There are unpushed commits - "git log origin.." output is:\n\n%s' % unpushedCommits) raise RuntimeError('There are unpushed commits - "git log origin.." output is:\n\n%s' % unpushedCommits)