Update scripts to support git checkouts of CEF and/or Chromium.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1664 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-04-18 18:31:22 +00:00
parent 5e5b753c4c
commit da87cf449d
7 changed files with 109 additions and 61 deletions

View File

@ -1,26 +1,44 @@
# Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file
from subprocess import Popen, PIPE
import sys
from exec_util import exec_cmd
import os
def get_svn_revision(path=".", branch="master"):
svn_rev = "None"
cmd = ("git log --grep=^git-svn-id: -n 1 %s" % branch).split()
try:
process = Popen(cmd, cwd=path, stdout = PIPE, stderr = PIPE,
shell=(sys.platform == 'win32'))
for line in process.stdout:
if line.find("git-svn-id") > 0:
svn_rev = line.split("@")[1].split()[0]
break
except IOError, (errno, strerror):
sys.stderr.write('Failed to read git log: ' + strerror + "\n")
raise
return svn_rev
def is_checkout(path):
""" Returns true if the path represents a git checkout. """
return os.path.exists(os.path.join(path, '.git'))
def get_changed_files(path="."):
def get_hash(path = '.', branch = 'master'):
""" Returns the git hash for the specified branch/tag/hash. """
cmd = "git rev-parse %s" % (branch)
result = exec_cmd(cmd, path)
if result['out'] != '':
return result['out'].strip()
return 'Unknown'
def get_url(path = '.'):
""" Returns the origin url for the specified path. """
cmd = "git config --get remote.origin.url"
result = exec_cmd(cmd, path)
if result['out'] != '':
return result['out'].strip()
return 'Unknown'
def get_svn_revision(path = '.', branch = 'master'):
""" Returns the SVN revision associated with the specified path and git
branch/tag/hash. """
svn_rev = "None"
cmd = "git log --grep=^git-svn-id: -n 1 %s" % (branch)
result = exec_cmd(cmd, path)
if result['err'] == '':
for line in result['out'].split('\n'):
if line.find("git-svn-id") > 0:
svn_rev = line.split("@")[1].split()[0]
break
return svn_rev
def get_changed_files(path = '.'):
""" Retrieves the list of changed files. """
# not implemented
return []