Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: git_common.py

Issue 611253003: Introduct git-auto-svn (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Better docs Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: git_common.py
diff --git a/git_common.py b/git_common.py
index 2e268da0f35b9dedda1a7f0a49548929be5e02fe..99ed53cc45608e80648414f85a3591300013f76b 100644
--- a/git_common.py
+++ b/git_common.py
@@ -319,15 +319,6 @@ def branches(*args):
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 @@ def run(*cmd, **kwargs):
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_branch_config(branch, option, value, scope='local'):
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 @@ def upstream(branch):
except subprocess2.CalledProcessError:
return None
+
def get_git_version():
"""Returns a tuple that contains the numeric components of the current git
version."""

Powered by Google App Engine
This is Rietveld 408576698