Skip to content

Commit

Permalink
Merge pull request #428 from bbhtt/bbhtt/commit-msg-module-name
Browse files Browse the repository at this point in the history
manifest: Add module name of changed data in commit message
  • Loading branch information
wjt committed Jun 3, 2024
2 parents bf14aa1 + defaf7d commit 43612f5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ def _update_manifest(self, path, datas, changes):

data.update()
if data.new_version.version is not None:
message = "Update {} to {}".format(
data.filename, data.new_version.version
message = "{}: Update {} to {}".format(
data.module, data.filename, data.new_version.version
)
else:
message = "Update {}".format(data.filename)
message = "{}: Update {}".format(data.module, data.filename)

changes[message] = None
path_has_changes = True
Expand Down
32 changes: 19 additions & 13 deletions tests/test_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async def test_update_json(self):
filename,
contents,
expected_new_contents,
["Update UnityHubSetup.AppImage to 1.2.3.4"],
["foo: Update UnityHubSetup.AppImage to 1.2.3.4"],
)

async def test_update_yaml(self):
Expand Down Expand Up @@ -288,7 +288,7 @@ async def test_update_yaml(self):
filename,
contents,
expected_new_contents,
["Update UnityHubSetup.AppImage to 1.2.3.4"],
["foo: Update UnityHubSetup.AppImage to 1.2.3.4"],
expected_data_count=2,
)

Expand Down Expand Up @@ -320,7 +320,7 @@ async def test_update_no_new_version(self):
filename,
contents,
expected_new_contents,
["Update some-deb.deb to 1.2.3.4"],
["foo: Update some-deb.deb to 1.2.3.4"],
new_release=False,
)

Expand Down Expand Up @@ -348,7 +348,7 @@ async def test_update_single_module(self):
filename,
contents,
expected_new_contents,
["Update some-deb.deb to 1.2.3.4"],
["foo: Update some-deb.deb to 1.2.3.4"],
new_release=False,
)

Expand All @@ -372,7 +372,7 @@ async def test_update_single_source(self):
filename,
contents,
expected_new_contents,
["Update some-deb.deb to 1.2.3.4"],
["None: Update some-deb.deb to 1.2.3.4"],
new_release=False,
)

Expand Down Expand Up @@ -418,7 +418,7 @@ async def test_update_sources(self):
filename,
contents,
expected_new_contents,
["Update some-deb.deb to 1.2.3.4"],
["None: Update some-deb.deb to 1.2.3.4"],
expected_data_count=2,
new_release=False,
)
Expand Down Expand Up @@ -717,7 +717,9 @@ async def test_update_one_important_source_updated(self):
filename=filename,
contents=contents,
expected_new_contents=expected_new_contents,
expected_updates=["Update extra-cmake-modules to 1.2.3.4"],
expected_updates=[
"extra-cmake-modules: Update extra-cmake-modules to 1.2.3.4"
],
expected_data_count=2,
new_release=False,
require_important_update=True,
Expand Down Expand Up @@ -796,8 +798,8 @@ async def test_update_two_important_sources_first_updated(self):
contents=contents,
expected_new_contents=expected_new_contents,
expected_updates=[
"Update extra-cmake-modules to 1.2.3.4",
"Update vt-py.git to 1.2.3.4",
"extra-cmake-modules: Update extra-cmake-modules to 1.2.3.4",
"vt-py: Update vt-py.git to 1.2.3.4",
],
expected_data_count=2,
new_release=False,
Expand Down Expand Up @@ -876,7 +878,9 @@ async def test_update_two_important_sources_second_updated(self):
filename=filename,
contents=contents,
expected_new_contents=expected_new_contents,
expected_updates=["Update extra-cmake-modules to 1.2.3.4"],
expected_updates=[
"extra-cmake-modules: Update extra-cmake-modules to 1.2.3.4"
],
expected_data_count=2,
new_release=True,
require_important_update=True,
Expand Down Expand Up @@ -1012,7 +1016,9 @@ async def test_update_one_main_source_updated(self):
filename=filename,
contents=contents,
expected_new_contents=expected_new_contents,
expected_updates=["Update extra-cmake-modules to 1.2.3.4"],
expected_updates=[
"extra-cmake-modules: Update extra-cmake-modules to 1.2.3.4"
],
expected_data_count=2,
new_release=True,
require_important_update=True,
Expand Down Expand Up @@ -1083,8 +1089,8 @@ async def test_require_important_source_disabled_no_important_source_updated(sel
contents=contents,
expected_new_contents=expected_new_contents,
expected_updates=[
"Update extra-cmake-modules to 1.2.3.4",
"Update vt-py.git to 1.2.3.4",
"extra-cmake-modules: Update extra-cmake-modules to 1.2.3.4",
"vt-py: Update vt-py.git to 1.2.3.4",
],
expected_data_count=2,
new_release=True,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ async def test_full_run(self):

body_lines = commit_data["body"].splitlines()
self.assertEqual(len(body_lines), 2)
self.assertRegex(body_lines[0], r"^Update libXaw-1.0.12.tar.bz2 to ")
self.assertRegex(body_lines[1], r"^Update xterm-snapshots.git to ")
self.assertRegex(body_lines[0], r"^libXaw: Update libXaw-1.0.12.tar.bz2 to ")
self.assertRegex(body_lines[1], r"^xterm: Update xterm-snapshots.git to ")

args2 = main.parse_cli_args([self.manifest_path])
self.assertEqual(await main.run_with_args(args2), (0, 0, False))
Expand Down

0 comments on commit 43612f5

Please sign in to comment.