[pull] master from kevoreilly:master - #540
Merged
Merged
Conversation
…ning (#3245) * Fix ResultServer file collisions with SHA256 deduplication and versioning * Fix CAPE processing crash when [magika] config section is missing and preserve dropfile name order * Use fast mocks in test_cape_processing_without_magika_config
* Add utils/agent_worktree.py for isolated PR/branch checkouts
Reviewing a PR or reproducing a bug against another branch currently means
checking it out in your working clone. Most clones carry uncommitted work, so
that is either unsafe or requires manual git worktree plumbing: figuring out
which fork the head branch lives in, fetching it under a sane name, setting
upstream, and cleaning up afterwards.
utils/agent_worktree.py wraps that:
new --pr <id> resolve the head fork via gh, fetch, branch, check out
new --branch <name> / --from <ref>
list / path / update / remove / cleanup / info
It is stdlib-only and repository-agnostic. Worktrees it creates are tagged
with metadata inside the git admin directory, so nothing extra appears in
git status and cleanup only ever touches its own worktrees. remove and
cleanup refuse to discard uncommitted changes or unpushed commits without
--force, and the main worktree can never be removed.
tests/test_agent_worktree.py covers the CLI against throwaway local
repositories; no network, credentials or CAPE configuration required.
SKILLS.md gains sections on the local development environment, isolated
checkouts, and codebase behaviours that cause silent failures.
* agent_worktree: handle fork remote layouts
Clones that follow the fork convention have origin pointing at the
contributor's fork and upstream at the canonical repository. Two things broke
there:
* repo_slug() preferred origin, so 'gh pr view' was asked about the fork
instead of the repository the PR was opened against. upstream now wins when
it is configured; clones made straight from the canonical repo are
unaffected because they have no upstream.
* 'new --branch' fetched from origin only and failed outright if the branch
lived upstream. It now tries origin, then upstream, then any other remote,
and reports which one it used.
A missing branch is now a clear error naming the remotes that were tried.
* agent_worktree: do not call work unpushed when it lives on another remote
The removal guard compared HEAD against the tracked upstream only. A review
branch normally tracks the branch it will merge into while its commits are
pushed to a fork, so 'rev-list @{upstream}..HEAD' is non-zero even though
nothing is at risk, and cleanup refused to remove a worktree whose work was
safely published.
The guard now treats work as unpushed only when no remote-tracking ref
contains HEAD at all, which is the condition that actually matters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )