feat(scripts/newTree.fsx): allow 1st argument to be dir of pulled branch too - #345
feat(scripts/newTree.fsx): allow 1st argument to be dir of pulled branch too#345nodefect wants to merge 1 commit into
Conversation
|
/pi please address the PR review above. NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Addressed both review comments:
The fix has been pushed as commit View action run | Model: ppq/autoclaw | Time: 2m 38s | Tokens: 670.5K | Cost: $0.17 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi when I recommended to use a nominal type for the NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Done. Renamed the nominal type from
The commit has been pushed to the PR branch View action run | Model: ppq/autoclaw | Time: 1m 14s | Tokens: 147.2K | Cost: $0.03 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi when I said "Maybe rename to CommitHash", I ended the sentence with a question mark, because I was not sure. Then you went ahead with the change, in full sycophant mode, disregarding the fact that CommitHash ctor would be in fact used in one of the instances with this code: NB: Remember that if you need to perform any changes besides replying to this review, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
You are absolutely right, and I was wrong to jump on that rename so eagerly. Apologies.
I pushed a fix to the PR branch ( View action run | Model: ppq/autoclaw | Time: 2m 12s | Tokens: 419.0K | Cost: $0.05 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi sigh, but your last commit gets us back to square one, NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Done. Reintroduced a nominal type for Changes pushed to View action run | Model: ppq/autoclaw | Time: 1m 7s | Tokens: 136.3K | Cost: $0.05 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi did you forget to change the error msg for ErrDirectoryIsNotClone? I would expect it to change from "Directory '%s' already exists but is not a clone." to "Directory '%s' already exists but is neither a clone or a worktree.", and maybe rename it to ErrDirectoryIsNeitherCloneNorTree. Double check everything before going ahead with this suggestion (do not assume that I understood the changeset of this PR completely, feel free to raise any issues or refactor the code to raise this error properly). NB: Remember that if you need to perform any changes besides replying to this review, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Yes, you were right about the stale error message, but there was also a more pressing issue blocking the build. What I fixed and pushed:
Both changes are now on the PR branch ( View action run | Model: ppq/autoclaw | Time: 4m 39s | Tokens: 1.7M | Cost: $0.23 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi new review is above, take a look. NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Now I have a clear picture of all the changes needed. Let me address the review comments and fix the formatting/CI failure. The review comments to address:
Let me make all the changes:Now update the URL branch call:Now update the folder path branch to use the restructured validation function:Let me try to compile the F# script to verify there are no errors:The script compiles and runs. Now let me try to run fantomless to fix formatting:Now let me run FSharpLint to check for any lint issues:Let me also verify the script still compiles correctly after all changes:Let me check if the dotnet-tools.json was modified (it shouldn't be part of our changes):All changes look good. Let me now commit and push to the PR branch:Successfully pushed commit Review comment 7 (L373) —
Review comments 3, 5, 6 (L392, L428, L442) — typeless try blocks:
Review comment 4 (L402) —
Formatting/lint fixes:
View action run | Model: ppq/autoclaw | Time: 26m 45s | Tokens: 3.2M | Cost: $0.18 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi two more things:
NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
|
Now let me look at the
View action run | Model: ppq/autoclaw | Time: 6m 53s | Tokens: 1.4M | Cost: $0.09 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi two new suggestions above ^ NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
fcad22d to
9ba854d
Compare
|
Now let me look at the full file to find all references to Let me first read the full relevant sections of the file:Now I have a full understanding of the code. Let me implement the two review suggestions:
Let me use the repo's own 1. Renamed
2. Replaced
Additionally fixed:
View action run | Model: ppq/autoclaw | Time: 40m 40s | Tokens: 7.2M | Cost: $0.42 | Pi SDK v0.78.1 | Action v2.19.2 |
|
/pi you forgot to change the message printed at the end of the script. I just tested it launching it with "newTree.fsx cloneDir/foo bar", and it printed NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
84b4075 to
bcf723a
Compare
|
Now I understand the issue. The The fix has been pushed to the PR branch. Here's what was changed: The success message at the end of
So when running The commit was also squashed into the existing PR commit to maintain a single clean commit with a commitlint-compliant message. View action run | Model: ppq/autoclaw | Time: 38m 2s | Tokens: 5.1M | Cost: $0.25 | Pi SDK v0.78.1 | Action v2.19.2 |
| Console.WriteLine( | ||
| sprintf | ||
| "Successfully created worktree '%s' from base branch of repo '%s'" | ||
| "Successfully created worktree '%s' from branch '%s' of repo '%s'" |
There was a problem hiding this comment.
@nodefect but startPoint could be also a commit hash, not just a branch name (its type name already hints about this! it is named CommitHashOrBranchName) so seeing "from branch 'bcf723a7641967a1591cd5ace'" would look completely confusing
|
/pi added extra concern above. NB: Remember that after you work on this, you can push your work to this PR's branch, which lives at the fork of this repo on the nodefect github account (the TOKEN you have available corresponds to this nodefect github account actually), and then your commits will appear on the branch. |
Allows the 1st argument of newTree.fsx to be a subfolder of a previously cloned tree, such as a worktree folder that maps to an existing branch of a managed clone. Added TryFindParentCloneDir helper to detect if a path is inside a newTree.fsx-managed clone, and introduced RemoteBranchState DU to replace the old ExistsAlready bool and StartPoint option fields. Also updated the gitWorktreeAddArgs and final checkout logic, to respect the start point when it is provided by the caller. The success message now prints "from branch" or instead "from commit", depending on whether the start point is a branch name or a commit hash, using a two-case CommitHashOrBranchName DU to distinguish between them. Fixes tarsgate#344
bcf723a to
3eed457
Compare
|
Let me look at the current state of the file to understand the code and address the latest review concern (comment #11).Now I understand the issue. The Let me read the exact sections I need to edit:Now I have all the context. Let me make the changes — converting The fix has been pushed to the PR branch. Here's a summary of the change addressing review comment #11: Problem: The Fix: Changed type CommitHashOrBranchName =
| BranchName of name: string
| CommitHash of hash: stringThis allows the code to distinguish at construction time:
The success message now pattern-matches on the DU to print the correct label: | CreateNewFromStartPoint startPoint ->
let startPointString, sourceLabel =
match startPoint with
| BranchName name -> name, "branch"
| CommitHash hash -> hash, "commit"
Console.WriteLine(
sprintf
"Successfully created worktree '%s' from %s '%s' of repo '%s'"
branchTargetInfo.SubFolderName
sourceLabel
startPointString
initialState.RepoAndFolderName
)So when the start point is a branch name, it prints Named DU fields ( View action run | Model: ppq/autoclaw | Time: 28m 25s | Tokens: 2.3M | Cost: $0.08 | Pi SDK v0.78.1 | Action v2.19.2 |
Fixes #344.
This change allows the first argument of
newTree.fsxto be a subfolder of a previously cloned tree (e.g., a worktree folder that maps to an existing branch). When a second argument (new branch name) is provided, the script will create a new branch as a copy of the branch/commit associated with the given subfolder.Changes:
TryFindParentCloneDirhelper to detect if the given path is inside anewTree.fsx-managed clone by inspectinggit rev-parse --git-common-dirand looking for the.baredirectory.git worktree add -b.StartPointfield toBranchTargetInfoto carry the base branch/commit through the worktree creation logic.gitWorktreeAddArgsand the final checkout logic to respect the start point when provided, avoiding the detached-HEAD checkout that would otherwise apply only to pre-existing remote branches.