LUCENE-10200: The branch does not have to be on origin remote. Replace this logic with a check whether the branch is up to date with the remote.

This commit is contained in:
Dawid Weiss 2021-10-30 20:48:57 +02:00
parent 6d8ea58ccd
commit d23f37d02d
1 changed files with 2 additions and 9 deletions

View File

@ -84,15 +84,8 @@ def getGitRev():
status = os.popen('git status').read().strip()
if 'nothing to commit, working directory clean' not in status and 'nothing to commit, working tree clean' not in status:
raise RuntimeError('git clone is dirty:\n\n%s' % status)
branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
command = 'git log origin/%s..' % branch
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if len(stdout.strip()) > 0:
raise RuntimeError('There are unpushed commits - "%s" output is:\n\n%s' % (command, stdout.decode('utf-8')))
if len(stderr.strip()) > 0:
raise RuntimeError('Command "%s" failed:\n\n%s' % (command, stderr.decode('utf-8')))
if 'Your branch is ahead of' in status:
raise RuntimeError('Your local branch is ahead of the remote? git status says:\n%s' % status)
print(' git clone is clean')
else:
print(' Ignoring dirty git clone due to dev-mode')