Chromium Code Reviews| Index: git_common.py |
| diff --git a/git_common.py b/git_common.py |
| index d730fed7f9239a4fed47d7ee36391f5dc19024bf..47dca42db1999fda5e61b8b5b677f5e50f2b3ad5 100644 |
| --- a/git_common.py |
| +++ b/git_common.py |
| @@ -25,6 +25,7 @@ import re |
| import signal |
| import sys |
| import tempfile |
| +import textwrap |
| import threading |
| import subprocess2 |
| @@ -239,7 +240,26 @@ def branch_config_map(option): |
| def branches(*args): |
| NO_BRANCH = ('* (no branch', '* (detached from ') |
| - for line in run('branch', *args).splitlines(): |
| + |
|
ghost stip (do not use)
2014/04/15 18:19:18
Seems like you'd want to split this check out to a
|
| + key = 'depot-tools.branch-limit' |
| + limit = 20 |
| + try: |
| + limit = int(config(key, limit)) |
| + except ValueError: |
| + pass |
| + |
| + raw_branches = run('branch', *args).splitlines() |
| + |
| + num = len(raw_branches) |
| + if num > limit: |
| + print >> sys.stderr, textwrap.dedent("""\ |
| + Your git repo has too many branches (%d/%d) for this tool to work well. |
| + |
| + You may adjust this limit with the config variable %s |
|
ghost stip (do not use)
2014/04/15 18:19:18
It would be polite to print the git command to do
|
| + """ % (num, limit, key)) |
| + sys.exit(1) |
| + |
| + for line in raw_branches: |
| if line.startswith(NO_BRANCH): |
| continue |
| yield line.split()[-1] |