ghstack 0.9.3__tar.gz → 0.9.4__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.3 → ghstack-0.9.4}/PKG-INFO +1 -1
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/cli.py +12 -6
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/config.py +12 -1
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/github_utils.py +1 -1
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/submit.py +16 -3
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/test_prelude.py +1 -1
- {ghstack-0.9.3 → ghstack-0.9.4}/pyproject.toml +1 -1
- {ghstack-0.9.3 → ghstack-0.9.4}/LICENSE +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/README.md +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/__init__.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/__main__.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/action.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/cache.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/checkout.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/circleci.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/circleci_real.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/diff.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/forensics.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/git.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/github.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/github_fake.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/github_real.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/github_schema.graphql +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/gpg_sign.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/inbox.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/land.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/logs.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/py.typed +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/rage.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/shell.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/status.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/types.py +0 -0
- {ghstack-0.9.3 → ghstack-0.9.4}/ghstack/unlink.py +0 -0
|
@@ -57,7 +57,9 @@ def cli_context(
|
|
|
57
57
|
@click.option("--force", is_flag=True, hidden=True)
|
|
58
58
|
@click.option("--no-skip", is_flag=True, hidden=True)
|
|
59
59
|
@click.option("--draft", is_flag=True, hidden=True)
|
|
60
|
-
@click.option(
|
|
60
|
+
@click.option(
|
|
61
|
+
"--direct/--no-direct", "direct_opt", is_flag=True, hidden=True, default=None
|
|
62
|
+
)
|
|
61
63
|
@click.option("--base", "-B", default=None, hidden=True)
|
|
62
64
|
@click.option("--stack/--no-stack", "-s/-S", is_flag=True, default=True, hidden=True)
|
|
63
65
|
def main(
|
|
@@ -67,7 +69,7 @@ def main(
|
|
|
67
69
|
update_fields: bool,
|
|
68
70
|
short: bool,
|
|
69
71
|
force: bool,
|
|
70
|
-
|
|
72
|
+
direct_opt: Optional[bool],
|
|
71
73
|
no_skip: bool,
|
|
72
74
|
draft: bool,
|
|
73
75
|
base: Optional[str],
|
|
@@ -89,7 +91,7 @@ def main(
|
|
|
89
91
|
draft=draft,
|
|
90
92
|
base=base,
|
|
91
93
|
stack=stack,
|
|
92
|
-
|
|
94
|
+
direct_opt=direct_opt,
|
|
93
95
|
)
|
|
94
96
|
|
|
95
97
|
|
|
@@ -226,7 +228,11 @@ def status(pull_request: str) -> None:
|
|
|
226
228
|
"listed in the command line.",
|
|
227
229
|
)
|
|
228
230
|
@click.option(
|
|
229
|
-
"--direct",
|
|
231
|
+
"--direct/--no-direct",
|
|
232
|
+
"direct_opt",
|
|
233
|
+
default=None,
|
|
234
|
+
is_flag=True,
|
|
235
|
+
help="Create stack that directly merges into master",
|
|
230
236
|
)
|
|
231
237
|
@click.argument(
|
|
232
238
|
"revs",
|
|
@@ -240,7 +246,7 @@ def submit(
|
|
|
240
246
|
force: bool,
|
|
241
247
|
no_skip: bool,
|
|
242
248
|
draft: bool,
|
|
243
|
-
|
|
249
|
+
direct_opt: Optional[bool],
|
|
244
250
|
base: Optional[str],
|
|
245
251
|
revs: Tuple[str, ...],
|
|
246
252
|
stack: bool,
|
|
@@ -264,7 +270,7 @@ def submit(
|
|
|
264
270
|
base_opt=base,
|
|
265
271
|
revs=revs,
|
|
266
272
|
stack=stack,
|
|
267
|
-
|
|
273
|
+
direct_opt=direct_opt,
|
|
268
274
|
)
|
|
269
275
|
|
|
270
276
|
|
|
@@ -12,6 +12,9 @@ import requests
|
|
|
12
12
|
|
|
13
13
|
import ghstack.logs
|
|
14
14
|
|
|
15
|
+
DEFAULT_GHSTACKRC_PATH = Path.home() / ".ghstackrc"
|
|
16
|
+
GHSTACKRC_PATH_VAR = "GHSTACKRC_PATH"
|
|
17
|
+
|
|
15
18
|
Config = NamedTuple(
|
|
16
19
|
"Config",
|
|
17
20
|
[
|
|
@@ -41,6 +44,12 @@ Config = NamedTuple(
|
|
|
41
44
|
)
|
|
42
45
|
|
|
43
46
|
|
|
47
|
+
def get_path_from_env_var(var_name: str) -> Optional[Path]:
|
|
48
|
+
if (path := os.environ.get(var_name)) is not None:
|
|
49
|
+
return Path(path).expanduser().resolve()
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
|
|
44
53
|
def read_config(
|
|
45
54
|
*,
|
|
46
55
|
request_circle_token: bool = False,
|
|
@@ -60,7 +69,9 @@ def read_config(
|
|
|
60
69
|
|
|
61
70
|
write_back = False
|
|
62
71
|
if config_path is None:
|
|
63
|
-
config_path =
|
|
72
|
+
config_path = str(
|
|
73
|
+
get_path_from_env_var(GHSTACKRC_PATH_VAR) or DEFAULT_GHSTACKRC_PATH
|
|
74
|
+
)
|
|
64
75
|
write_back = True
|
|
65
76
|
|
|
66
77
|
logging.debug(f"config_path = {config_path}")
|
|
@@ -27,7 +27,7 @@ def get_github_repo_name_with_owner(
|
|
|
27
27
|
# Grovel in remotes to figure it out
|
|
28
28
|
remote_url = sh.git("remote", "get-url", remote_name)
|
|
29
29
|
while True:
|
|
30
|
-
match = r"^git@{github_url}
|
|
30
|
+
match = r"^git@{github_url}:/?([^/]+)/(.+?)(?:\.git)?$".format(
|
|
31
31
|
github_url=github_url
|
|
32
32
|
)
|
|
33
33
|
m = re.match(match, remote_url)
|
|
@@ -341,8 +341,8 @@ class Submitter:
|
|
|
341
341
|
|
|
342
342
|
# Instead of merging into base branch, merge directly into the appropriate
|
|
343
343
|
# main or head branch. Change merge targets appropriately as PRs get
|
|
344
|
-
# merged
|
|
345
|
-
|
|
344
|
+
# merged. If None, infer whether or not the PR should be direct or not.
|
|
345
|
+
direct_opt: Optional[bool] = None
|
|
346
346
|
|
|
347
347
|
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
348
348
|
# Computed in post init
|
|
@@ -356,6 +356,8 @@ class Submitter:
|
|
|
356
356
|
|
|
357
357
|
base: str = dataclasses.field(init=False)
|
|
358
358
|
|
|
359
|
+
direct: bool = dataclasses.field(init=False)
|
|
360
|
+
|
|
359
361
|
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
360
362
|
# Mutable state; TODO: remove me
|
|
361
363
|
|
|
@@ -405,6 +407,18 @@ class Submitter:
|
|
|
405
407
|
|
|
406
408
|
object.__setattr__(self, "base", default_branch)
|
|
407
409
|
|
|
410
|
+
# Check if direct should be used, if the user didn't explicitly
|
|
411
|
+
# specify an option
|
|
412
|
+
direct = self.direct_opt
|
|
413
|
+
if direct is None:
|
|
414
|
+
direct_r = self.sh.git(
|
|
415
|
+
"cat-file", "-e", "HEAD:.github/ghstack_direct", exitcode=True
|
|
416
|
+
)
|
|
417
|
+
assert isinstance(direct_r, bool)
|
|
418
|
+
direct = direct_r
|
|
419
|
+
|
|
420
|
+
object.__setattr__(self, "direct", direct)
|
|
421
|
+
|
|
408
422
|
# ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
409
423
|
# The main algorithm
|
|
410
424
|
|
|
@@ -664,7 +678,6 @@ class Submitter:
|
|
|
664
678
|
commits_to_submit: List[ghstack.git.CommitHeader],
|
|
665
679
|
commits_to_rebase: List[ghstack.git.CommitHeader],
|
|
666
680
|
) -> Tuple[Dict[GitCommitHash, DiffMeta], Dict[GitCommitHash, GitCommitHash]]:
|
|
667
|
-
|
|
668
681
|
# Prepare diffs in reverse topological order.
|
|
669
682
|
# (Reverse here is important because we must have processed parents
|
|
670
683
|
# first.)
|
|
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
|
|
File without changes
|