使用 commit -r 提交到不同的分支
CVS 是否允许将文件提交到与检出文件不同的分支?手册页和一些网站建议我们可以这样做a cvs ci -rbranch-1 file.c
但它给出了以下错误:
cvs 提交:“file.c”的最新检查失败
cvs [提交中止]:首先纠正以上错误!
我做了一个cvs diff -rbranch-1 file.c
来确保file.c的内容在我的BASE
和branch-1
中确实是一样的。
我知道我们可以使用 cvs co -rbranch-1
手动签出,将主分支合并到它(并修复任何合并问题),然后签入。问题是有许多分支,我想使用脚本自动化操作。 此帖子似乎表明-r< /code> 已被删除。有人可以证实吗?
如果不支持 ci -r ,我正在考虑执行以下操作:
- 相同
- 确保分支版本和基本版本与 cvs diff签入当前版本 分支
- 在临时文件中保留文件的副本
- 对于每个分支:
- 使用
-r
从分支签出 - 用临时文件替换该文件
- 签入(由于
-r
具有粘性,它将进入分支)
- 使用
- 删除临时文件
替换部分对我来说听起来像是作弊 - 你能想到可能发生的任何潜在问题吗?有什么我应该小心的吗?有没有其他方法可以自动化这个过程?
Does CVS allow committing a file to a different branch than the one it was checked out from? The man page and some sites suggest that we can do a cvs ci -r branch-1 file.c
but it gives the following error:
cvs commit: Up-to-date check failed for `file.c'
cvs [commit aborted]: correct above errors first!
I did a cvs diff -r branch-1 file.c
to make sure that contents of file.c in my BASE
and branch-1
are indeed the same.
I know that we can manually check out using cvs co -r branch-1
, merge the main branch to it (and fix any merge issues) and then do a check in. The problem is that there are a number of branches and I would like to automate things using a script. This thread seems to suggest that -r
has been removed. Can someone confirm that?
If ci -r
is not supported, I am thinking of doing something like:
- Make sure the branch versions and base version are the same with a
cvs diff
- Check in to the current branch
- Keep a copy of the file in a temp file
- For each branch:
- Check out from branch with
-r
- replace the file with the temp file
- Check in (it'll go the branch as
-r
is sticky)
- Check out from branch with
- Delete the temp file
The replacing part sounds like cheating to me - can you think of any potential issues that might occur? Anything I should be careful about? Is there any other way to automate this process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,即使
diff
显示零输出,文件也可能不是最新的。例如,如果您在一次提交中向文件中添加一行文本,并在下一次提交中将其删除,那么沿着两个修订的路径,差异为零。至于commit -r -问题。对我来说,这似乎是一个实验性功能,实际上,通过使用它会更好:
此外,像您建议的那样以编程方式将单个提交传播到所有其他分支是有点值得怀疑的业务,因为您通常需要相当多的人力大脑来解决冲突。
Note that a file may not be up-to-date even if
diff
shows zero output. For example, if you add a line of text to a file in one commit and remove it in the next you have zero difference along the path of two revisions.As for the commit -r -issue. To me it seems like an experimental feature, and actually one you are better off by just using:
Besides, propagating a single commit to all other branches programatically like the way you suggested is slightly questionable business since you usually need a quite a bit of human brain to resolve the conflicts.