Skip to content

fix(cli): allow clone registration after failed install rollback#3462

Merged
jmcouffin merged 3 commits into
developfrom
cursor/fix-clone-already-exists-99fc
Jul 1, 2026
Merged

fix(cli): allow clone registration after failed install rollback#3462
jmcouffin merged 3 commits into
developfrom
cursor/fix-clone-already-exists-99fc

Conversation

@jmcouffin

Copy link
Copy Markdown
Contributor

Description

Fixes a CLI clone failure where a retried pyrevit clone succeeds at git clone and CI binary download, then fails at registration with:

Clone with repo path "C:\pyRevit\main" already exists.

The install rollback deletes the clone directory but leaves the config entry behind. On retry, the freshly created clone is valid, so GetRegisteredClones() keeps the stale registration and RegisterClone rejects the duplicate path, which triggers another rollback.

Changes:

  • Prune stale clone registrations before repo/image deploy starts
  • Register deployed clones with forceUpdate: true so redeploying to the same path updates the entry instead of failing
  • Unregister the clone path during post-install rollback cleanup so failed installs do not leave orphaned config entries

Checklist

  • Code follows the project style guide
  • Changes are tested and verified to work as expected (dotnet build not available in this environment)

Related Issues

  • Follow-up to CI binary download clone flow reported by Tamas Dery

Additional Notes

After this fix, users with a stale main registration from a previous failed attempt can retry pyrevit clone main ... without manually running pyrevit clones forget main first.

Open in Web Open in Cursor 

When a clone install fails after creating the directory, rollback deletes
the clone folder but leaves the config entry behind. A retry then succeeds
at git clone and binary install but RegisterClone throws because the stale
path is already registered, which triggers another rollback.

Prune stale registrations before deploy, use forceUpdate when registering
from deploy flows, and unregister the clone path during post-install
rollback cleanup.

Co-authored-by: Jean-Marc Couffin <jmcouffin@users.noreply.github.com>
@devloai

devloai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

@jmcouffin
jmcouffin marked this pull request as ready for review June 30, 2026 19:35
@jmcouffin
jmcouffin requested a review from Copilot June 30, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a pyRevit CLI clone retry failure where a previous rollback left behind a clone registration, causing subsequent pyrevit clone attempts to fail during registration even after a successful re-clone.

Changes:

  • Adjusts clone registration to support “update-in-place” behavior via forceUpdate, removing existing registrations by name/path before re-adding.
  • Prunes stale clone registrations early in repo/image deployment flows (leveraging GetRegisteredClones()’s existing validation/pruning behavior).
  • Ensures rollback cleanup also removes any registration for the failed clone path to avoid orphaned config entries.

UseTestPyRevitConfig was static but accessed the instance TestTempDir
property from TempFileTestBase, causing CS0120 on net48 and net8.0-windows.

Co-authored-by: Jean-Marc Couffin <jmcouffin@users.noreply.github.com>
@jmcouffin jmcouffin self-assigned this Jul 1, 2026
@jmcouffin jmcouffin added the Command Line Utility (CLI) Issues related to pyRevit CLI tool [subsystem] label Jul 1, 2026
@jmcouffin
jmcouffin merged commit 909ecb8 into develop Jul 1, 2026
@jmcouffin
jmcouffin deleted the cursor/fix-clone-already-exists-99fc branch July 1, 2026 20:15
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

@github-actions

Copy link
Copy Markdown
Contributor

📦 New work-in-progress (wip) builds are available for 6.5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Command Line Utility (CLI) Issues related to pyRevit CLI tool [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants