Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-6938: switch from svn to git

Mike McCandlessf8be973b9473
diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.py
index 81b2aa1d971..68671a2c076 100644
--- a/dev-tools/scripts/buildAndPushRelease.py
+++ b/dev-tools/scripts/buildAndPushRelease.py
@@ -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')