repo: allow REPO_REV to be an env var

We do this for REPO_URL already.

Bug: https://crbug.com/gerrit/10233
Change-Id: I53410645474b00d900467c96fa5d8446f3a607d3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253552
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
(cherry picked from commit 563f1a6512)
This commit is contained in:
Mike Frysinger 2020-02-05 23:52:07 -05:00
parent 68744dbc01
commit 19607b2817

8
repo
View File

@ -16,7 +16,9 @@ import os
REPO_URL = os.environ.get('REPO_URL', None) REPO_URL = os.environ.get('REPO_URL', None)
if not REPO_URL: if not REPO_URL:
REPO_URL = 'https://gerrit.googlesource.com/git-repo' REPO_URL = 'https://gerrit.googlesource.com/git-repo'
REPO_REV = 'repo-1' REPO_REV = os.environ.get('REPO_REV')
if not REPO_REV:
REPO_REV = 'repo-1'
# Copyright (C) 2008 Google Inc. # Copyright (C) 2008 Google Inc.
# #
@ -235,10 +237,10 @@ group.add_option('--no-tags',
group = init_optparse.add_option_group('repo Version options') group = init_optparse.add_option_group('repo Version options')
group.add_option('--repo-url', group.add_option('--repo-url',
dest='repo_url', dest='repo_url',
help='repo repository location', metavar='URL') help='repo repository location ($REPO_URL)', metavar='URL')
group.add_option('--repo-branch', group.add_option('--repo-branch',
dest='repo_branch', dest='repo_branch',
help='repo branch or revision', metavar='REVISION') help='repo branch or revision ($REPO_REV)', metavar='REVISION')
group.add_option('--no-repo-verify', group.add_option('--no-repo-verify',
dest='no_repo_verify', action='store_true', dest='no_repo_verify', action='store_true',
help='do not verify repo source code') help='do not verify repo source code')