Skip to content

Commit 79ad94c

Browse files
coreycbahal
authored andcommitted
Update file_url() handling of Thunderbird comm paths
In commit df291c6, root_dir was changed from a relative path to an absolute path, resulting in file_url() no longer detecting the path correctly as it didn't start with "comm/". This change allows file_url() to correctly detect and handle an absolute path that includes "comm/".
1 parent 368f45d commit 79ad94c

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/taskgraph/parameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ def file_url(self, path, pretty=False):
253253
:return str: The URL displaying the given path.
254254
"""
255255
if self["repository_type"] == "hg":
256-
if path.startswith("comm/"):
257-
path = path[len("comm/") :]
256+
if "comm/" in path:
257+
path = path.split("comm/")[1]
258258
repo = self["comm_head_repository"]
259259
rev = self["comm_head_rev"]
260260
else:

test/test_parameters.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ def test_Parameters_check_extra(self):
9797
p = Parameters(strict=False, xyz=10, **self.vals)
9898
p.check() # should not raise
9999

100+
def test_Parameters_file_url_hg_comm(self):
101+
vals = self.vals.copy()
102+
vals["repository_type"] = "hg"
103+
104+
vals["comm_head_repository"] = "https://hg.mozilla.org/releases/comm-beta"
105+
vals["comm_head_rev"] = "branch"
106+
vals["head_repository"] = "https://hg.mozilla.org/releases/mozilla-beta"
107+
p = Parameters(**vals)
108+
109+
path = (
110+
"/builds/worker/checkouts/gecko/comm/taskcluster/kinds/"
111+
"shippable-l10n-signing"
112+
)
113+
kind_path = (
114+
"https://hg.mozilla.org/releases/comm-beta/file/branch/"
115+
"taskcluster/kinds/shippable-l10n-signing"
116+
)
117+
self.assertTrue(p.file_url(path, pretty=True) == kind_path)
118+
100119
def test_Parameters_file_url_git_remote(self):
101120
vals = self.vals.copy()
102121
vals["repository_type"] = "git"

0 commit comments

Comments
 (0)