Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions landoscript/src/landoscript/actions/android_l10n_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def run(
log.info(f"fetching original files from l10n repository: {dst_files}")
orig_files = await github_client.get_files(dst_files, branch=to_branch)

diff = ""
diffs = []
for l10n_file in l10n_files:
if l10n_file.dst_name not in orig_files:
log.warning(f"WEIRD: {l10n_file.dst_name} not in orig_files, continuing anyways...")
Expand All @@ -106,7 +106,7 @@ async def run(
log.warning(f"old and new contents of {l10n_file.dst_name} are the same, skipping bump...")
continue

diff += diff_contents(orig_file, new_file, l10n_file.dst_name)
diffs.append(diff_contents(orig_file, new_file, l10n_file.dst_name))

for toml_info in android_l10n_import_info.toml_info:
src_path = toml_info.toml_path
Expand All @@ -122,11 +122,13 @@ async def run(
log.warning(f"old and new contents of {dst_path} are the same, skipping bump...")
continue

diff += diff_contents(orig_file, new_file, dst_path)
diffs.append(diff_contents(orig_file, new_file, dst_path))

if not diff:
if not diffs:
return []

diff = "\n".join(diffs)

with open(os.path.join(public_artifact_dir, "android-import.diff"), "w+") as f:
f.write(diff)

Expand Down
10 changes: 6 additions & 4 deletions landoscript/src/landoscript/actions/android_l10n_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def run(github_client: GithubClient, public_artifact_dir: str, android_l10
log.info(f"fetching original files from l10n repository: {dst_files}")
orig_files = await github_client.get_files(dst_files, branch=to_branch)

diff = ""
diffs = []
for l10n_file in l10n_files:
if l10n_file.dst_name not in orig_files:
log.warning(f"WEIRD: {l10n_file.dst_name} not in orig_files, continuing anyways...")
Expand All @@ -98,7 +98,7 @@ async def run(github_client: GithubClient, public_artifact_dir: str, android_l10
log.warning(f"old and new contents of {l10n_file.dst_name} are the same, skipping bump...")
continue

diff += diff_contents(orig_file, new_file, l10n_file.dst_name)
diffs.append(diff_contents(orig_file, new_file, l10n_file.dst_name))

for toml_info in android_l10n_sync_info.toml_info:
if toml_info.toml_path not in new_files or toml_info.toml_path not in orig_files:
Expand All @@ -111,11 +111,13 @@ async def run(github_client: GithubClient, public_artifact_dir: str, android_l10
log.warning(f"old and new contents of {toml_info.toml_path} are the same, skipping bump...")
continue

diff += diff_contents(orig_file, new_file, toml_info.toml_path)
diffs.append(diff_contents(orig_file, new_file, toml_info.toml_path))

if not diff:
if not diffs:
return []

diff = "\n".join(diffs)

with open(os.path.join(public_artifact_dir, "android-sync.diff"), "w+") as f:
f.write(diff)

Expand Down
8 changes: 5 additions & 3 deletions landoscript/src/landoscript/actions/merge_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async def run(
# process replacements, regex-replacements, and update clobber file
replacements = merge_info.replacements
regex_replacements = merge_info.regex_replacements
diff = ""
diffs = []
if replacements or regex_replacements:
log.info("Performing replacements and regex_replacements")
needed_files = []
Expand All @@ -167,15 +167,17 @@ async def run(
if orig_contents[fn] is None:
raise LandoscriptError(f"Couldn't find file '{fn}' in repository!")

diff += diff_contents(str(orig_contents[fn]), new_contents[fn], fn)
diffs.append(diff_contents(str(orig_contents[fn]), new_contents[fn], fn))

log.info("Touching clobber file")
orig_clobber_file = (await github_client.get_files("CLOBBER", bump_branch))["CLOBBER"]
if orig_clobber_file is None:
raise LandoscriptError("Couldn't find CLOBBER file in repository!")

new_clobber_file = get_new_clobber_file(orig_clobber_file)
diff += diff_contents(orig_clobber_file, new_clobber_file, "CLOBBER")
diffs.append(diff_contents(orig_clobber_file, new_clobber_file, "CLOBBER"))

diff = "\n".join(diffs)

log.info("replacements and clobber diff is:")
log_file_contents(diff)
Expand Down
8 changes: 5 additions & 3 deletions landoscript/src/landoscript/actions/version_bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def run(
the time of writing is when running the `release-to-esr` merge automation. Future uses
are discouraged, and should be avoided if at all possible."""

diff = ""
diffs = []

for version_bump_info in version_bump_infos:
next_version = version_bump_info.next_version
Expand Down Expand Up @@ -89,12 +89,14 @@ async def run(
log.info(f"{file}: successfully bumped! new contents are:")
log_file_contents(modified)

diff += diff_contents(orig, modified, file)
diffs.append(diff_contents(orig, modified, file))

if not diff:
if not diffs:
log.info("no files to bump")
return []

diff = "\n".join(diffs)

with open(os.path.join(public_artifact_dir, "version-bump.diff"), "w+") as f:
f.write(diff)

Expand Down
4 changes: 2 additions & 2 deletions landoscript/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def assert_add_commit_response(action, commit_msg_strings, initial_values, expec
for msg in commit_msg_strings:
assert msg in action["commitmsg"]

diffs = action["diff"].split("diff\n")
diffs = action["diff"].split("\ndiff")

# ensure expected bumps are present to a reasonable degree of certainty
for file, after in expected_bumps.items():
Expand Down Expand Up @@ -244,7 +244,7 @@ def assert_add_commit_response(action, commit_msg_strings, initial_values, expec
if "\n" in before or "\n" in after:
break

if f"-{before}" in diff and f"+{after}":
if f"-{before}" in diff and f"+{after}" in diff:
break
else:
assert False, f"no bump found for {file}: {diffs}"
Expand Down