github2gerrit 0.1.5__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.editorconfig +3 -3
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.pre-commit-config.yaml +2 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.yamllint +2 -0
- {github2gerrit-0.1.5/src/github2gerrit.egg-info → github2gerrit-0.1.6}/PKG-INFO +22 -25
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/README.md +21 -24
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/action.yaml +19 -19
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/pyproject.toml +4 -5
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/cli.py +86 -117
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/config.py +32 -24
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/core.py +425 -417
- github2gerrit-0.1.6/src/github2gerrit/duplicate_detection.py +724 -0
- github2gerrit-0.1.6/src/github2gerrit/gerrit_urls.py +256 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/github_api.py +6 -17
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/gitutils.py +30 -13
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/models.py +1 -0
- github2gerrit-0.1.6/src/github2gerrit/similarity.py +458 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/ssh_discovery.py +20 -67
- {github2gerrit-0.1.5 → github2gerrit-0.1.6/src/github2gerrit.egg-info}/PKG-INFO +22 -25
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/SOURCES.txt +4 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/conftest.py +3 -10
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/fixtures/make_repo.py +15 -12
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_cli.py +6 -17
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_cli_helpers.py +4 -12
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_cli_outputs_file.py +5 -16
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_cli_url_and_dryrun.py +3 -9
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_config_and_reviewers.py +1 -3
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_config_helpers.py +19 -68
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_close_pr_policy.py +7 -21
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_config_and_errors.py +16 -48
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_gerrit_backref_comment.py +30 -33
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_gerrit_rest_results.py +15 -47
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_integration_fixture_repo.py +2 -6
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_prepare_commits.py +17 -53
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_ssh_setup.py +20 -60
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_duplicate_detection.py +75 -118
- github2gerrit-0.1.6/tests/test_gerrit_change_id_footer.py +154 -0
- github2gerrit-0.1.6/tests/test_gerrit_urls.py +336 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_ghe_and_gitreview_args.py +4 -14
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_github_api_helpers.py +1 -4
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_gitutils_helpers.py +9 -30
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_ssh_discovery.py +29 -48
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_url_parser.py +1 -3
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/uv.lock +25 -0
- github2gerrit-0.1.5/src/github2gerrit/duplicate_detection.py +0 -542
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/actionlint.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/dependabot.yml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/release-drafter.yml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/build-test-release.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/build-test.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/dependencies.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/github2gerrit.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/release-drafter.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/semantic-pull-request.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.github/workflows/sha-pinned-actions.yaml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.gitignore +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.gitlint +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/.readthedocs.yml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/LICENSE +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/LICENSES/Apache-2.0.txt +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/REUSE.toml +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/setup.cfg +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/sitecustomize.py +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit/__init__.py +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/dependency_links.txt +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/entry_points.txt +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/requires.txt +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/top_level.txt +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/fixtures/__init__.py +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_core_gerrit_push_errors.py +0 -0
- {github2gerrit-0.1.5 → github2gerrit-0.1.6}/tests/test_github_api_retry_and_helpers.py +0 -0
@@ -79,6 +79,7 @@ repos:
|
|
79
79
|
hooks:
|
80
80
|
- id: write-good
|
81
81
|
files: "\\.(rst|md|markdown|mdown|mkdn)$"
|
82
|
+
exclude: "GERRIT_URL_CENTRALIZATION.md"
|
82
83
|
|
83
84
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
84
85
|
rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
|
@@ -90,6 +91,7 @@ repos:
|
|
90
91
|
hooks:
|
91
92
|
- id: markdownlint
|
92
93
|
args: ["--fix"]
|
94
|
+
exclude: "GERRIT_URL_CENTRALIZATION.md"
|
93
95
|
|
94
96
|
- repo: https://github.com/fsfe/reuse-tool
|
95
97
|
rev: 60dfc6b2ad9e1f3eabfbcf3a0dc202ee89dc5a00 # frozen: v5.0.2
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: github2gerrit
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.6
|
4
4
|
Summary: Submit a GitHub pull request to a Gerrit repository.
|
5
5
|
Author-email: Matthew Watkins <mwatkins@linuxfoundation.org>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -105,16 +105,25 @@ stabilize coverage reporting for parallel/xdist runs.
|
|
105
105
|
|
106
106
|
## Duplicate detection
|
107
107
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
Duplicate detection uses a scoring-based approach. Instead of relying on a hash
|
109
|
+
added by this action, the detector compares the first line of the commit message
|
110
|
+
(subject/PR title), analyzes the body text and the set of files changed, and
|
111
|
+
computes a similarity score. When the score meets or exceeds a configurable
|
112
|
+
threshold (default 0.8), the tool treats the change as a duplicate and blocks
|
113
|
+
submission. This approach aims to remain robust even when similar changes
|
114
|
+
appeared outside this pipeline.
|
112
115
|
|
113
116
|
### Examples of detected duplicates
|
114
117
|
|
115
|
-
-
|
116
|
-
|
117
|
-
|
118
|
+
- Dependency bumps for the same package across close versions
|
119
|
+
(e.g., "Bump foo from 1.0 to 1.1" vs "Bump foo from 1.1 to 1.2")
|
120
|
+
with overlapping files — high score
|
121
|
+
- Pre-commit autoupdates that change .pre-commit-config.yaml and hook versions —
|
122
|
+
high score
|
123
|
+
- GitHub Actions version bumps that update .github/workflows/* uses lines —
|
124
|
+
medium to high score
|
125
|
+
- Similar bug fixes with the same subject and significant file overlap —
|
126
|
+
strong match
|
118
127
|
|
119
128
|
### Allowing duplicates
|
120
129
|
|
@@ -290,19 +299,7 @@ jobs:
|
|
290
299
|
submit-to-gerrit:
|
291
300
|
runs-on: ubuntu-latest
|
292
301
|
steps:
|
293
|
-
|
294
|
-
<!-- markdownlint-disable-next-line MD013 -->
|
295
|
-
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
|
296
|
-
with:
|
297
|
-
key: ${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}
|
298
|
-
name: "id_rsa"
|
299
|
-
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
|
300
|
-
config: |
|
301
|
-
Host ${{ vars.GERRIT_SERVER }}
|
302
|
-
User ${{ vars.GERRIT_SSH_USER_G2G }}
|
303
|
-
Port ${{ vars.GERRIT_SERVER_PORT }}
|
304
|
-
PubkeyAcceptedKeyTypes +ssh-rsa
|
305
|
-
IdentityFile ~/.ssh/id_rsa
|
302
|
+
|
306
303
|
|
307
304
|
- name: Submit PR to Gerrit (with explicit overrides)
|
308
305
|
id: g2g
|
@@ -336,10 +333,10 @@ jobs:
|
|
336
333
|
|
337
334
|
Notes:
|
338
335
|
|
339
|
-
-
|
340
|
-
|
341
|
-
-
|
342
|
-
|
336
|
+
- The action configures SSH internally using the provided inputs (key,
|
337
|
+
known_hosts) and does not use the runner’s SSH agent or ~/.ssh/config.
|
338
|
+
- Do not add external steps to install SSH keys or edit SSH config; they’re
|
339
|
+
unnecessary and may conflict with the action.
|
343
340
|
|
344
341
|
## GitHub Enterprise support
|
345
342
|
|
@@ -65,16 +65,25 @@ stabilize coverage reporting for parallel/xdist runs.
|
|
65
65
|
|
66
66
|
## Duplicate detection
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
Duplicate detection uses a scoring-based approach. Instead of relying on a hash
|
69
|
+
added by this action, the detector compares the first line of the commit message
|
70
|
+
(subject/PR title), analyzes the body text and the set of files changed, and
|
71
|
+
computes a similarity score. When the score meets or exceeds a configurable
|
72
|
+
threshold (default 0.8), the tool treats the change as a duplicate and blocks
|
73
|
+
submission. This approach aims to remain robust even when similar changes
|
74
|
+
appeared outside this pipeline.
|
72
75
|
|
73
76
|
### Examples of detected duplicates
|
74
77
|
|
75
|
-
-
|
76
|
-
|
77
|
-
|
78
|
+
- Dependency bumps for the same package across close versions
|
79
|
+
(e.g., "Bump foo from 1.0 to 1.1" vs "Bump foo from 1.1 to 1.2")
|
80
|
+
with overlapping files — high score
|
81
|
+
- Pre-commit autoupdates that change .pre-commit-config.yaml and hook versions —
|
82
|
+
high score
|
83
|
+
- GitHub Actions version bumps that update .github/workflows/* uses lines —
|
84
|
+
medium to high score
|
85
|
+
- Similar bug fixes with the same subject and significant file overlap —
|
86
|
+
strong match
|
78
87
|
|
79
88
|
### Allowing duplicates
|
80
89
|
|
@@ -250,19 +259,7 @@ jobs:
|
|
250
259
|
submit-to-gerrit:
|
251
260
|
runs-on: ubuntu-latest
|
252
261
|
steps:
|
253
|
-
|
254
|
-
<!-- markdownlint-disable-next-line MD013 -->
|
255
|
-
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
|
256
|
-
with:
|
257
|
-
key: ${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}
|
258
|
-
name: "id_rsa"
|
259
|
-
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
|
260
|
-
config: |
|
261
|
-
Host ${{ vars.GERRIT_SERVER }}
|
262
|
-
User ${{ vars.GERRIT_SSH_USER_G2G }}
|
263
|
-
Port ${{ vars.GERRIT_SERVER_PORT }}
|
264
|
-
PubkeyAcceptedKeyTypes +ssh-rsa
|
265
|
-
IdentityFile ~/.ssh/id_rsa
|
262
|
+
|
266
263
|
|
267
264
|
- name: Submit PR to Gerrit (with explicit overrides)
|
268
265
|
id: g2g
|
@@ -296,10 +293,10 @@ jobs:
|
|
296
293
|
|
297
294
|
Notes:
|
298
295
|
|
299
|
-
-
|
300
|
-
|
301
|
-
-
|
302
|
-
|
296
|
+
- The action configures SSH internally using the provided inputs (key,
|
297
|
+
known_hosts) and does not use the runner’s SSH agent or ~/.ssh/config.
|
298
|
+
- Do not add external steps to install SSH keys or edit SSH config; they’re
|
299
|
+
unnecessary and may conflict with the action.
|
303
300
|
|
304
301
|
## GitHub Enterprise support
|
305
302
|
|
@@ -33,16 +33,20 @@ inputs:
|
|
33
33
|
GERRIT_SSH_USER_G2G:
|
34
34
|
description: >
|
35
35
|
Gerrit SSH username (e.g. automation bot account). In GitHub Actions,
|
36
|
-
automatically derived as [ORGANIZATION].gh2gerrit when not provided
|
37
|
-
For local CLI usage,
|
36
|
+
automatically derived as [ORGANIZATION].gh2gerrit when not provided if
|
37
|
+
G2G_ENABLE_DERIVATION=true (default: false). For local CLI usage,
|
38
|
+
derivation is enabled by default; set
|
39
|
+
G2G_ENABLE_DERIVATION=false to disable.
|
38
40
|
required: false
|
39
41
|
default: ""
|
40
42
|
GERRIT_SSH_USER_G2G_EMAIL:
|
41
43
|
description: >
|
42
44
|
Email address associated to the Gerrit SSH user. In GitHub Actions,
|
43
45
|
automatically derived as
|
44
|
-
releng+[ORGANIZATION]-gh2gerrit@linuxfoundation.org when not provided
|
45
|
-
For local CLI usage,
|
46
|
+
releng+[ORGANIZATION]-gh2gerrit@linuxfoundation.org when not provided if
|
47
|
+
G2G_ENABLE_DERIVATION=true (default: false). For local CLI usage,
|
48
|
+
derivation is enabled by default; set
|
49
|
+
G2G_ENABLE_DERIVATION=false to disable.
|
46
50
|
required: false
|
47
51
|
default: ""
|
48
52
|
|
@@ -76,13 +80,21 @@ inputs:
|
|
76
80
|
required: false
|
77
81
|
default: ""
|
78
82
|
|
83
|
+
DUPLICATES:
|
84
|
+
description: >
|
85
|
+
Comma-separated Gerrit statuses to consider for duplicate
|
86
|
+
detection (e.g., open,merged,abandoned)
|
87
|
+
required: false
|
88
|
+
default: "open"
|
89
|
+
|
79
90
|
# Optional Gerrit overrides (used when .gitreview is missing)
|
80
91
|
GERRIT_SERVER:
|
81
92
|
description: >
|
82
93
|
Gerrit server hostname (optional; use .gitreview if present). In GitHub
|
83
94
|
Actions, automatically derived as gerrit.[ORGANIZATION].org when not
|
84
|
-
provided. For local CLI
|
85
|
-
derivation
|
95
|
+
provided if G2G_ENABLE_DERIVATION=true (default: false). For local CLI
|
96
|
+
usage, derivation is enabled by default; set G2G_ENABLE_DERIVATION=false
|
97
|
+
to disable.
|
86
98
|
required: false
|
87
99
|
default: ""
|
88
100
|
GERRIT_SERVER_PORT:
|
@@ -204,19 +216,6 @@ runs:
|
|
204
216
|
fi
|
205
217
|
fi
|
206
218
|
|
207
|
-
- name: Install SSH key for Gerrit
|
208
|
-
# yamllint disable-line rule:line-length
|
209
|
-
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
|
210
|
-
with:
|
211
|
-
key: ${{ inputs.GERRIT_SSH_PRIVKEY_G2G }}
|
212
|
-
name: "id_rsa"
|
213
|
-
known_hosts: ${{ inputs.GERRIT_KNOWN_HOSTS }}
|
214
|
-
config: |
|
215
|
-
Host ${{ inputs.GERRIT_SERVER || env.GERRIT_SERVER }}
|
216
|
-
User ${{ inputs.GERRIT_SSH_USER_G2G }}
|
217
|
-
Port ${{ inputs.GERRIT_SERVER_PORT }}
|
218
|
-
PubkeyAcceptedKeyTypes +ssh-rsa
|
219
|
-
IdentityFile ~/.ssh/id_rsa
|
220
219
|
|
221
220
|
- name: Run github2gerrit Python CLI
|
222
221
|
id: run-cli
|
@@ -240,6 +239,7 @@ runs:
|
|
240
239
|
DRY_RUN: ${{ inputs.DRY_RUN }}
|
241
240
|
ALLOW_DUPLICATES: ${{ inputs.ALLOW_DUPLICATES }}
|
242
241
|
ISSUE_ID: ${{ inputs.ISSUE_ID }}
|
242
|
+
DUPLICATES: ${{ inputs.DUPLICATES }}
|
243
243
|
|
244
244
|
# Optional Gerrit overrides (when .gitreview is missing)
|
245
245
|
GERRIT_SERVER: ${{ inputs.GERRIT_SERVER }}
|
@@ -76,7 +76,7 @@ dev = [
|
|
76
76
|
]
|
77
77
|
|
78
78
|
[tool.ruff]
|
79
|
-
line-length =
|
79
|
+
line-length = 120
|
80
80
|
target-version = "py311"
|
81
81
|
|
82
82
|
[tool.ruff.lint]
|
@@ -92,8 +92,9 @@ ignore = [
|
|
92
92
|
]
|
93
93
|
|
94
94
|
[tool.ruff.lint.per-file-ignores]
|
95
|
-
"tests/*.py" = ["S101", "S105", "PLW0603", "
|
96
|
-
"sitecustomize.py" = ["S110", "SIM103", "SIM105", "PLW2901"
|
95
|
+
"tests/*.py" = ["S101", "S105", "PLW0603", "TRY003"]
|
96
|
+
"sitecustomize.py" = ["S110", "SIM103", "SIM105", "PLW2901"]
|
97
|
+
"src/github2gerrit/duplicate_detection.py" = ["S310"]
|
97
98
|
|
98
99
|
[tool.ruff.lint.isort]
|
99
100
|
known-first-party = ["github2gerrit"]
|
@@ -124,8 +125,6 @@ exclude = [
|
|
124
125
|
"tests/fixtures/",
|
125
126
|
]
|
126
127
|
|
127
|
-
|
128
|
-
|
129
128
|
[[tool.mypy.overrides]]
|
130
129
|
module = ["pygerrit2", "pygerrit2.*"]
|
131
130
|
ignore_missing_imports = true
|