LUCENE-6938: switch from svn to git

This commit is contained in:
Mike McCandless 2016-02-11 09:52:48 -05:00
parent 8e0f7ff7bb
commit f8be973b94
1 changed files with 10 additions and 28 deletions

View File

@ -57,29 +57,13 @@ def runAndSendGPGPassword(command, password):
print(msg)
raise RuntimeError(msg)
def scrubCheckout():
# removes any files not checked into svn
unversionedRex = re.compile('^ ?[\?ID] *[1-9 ]*[a-zA-Z]* +(.*)')
for l in os.popen('svn status --no-ignore -v').readlines():
match = unversionedRex.match(l)
if match:
s = match.group(1)
if os.path.exists(s):
print(' delete %s' % s)
if os.path.isdir(s) and not os.path.islink(s):
shutil.rmtree(s)
else:
os.remove(s)
def getSVNRev():
rev = os.popen('svnversion').read().strip()
try:
int(rev)
except (TypeError, ValueError):
raise RuntimeError('svn version is not clean: %s' % rev)
return rev
def getGitRev():
status = os.popen('git status').read().strip()
if 'Your branch is up-to-date' not in status:
raise RuntimeError('git clone has local changes:\n\n%s' % status)
if 'Untracked files' in status:
raise RuntimeError('there are untracked files; please run git clean -xfd:\n\n%s' % status)
return os.popen('git rev-parse HEAD').read().strip()
def prepare(root, version, gpgKeyID, gpgPassword):
@ -92,15 +76,13 @@ def prepare(root, version, gpgKeyID, gpgPassword):
print(' svn up...')
run('svn up')
rev = getSVNRev()
print(' svn rev: %s' % rev)
log('\nSVN rev: %s\n' % rev)
rev = getGitRev()
print(' git rev: %s' % rev)
log('\nGIT rev: %s\n' % rev)
print(' ant clean test')
run('ant clean test')
print(' clean checkout')
scrubCheckout()
open('rev.txt', mode='wb').write(rev.encode('UTF-8'))
print(' lucene prepare-release')