ghstack 0.9.0__tar.gz → 0.9.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.
- {ghstack-0.9.0 → ghstack-0.9.2}/PKG-INFO +2 -1
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/config.py +8 -2
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/github_real.py +12 -2
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/gpg_sign.py +1 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/rage.py +1 -1
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/shell.py +7 -17
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/submit.py +32 -10
- {ghstack-0.9.0 → ghstack-0.9.2}/pyproject.toml +4 -3
- {ghstack-0.9.0 → ghstack-0.9.2}/LICENSE +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/README.md +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/__init__.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/__main__.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/action.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/cache.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/checkout.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/circleci.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/circleci_real.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/cli.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/diff.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/forensics.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/git.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/github.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/github_fake.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/github_schema.graphql +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/github_utils.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/inbox.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/land.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/logs.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/py.typed +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/status.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/test_prelude.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/types.py +0 -0
- {ghstack-0.9.0 → ghstack-0.9.2}/ghstack/unlink.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ghstack
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Stack diff support for GitHub
|
|
5
5
|
Home-page: https://github.com/ezyang/ghstack
|
|
6
6
|
License: MIT
|
|
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Requires-Dist: aiohttp (>=3,<4)
|
|
18
18
|
Requires-Dist: click (>=8,<9)
|
|
19
|
+
Requires-Dist: flake8 (>=7.0.0,<8.0.0)
|
|
19
20
|
Requires-Dist: importlib-metadata (>=1.4) ; python_version < "3.8"
|
|
20
21
|
Requires-Dist: requests (>=2,<3)
|
|
21
22
|
Requires-Dist: typing-extensions (>=3,<5)
|
|
@@ -100,7 +100,7 @@ def read_config(
|
|
|
100
100
|
res = requests.post(
|
|
101
101
|
f"https://{github_url}/login/device/code",
|
|
102
102
|
headers={"Accept": "application/json"},
|
|
103
|
-
data={"client_id": CLIENT_ID, "scope": "
|
|
103
|
+
data={"client_id": CLIENT_ID, "scope": "repo"},
|
|
104
104
|
)
|
|
105
105
|
data = res.json()
|
|
106
106
|
print(f"User verification code: {data['user_code']}")
|
|
@@ -140,14 +140,20 @@ def read_config(
|
|
|
140
140
|
if config.has_option("ghstack", "github_username"):
|
|
141
141
|
github_username = config.get("ghstack", "github_username")
|
|
142
142
|
if github_username is None and github_oauth is not None:
|
|
143
|
+
request_url: str
|
|
144
|
+
if github_url == "github.com":
|
|
145
|
+
request_url = f"https://api.{github_url}/user"
|
|
146
|
+
else:
|
|
147
|
+
request_url = f"https://{github_url}/api/v3/user"
|
|
143
148
|
res = requests.get(
|
|
144
|
-
|
|
149
|
+
request_url,
|
|
145
150
|
headers={
|
|
146
151
|
"Accept": "application/vnd.github+json",
|
|
147
152
|
"Authorization": f"Bearer {github_oauth}",
|
|
148
153
|
"X-GitHub-Api-Version": "2022-11-28",
|
|
149
154
|
},
|
|
150
155
|
)
|
|
156
|
+
res.raise_for_status()
|
|
151
157
|
github_username = res.json()["login"]
|
|
152
158
|
config.set("ghstack", "github_username", github_username)
|
|
153
159
|
write_back = True
|
|
@@ -17,11 +17,21 @@ class RealGitHubEndpoint(ghstack.github.GitHubEndpoint):
|
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
# The URL of the GraphQL endpoint to connect to
|
|
20
|
-
|
|
20
|
+
@property
|
|
21
|
+
def graphql_endpoint(self) -> str:
|
|
22
|
+
if self.github_url == "github.com":
|
|
23
|
+
return f"https://api.{self.github_url}/graphql"
|
|
24
|
+
else:
|
|
25
|
+
return f"https://{self.github_url}/api/graphql"
|
|
21
26
|
|
|
22
27
|
# The base URL of the REST endpoint to connect to (all REST requests
|
|
23
28
|
# will be subpaths of this URL)
|
|
24
|
-
|
|
29
|
+
@property
|
|
30
|
+
def rest_endpoint(self) -> str:
|
|
31
|
+
if self.github_url == "github.com":
|
|
32
|
+
return f"https://api.{self.github_url}"
|
|
33
|
+
else:
|
|
34
|
+
return f"https://{self.github_url}/api/v3"
|
|
25
35
|
|
|
26
36
|
# The base URL of regular WWW website, in case we need to manually
|
|
27
37
|
# interact with the real website
|
|
@@ -233,23 +233,16 @@ class Shell(object):
|
|
|
233
233
|
return s
|
|
234
234
|
|
|
235
235
|
@overload # noqa: F811
|
|
236
|
-
def git(self, *args: str) -> str:
|
|
237
|
-
...
|
|
236
|
+
def git(self, *args: str) -> str: ...
|
|
238
237
|
|
|
239
238
|
@overload # noqa: F811
|
|
240
|
-
def git(self, *args: str, input: str) -> str:
|
|
241
|
-
|
|
242
|
-
...
|
|
239
|
+
def git(self, *args: str, input: str) -> str: ...
|
|
243
240
|
|
|
244
241
|
@overload # noqa: F811
|
|
245
|
-
def git(self, *args: str, input: str, env: Dict[str, str]) -> str:
|
|
246
|
-
|
|
247
|
-
...
|
|
242
|
+
def git(self, *args: str, input: str, env: Dict[str, str]) -> str: ...
|
|
248
243
|
|
|
249
244
|
@overload # noqa: F811
|
|
250
|
-
def git(self, *args: str, **kwargs: Any) -> _SHELL_RET:
|
|
251
|
-
|
|
252
|
-
...
|
|
245
|
+
def git(self, *args: str, **kwargs: Any) -> _SHELL_RET: ...
|
|
253
246
|
|
|
254
247
|
def git(self, *args: str, **kwargs: Any) -> _SHELL_RET: # noqa: F811
|
|
255
248
|
"""
|
|
@@ -288,16 +281,13 @@ class Shell(object):
|
|
|
288
281
|
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))
|
|
289
282
|
|
|
290
283
|
@overload # noqa: F811
|
|
291
|
-
def hg(self, *args: str) -> str:
|
|
292
|
-
...
|
|
284
|
+
def hg(self, *args: str) -> str: ...
|
|
293
285
|
|
|
294
286
|
@overload # noqa: F811
|
|
295
|
-
def hg(self, *args: str, input: str) -> str:
|
|
296
|
-
...
|
|
287
|
+
def hg(self, *args: str, input: str) -> str: ...
|
|
297
288
|
|
|
298
289
|
@overload # noqa: F811
|
|
299
|
-
def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET:
|
|
300
|
-
...
|
|
290
|
+
def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET: ...
|
|
301
291
|
|
|
302
292
|
def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET: # noqa: F811
|
|
303
293
|
"""
|
|
@@ -363,9 +363,9 @@ class Submitter:
|
|
|
363
363
|
# did not exist on the stack at all), because they were associated
|
|
364
364
|
# with a patch that contains no changes. GhNumber may be false
|
|
365
365
|
# if the diff was never associated with a PR.
|
|
366
|
-
ignored_diffs: List[
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
ignored_diffs: List[Tuple[ghstack.diff.Diff, Optional[DiffWithGitHubMetadata]]] = (
|
|
367
|
+
dataclasses.field(default_factory=list)
|
|
368
|
+
)
|
|
369
369
|
|
|
370
370
|
# Set of seen ghnums
|
|
371
371
|
seen_ghnums: Set[Tuple[str, GhNumber]] = dataclasses.field(default_factory=set)
|
|
@@ -692,9 +692,11 @@ class Submitter:
|
|
|
692
692
|
parent_commit,
|
|
693
693
|
parent_diff_meta,
|
|
694
694
|
diff,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
695
|
+
(
|
|
696
|
+
self.elaborate_diff(diff)
|
|
697
|
+
if diff.pull_request_resolved is not None
|
|
698
|
+
else None
|
|
699
|
+
),
|
|
698
700
|
submit,
|
|
699
701
|
)
|
|
700
702
|
if diff_meta is not None:
|
|
@@ -952,9 +954,11 @@ to disassociate the commit with the pull request, and then try again.
|
|
|
952
954
|
[
|
|
953
955
|
f"{strip_mentions(diff.summary.rstrip())}\n\n",
|
|
954
956
|
f"ghstack-source-id: {diff.source_id}\n",
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
957
|
+
(
|
|
958
|
+
f"ghstack-comment-id: {elab_diff.comment_id}\n"
|
|
959
|
+
if self.direct
|
|
960
|
+
else ""
|
|
961
|
+
),
|
|
958
962
|
f"Pull Request resolved: {pull_request_resolved.url()}",
|
|
959
963
|
]
|
|
960
964
|
)
|
|
@@ -1193,6 +1197,22 @@ is closed (likely due to being merged). Please rebase to upstream and try again
|
|
|
1193
1197
|
base_args: List[str] = []
|
|
1194
1198
|
if push_branches.base.commit is not None:
|
|
1195
1199
|
base_args.extend(("-p", push_branches.base.commit.commit_id))
|
|
1200
|
+
# We don't technically need to do this, but often tooling
|
|
1201
|
+
# relies on pull requests being able to compute merge-base
|
|
1202
|
+
# with the main branch. While the result you get here can be
|
|
1203
|
+
# misleading (in particular, the merge-base will not
|
|
1204
|
+
# incorporate changes on base, and if a ghstack has been
|
|
1205
|
+
# rebased backwards in time, the merge-base will be stuck
|
|
1206
|
+
# on the more recent commit), it is useful so we put it in.
|
|
1207
|
+
extra_base = self.sh.git("merge-base", base.commit_id, self.base)
|
|
1208
|
+
if push_branches.base.commit is None or not self.sh.git(
|
|
1209
|
+
"merge-base",
|
|
1210
|
+
"--is-ancestor",
|
|
1211
|
+
extra_base,
|
|
1212
|
+
push_branches.base.commit.commit_id,
|
|
1213
|
+
exitcode=True,
|
|
1214
|
+
):
|
|
1215
|
+
base_args.extend(("-p", extra_base))
|
|
1196
1216
|
new_base = GitCommitHash(
|
|
1197
1217
|
self.sh.git(
|
|
1198
1218
|
"commit-tree",
|
|
@@ -1672,7 +1692,9 @@ is closed (likely due to being merged). Please rebase to upstream and try again
|
|
|
1672
1692
|
# Direct commit parent typically have base, as it will be the
|
|
1673
1693
|
# main branch
|
|
1674
1694
|
if not self.direct:
|
|
1675
|
-
|
|
1695
|
+
pass
|
|
1696
|
+
# This is now set to the orig base
|
|
1697
|
+
# assert not base_commit.parents
|
|
1676
1698
|
|
|
1677
1699
|
# 8. Head branch is not malformed
|
|
1678
1700
|
assert self.sh.git(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "ghstack"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.2"
|
|
4
4
|
authors = ["Edward Z. Yang <ezyang@mit.edu>"]
|
|
5
5
|
description = "Stack diff support for GitHub"
|
|
6
6
|
readme = "README.md"
|
|
@@ -23,10 +23,11 @@ python = "^3.8.1"
|
|
|
23
23
|
requests = "^2"
|
|
24
24
|
typing-extensions = ">=3 <5"
|
|
25
25
|
click = "^8"
|
|
26
|
+
flake8 = "^7.0.0"
|
|
26
27
|
|
|
27
28
|
[tool.poetry.dev-dependencies]
|
|
28
|
-
black = "^
|
|
29
|
-
flake8 = "^
|
|
29
|
+
black = "^24.3.0"
|
|
30
|
+
flake8 = "^7"
|
|
30
31
|
graphql-core = "^3"
|
|
31
32
|
hypothesis = "^6"
|
|
32
33
|
mypy = "^1"
|
|
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
|