path-sync 0.6.0__tar.gz → 0.6.2__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.
- {path_sync-0.6.0 → path_sync-0.6.2}/PKG-INFO +2 -2
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/__init__.py +1 -1
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/git_ops.py +49 -4
- {path_sync-0.6.0 → path_sync-0.6.2}/pyproject.toml +2 -2
- {path_sync-0.6.0 → path_sync-0.6.2}/.gitignore +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/LICENSE +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/README.md +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/__main__.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/__init__.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/cmd_boot.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/cmd_copy.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/cmd_dep_update.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/cmd_options.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/cmd_validate.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/file_utils.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/header.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/log_capture.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/models.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/models_dep.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/prompt_utils.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/typer_app.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/validation.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/verify.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/_internal/yaml_utils.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/config.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/copy.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/dep_update.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/sections.py +0 -0
- {path_sync-0.6.0 → path_sync-0.6.2}/path_sync/validate_no_changes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: path-sync
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Sync files from a source repo to multiple destination repos
|
|
5
5
|
Author-email: EspenAlbert <espen.albert1@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -13,7 +13,7 @@ Requires-Dist: gitpython>=3.1.0
|
|
|
13
13
|
Requires-Dist: pydantic>=2.0
|
|
14
14
|
Requires-Dist: pyyaml>=6.0
|
|
15
15
|
Requires-Dist: typer>=0.16.0
|
|
16
|
-
Requires-Dist: zero-3rdparty>=0.
|
|
16
|
+
Requires-Dist: zero-3rdparty>=0.104.2
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
|
|
19
19
|
# path-sync
|
|
@@ -105,12 +105,12 @@ def get_remote_url(repo: Repo, remote_name: str = "origin") -> str:
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
def has_changes(repo: Repo) -> bool:
|
|
108
|
-
return repo.is_dirty() or len(repo.untracked_files) > 0
|
|
108
|
+
return repo.is_dirty(submodules=False) or len(repo.untracked_files) > 0
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
def commit_changes(repo: Repo, message: str) -> None:
|
|
112
112
|
repo.git.add("-A")
|
|
113
|
-
if repo.is_dirty():
|
|
113
|
+
if repo.is_dirty(submodules=False):
|
|
114
114
|
_ensure_git_user(repo)
|
|
115
115
|
repo.git.commit("-m", message)
|
|
116
116
|
logger.info(f"Committed: {message}")
|
|
@@ -124,7 +124,7 @@ def stage_and_commit(repo: Repo, add_paths: list[str], message: str) -> bool:
|
|
|
124
124
|
repo.git.add(path)
|
|
125
125
|
for path in exclude:
|
|
126
126
|
repo.git.reset("HEAD", "--", path)
|
|
127
|
-
if not repo.is_dirty(index=True):
|
|
127
|
+
if not repo.is_dirty(index=True, submodules=False):
|
|
128
128
|
return False
|
|
129
129
|
_ensure_git_user(repo)
|
|
130
130
|
repo.git.commit("-m", message)
|
|
@@ -147,8 +147,53 @@ def push_branch(repo: Repo, branch: str, force: bool = True) -> None:
|
|
|
147
147
|
repo.git.push(*args)
|
|
148
148
|
|
|
149
149
|
|
|
150
|
+
def _get_repo_full_name(repo_path: Path) -> str | None:
|
|
151
|
+
"""Get owner/repo from gh CLI."""
|
|
152
|
+
cmd = [
|
|
153
|
+
"gh",
|
|
154
|
+
"repo",
|
|
155
|
+
"view",
|
|
156
|
+
"--json",
|
|
157
|
+
"owner,name",
|
|
158
|
+
"-q",
|
|
159
|
+
'.owner.login + "/" + .name',
|
|
160
|
+
]
|
|
161
|
+
result = subprocess.run(cmd, cwd=repo_path, capture_output=True, text=True)
|
|
162
|
+
if result.returncode != 0:
|
|
163
|
+
logger.warning(f"Failed to get repo info: {result.stderr}")
|
|
164
|
+
return None
|
|
165
|
+
return result.stdout.strip()
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _get_pr_number(repo_path: Path, branch: str) -> str | None:
|
|
169
|
+
"""Get PR number for a branch."""
|
|
170
|
+
cmd = ["gh", "pr", "view", branch, "--json", "number", "-q", ".number"]
|
|
171
|
+
result = subprocess.run(cmd, cwd=repo_path, capture_output=True, text=True)
|
|
172
|
+
if result.returncode != 0:
|
|
173
|
+
logger.warning(f"Failed to get PR number: {result.stderr}")
|
|
174
|
+
return None
|
|
175
|
+
return result.stdout.strip()
|
|
176
|
+
|
|
177
|
+
|
|
150
178
|
def update_pr_body(repo_path: Path, branch: str, body: str) -> bool:
|
|
151
|
-
|
|
179
|
+
"""Update PR body using REST API (only requires 'repo' scope, not 'read:org')."""
|
|
180
|
+
repo_full = _get_repo_full_name(repo_path)
|
|
181
|
+
if not repo_full:
|
|
182
|
+
return False
|
|
183
|
+
|
|
184
|
+
pr_number = _get_pr_number(repo_path, branch)
|
|
185
|
+
if not pr_number:
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
cmd = [
|
|
189
|
+
"gh",
|
|
190
|
+
"api",
|
|
191
|
+
"-X",
|
|
192
|
+
"PATCH",
|
|
193
|
+
f"repos/{repo_full}/pulls/{pr_number}",
|
|
194
|
+
"-f",
|
|
195
|
+
f"body={body}",
|
|
196
|
+
]
|
|
152
197
|
result = subprocess.run(cmd, cwd=repo_path, capture_output=True, text=True)
|
|
153
198
|
if result.returncode != 0:
|
|
154
199
|
logger.warning(f"Failed to update PR body: {result.stderr}")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "path-sync"
|
|
5
|
-
version = "0.6.
|
|
5
|
+
version = "0.6.2"
|
|
6
6
|
description = "Sync files from a source repo to multiple destination repos"
|
|
7
7
|
requires-python = ">=3.13"
|
|
8
8
|
license = "MIT"
|
|
@@ -28,7 +28,7 @@ dependencies = [
|
|
|
28
28
|
"pyyaml>=6.0",
|
|
29
29
|
"typer>=0.16.0",
|
|
30
30
|
"gitpython>=3.1.0",
|
|
31
|
-
"zero-3rdparty>=0.
|
|
31
|
+
"zero-3rdparty>=0.104.2",
|
|
32
32
|
]
|
|
33
33
|
|
|
34
34
|
[project.scripts]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|