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

Add python3 support to gitiles recipe module

This change omits python3 support for resources/gerrit_client.py

Bug: 1227140
Change-Id: Ibc8d9f1fbd28008959991688ced5818f0188f905
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3012233
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
parent 0e27bfe3
......@@ -588,16 +588,16 @@ DEPRECATED. Consider using gerrit.get_change_description instead.
[DEPS](/recipes/recipe_modules/gitiles/__init__.py#5): [recipe\_engine/json][recipe_engine/recipe_modules/json], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/raw\_io][recipe_engine/recipe_modules/raw_io], [recipe\_engine/step][recipe_engine/recipe_modules/step], [recipe\_engine/url][recipe_engine/recipe_modules/url]
#### **class [Gitiles](/recipes/recipe_modules/gitiles/api.py#11)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
#### **class [Gitiles](/recipes/recipe_modules/gitiles/api.py#17)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
Module for polling a git repository using the Gitiles web interface.
&mdash; **def [canonicalize\_repo\_url](/recipes/recipe_modules/gitiles/api.py#216)(self, repo_url):**
&mdash; **def [canonicalize\_repo\_url](/recipes/recipe_modules/gitiles/api.py#222)(self, repo_url):**
Returns a canonical form of repo_url. If not recognized, returns as is.
&mdash; **def [commit\_log](/recipes/recipe_modules/gitiles/api.py#114)(self, url, commit, step_name=None, attempts=None):**
&mdash; **def [commit\_log](/recipes/recipe_modules/gitiles/api.py#120)(self, url, commit, step_name=None, attempts=None):**
Returns: (dict) the Gitiles commit log structure for a given commit.
......@@ -607,7 +607,7 @@ Args:
* step_name (str): If not None, override the step name.
* attempts (int): Number of times to try the request before failing.
&mdash; **def [download\_archive](/recipes/recipe_modules/gitiles/api.py#156)(self, repository_url, destination, revision='refs/heads/master'):**
&mdash; **def [download\_archive](/recipes/recipe_modules/gitiles/api.py#162)(self, repository_url, destination, revision='refs/heads/master'):**
Downloads an archive of the repo and extracts it to `destination`.
......@@ -623,7 +623,7 @@ Args:
* revision (str): The ref or revision in the repo to download. Defaults to
'refs/heads/master'.
&mdash; **def [download\_file](/recipes/recipe_modules/gitiles/api.py#130)(self, repository_url, file_path, branch='master', step_name=None, attempts=None, \*\*kwargs):**
&mdash; **def [download\_file](/recipes/recipe_modules/gitiles/api.py#136)(self, repository_url, file_path, branch='master', step_name=None, attempts=None, \*\*kwargs):**
Downloads raw file content from a Gitiles repository.
......@@ -637,7 +637,7 @@ Args:
Returns:
Raw file content.
&mdash; **def [log](/recipes/recipe_modules/gitiles/api.py#68)(self, url, ref, limit=0, cursor=None, step_name=None, attempts=None, \*\*kwargs):**
&mdash; **def [log](/recipes/recipe_modules/gitiles/api.py#74)(self, url, ref, limit=0, cursor=None, step_name=None, attempts=None, \*\*kwargs):**
Returns the most recent commits under the given ref with properties.
......@@ -660,17 +660,17 @@ Returns:
Cursor can be used for subsequent calls to log for paging. If None,
signals that there are no more commits to fetch.
&mdash; **def [parse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#205)(self, repo_url):**
&mdash; **def [parse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#211)(self, repo_url):**
Returns (host, project) pair.
Returns (None, None) if repo_url is not recognized.
&mdash; **def [refs](/recipes/recipe_modules/gitiles/api.py#56)(self, url, step_name='refs', attempts=None):**
&mdash; **def [refs](/recipes/recipe_modules/gitiles/api.py#62)(self, url, step_name='refs', attempts=None):**
Returns a list of refs in the remote repository.
&mdash; **def [unparse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#212)(self, host, project):**
&mdash; **def [unparse\_repo\_url](/recipes/recipe_modules/gitiles/api.py#218)(self, host, project):**
Generates a Gitiles repo URL. See also parse_repo_url.
### *recipe_modules* / [gsutil](/recipes/recipe_modules/gsutil)
......
......@@ -2,8 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import division
import base64
import urlparse
try:
import urlparse
except ImportError: # pragma: no cover
import urllib.parse as urlparse
from recipe_engine import recipe_api
......
......@@ -10,6 +10,8 @@ Example usage:
-u https://chromium.googlesource.com/chromium/src/+log
"""
from __future__ import print_function
import argparse
import json
import logging
......@@ -17,8 +19,13 @@ import os
import sys
import tarfile
import time
import urllib
import urlparse
try:
from urllib import urlencode
import urlparse
except ImportError: # pragma: no cover
from urllib.parse import urlencode
import urllib.parse as urlparse
DEPOT_TOOLS = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
......@@ -35,7 +42,7 @@ def reparse_url(parsed_url, query_params):
path=parsed_url.path,
params=parsed_url.params,
fragment=parsed_url.fragment,
query=urllib.urlencode(query_params, doseq=True))
query=urlencode(query_params, doseq=True))
def gitiles_get(parsed_url, handler, attempts):
......
......@@ -25,7 +25,7 @@ class GitilesTestApi(recipe_test_api.RecipeTestApi):
new_files=['%s.py' % (chr(i + ord('a')))],
email='fake_%s@fake_%i.email.com' % (s, i),
)
for i in xrange(n)
for i in range(n)
],
}
if cursor:
......
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