维护源代码检出。 [7917]
注解
要了解如何维护ROS 2**最新开发版本**的源代码检出,请参考`维护ROS 2 Rolling源代码检出 <../../rolling/Installation/Maintaining-a-Source-Checkout.html>`__ [7918]
如果您已经从源代码安装了ROS 2,那么自您检出代码以来,源代码可能已经发生了更改。为了使您的源代码检出保持最新,您需要定期更新您的``ros2.repos``文件,下载最新的源代码,并重新构建您的工作空间。 [7919]
更新存储库列表 [7920]
每个ROS 2版本都包含一个``ros2.repos``文件,其中包含该版本的存储库及其版本的列表。 [7921]
最新的ROS 2 Humble分支 [7922]
如果您希望检出ROS 2 Humble的最新代码,可以运行以下命令获取相关的存储库列表: [7923]
cd ~/ros2_humble
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos
cd ~/ros2_humble
mv -i ros2.repos ros2.repos.old
wget https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos
# CMD
cd \dev\ros2_humble
curl -sk https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos -o ros2.repos
# PowerShell
cd \dev\ros2_humble
curl https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos -o ros2.repos
更新您的仓库 [7927]
您会注意到在`ros2.repos <https://raw.githubusercontent.com/ros2/ros2/humble/ros2.repos>`__文件中,每个仓库都有一个与之关联的``version``,它指向一个特定的提交哈希、标签或分支名称。可能这些版本引用了新的标签/分支,而您本地的仓库副本由于过时无法识别。因此,您应该使用以下命令更新已经检出的仓库: [7928]
vcs custom --args remote update
下载新的源代码 [7929]
现在,您应该能够使用以下命令下载与新的仓库列表相关的源代码: [7930]
vcs import src < ros2.repos
vcs pull src
vcs import src < ros2.repos
vcs pull src
# CMD
vcs import src < ros2.repos
vcs pull src
# PowerShell
vcs import --input ros2.repos src
vcs pull src