Introduct git-auto-svn
This tool can automatically set up the necessary git-svn metadata for our
repos that live in SVN but are mirrored to Chrome.
R=iannucci@chromium.org, tandrii@chromium.org
BUG=418973
Review URL: https://codereview.chromium.org/611253003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292241 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_common.py b/git_common.py
index 2e268da..99ed53c 100644
--- a/git_common.py
+++ b/git_common.py
@@ -319,15 +319,6 @@
yield line.split()[-1]
-def run_with_retcode(*cmd, **kwargs):
- """Run a command but only return the status code."""
- try:
- run(*cmd, **kwargs)
- return 0
- except subprocess2.CalledProcessError as cpe:
- return cpe.returncode
-
-
def config(option, default=None):
try:
return run('config', '--get', option) or default
@@ -551,6 +542,15 @@
return run_with_stderr(*cmd, **kwargs)[0]
+def run_with_retcode(*cmd, **kwargs):
+ """Run a command but only return the status code."""
+ try:
+ run(*cmd, **kwargs)
+ return 0
+ except subprocess2.CalledProcessError as cpe:
+ return cpe.returncode
+
+
def run_stream(*cmd, **kwargs):
"""Runs a git command. Returns stdout as a PIPE (file-like object).
@@ -600,6 +600,7 @@
def set_config(option, value, scope='local'):
run('config', '--' + scope, option, value)
+
def squash_current_branch(header=None, merge_base=None):
header = header or 'git squash commit.'
merge_base = merge_base or get_or_create_merge_base(current_branch())
@@ -723,6 +724,7 @@
except subprocess2.CalledProcessError:
return None
+
def get_git_version():
"""Returns a tuple that contains the numeric components of the current git
version."""