Answer product-owner round 1: 0 🔴, 4 🟡 (0 misread); move through the open status, refuse open-epic without a branch, tell a conflict from git's other failures
This commit is contained in:
@@ -95,11 +95,11 @@ clean acts once the forge reports the branch's pull request merged at the com
|
||||
still removes the worktree and the branch, and fails saying why.
|
||||
open-epic runs in any checkout of the repository, once the epic's last chunk has merged. It
|
||||
fetches origin and brings the working branch of the epic named level with origin's
|
||||
default branch, by a merge commit pushed to origin, or makes the branch where origin has
|
||||
none. Then it opens the pull request from that branch into the default branch, ready and
|
||||
titled <title>, and leaves it to a person to merge. Where the two don't merge cleanly it
|
||||
opens nothing and says how a person merges them. Where the pull request is open
|
||||
already, it opens no second one. It fails where the config sets no `epic-branch`.
|
||||
default branch, by a merge commit pushed to origin. Then it opens the pull request from
|
||||
that branch into the default branch, ready and titled <title>, and leaves it to a person
|
||||
to merge. Where the two don't merge cleanly it doesn't open anything and says how a
|
||||
person merges them. Where the pull request is open already, it doesn't open a second
|
||||
one. It fails where the config sets no `epic-branch`, or origin has no such branch.
|
||||
|
||||
It prints what it did, exit 0, or why it failed, exit 1.
|
||||
"""
|
||||
@@ -168,6 +168,7 @@ def step(argv: list[str], run: Run, config: Config, parks: bool = False) -> str
|
||||
return synced(run, config)
|
||||
case ["ready", *title] if len(title) <= 1 and not any(given.startswith("-") for given in title):
|
||||
return Failure("give a title of one line") if title and not one_line(title[0]) else (misfit(title[0], run, config) if title else None) or readied(run, title[0] if title else None, config)
|
||||
# Three readers, seated as those who run `chunk-pr`, picked the spellings `push`, 3-0, and `open-epic`, 2-1.
|
||||
case ["push"]:
|
||||
return pushed(run, config)
|
||||
case ["open-epic", epic, title, *body] if len(body) <= 1 and not any(given.startswith("-") for given in (epic, title)):
|
||||
@@ -401,6 +402,9 @@ def epic_opened(epic: str, title: str, body: str, run: Run, config: Config) -> s
|
||||
if isinstance(default, Failure):
|
||||
return default
|
||||
forge = forge_of(found[0])
|
||||
# `levelled` makes a branch origin lacks, which here would be a stray one: a mistyped key, or a branch its merge deleted.
|
||||
if isinstance(held := answers(run, ["fetch", "--quiet", "origin"]), Failure) or isinstance(run(["git", "rev-parse", "--quiet", "--verify", f"refs/remotes/origin/{branch}"]), Failure):
|
||||
return held if isinstance(held, Failure) else Failure(f"origin has no branch {branch}, so no chunk of {epic} has merged into one: check the epic's key, and whether the branch's pull request merged already")
|
||||
level = epic_branch.levelled(branch, f"origin/{default}", run=lambda *args, cwd=None, timeout=None, guarded=False, errors="strict": run(["git", *args]))
|
||||
head = level if isinstance(level, Failure) else answers(run, ["rev-parse", f"origin/{branch}"])
|
||||
number = head if isinstance(head, Failure) else open_pull(forge, branch, head[0], run)
|
||||
|
||||
Reference in New Issue
Block a user