Skip to content

Proposal: Allow default ".repos" file (similar to how Docker handles Dockerfile) #113

Description

@caioaamaral

Feature Request

Description

Default the .repos file to $(cwd)/.repos.

Users would still be able to set a custom file via the --file argument (similar to how Docker operates on a default Dockerfile).

Motivation

Running vcs import in a workspace that has a canonical .repos file should not require re-typing the file path every time. Defaulting to $(cwd)/.repos removes that friction while keeping full control via --file for anything non-default.

Proposed Solution

usage: vcs import [-h] [--file FILE_OR_URL] [--force] [--shallow] [--recursive] [--retry N] [--skip-existing] [--debug] [-w N] [--repos] [path]

Import the list of repositories

options:
  -h, --help           show this help message and exit

"import" command parameters:
  --file FILE_OR_URL   Where to read the .repos file (default: "$(cwd)/.repos")
  --force              Delete existing directories if they don't contain the repository being imported (default: False)
  --shallow            Create a shallow clone without a history (default: False)
  --recursive          Recurse into submodules (default: False)
  --retry N            Retry commands requiring network access N times on failure (default: 2)
  --skip-existing      Don't overwrite existing directories or change custom checkouts in repos using the same URL (but fetch repos with same URL) (default: False)

Common parameters:
  --debug              Show debug messages (default: False)
  -w N, --workers N    Number of parallel worker threads (default: 20)
  --repos              List repositories which the command operates on (default: False)
  path                 Base path to clone repositories to (default: .)

Typical use-cases

  • Use import without specifying a .repos file:
# looks for a '.repos' file in cwd
vcs import
  • Still set a custom .repos file by giving its location:
# set the '.repos' file location
vcs import --file ros2.repos
  • Import a subset of repositories from $(cwd)/.repos:
vcs import --repos my_package_drivers my_package_bringup

Notes

  • vcs import (with no input specified) is valid, but expects input from stdin.
  • Ideally we would drop --input (or deprecate it) in favor of --file.
  • Not sure if there are other vcs commands affected.

Moved from dirk-thomas/vcstool#294

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions