mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
init: make bad --repo-rev settings more clear
If the user passes a bad --repo-rev setting in a new checkout, add a tip to the error message that their option is probably bad instead of just saying "unable to resolve". If the user has already initialized a checkout, we'd display a raw traceback which would confuse them. Swallow that and also include the --repo-rev tip. Bug: https://crbug.com/gerrit/15610 Change-Id: I5d72513c7b37bf9bb5d19862fcdfaf0d1f44e886 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/328820 Reviewed-by: Jack Neus <jackneus@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
b550501254
commit
4aa8584ec6
1
repo
1
repo
@ -618,6 +618,7 @@ def _Init(args, gitc_init=False):
|
|||||||
"REPO_URL set correctly?" % url, file=sys.stderr)
|
"REPO_URL set correctly?" % url, file=sys.stderr)
|
||||||
|
|
||||||
except CloneFailure:
|
except CloneFailure:
|
||||||
|
print('fatal: double check your --repo-rev setting.', file=sys.stderr)
|
||||||
if opt.quiet:
|
if opt.quiet:
|
||||||
print('fatal: repo init failed; run without --quiet to see why',
|
print('fatal: repo init failed; run without --quiet to see why',
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
@ -520,8 +520,12 @@ to update the working directory files.
|
|||||||
# Handle new --repo-rev requests.
|
# Handle new --repo-rev requests.
|
||||||
if opt.repo_rev:
|
if opt.repo_rev:
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
remote_ref, rev = wrapper.check_repo_rev(
|
try:
|
||||||
rp.gitdir, opt.repo_rev, repo_verify=opt.repo_verify, quiet=opt.quiet)
|
remote_ref, rev = wrapper.check_repo_rev(
|
||||||
|
rp.gitdir, opt.repo_rev, repo_verify=opt.repo_verify, quiet=opt.quiet)
|
||||||
|
except wrapper.CloneFailure:
|
||||||
|
print('fatal: double check your --repo-rev setting.', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
branch = rp.GetBranch('default')
|
branch = rp.GetBranch('default')
|
||||||
branch.merge = remote_ref
|
branch.merge = remote_ref
|
||||||
rp.work_git.reset('--hard', rev)
|
rp.work_git.reset('--hard', rev)
|
||||||
|
Loading…
Reference in New Issue
Block a user