Skip tracking status in map-branches when -v flag is not supplied.
This CL prevents map-branches from loading the tracking status when
the -v flag is not supplied. This prevents the vanilla map-branches
from taking a potentially long time to retrieve the tracking status.
BUG=410137
Review URL: https://codereview.chromium.org/536793002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291846 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_common.py b/git_common.py
index 31a62b8..2e268da 100644
--- a/git_common.py
+++ b/git_common.py
@@ -733,18 +733,19 @@
return tuple(int(x) for x in version.split('.'))
-def get_all_tracking_info():
+def get_branches_info(include_tracking_status):
format_string = (
'--format=%(refname:short):%(objectname:short):%(upstream:short):')
# This is not covered by the depot_tools CQ which only has git version 1.8.
- if get_git_version() >= MIN_UPSTREAM_TRACK_GIT_VERSION: # pragma: no cover
+ if (include_tracking_status and
+ get_git_version() >= MIN_UPSTREAM_TRACK_GIT_VERSION): # pragma: no cover
format_string += '%(upstream:track)'
info_map = {}
data = run('for-each-ref', format_string, 'refs/heads')
- TrackingInfo = collections.namedtuple(
- 'TrackingInfo', 'hash upstream ahead behind')
+ BranchesInfo = collections.namedtuple(
+ 'BranchesInfo', 'hash upstream ahead behind')
for line in data.splitlines():
(branch, branch_hash, upstream_branch, tracking_status) = line.split(':')
@@ -754,7 +755,7 @@
behind_match = re.search(r'behind (\d+)', tracking_status)
behind = int(behind_match.group(1)) if behind_match else None
- info_map[branch] = TrackingInfo(
+ info_map[branch] = BranchesInfo(
hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind)
# Set None for upstreams which are not branches (e.g empty upstream, remotes