Minimal changes to make development work with Git. (issue 227380043 by kpreid@google.com)

3 views
Skip to first unread message

re...@codereview-hr.appspotmail.com

unread,
Apr 20, 2015, 6:50:05 PM4/20/15
to fel...@gmail.com, kpr...@google.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: felix8a,

Description:
* Teach appspot.py about git instead of svn. (myvn will be updated or
killed later).
* Make build-version handling use git describe.
* Some needed .gitignore extensions.

Please review this at https://codereview.appspot.com/227380043/

Affected files (+12, -22 lines):
M .gitignore
M build.xml
M tools/appspot.py
M tools/svnversion-nocolon


Index: .gitignore
diff --git a/.gitignore b/.gitignore
index
9244cd153aef53391ddfc7eba1854e86f168091a..48253d8f20bb50eb42cae2d5236bd4b54c9196e4
100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-/.appspot-change
+/.appspot-change*
/.classpath
/.project
/.settings
@@ -18,3 +18,4 @@
/ant-www
/gwt-unitCache
/war
+/junit*.properties
Index: build.xml
diff --git a/build.xml b/build.xml
index
ef35c1d0c5820d4ca2210237afd9d82cdae2d181..77c911105a77a04a709ec2d2c49fffaf1e035e99
100644
--- a/build.xml
+++ b/build.xml
@@ -1268,7 +1268,7 @@ For help on building and testing Caja, see:
</copy>
<replaceregexp
flags="g"
- match="(cajaBuildVersion\s*=|'cajolerVersion':)\s*'([\dmsp_]+|
unknown)'"
+ match="(cajaBuildVersion\s*=|'cajolerVersion':)\s*'([^\\']+)'"
replace="\1'0000'">
<fileset dir="${war}/testing/skew-0000" includes="**/*.js"/>
</replaceregexp>
@@ -1282,7 +1282,7 @@ For help on building and testing Caja, see:
</copy>
<replaceregexp
flags="g"
- match="(cajaBuildVersion\s*=|'cajolerVersion':)\s*'([\dmsp_]+|
unknown)'"
+ match="(cajaBuildVersion\s*=|'cajolerVersion':)\s*'([^\\']+)'"
replace="\1'${ver.mmm}'">
<fileset dir="${war}/testing/skew-mmm" includes="**/*.js"/>
</replaceregexp>
Index: tools/appspot.py
diff --git a/tools/appspot.py b/tools/appspot.py
index
8415f67d4d9506b38605182a7654c8cc00b99965..d565a0909d8ebbf279df0f61e6be684fbe1acdda
100755
--- a/tools/appspot.py
+++ b/tools/appspot.py
@@ -79,6 +79,7 @@ class ChangeList(object):
args = []
args.extend(['--oauth2'])
args.extend(['--server', server])
+ args.extend(['--rev', '@{u}']) # diff against this branch's upstream
if self.issue:
args.extend(['--issue', str(self.issue)])
if self.title:
@@ -479,17 +480,12 @@ def main():
private=params.get('--private'))

# Figure out where the CL lives on disk
- client_root = os.path.abspath(os.curdir)
- while True:
- client_root_parent = os.path.dirname(client_root)
- if not client_root_parent or client_root_parent == client_root: break
- if not os.path.isdir(os.path.join(client_root_parent, '.svn')):
- break
- client_root = client_root_parent
- if not os.path.isdir(os.path.join(client_root, '.svn')):
+ client_root = subprocess.Popen(
+ ['git', 'rev-parse', '--show-toplevel'],
+ stdout=subprocess.PIPE).communicate()[0].strip()
+ if not os.path.isdir(client_root):
print >>sys.stderr, (
- 'Cannot locate client root.\n'
- 'No directory named google-caja on %s') %
os.path.abspath(os.curdir)
+ 'No Git repository found for %s') % os.path.abspath(os.curdir)
sys.exit(-1)
cl_file_path = make_cl_file_path(client_root)

Index: tools/svnversion-nocolon
diff --git a/tools/svnversion-nocolon b/tools/svnversion-nocolon
index
e2e8fe88c7b9c6b1b81901572f0c3e7006392138..475f41798251eb0310ecae67abff387769c2c3e2
100755
--- a/tools/svnversion-nocolon
+++ b/tools/svnversion-nocolon
@@ -1,11 +1,4 @@
#!/usr/bin/env bash

-# A wrapper around 'svnversion' that removes the colons
-# and lowercases (appengine restrictions) and canonicalizes
-# svn 1.7 "Unversioned directory" = svn 1.6 "exported"
-# to "unknown".
-svnversion | perl -pe '
- s/^(Unversioned.*|Uncommitted.*|exported)$/unknown/;
- s/:/_/g;
- tr/A-Z/a-z/;
-'
+# The output of this command must be valid as an App Engine version string.
+git describe --always | tr 'A-Z' 'a-z'


fel...@gmail.com

unread,
Apr 20, 2015, 7:00:02 PM4/20/15
to kpr...@google.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com
lgtm


https://codereview.appspot.com/227380043/diff/1/tools/svnversion-nocolon
File tools/svnversion-nocolon (right):

https://codereview.appspot.com/227380043/diff/1/tools/svnversion-nocolon#newcode4
tools/svnversion-nocolon:4: git describe --always | tr 'A-Z' 'a-z'
I miss the monotonically increasing numbers, but I don't have anything
better in mind.

Maybe rename this from 'svnversion-nocolon' to 'cajaversion' or
something similar.

https://codereview.appspot.com/227380043/

kpr...@google.com

unread,
Apr 20, 2015, 7:03:20 PM4/20/15
to fel...@gmail.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com

https://codereview.appspot.com/227380043/diff/1/tools/svnversion-nocolon
File tools/svnversion-nocolon (right):

https://codereview.appspot.com/227380043/diff/1/tools/svnversion-nocolon#newcode4
tools/svnversion-nocolon:4: git describe --always | tr 'A-Z' 'a-z'
On 2015/04/20 23:00:02, felix8a wrote:
> I miss the monotonically increasing numbers, but I don't have anything
better in
> mind.

IIRC, we need them too (maybe only in the cajoler or something). My plan
is that anything that is an actual _release_ will get monotonically
tagged (starting at "r6000"), which should be good enough and git
describe will use automatically.

> Maybe rename this from 'svnversion-nocolon' to 'cajaversion' or
something
> similar.

Will do, later, as part of less blocking-everything-else cleanups.

https://codereview.appspot.com/227380043/
Reply all
Reply to author
Forward
0 new messages