Ros2 vcs(vcstool)安装及使用

vcstool是ROS中的一个命令行工具,用于项目版本管理。它可以方便地进行仓库的导入、导出和更新操作。例如,使用`vcsimport`从.yaml或.rosinstall文件导入仓库,`vcsexport`导出当前仓库集合,以及`vcspull`更新工作区的仓库。文章提供了相关命令的使用示例和参数选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文用来简单记录vcstool如何下载,vcs在ros中用来做项目版本管理,可以用来方便保存、下载、更新依赖repo流程。

官网说明文档http://wiki.ros.org/vcstool

下载安装

方法1

sudo apt install python3-vcstool

方法2

sudo pip install -U vcstool

使用

导入import

# 从`.yaml`或者`.rosinstall`填充文件到工作区
vcs import deps < deps.yaml 

文件内容类似如下:

# deps.yaml
repositories:
	common/moveit_msgs:
		type: git
		url: https://github.com/ros-planning/moveit_msgs.git
		version: master
	common/moveit_resources:
		type: git
		url: https://github.com/ros-planning/moveit_resources.git
		version: master
	common/geometric_shapes:
	    type: git
	    url: https://github.com/ros-planning/geometric_shapes.git
	    version: noetic-devel
	    
usage: vcs import [-h] [--input 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:
  --input FILE_OR_URL  Where to read YAML from (default: -)
  --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: 12)
  --repos              List repositories which the command operates on (default: False)
  path                 Base path to clone repositories to (default: .)

导出export

导出当前仓库集合

vcs export > deps.yaml
usage: vcs export [-h] [--exact | --exact-with-tags] [--debug] [-n] [-w N] [--repos] [path]

Export the list of repositories

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

"export" command parameters:
  --exact            Export commit hashes instead of branch names (default: False)
  --exact-with-tags  Export unique tag names or commit hashes instead of branch names (default: False)

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

更新pull

usage: vcs pull [-h] [--debug] [-s] [-n] [-w N] [--repos] [paths ...]

Bring changes from the repository into the working copy

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

Common parameters:
  --debug               Show debug messages (default: False)
  -s, --hide-empty, --skip-empty
                        Hide repositories with empty output (default: False)
  -n, --nested          Search for nested repositories (default: False)
  -w N, --workers N     Number of parallel worker threads (default: 12)
  --repos               List repositories which the command operates on (default: False)
  paths                 Base paths to look for repositories (default: ['.'])

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机器人梦想家

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值