有没有办法从命令行获取简短的 CVS 状态?

发布于 2024-07-06 16:13:55 字数 593 浏览 5 评论 0原文

在执行cvs更新时,您会得到存储库状态的一个很好的摘要,例如:

M src/file1.txt
M src/file2.txt
C src/file3.txt
A src/file4.txt
? src/file5.txt

有没有办法在不实际更新的情况下获得此信息? 我知道有 cvs status,但这是一种冗长的方式:

===================================================================
File: file6.txt        Status: Up-to-date

Working revision:    1.2
Repository revision: 1.2     /var/cvs/cvsroot/file6.txt,v
Sticky Tag:          (none)
Sticky Date:         (none)
Sticky Options:      (none)

我当然可以制作一个脚本来进行从后者到前者的转换,但这似乎是浪费时间,因为 cvs 显然可以产生前者。

When doing a cvs update, you get a nice summary of the state of the repository, for example:

M src/file1.txt
M src/file2.txt
C src/file3.txt
A src/file4.txt
? src/file5.txt

Is there a way to get this without actually updating? I know there is cvs status, but this is way to verbose:

===================================================================
File: file6.txt        Status: Up-to-date

Working revision:    1.2
Repository revision: 1.2     /var/cvs/cvsroot/file6.txt,v
Sticky Tag:          (none)
Sticky Date:         (none)
Sticky Options:      (none)

I could of course make a script to do the transformation from the latter to the former, but it seems a waste of time since cvs can obviously produce the former.

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

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

发布评论

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

评论(4

还给你自由 2024-07-13 16:13:55

您可以使用 -n 标志来获取更新输出,而无需实际更新文件。 您还可以添加 -q(安静)来抑制任何服务器消息。

cvs -q -n update

You can use the -n flag to get the update output without actually updating the files. You can also add -q (quiet) to suppress any server messages.

cvs -q -n update
等待我真够勒 2024-07-13 16:13:55

@jmcnamara:好提示!

一直以来我一直在使用这个 bash 脚本:

cvs -q status "$@" | grep '^[?F]' | grep -v 'Up-to-date'

@jmcnamara: Good tip!

And all this time I've been using this bash script:

cvs -q status "$@" | grep '^[?F]' | grep -v 'Up-to-date'
赤濁 2024-07-13 16:13:55

我有一些别名,可能对某人有用:

alias cvsstatus_command='cvs -q status | grep "^[?F]" | grep -v "Up-to-date" | \
    grep -v "\.so" | grep -v "\.[c]*project"'

alias cvsstatus_color='nawk '"'"'BEGIN \
    { \
        arr["Needs Merge"] = "0;31"; \
        arr["Needs Patch"] = "1;31"; \
        arr["conflicts"] = "1;33"; \
        arr["Locally Modified"] = "0;33"; \
        arr["Locally Added"] = "0;32" \
    } \
    { \
        l = $0; \
        for (pattern in arr) { \
            gsub(".*" pattern ".*", "\033[" arr[pattern] "m&\033[0m", l); \
        } \
        print l; \
    }'"'"

alias cvsstatus='cvsstatus_command | cvsstatus_color'

这将仅显示文件名及其状态,忽略所有最新文件,删除所有 Eclipse 项目文件和共享对象,并且还会以不同的方式打印行颜色,取决于状态(例如,我有橙色表示本地修改;红色表示文件,需要合并;绿色表示本地添加等)

I have some aliases, that may be useful for somebody:

alias cvsstatus_command='cvs -q status | grep "^[?F]" | grep -v "Up-to-date" | \
    grep -v "\.so" | grep -v "\.[c]*project"'

alias cvsstatus_color='nawk '"'"'BEGIN \
    { \
        arr["Needs Merge"] = "0;31"; \
        arr["Needs Patch"] = "1;31"; \
        arr["conflicts"] = "1;33"; \
        arr["Locally Modified"] = "0;33"; \
        arr["Locally Added"] = "0;32" \
    } \
    { \
        l = $0; \
        for (pattern in arr) { \
            gsub(".*" pattern ".*", "\033[" arr[pattern] "m&\033[0m", l); \
        } \
        print l; \
    }'"'"

alias cvsstatus='cvsstatus_command | cvsstatus_color'

This will display only file names and their status, ignore all up-to-date files, remove all eclipse project files and shared objects and will also print the lines in different colors, depending on the status (for example, I have orange for locally modified; red for files, needing merge; green for locally added, etc)

无所谓啦 2024-07-13 16:13:55

如果您使用的是 CVSNT,您也可以执行 cvs status -q,这也会产生比常规状态命令更简短的输出(每个文件也只有一行)。 使用较新的版本,您甚至可以执行 cvs status -qq 这将跳过最新文件。

If you're using CVSNT you can also just do cvs status -q which will also produce much briefer output than the regular status command (also just one line per file). With more recent versions you can even do cvs status -qq which will skip the up-to-date files.

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