Move git_cl back into depot_tools.
Remove git_cl_hooks.py since it's now unnecessary. BUG= TEST= Review URL: http://codereview.chromium.org/6758001 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79715 0039d316-1c4b-4281-b951-d872f2087c98experimental/szager/collated-output
parent
de568681f1
commit
2a74d37e28
@ -1,26 +0,0 @@
|
||||
Copyright (c) 2008 Evan Martin <martine@danga.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the author nor the names of contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,71 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Top-level presubmit script for depot tools.
|
||||
|
||||
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
|
||||
details on the presubmit API built into gcl.
|
||||
"""
|
||||
|
||||
|
||||
def CheckChangeOnUpload(input_api, output_api):
|
||||
return RunTests(input_api, output_api)
|
||||
|
||||
|
||||
def CheckChangeOnCommit(input_api, output_api):
|
||||
return RunTests(input_api, output_api)
|
||||
|
||||
|
||||
def RunTests(input_api, output_api):
|
||||
"""Run all the shells scripts in the directory test.
|
||||
"""
|
||||
# Not exposed from InputApi.
|
||||
from os import listdir
|
||||
|
||||
# First loads a local Rietveld instance.
|
||||
import sys
|
||||
old_sys_path = sys.path
|
||||
try:
|
||||
sys.path = [input_api.PresubmitLocalPath()] + sys.path
|
||||
from test import local_rietveld # pylint: disable=W0403
|
||||
server = local_rietveld.LocalRietveld()
|
||||
finally:
|
||||
sys.path = old_sys_path
|
||||
|
||||
# Set to True for testing.
|
||||
verbose = False
|
||||
if verbose:
|
||||
stdout = None
|
||||
stderr = None
|
||||
else:
|
||||
stdout = input_api.subprocess.PIPE
|
||||
stderr = input_api.subprocess.STDOUT
|
||||
output = []
|
||||
try:
|
||||
# Start a local rietveld instance to test against.
|
||||
server.start_server()
|
||||
test_path = input_api.os_path.abspath(
|
||||
input_api.os_path.join(input_api.PresubmitLocalPath(), 'test'))
|
||||
for test in listdir(test_path):
|
||||
# test-lib.sh is not an actual test so it should not be run. The other
|
||||
# tests are tests known to fail.
|
||||
DISABLED_TESTS = (
|
||||
'owners.sh', 'push-from-logs.sh', 'rename.sh', 'test-lib.sh')
|
||||
if test in DISABLED_TESTS or not test.endswith('.sh'):
|
||||
continue
|
||||
|
||||
print('Running %s' % test)
|
||||
proc = input_api.subprocess.Popen(
|
||||
[input_api.os_path.join(test_path, test)],
|
||||
cwd=test_path,
|
||||
stdout=stdout,
|
||||
stderr=stderr)
|
||||
proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
output.append(output_api.PresubmitError('%s failed' % test))
|
||||
except local_rietveld.Failure, e:
|
||||
output.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args)))
|
||||
finally:
|
||||
server.stop_server()
|
||||
return output
|
@ -1,10 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
# git-cl -- a git-command for integrating reviews on Rietveld
|
||||
# Copyright (C) 2008 Evan Martin <martine@danga.com>
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import sys
|
||||
base_dir=$(dirname "$0")
|
||||
|
||||
import git_cl
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(git_cl.main(sys.argv[1:]))
|
||||
"$base_dir"/../git_cl.py "$@"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,90 +0,0 @@
|
||||
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import breakpad # pylint: disable=W0611
|
||||
|
||||
from git_cl import git_cl
|
||||
from git_cl import upload
|
||||
|
||||
import presubmit_support
|
||||
import scm
|
||||
import watchlists
|
||||
|
||||
# Really ugly hack to quiet upload.py
|
||||
upload.verbosity = 0
|
||||
|
||||
def Backquote(cmd, cwd=None):
|
||||
"""Like running `cmd` in a shell script."""
|
||||
return subprocess.Popen(cmd,
|
||||
cwd=cwd,
|
||||
stdout=subprocess.PIPE).communicate()[0].strip()
|
||||
|
||||
def ConvertToInteger(inputval):
|
||||
"""Convert a string to integer, but returns either an int or None."""
|
||||
try:
|
||||
return int(inputval)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
class ChangeOptions:
|
||||
def __init__(self, commit=None, upstream_branch=None):
|
||||
self.commit = commit
|
||||
self.verbose = None
|
||||
self.default_presubmit = None
|
||||
self.may_prompt = None
|
||||
|
||||
root = Backquote(['git', 'rev-parse', '--show-cdup'])
|
||||
if not root:
|
||||
root = "."
|
||||
absroot = os.path.abspath(root)
|
||||
if not root:
|
||||
raise Exception("Could not get root directory.")
|
||||
# We use the sha1 of HEAD as a name of this change.
|
||||
name = Backquote(['git', 'rev-parse', 'HEAD'])
|
||||
files = scm.GIT.CaptureStatus([root], upstream_branch)
|
||||
cl = git_cl.Changelist()
|
||||
issue = ConvertToInteger(cl.GetIssue())
|
||||
patchset = ConvertToInteger(cl.GetPatchset())
|
||||
if issue:
|
||||
description = cl.GetDescription()
|
||||
else:
|
||||
# If the change was never uploaded, use the log messages of all commits
|
||||
# up to the branch point, as git cl upload will prefill the description
|
||||
# with these log messages.
|
||||
description = Backquote(['git', 'log', '--pretty=format:%s%n%n%b',
|
||||
'%s...' % (upstream_branch)])
|
||||
self.change = presubmit_support.GitChange(name, description, absroot, files,
|
||||
issue, patchset)
|
||||
|
||||
|
||||
def RunHooks(hook_name, upstream_branch):
|
||||
commit = (hook_name == 'pre-cl-dcommit')
|
||||
|
||||
# Create our options based on the command-line args and the current checkout.
|
||||
options = ChangeOptions(commit=commit, upstream_branch=upstream_branch)
|
||||
|
||||
# Apply watchlists on upload.
|
||||
if not commit:
|
||||
watchlist = watchlists.Watchlists(options.change.RepositoryRoot())
|
||||
files = [f.LocalPath() for f in options.change.AffectedFiles()]
|
||||
watchers = watchlist.GetWatchersForPaths(files)
|
||||
Backquote(['git', 'config', '--replace-all',
|
||||
'rietveld.extracc', ','.join(watchers)])
|
||||
|
||||
# Run the presubmit checks.
|
||||
if presubmit_support.DoPresubmitChecks(options.change,
|
||||
options.commit,
|
||||
options.verbose,
|
||||
sys.stdout,
|
||||
sys.stdin,
|
||||
options.default_presubmit,
|
||||
options.may_prompt):
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Unit tests for depot_tools."""
|
Loading…
Reference in New Issue