зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1565358: Use `Parameters.file_url` helper consitently; r=mhentges
Only one place should need to know how to generate VCS URLs. This makes it easier to support other VCSs. Differential Revision: https://phabricator.services.mozilla.com/D37772 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9fa0ebbc44
Коммит
bd1512fcbf
|
@ -195,14 +195,14 @@ class Parameters(ReadOnlyDict):
|
|||
"""
|
||||
return 'try' in self['project'] or self['try_mode'] == 'try_select'
|
||||
|
||||
def file_url(self, path, endpoint="file"):
|
||||
def file_url(self, path, pretty=False):
|
||||
"""
|
||||
Determine the VCS URL for viewing a file in the tree, suitable for
|
||||
viewing by a human.
|
||||
|
||||
:param basestring path: The path, relative to the root of the repository.
|
||||
:param basestring endpoint: The endpoint. Defaults to "file"
|
||||
|
||||
:param bool pretty: Whether to return a link to a formatted version of the
|
||||
file, or the raw file version.
|
||||
:return basestring: The URL displaying the given path.
|
||||
"""
|
||||
if path.startswith('comm/'):
|
||||
|
@ -213,6 +213,7 @@ class Parameters(ReadOnlyDict):
|
|||
repo = self['head_repository']
|
||||
rev = self['head_rev']
|
||||
|
||||
endpoint = 'file' if pretty else 'raw-file'
|
||||
return '{}/{}/{}/{}'.format(repo, endpoint, rev, path)
|
||||
|
||||
def release_level(self):
|
||||
|
|
|
@ -127,10 +127,8 @@ def docker_worker_debian_package(config, job, taskdesc):
|
|||
if 'patch' in run:
|
||||
# We don't use robustcheckout or run-task to get a checkout. So for
|
||||
# this one file we'd need from a checkout, download it.
|
||||
env['PATCH_URL'] = '{head_repo}/raw-file/{head_rev}/build/debian-packages/{patch}'.format(
|
||||
head_repo=config.params['head_repository'],
|
||||
head_rev=config.params['head_rev'],
|
||||
patch=run['patch'],
|
||||
env["PATCH_URL"] = config.params.file_url(
|
||||
"build/debian-packages/{patch}".format(patch=run["patch"]),
|
||||
)
|
||||
adjust += 'curl -sL $PATCH_URL | patch -p1 && '
|
||||
if 'pre-build-command' in run:
|
||||
|
|
|
@ -391,8 +391,8 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
|
|||
'format': 'zip'
|
||||
}]
|
||||
if is_bitbar:
|
||||
a_url = '{}/raw-file/{}/taskcluster/scripts/tester/{}'.format(
|
||||
config.params['head_repository'], config.params['head_rev'], bitbar_script
|
||||
a_url = config.params.file_url(
|
||||
'taskcluster/scripts/tester/{}'.format(bitbar_script),
|
||||
)
|
||||
worker['mounts'] = [{
|
||||
'file': bitbar_script,
|
||||
|
@ -473,8 +473,8 @@ def mozharness_test_on_script_engine_autophone(config, job, taskdesc):
|
|||
env['EXTRA_MOZHARNESS_CONFIG'] = {'task-reference': json.dumps(extra_config)}
|
||||
|
||||
script = 'test-linux.sh'
|
||||
worker['context'] = '{}/raw-file/{}/taskcluster/scripts/tester/{}'.format(
|
||||
config.params['head_repository'], config.params['head_rev'], script
|
||||
worker['context'] = config.params.file_url(
|
||||
'taskcluster/scripts/tester/{}'.format(script),
|
||||
)
|
||||
|
||||
command = worker['command'] = ["./{}".format(script)]
|
||||
|
|
|
@ -85,10 +85,9 @@ worker_defaults = {
|
|||
|
||||
|
||||
def script_url(config, script):
|
||||
return '{}/raw-file/{}/taskcluster/scripts/{}'.format(
|
||||
config.params['head_repository'],
|
||||
config.params['head_rev'],
|
||||
script)
|
||||
return config.params.file_url(
|
||||
'taskcluster/scripts/{}'.format(script),
|
||||
)
|
||||
|
||||
|
||||
@run_job_using("docker-worker", "run-task", schema=run_task_schema, defaults=worker_defaults)
|
||||
|
|
|
@ -88,7 +88,7 @@ def add_entitlements_link(config, jobs):
|
|||
)
|
||||
if entitlements_path:
|
||||
job['entitlements-url'] = config.params.file_url(
|
||||
entitlements_path, endpoint="raw-file"
|
||||
entitlements_path,
|
||||
)
|
||||
yield job
|
||||
|
||||
|
|
|
@ -1785,7 +1785,7 @@ def build_task(config, tasks):
|
|||
'description': task['description'],
|
||||
'name': task['label'],
|
||||
'owner': config.params['owner'],
|
||||
'source': config.params.file_url(config.path),
|
||||
'source': config.params.file_url(config.path, pretty=True),
|
||||
},
|
||||
'extra': extra,
|
||||
'tags': tags,
|
||||
|
|
Загрузка…
Ссылка в новой задаче