在 CVS 中移动文件而不重置修订号

发布于 2024-07-06 07:09:35 字数 186 浏览 1 评论 0原文

最近我一直在源代码树中移动源文件。 例如,将一堆文件放入一个公共程序集中。 我一直在这样做,从 CVS 中删除文件,然后将其再次添加到新位置。 问题是文件的修订号重置回 1.1。 有没有一些简单的方法可以在不重置号码的情况下移动物品?

我可能应该提到我无权访问存储库,因此任何需要的内容对我没有帮助,但可能对其他人有帮助。

Lately I've be moving source files around in our source tree. For example placing a bunch of files into a common assembly. I've been doing this my deleting the file from CVS and then adding it again in the new spot. The problem is the revision number of the file resets back to 1.1. Is there some simple way to move things without having the number reset.

I probably should have mentioned that I don't have access to the repository so anything that requires that doesn't help me but it might help others.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

撩动你心 2024-07-13 07:09:35

实现此效果的普遍接受的方法是执行以下步骤。 其技术术语是 repocopy。

  1. 登录托管 CVS 存储库的服务器,并将存储库文件从您想要的位置复制(不要移动)到新位置。
  2. 在客户端 cvs 删除旧位置的文件。
  3. 在客户端,cvs 更新新位置中的目录内容(以便该文件将出现在那里)。
  4. 在客户端对复制的文件执行强制 cvs 提交(使用 -f 标志),以记录它被重新复制的事实(为此添加日志注释)。

此过程将文件历史记录保留在新位置,并且不会破坏存储库的向后连续性。 如果您及时返回,该文件将正确显示在其旧位置。 您还可以使用相同的过程来重命名文件。

The generally accepted way to achieve this effect is to perform the following steps. The technical term for this is a repocopy.

  1. Login on the server hosting the CVS repository and copy (don't move) the repository file from the location you want it to the new location.
  2. On the client side cvs delete the file from the old location.
  3. On the client side cvs update the directory contents in the new location (so that the file will appear there).
  4. On the client side perform a forced cvs commit (using the -f flag) of the copied file to log the fact that it was repocopied (add a log comment to that effect).

This procedure maintains the file history in its new location, and also doesn't break the backward continuity of the repository. If you move back in time, the file will correctly appear in its old location. You can also use the same procedure to rename a file.

痴意少年 2024-07-13 07:09:35

无法使用仅客户端命令来移动文件。 您需要访问服务器文件系统,并且可以将存储库中的“,v”文件移动到新位置。 这将保留所有历史记录,因为 CVS 将每个修订及其注释记录在该文件中。

请记住,删除文件后,文件将移至“Attic”子文件夹(从客户端无法看到)。 这就是文件删除后可以恢复的方法。

一般来说,这种方法不会立即出现问题,但是如果您决定查看产品的早期版本(可能依赖于以前的目录结构),则必须考虑后果!

这就是 Subversion 等其他版本控制系统具有明显优势的地方。

There is no way to move files around with client-only commands. You need access to the servers file system and can move the ",v" file in the repository to a new location. This will keep all history, since CVS records every revision and their comments in that one file.

Keep in mind that files are moved into an "Attic" subfolder (which cannot be seen from the client) when they are deleted. This is how files can be restored after they have been deleted.

Generally there are no immediate problems with this approach, however you have to consider the consequences should you decide to check out an earlier version of your product which might rely on the previous directory structure!

This is where other revision control systems like Subversion have a definitive advantage.

醉南桥 2024-07-13 07:09:35

在线 CVS 手册 有关如何执行此操作的一些详细信息:

移动文件的正常方法是发出 cvs rename 命令。

$ cvs 重命名旧的新
$ cvs commit -m "将旧的重命名为新的"

这是移动文件的最简单方法。 它不容易出错,并且保留了所做操作的历史记录。 CVSNT 客户端可以通过检出旧版本的存储库来检索原始名称。

此功能仅在 CVSNT 服务器 2.0.55 及更高版本上受支持。

The online CVS manual has some detail on how to do this:

The normal way to move a file is to issue a cvs rename command.

$ cvs rename old new
$ cvs commit -m "Renamed old to new"

This is the simplest way to move a file. It is not error prone, and it preserves the history of what was done. CVSNT clients can retrieve the original name by checking out an older version of the repository.

This feature is only supported on CVSNT servers 2.0.55 and later.

寂寞笑我太脆弱 2024-07-13 07:09:35

那么最简单的方法是访问您的存储库所在的 cvs 服务器,然后使用 mv 移动您的文件夹/文件(假设是 *nix 机器)。 这样文件的历史记录将被保留。

well the simplest way would be to acess the cvs server where your repo is and just move your folders/files around with mv (assuming a *nix machine). that way the history of the file will be keeped.

蹲在坟头点根烟 2024-07-13 07:09:35

这不是 CVS 的已知缺陷之一 - 没有用于移动文件的内置机制吗? 然而我已经很久没有使用它了,所以也许现在有一个解决方案。

Subversion 将允许您移动文件,但这也会被跟踪,以便新文件获得最新的修订号。

Isn't this one of the known flaws with CVS - no inbuilt mechanism for moving files? It has been a long time since I used it however, so maybe there is now a solution.

Subversion will allow you to move files, but that will be tracked as well so the new file gets the most recent revision number.

烧了回忆取暖 2024-07-13 07:09:35

它似乎保留了版本历史记录,您在移动时必须使用 -v 选项,请参见下文

CVS 重命名文件很麻烦。
从存储库的角度来看,您
只能删除文件或添加新文件。
所以,通常的流程是

mv oldfile.c newfile.c cvs 删除
oldfile.c cvs 添加 newfile.c

这确实有效,但你会失去所有
更改您想要写入的信息
在多年的提交操作中
艰苦的发展,这可能是
不是你想要的。 但有一个办法;
您必须能够直接访问
存储库。 首先,去那里,找到
您的项目所在的目录以及执行的操作
以下内容:

cp 旧文件.c,v 新文件.c,v

现在转到您的工作目录并
进行简历更新; newfile.c 将
显示为新文件。 现在您可以简历
删除oldfile.c并提交。

It seems to keep the version history you haver to use the -v option when moving see below

CVS renaming of files is cumbersome.
To the repository point of view, you
just can delete files or add new ones.
So, the usual process is

mv oldfile.c newfile.c cvs delete
oldfile.c cvs add newfile.c

This does work, but you lose all the
change information you care to wrote
in commit operations during years of
hard development and that is probably
not what you want. But there is a way;
you must have direct access to the
repository. First, go there, find the
directory where your project is and do
the following:

cp oldfile.c,v newfile.c,v

now go to your working directory and
do a cvs update ; newfile.c will
appear as a new file. Now you can cvs
delete oldfile.c and commit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文