|
3 | 3 |
|
4 | 4 | import pytest |
5 | 5 | from git import Repo |
6 | | -from utils import hg_cat |
| 6 | +from utils import hg_cat, hg_log, hg_rev |
7 | 7 |
|
8 | 8 | from git_hg_sync.__main__ import get_connection, get_queue |
9 | 9 | from git_hg_sync.config import PulseConfig, TrackedRepository |
@@ -38,6 +38,11 @@ def test_sync_process_( |
38 | 38 | repo.index.add([foo_path]) |
39 | 39 | repo.index.commit("add foo.txt") |
40 | 40 |
|
| 41 | + branch = "bar" |
| 42 | + tag_branch = "tags" |
| 43 | + tag = "mytag" |
| 44 | + tag_suffix = "some suffix" |
| 45 | + |
41 | 46 | # Push to mercurial repository |
42 | 47 | subprocess.run( |
43 | 48 | [ |
@@ -71,19 +76,28 @@ def test_sync_process_( |
71 | 76 | git_local_repo_path = tmp_path / "clones" / "myrepo" |
72 | 77 | syncrepos = RepoSynchronizer(git_local_repo_path, str(git_remote_repo_path)) |
73 | 78 | operations: list[SyncBranchOperation | SyncTagOperation] = [ |
74 | | - SyncBranchOperation(source_commit=git_commit_sha, destination_branch="bar"), |
| 79 | + SyncBranchOperation(source_commit=git_commit_sha, destination_branch=branch), |
75 | 80 | SyncTagOperation( |
76 | | - source_commit=git_commit_sha, tag="mytag", tags_destination_branch="tags" |
| 81 | + source_commit=git_commit_sha, |
| 82 | + tag=tag, |
| 83 | + tags_destination_branch=tag_branch, |
| 84 | + tag_message_suffix=tag_suffix, |
77 | 85 | ), |
78 | 86 | ] |
79 | 87 |
|
80 | 88 | request_user = "request_user@example.com" |
81 | 89 | syncrepos.sync(str(hg_remote_repo_path), operations, request_user) |
82 | 90 |
|
83 | 91 | # test |
84 | | - assert "BAR CONTENT" in hg_cat(hg_remote_repo_path, "bar.txt", "bar") |
85 | | - |
86 | | - assert "BAR CONTENT" in hg_cat(hg_remote_repo_path, "bar.txt", "mytag") |
| 92 | + assert "BAR CONTENT" in hg_cat(hg_remote_repo_path, "bar.txt", branch) |
| 93 | + assert "BAR CONTENT" in hg_cat(hg_remote_repo_path, "bar.txt", tag) |
| 94 | + |
| 95 | + # test tag commit message |
| 96 | + tag_log = hg_log(hg_remote_repo_path, tag_branch, ["-T", "{desc}"]) |
| 97 | + assert "No bug - Tagging" in tag_log |
| 98 | + assert tag_suffix in tag_log |
| 99 | + assert tag in tag_log |
| 100 | + assert hg_rev(hg_remote_repo_path, branch) in tag_log |
87 | 101 |
|
88 | 102 |
|
89 | 103 | def test_get_connection_and_queue(pulse_config: PulseConfig) -> None: |
|
0 commit comments