Perforce (P4):是否有“反向同步”之类的东西,可以将本地目录中的任何/所有更改推送到服务器?

发布于 2024-12-05 12:53:49 字数 111 浏览 0 评论 0原文

我知道这是一个奇怪的问题,但是是否有一个 p4 命令与“sync”相反?也就是说,我希望将本地工作区目录中的所有文件推送到仓库。

我知道您的第一个想法可能是“但是为什么?”,答案是,这很复杂。

I know this is a strange question, but is there a p4 command that is the reverse of 'sync'? That is, I'd like whatever files are in my local workspace directory to be pushed to the depot.

I know your first thought is probably "but WHY?", and the answer is, it's complicated.

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

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

发布评论

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

评论(3

顾挽 2024-12-12 12:53:49

协调离线工作可以帮助您。它推送添加、更改或删除的文件。重命名的文件有点棘手。

出于好奇。到底什么是“很复杂”

Reconciling offline work could help you. It pushes files that are added, or changed or deleted . Its a bit trickier with renamed files.

Out of curiosity. What exactly is "it's complicated"

琴流音 2024-12-12 12:53:49

“提交”和“搁置”都可以将文件内容从本地工作区发送到仓库。

无论哪种情况,您都必须先使用“添加”或“编辑”来标记要发送到软件仓库的文件。 (如何执行此操作取决于您使用的客户端工具。)

Both 'submit' and 'shelve' can send file content from your local workspace to the depot.

In either case, you have to use 'add' or 'edit' first to mark the files to be sent to the depot. (How you do this depends on the client tool you're using.)

爱的那么颓废 2024-12-12 12:53:49

这是一个来自 O'Reilly Perforce 书的脚本,

您可能想从它开始

    p4 sync -k ...

,它使 perforce 认为它已同步到当前头,但事实上
不对文件系统进行任何更改。因此,以下差异的行为(强制)类似于当前头部的更改。

    # a reverse 'synchronize' (sync what's on disk with what's in the depot)
    # see "practical perforce" (o'reilly) page 46
    #
    # changed files
    p4 diff -se | p4 -x- edit
    #
    # deleted files
    p4 diff -sd | p4 -x- delete
    #
    # added files
    find . -type f -o -type l | p4 -x- add -f 

我没有单独测试上述内容(它来自已广泛使用的较长脚本),但我相信它应该有效。

Here's a script, derived from the O'Reilly Perforce book

You probably want to start with

    p4 sync -k ...

which makes perforce think it has synchronized to the current head, but in fact
makes no changes to the filesystem. So the below diffs will behave (to perforce) like changes to the current head.

    # a reverse 'synchronize' (sync what's on disk with what's in the depot)
    # see "practical perforce" (o'reilly) page 46
    #
    # changed files
    p4 diff -se | p4 -x- edit
    #
    # deleted files
    p4 diff -sd | p4 -x- delete
    #
    # added files
    find . -type f -o -type l | p4 -x- add -f 

I have not tested the above in isolation (it came from a longer script that has been widely used) but I believe it should work.

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