Skip to content

Add spack repo update command#50868

Merged
tgamblin merged 40 commits intospack:developfrom
alecbcs:add/repo-update-cmd
Jun 19, 2025
Merged

Add spack repo update command#50868
tgamblin merged 40 commits intospack:developfrom
alecbcs:add/repo-update-cmd

Conversation

@alecbcs
Copy link
Copy Markdown
Member

@alecbcs alecbcs commented Jun 9, 2025

This PR introduces a new spack repo update command that allows users to update remote Git repositories and switch between branches, tags, or commits in their Spack repository configuration.

# Update all remote repositories
spack repo update

# Update specific repositories
spack repo update my-repo another-repo

# Switch to a specific branch/tag/commit
spack repo update my-repo --branch develop
spack repo update my-repo --tag v2.1.0
spack repo update my-repo --commit abc123

# Use a different remote
spack repo update --remote upstream

This PR also adds optional branch, tag, and commit keys to a git repository's configuration in repos.yaml.

repos.yaml:

repos:
  builtin:
    git: https://github.com/spack/spack-packages.git
    branch: develop  # optional
    tag: 2025.06     # optional
    commit: abc123   # optional

If multiple keys are specified they are prioritized commit > tag > branch.

@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality labels Jun 9, 2025
@tgamblin tgamblin added this to the v1.0.0 milestone Jun 9, 2025
@spackbot-app spackbot-app bot added the tests General test capability(ies) label Jun 10, 2025
@alecbcs alecbcs force-pushed the add/repo-update-cmd branch 3 times, most recently from b2dc486 to c86d2a9 Compare June 10, 2025 08:37
@alecbcs alecbcs force-pushed the add/repo-update-cmd branch 9 times, most recently from c91c3dc to 97f731b Compare June 11, 2025 08:52
@alecbcs alecbcs force-pushed the add/repo-update-cmd branch from 9cedc79 to 67ab283 Compare June 16, 2025 23:19
@tgamblin tgamblin merged commit 6b22f95 into spack:develop Jun 19, 2025
31 checks passed
@haampie haampie requested a review from Copilot June 19, 2025 06:53
Copy link
Copy Markdown

Copilot AI left a comment

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 adds a new "spack repo update" command to support updating remote Git repositories and switching between branches, tags, or commits. Key changes include new completions for Fish and Bash shells, extended Git utility functions and tests for repository management, and corresponding updates to configuration schema and command parsing.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
share/spack/spack-completion.fish Added update completion for spack repo update command
share/spack/spack-completion.bash Updated Bash completion to include the new update command
lib/spack/spack/util/git.py Introduced new Git helper functions for repo updates
lib/spack/spack/test/util/git.py Added tests for the new Git repository initialization and checkout
lib/spack/spack/test/repo.py Expanded tests to exercise repo update functionality
lib/spack/spack/test/cmd/repo.py Added new tests for repo update flags and invalid configurations
lib/spack/spack/schema/repos.py Updated repos.yaml schema to include branch, tag, and commit keys
lib/spack/spack/repo.py Added update functionality to RemoteRepoDescriptor and updated repo command logic
lib/spack/spack/cmd/repo.py Added the repo update subcommand with mutually exclusive refspec options
Comments suppressed due to low confidence (1)

lib/spack/spack/test/cmd/repo.py:721

  • Using os.path.join with a single argument is redundant; consider simply calling os.makedirs('.git') for improved readability.
    )

tgamblin added a commit that referenced this pull request Jun 19, 2025
Add asserts missing in #50868.
haampie pushed a commit that referenced this pull request Jun 19, 2025
Add asserts missing in #50868.
@alecbcs alecbcs deleted the add/repo-update-cmd branch June 19, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality shell-support tests General test capability(ies) utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants