AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 424242
Accepted
calvinf
calvinf
Asked: 2012-09-05 09:52:41 +0800 CST2012-09-05 09:52:41 +0800 CST 2012-09-05 09:52:41 +0800 CST

我如何取消提交以前提交的 Perforce 更改列表?

  • 772

我刚刚提交了一个 Perforce (p4) 更改列表,我需要对其进行小的修改以更正构建。如何取消提交最近提交的 p4 更改列表?

perforce
  • 4 4 个回答
  • 32917 Views

4 个回答

  • Voted
  1. Jimmy S
    2017-10-30T12:20:31+08:002017-10-30T12:20:31+08:00

    自 2016.2 以来p4 undo,提供了一个新命令,可以轻松撤消一个或多个更改列表。

    例如,

    p4 undo @12345
    

    此命令将在您的工作区中打开 Changelist 12345 中修改的文件。这些文件将具有其先前修订版的内容。提交打开的文件后,更改列表 12345 的影响将被撤消。

    p4 undo还支持修订范围以一次撤消多个更改列表。

    p4 sync请注意,如果在提供的更改列表之后修改了文件,您将需要p4 resolve像往常一样修改文件。

    有关更多信息,请参见此处:https ://www.perforce.com/perforce/doc.current/manuals/cmdref/Content/CmdRef/p4_undo.html

    • 8
  2. Best Answer
    scuttlemonkey
    2012-09-05T12:39:25+08:002012-09-05T12:39:25+08:00

    您可以使用 p4 sync 和 edit/resolve/submit 来撤销已提交的更改列表。有关详细说明,请查看:https ://community.perforce.com/s/article/3474

    希望有所帮助。

    • 4
  3. Alan Wendt
    2020-04-10T13:06:12+08:002020-04-10T13:06:12+08:00
    # source: https://community.perforce.com/s/article/3474
    
    prevcl=`expr $1 - 1`
    echo previous $prevcl
    
    p4 sync @$prevcl
    
    # open all of the edited files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ edit$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "reverting edits to $name"
       p4 edit $name
    done
    
    # add all of the deleted files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ delete$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "restoring deleted file $name"
       p4 add $name
    done
    
    p4 sync @$1
    p4 resolve -ay
    p4 sync
    p4 resolve
    
    # delete all of the added files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ add$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "removing added file $name"
       p4 delete $name
    done
    
    • 0
  4. Sergii Puliaiev
    2020-10-20T17:02:15+08:002020-10-20T17:02:15+08:00

    @Alan Wendt - 谢谢,这很有帮助。

    只是一个添加 - 有时文件被移动 - 而不是简单地添加/删除导致有点不同的后缀。这是固定代码,它还解决了删除和添加作为 MOVE 操作的一部分的问题:

    # source: https://community.perforce.com/s/article/3474
    
    prevcl=`expr $1 - 1`
    echo previous $prevcl
    
    p4 sync @$prevcl
    
    # open all of the edited files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ edit$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "reverting edits to $name"
       p4 edit $name
    done
    
    # add all of the deleted files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ (move/)?delete$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "restoring deleted file $name"
       p4 add $name
    done
    
    p4 sync @$1
    p4 resolve -ay
    p4 sync
    p4 resolve
    
    # delete all of the added files
    for name in `p4 describe -s $1 | egrep '#[0-9]+ (move/)?add$' | cut -f 1 -d# | colrm 1 4`
    do
       echo "removing added file $name"
       p4 delete $name
    done
    
    • 0

相关问题

  • Perforce 从多个检查点文件还原?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve