github2gerrit 0.1.16__py3-none-any.whl → 0.1.17__py3-none-any.whl
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/core.py +75 -21
- {github2gerrit-0.1.16.dist-info → github2gerrit-0.1.17.dist-info}/METADATA +1 -1
- {github2gerrit-0.1.16.dist-info → github2gerrit-0.1.17.dist-info}/RECORD +6 -6
- {github2gerrit-0.1.16.dist-info → github2gerrit-0.1.17.dist-info}/WHEEL +0 -0
- {github2gerrit-0.1.16.dist-info → github2gerrit-0.1.17.dist-info}/entry_points.txt +0 -0
- {github2gerrit-0.1.16.dist-info → github2gerrit-0.1.17.dist-info}/licenses/LICENSE +0 -0
github2gerrit/core.py
CHANGED
@@ -1749,6 +1749,10 @@ class Orchestrator:
|
|
1749
1749
|
) -> None:
|
1750
1750
|
"""Set git global config and initialize git-review if needed."""
|
1751
1751
|
log.debug("Configuring git and git-review for %s", gerrit.host)
|
1752
|
+
|
1753
|
+
# Configure git user identity (required for merge operations)
|
1754
|
+
self._ensure_git_user_identity(inputs)
|
1755
|
+
|
1752
1756
|
# Prefer repo-local config; fallback to global if needed
|
1753
1757
|
try:
|
1754
1758
|
git_config(
|
@@ -1761,26 +1765,7 @@ class Orchestrator:
|
|
1761
1765
|
git_config(
|
1762
1766
|
"gitreview.username", inputs.gerrit_ssh_user_g2g, global_=True
|
1763
1767
|
)
|
1764
|
-
|
1765
|
-
git_config(
|
1766
|
-
"user.name",
|
1767
|
-
inputs.gerrit_ssh_user_g2g,
|
1768
|
-
global_=False,
|
1769
|
-
cwd=self.workspace,
|
1770
|
-
)
|
1771
|
-
except GitError:
|
1772
|
-
git_config("user.name", inputs.gerrit_ssh_user_g2g, global_=True)
|
1773
|
-
try:
|
1774
|
-
git_config(
|
1775
|
-
"user.email",
|
1776
|
-
inputs.gerrit_ssh_user_g2g_email,
|
1777
|
-
global_=False,
|
1778
|
-
cwd=self.workspace,
|
1779
|
-
)
|
1780
|
-
except GitError:
|
1781
|
-
git_config(
|
1782
|
-
"user.email", inputs.gerrit_ssh_user_g2g_email, global_=True
|
1783
|
-
)
|
1768
|
+
# Git user identity is configured by _ensure_git_user_identity
|
1784
1769
|
# Disable GPG signing to avoid interactive prompts for signing keys
|
1785
1770
|
try:
|
1786
1771
|
git_config(
|
@@ -4386,7 +4371,15 @@ class Orchestrator:
|
|
4386
4371
|
"""Suggest recovery actions based on merge failure analysis."""
|
4387
4372
|
stderr = (merge_exc.stderr or "").lower()
|
4388
4373
|
|
4389
|
-
if
|
4374
|
+
if (
|
4375
|
+
"committer identity unknown" in stderr
|
4376
|
+
or "empty ident name" in stderr
|
4377
|
+
):
|
4378
|
+
return (
|
4379
|
+
"Git user identity not configured - this should be handled "
|
4380
|
+
"automatically by the tool. Please report this as a bug."
|
4381
|
+
)
|
4382
|
+
elif "conflict" in stderr:
|
4390
4383
|
return "Check for merge conflicts in the PR files and resolve them"
|
4391
4384
|
elif "fatal: refusing to merge unrelated histories" in stderr:
|
4392
4385
|
return (
|
@@ -4516,6 +4509,67 @@ class Orchestrator:
|
|
4516
4509
|
|
4517
4510
|
log.error("=== End verbose merge failure analysis ===")
|
4518
4511
|
|
4512
|
+
def _ensure_git_user_identity(self, inputs: Inputs) -> None:
|
4513
|
+
"""Ensure git user identity is configured for merge operations."""
|
4514
|
+
log.debug("Ensuring git user identity is configured")
|
4515
|
+
|
4516
|
+
# Check if user.name and user.email are already configured
|
4517
|
+
try:
|
4518
|
+
name_result = run_cmd(
|
4519
|
+
["git", "config", "user.name"], cwd=self.workspace, check=False
|
4520
|
+
)
|
4521
|
+
email_result = run_cmd(
|
4522
|
+
["git", "config", "user.email"], cwd=self.workspace, check=False
|
4523
|
+
)
|
4524
|
+
|
4525
|
+
if (
|
4526
|
+
name_result.returncode == 0
|
4527
|
+
and name_result.stdout.strip()
|
4528
|
+
and email_result.returncode == 0
|
4529
|
+
and email_result.stdout.strip()
|
4530
|
+
):
|
4531
|
+
log.debug(
|
4532
|
+
"Git user identity already configured: %s <%s>",
|
4533
|
+
name_result.stdout.strip(),
|
4534
|
+
email_result.stdout.strip(),
|
4535
|
+
)
|
4536
|
+
return
|
4537
|
+
|
4538
|
+
except Exception as e:
|
4539
|
+
log.debug("Failed to check existing git identity: %s", e)
|
4540
|
+
|
4541
|
+
# Configure git identity using Gerrit credentials
|
4542
|
+
user_name = inputs.gerrit_ssh_user_g2g or "github2gerrit-bot"
|
4543
|
+
user_email = (
|
4544
|
+
inputs.gerrit_ssh_user_g2g_email or "github2gerrit@example.com"
|
4545
|
+
)
|
4546
|
+
|
4547
|
+
log.debug("Configuring git identity: %s <%s>", user_name, user_email)
|
4548
|
+
|
4549
|
+
try:
|
4550
|
+
# Set local repository identity
|
4551
|
+
run_cmd(
|
4552
|
+
["git", "config", "user.name", user_name], cwd=self.workspace
|
4553
|
+
)
|
4554
|
+
run_cmd(
|
4555
|
+
["git", "config", "user.email", user_email], cwd=self.workspace
|
4556
|
+
)
|
4557
|
+
log.debug("Successfully configured git user identity")
|
4558
|
+
|
4559
|
+
except CommandError as e:
|
4560
|
+
# Fallback to global config if local fails
|
4561
|
+
log.warning(
|
4562
|
+
"Failed to set local git identity, trying global: %s", e
|
4563
|
+
)
|
4564
|
+
try:
|
4565
|
+
run_cmd(["git", "config", "--global", "user.name", user_name])
|
4566
|
+
run_cmd(["git", "config", "--global", "user.email", user_email])
|
4567
|
+
log.debug("Successfully configured global git user identity")
|
4568
|
+
except CommandError as global_e:
|
4569
|
+
log.exception("Failed to configure git user identity")
|
4570
|
+
msg = "Cannot configure git user identity"
|
4571
|
+
raise OrchestratorError(msg) from global_e
|
4572
|
+
|
4519
4573
|
|
4520
4574
|
# ---------------------
|
4521
4575
|
# Utility functions
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: github2gerrit
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.17
|
4
4
|
Summary: Submit a GitHub pull request to a Gerrit repository.
|
5
5
|
Project-URL: Homepage, https://github.com/lfreleng-actions/github2gerrit
|
6
6
|
Project-URL: Repository, https://github.com/lfreleng-actions/github2gerrit
|
@@ -2,7 +2,7 @@ github2gerrit/__init__.py,sha256=N1Vj1HJ28LKCJLAynQdm5jFGQQAz9YSMzZhEfvbBgow,886
|
|
2
2
|
github2gerrit/cli.py,sha256=edQGODSo0A1RfvO0C7zAjWwIZCnt4RT67BnJwgL0MAY,67843
|
3
3
|
github2gerrit/commit_normalization.py,sha256=5HqUJ7p3WQzUYNTkganIsu82aW1wZrh7J7ivQvdCYXw,17033
|
4
4
|
github2gerrit/config.py,sha256=khuXAfmOc2wqO4r1Cpp8PYk04AO-JpmnJvSWQZ3fdL8,22315
|
5
|
-
github2gerrit/core.py,sha256=
|
5
|
+
github2gerrit/core.py,sha256=VlhzlZEo9DGd6Fn2WTx_5TDR9OmbpZ1t1-GmVA92TVM,174687
|
6
6
|
github2gerrit/duplicate_detection.py,sha256=HSL1IpyfPk0yLkzCKA8mWadYB3qENR6Ar3AfiH59lCI,28766
|
7
7
|
github2gerrit/external_api.py,sha256=9483kkgIs1ECOl_f0lcGb8GrJQF9IfYmWfBQwUJT9hk,18480
|
8
8
|
github2gerrit/gerrit_query.py,sha256=7AR9UEwZxtTb9V-l17UDdtWvlvROlnIeJVMa57ilf6s,8343
|
@@ -24,8 +24,8 @@ github2gerrit/trailers.py,sha256=9w0vIxPNBNQp56sIy-MF62d22Rm6vY-msh9ao1lX0rQ,838
|
|
24
24
|
github2gerrit/utils.py,sha256=1CKTsQo_FO3eyVjzNUT3XyFnyObIxyEFLeSmVKzavVo,3397
|
25
25
|
github2gerrit/orchestrator/__init__.py,sha256=HAEcdCAHOFr8LsdIwAdcIcFZn_ayMbX9rdVUULp8410,864
|
26
26
|
github2gerrit/orchestrator/reconciliation.py,sha256=qLhmjnIblSa_PVmBblWJ1gSvJ6Gto2AIVOVdYvT6zbk,18364
|
27
|
-
github2gerrit-0.1.
|
28
|
-
github2gerrit-0.1.
|
29
|
-
github2gerrit-0.1.
|
30
|
-
github2gerrit-0.1.
|
31
|
-
github2gerrit-0.1.
|
27
|
+
github2gerrit-0.1.17.dist-info/METADATA,sha256=AscYuKk_-EZkZt4LhTbX3vVeWW78nwPY4yOeyBlNaZM,33833
|
28
|
+
github2gerrit-0.1.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
github2gerrit-0.1.17.dist-info/entry_points.txt,sha256=MxN2_liIKo3-xJwtAulAeS5GcOS6JS96nvwOQIkP3W8,56
|
30
|
+
github2gerrit-0.1.17.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
31
|
+
github2gerrit-0.1.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|