如何通过命令行从 CVS 获取新添加文件的具体版本?

发布于 2024-07-06 15:30:34 字数 440 浏览 4 评论 0原文

我们内部编写的工具之一提供了以下形式的 cvs 提交跟踪:

Checking in src/com/package/AFile.java;
    /home/cvs/src/com/package/AFile.java,v <-- Afile.java
    new revision: 1.1.2.56; previous revision: 1.1.2.55
    done

然后,该工具通过在已经具有特定内容的工作目录中发出 cvs update -r 1.1.2.56 命令来从 cvs 获取文件代码分支已签出。

如果工作目录中存在 AFile.java 的现有版本,则此命令可以正常工作。 但是,当我们跟踪工作目录中没有版本的文件时,该命令无法获取该文件。

有办法做到吗?

One of our internally written tool is fed a cvs commit trace of the form:

Checking in src/com/package/AFile.java;
    /home/cvs/src/com/package/AFile.java,v <-- Afile.java
    new revision: 1.1.2.56; previous revision: 1.1.2.55
    done

The tool then acquires the file from cvs by issuing a cvs update -r 1.1.2.56 command in a working directory that already have specific branch of code checked-out.

This commands work correctly if there is an existing version of AFile.java in working directory. But when we get a trace of a file that has no version in working directory the command is not able to acquire the file.

Is there a way to do it?

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

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

发布评论

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

评论(6

格子衫的從容 2024-07-13 15:30:34

目前尚不清楚您的最终目标是什么:使整个存储库进入所需状态(选择所选分支的修订版)或从存储库获取单个文件以进行进一步处理。 我认为是后者。

然后,您需要这个命令:

cvs checkout -r <revision> -p filename.ext > ~/tmp/filename.ext

这将转储到标准输出指定文件(或多个文件)的指定版本,可以将其重定向到临时位置并进行处理。

或者您可以使用:

cvs export -r <revision> -d ~/tmp module/filename.ext

,它将(部分)存储库导出到指定的目标目录。

It is not clear what is your final goal: to bring whole repository into required state (choosen revision of the choosen branch) or to acquire the single file from the repository for further processing. I assume it is the latter.

Then, you need this command:

cvs checkout -r <revision> -p filename.ext > ~/tmp/filename.ext

This will dump to stdout specified revision of the specified file (or files), which could be redirected into temporary location and processed.

Or you could use:

cvs export -r <revision> -d ~/tmp module/filename.ext

, which would export (part of) repository to specified destination directory.

蓝眼睛不忧郁 2024-07-13 15:30:34

cvs --help

告诉您可以使用 -H 参数查看特定 CVS 命令的帮助,如下所示:

$ cvs -H checkout
Usage:
  cvs checkout [-ANPRcflnps] [-r rev] [-D date] [-d dir]
    [-j rev1] [-j rev2] [-k kopt] modules...
        -A      Reset any sticky tags/date/kopts.
        -N      Don't shorten module paths if -d specified.
        -P      Prune empty directories.
        -R      Process directories recursively.
        -c      "cat" the module database.
        -f      Force a head revision match if tag/date not found.
        -l      Local directory only, not recursive
        -n      Do not run module program (if any).
        -p      Check out files to standard output (avoids stickiness).
        -s      Like -c, but include module status.
        -r rev  Check out revision or tag. (implies -P) (is sticky)
        -D date Check out revisions as of date. (implies -P) (is sticky)
        -d dir  Check out into dir instead of module name.
        -k kopt Use RCS kopt -k option on checkout. (is sticky)
        -j rev  Merge in changes made between current revision and rev.
(Specify the --help global option for a list of other help options)

...教一个人如何钓鱼.. 。:)

cvs --help

tells you that you can use the -H arg to view help on a specific CVS command like so:

$ cvs -H checkout
Usage:
  cvs checkout [-ANPRcflnps] [-r rev] [-D date] [-d dir]
    [-j rev1] [-j rev2] [-k kopt] modules...
        -A      Reset any sticky tags/date/kopts.
        -N      Don't shorten module paths if -d specified.
        -P      Prune empty directories.
        -R      Process directories recursively.
        -c      "cat" the module database.
        -f      Force a head revision match if tag/date not found.
        -l      Local directory only, not recursive
        -n      Do not run module program (if any).
        -p      Check out files to standard output (avoids stickiness).
        -s      Like -c, but include module status.
        -r rev  Check out revision or tag. (implies -P) (is sticky)
        -D date Check out revisions as of date. (implies -P) (is sticky)
        -d dir  Check out into dir instead of module name.
        -k kopt Use RCS kopt -k option on checkout. (is sticky)
        -j rev  Merge in changes made between current revision and rev.
(Specify the --help global option for a list of other help options)

... teach a person how to fish ... :)

橘虞初梦 2024-07-13 15:30:34

我已经尝试过以下方式,

cvs checkout -r <revision> -p filename.ext > ~/tmp/filename.ext

但出现了类似的错误,

cvs checkout: cannot find module `filename.ext` -ignored.

所以我已经按照以下方式完成了,

cvs checkout -r <revision> -p Module_name/path_to_file/filename.ext > ~/tmp/filename.ext

现在效果很好。

I have tried as below way

cvs checkout -r <revision> -p filename.ext > ~/tmp/filename.ext

It was giving error like

cvs checkout: cannot find module `filename.ext` -ignored.

So i have done as below way

cvs checkout -r <revision> -p Module_name/path_to_file/filename.ext > ~/tmp/filename.ext

Now it worked fine.

为你鎻心 2024-07-13 15:30:34

一种解决方案是更改工具来为文件发出“cvs co”,指定当前更新的修订版本。 签出命令必须从树的顶部完成,而不是在包含该文件的目录中完成。 我遇到过类似的情况,更新无法找到新文件,需要按照我的描述签出该文件。

One solution would be to change the tool to issue a "cvs co" for the file, specifying the revision as is being now with the update. The checkout command would have to be done from the top of your tree, not in the directory containing the file. I've come across similar cases where the update fails to find a new file, requiring a checkout of the file as I've described.

策马西风 2024-07-13 15:30:34

这是对我有用的唯一方法,因为 checkout 命令总是给出“找不到模块”错误:

cvs diff -r <revision> <file> > /tmp/patch
cp <file> /tmp
cd /tmp
patch -R < patch

似乎 cvs 在这方面失败了。

This is the only way that works for me, as the checkout command always gives a "module not found" error:

cvs diff -r <revision> <file> > /tmp/patch
cp <file> /tmp
cd /tmp
patch -R < patch

It seems that cvs dropped the ball on this.

刘备忘录 2024-07-13 15:30:34

我这样做了:

cd <to_your_file_directory>
mv user.cpp user.cpp.bak
cvs update -r 1.55 user.cpp

I did this:

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