category
tags
type
status
slug
date
summary
icon
password
🤔前言
公司要求使用CVS作为版本控制器,以前一直使用SVN和Git的我感觉要先学习了解一下:
关于CVS
CVS:协作版本系统(Concurrent Versions System)是一种开放源码的版本控制软件。主要在开源软件管理中使用。与它相类似的代码版本控制软件有Subversion。多个开发人员通过一个中心版本控制系统来记录文件版本,从而达到保证文件同步的目的。由于之前CVS编码的问题,大多数软件开发公司都使用SVN替代了CVS。
GUI程序暂时还不兼容
SmartCVS是Mac系统上常用的CVS的可视化程序,奈何最新版本不支持macOS Big Sur的操作系统,官网只支持10.7-10.10的版本,并且指出不再维护该软件(SmartCVS is end-of-life and not supported anymore. We recommend migrating to Git.)这篇文章将描述如何在Mac下用CVS的命令行。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F4201d82c-fd14-4346-b74c-a180f603a829%2FUntitled.png?table=block&id=23ae1951-9256-452a-9cc5-bedb636b1d39)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb318e0b8-0d6a-47df-b218-624cc3f6115e%2FUntitled.png?table=block&id=aa91630b-6708-4ee2-a378-d000d25cfcf2)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F552f06e3-152b-485c-880d-cc4551af5946%2FUntitled.png?table=block&id=f2cc15ef-887f-4f7c-9b1d-96d6cb4fe81e)
安装CVS环境
关于Homebrew
这里我们将使用HomeBrew安装CVS环境,Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。
Homebrew 安装
(已经安装了的可以跳过这段)
在终端或iTerm中输入以下指令安装
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Ff2ead2c3-1272-4eda-acd5-6f28c4052fc7%2FUntitled.png?table=block&id=e3d474cf-52c5-4db2-bd4a-8dc456eec5b1)
任意选择一个安装源即可
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbc685c6a-9203-4e62-8aa1-177a9f0074f5%2FUntitled.png?table=block&id=2693b326-e3cb-4675-9d70-ac4193b5d72e)
脚本执行若无响应,可能你的网络无法访问改地址,可以尝试以下方式:手动下载脚本执行(点击三角展开说明)
这一步如果打不开,可能是你的网络屏蔽了该网站😢,可以尝试下载下面的脚本文件![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc6054007-18e0-4834-a15c-f4f6fcb6a989%2FKapture_2021-09-28_at_16.46.02.gif?table=block&id=36b345c6-9d85-411b-8b28-b7e41717217d)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0b39e20a-160d-4e5e-adbb-4b86aa803a35%2FUntitled.png?table=block&id=2cf68648-b376-4c8d-8fe1-63f9f78451bd)
homebrew-install.sh
进行安装
1.chmod a+x
表示赋予执行权限 直接将脚本拖入终端,按下回车2.再将脚本拖入终端,按下回车执行
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fc6054007-18e0-4834-a15c-f4f6fcb6a989%2FKapture_2021-09-28_at_16.46.02.gif?table=block&id=36b345c6-9d85-411b-8b28-b7e41717217d)
执行后如图
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0b39e20a-160d-4e5e-adbb-4b86aa803a35%2FUntitled.png?table=block&id=2cf68648-b376-4c8d-8fe1-63f9f78451bd)
使用Homebrew安装CVS
在终端中输入以下指令,即可完成安装。
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fced5b374-3f8c-424a-81ec-7b56fbbe6f20%2FUntitled.png?table=block&id=fb46a635-da3b-400f-b460-c08f1da31523)
CVS指令说明
在控制台输入
cvs help
可以这样查看CVS的基本指令功能。基本常用指令
cvs login :登入CVS
cvs import :放个module进CVS管理
cvs checkout :从服务器检出一个项目
cvs add :添加文件
cvs remove :移除文件
cvs commit :将本地的文件改动提交到服务器
cvs update :别人有新的送交行为时,更新自己的版本,同步柜子的版本。
cvs status :查看服务器库里面的文件 加上-l只看本地
cvs diff :看两个版本的差异
cvs log :看一下log历史纪录
cvs logout :登出CVS
日常使用步骤
- 0.指定
CVSROOT
,需要配置仓库地址
执行指令:
export CVSROOT=:pserver:username@the_servername:/home/cvsroot
说明:
pserver
:访问方式,如果服务器设置的是口令认证,则是 pserverusername
:CVS服务器的用户名,可以根据你的设置修改;the_server_name
:CVS服务器的名称或者IP地址; /home/cvsroot
:CVS服务器的CVSROOT目录,根据CVS服务器修改或询问管理员.- 1.登录账号
cvs login
这时候cvs会问你口令,请把你在CVS服务器上的口令敲进去: ![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F428d7fb1-f9f8-4766-8ef6-655bb67b5961%2FUntitled.png?table=block&id=21ae1da0-1480-49d6-98cc-800e3f370a0b)
Passwd:xxxxxxxx
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F428d7fb1-f9f8-4766-8ef6-655bb67b5961%2FUntitled.png?table=block&id=21ae1da0-1480-49d6-98cc-800e3f370a0b)
- 2.查看库里的所有项目:
cvs ls
有的服务端不支持查看所有项目,会提示
server does not support ls
不过不影响使用- 3.从库里 checkout 项目到本地
cvs checkout project_name
注意:先将目录切换到准备放项目的位置,指令参考:
cd /Users/tangly/Documents/WorkSpace
方法二:将文件夹拖拽到终端中,按下回车键
如果出现permission denied,需要先加一个
cd
在前面![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F1e6a8f3d-87ea-4d9d-8d6c-d76afd97fd52%2FKapture_2021-10-08_at_14.08.09.gif?table=block&id=9e6ee42e-555e-486b-aa73-c1249a070ab6)
- 4.更新本地文件
cvs update
- 5.添加新的文件夹/文件
cvs add filename
- 6.将本地的改动上传
cvs commit -m "comment" filename
待解决问题
中文乱码
如果检出的文件目录,文件夹名称有中文会报错
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fca0417c7-b6eb-4fef-93a8-2a55b4fe5c35%2FUntitled.png?table=block&id=42fcfbb9-cba8-4190-aeaf-7c7274cae080)
指令补充说明
指令缩写对照
完整指令
同义缩写
说明
在IDE中配置CVS插件
执行以下指令查找CVS的安装目录
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2447b31d-eda8-4e08-9648-6ebe40699297%2FUntitled.png?table=block&id=dc3d829b-f3c9-4811-b9b8-899e70b77761)
上面的这个
/usr/local/Cellar/cvs/1.12.13_3/
就是要配置到IDE的目录。在VisualStudio中的配置方式如下:![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F619a822d-b47a-444d-9a1c-2cb029cf15ac%2FUntitled.png?table=block&id=27819757-a114-4b09-aeb6-735446571bb4)
如果环境配置错误会提示
Unable to get vscode-cvs.CVSROOT variable
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fdfc2c456-e998-4c35-86ef-dc0b5a1a68b9%2FUntitled.png?table=block&id=9e564a42-623d-4f17-a227-c5353340b635)
参考文章
- 需要指定CVSROOT
- 指令集
- 作者:NotionNext
- 链接:https://tangly1024.com/mac-big-sur-cvs
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。
相关文章