Commit dde93a5a authored by Gavin Mak's avatar Gavin Mak Committed by LUCI CQ

Add PYTHON_VERSION_COMPATIBILITY to git recipe module

Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited
Recipe-Nontrivial-Roll: chrome_release
Recipe-Nontrivial-Roll: infra
Bug: 1227140
Change-Id: Ia1fc9c67dd4e8cac08bd8892696ffc6da6c6ccd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3123944
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
parent 535213f8
......@@ -8,7 +8,7 @@
* [depot_tools](#recipe_modules-depot_tools) (Python3 ✅) &mdash; The `depot_tools` module provides safe functions to access paths within the depot_tools repo.
* [gclient](#recipe_modules-gclient) (Python3 ✅)
* [gerrit](#recipe_modules-gerrit) (Python3 ✅)
* [git](#recipe_modules-git)
* [git](#recipe_modules-git) (Python3 ✅)
* [git_cl](#recipe_modules-git_cl) (Python3 ✅)
* [gitiles](#recipe_modules-gitiles) (Python3 ✅)
* [gsutil](#recipe_modules-gsutil) (Python3 ✅)
......@@ -30,7 +30,7 @@
* [gclient:tests/patch_project](#recipes-gclient_tests_patch_project) (Python3 ✅)
* [gclient:tests/sync_failure](#recipes-gclient_tests_sync_failure) (Python3 ✅)
* [gerrit:examples/full](#recipes-gerrit_examples_full) (Python3 ✅)
* [git:examples/full](#recipes-git_examples_full)
* [git:examples/full](#recipes-git_examples_full) (Python3 ✅)
* [git_cl:examples/full](#recipes-git_cl_examples_full) (Python3 ✅)
* [gitiles:examples/full](#recipes-gitiles_examples_full) (Python3 ✅)
* [gitiles:tests/parse_repo_url](#recipes-gitiles_tests_parse_repo_url) (Python3 ✅)
......@@ -478,9 +478,9 @@ Returns:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-change
### *recipe_modules* / [git](/recipes/recipe_modules/git)
[DEPS](/recipes/recipe_modules/git/__init__.py#1): [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/step][recipe_engine/recipe_modules/step]
[DEPS](/recipes/recipe_modules/git/__init__.py#3): [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/runtime][recipe_engine/recipe_modules/runtime], [recipe\_engine/step][recipe_engine/recipe_modules/step]
PYTHON_VERSION_COMPATIBILITY: PY2
PYTHON_VERSION_COMPATIBILITY: PY2+3
#### **class [GitApi](/recipes/recipe_modules/git/api.py#18)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
......@@ -488,7 +488,7 @@ PYTHON_VERSION_COMPATIBILITY: PY2
Returns a git command step.
&mdash; **def [bundle\_create](/recipes/recipe_modules/git/api.py#388)(self, bundle_path, rev_list_args=None, \*\*kwargs):**
&mdash; **def [bundle\_create](/recipes/recipe_modules/git/api.py#389)(self, bundle_path, rev_list_args=None, \*\*kwargs):**
Runs 'git bundle create' on a Git repository.
......@@ -502,7 +502,7 @@ Args:
Outputs the contents of a file at a given revision.
&mdash; **def [checkout](/recipes/recipe_modules/git/api.py#121)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, can_fail_build=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False, progress=True, tags=False):**
&mdash; **def [checkout](/recipes/recipe_modules/git/api.py#122)(self, url, ref=None, dir_path=None, recursive=False, submodules=True, submodule_update_force=False, keep_paths=None, step_suffix=None, curl_trace_file=None, can_fail_build=True, set_got_revision=False, remote_name=None, display_fetch_size=None, file_name=None, submodule_update_recursive=True, use_git_cache=False, progress=True, tags=False):**
Performs a full git checkout and returns sha1 of checked out revision.
......@@ -541,7 +541,7 @@ Args:
Returns: If the checkout was successful, this returns the commit hash of
the checked-out-repo. Otherwise this returns None.
&mdash; **def [config\_get](/recipes/recipe_modules/git/api.py#357)(self, prop_name, \*\*kwargs):**
&mdash; **def [config\_get](/recipes/recipe_modules/git/api.py#358)(self, prop_name, \*\*kwargs):**
Returns git config output.
......@@ -568,7 +568,7 @@ Returns:
Fetches all tags from the remote.
&mdash; **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#376)(self, remote_name=None, \*\*kwargs):**
&mdash; **def [get\_remote\_url](/recipes/recipe_modules/git/api.py#377)(self, remote_name=None, \*\*kwargs):**
Returns the remote Git repository URL, or None.
......@@ -578,11 +578,11 @@ Args:
Returns: (str) The URL of the remote Git repository, or None.
&mdash; **def [get\_timestamp](/recipes/recipe_modules/git/api.py#328)(self, commit='HEAD', test_data=None, \*\*kwargs):**
&mdash; **def [get\_timestamp](/recipes/recipe_modules/git/api.py#329)(self, commit='HEAD', test_data=None, \*\*kwargs):**
Find and return the timestamp of the given commit.
&mdash; **def [new\_branch](/recipes/recipe_modules/git/api.py#401)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):**
&mdash; **def [new\_branch](/recipes/recipe_modules/git/api.py#402)(self, branch, name=None, upstream=None, upstream_current=False, \*\*kwargs):**
Runs git new-branch on a Git repository, to be used before git cl
upload.
......@@ -594,7 +594,7 @@ Args:
* upstream_current (bool): whether to use '--upstream_current'.
* kwargs: Forwarded to '__call__'.
&mdash; **def [rebase](/recipes/recipe_modules/git/api.py#337)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):**
&mdash; **def [rebase](/recipes/recipe_modules/git/api.py#338)(self, name_prefix, branch, dir_path, remote_name=None, \*\*kwargs):**
Runs rebase HEAD onto branch
......@@ -1141,11 +1141,11 @@ PYTHON_VERSION_COMPATIBILITY: PY2+3
&mdash; **def [RunSteps](/recipes/recipe_modules/gerrit/examples/full.py#13)(api):**
### *recipes* / [git:examples/full](/recipes/recipe_modules/git/examples/full.py)
[DEPS](/recipes/recipe_modules/git/examples/full.py#5): [git](#recipe_modules-git), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step]
[DEPS](/recipes/recipe_modules/git/examples/full.py#7): [git](#recipe_modules-git), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step]
PYTHON_VERSION_COMPATIBILITY: PY2
PYTHON_VERSION_COMPATIBILITY: PY2+3
&mdash; **def [RunSteps](/recipes/recipe_modules/git/examples/full.py#18)(api):**
&mdash; **def [RunSteps](/recipes/recipe_modules/git/examples/full.py#20)(api):**
### *recipes* / [git\_cl:examples/full](/recipes/recipe_modules/git_cl/examples/full.py)
[DEPS](/recipes/recipe_modules/git_cl/examples/full.py#11): [git\_cl](#recipe_modules-git_cl), [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step]
......
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'recipe_engine/buildbucket',
'recipe_engine/context',
......
......@@ -83,6 +83,7 @@ class GitApi(recipe_api.RecipeApi):
result = {}
for line in step_result.stdout.splitlines():
line = line.decode('utf-8')
name, value = line.split(':', 1)
result[name] = int(value.strip())
......@@ -297,7 +298,7 @@ class GitApi(recipe_api.RecipeApi):
self.m.raw_io.test_api.stream_output('deadbeef'))
if rev_parse_step.presentation.status == 'SUCCESS':
sha = rev_parse_step.stdout.strip()
sha = rev_parse_step.stdout.strip().decode('utf-8')
retVal = sha
rev_parse_step.presentation.step_text = "<br/>checked out %r<br/>" % sha
if set_got_revision:
......@@ -370,7 +371,7 @@ class GitApi(recipe_api.RecipeApi):
value = result.stdout
if value:
value = value.strip()
result.presentation.step_text = value
result.presentation.step_text = value.decode('utf-8')
return value
def get_remote_url(self, remote_name=None, **kwargs):
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -50,7 +50,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -47,7 +47,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -49,7 +49,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -121,7 +121,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -49,7 +49,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -96,7 +96,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......@@ -182,9 +182,9 @@
"The recipe has crashed at point 'Uncaught exception'!",
"",
"Traceback (most recent call last):",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/examples/full.py\", line 83, in RunSteps",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/examples/full.py\", line 85, in RunSteps",
" upstream_current=True)",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 418, in new_branch",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/git/api.py\", line 419, in new_branch",
" raise ValueError('Can not define both upstream and upstream_current')",
"ValueError: Can not define both upstream and upstream_current"
]
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -50,7 +50,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@"
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@"
]
},
{
......
......@@ -48,7 +48,7 @@
"infra_step": true,
"name": "read revision",
"~followup_annotations": [
"@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@",
"@@@STEP_TEXT@<br/>checked out u'deadbeef'<br/>@@@",
"@@@SET_BUILD_PROPERTY@got_revision@\"deadbeef\"@@@"
]
},
......
......@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'recipe_engine/buildbucket',
'recipe_engine/context',
......@@ -94,7 +96,7 @@ def RunSteps(api):
step_result = api.git.cat_file_at_commit(api.properties['cat_file'],
revision,
stdout=api.raw_io.output())
if 'TestOutput' in step_result.stdout:
if 'TestOutput' in step_result.stdout.decode('utf-8'):
pass # Success!
# Bundle the repository.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment