【问题标题】:Perforce: How to checkout file same file from different version?Perforce:如何从不同版本签出文件相同的文件?
【发布时间】:2011-10-21 06:34:25
【问题描述】:

例如,我在更改列表中签出了 100 多个文件:

//Development/MyProject/Version1.0/Coord/File1.cs
//Development/MyProject/Version1.0/Coord/File2.cs
...
//Development/MyProject/Version1.0/Coord/Filen.cs
//Development/MyProject/Version1.0/Common/File1.cs
...
//Development/MyProject/Version1.0/Common/Filen.cs

在更多目录中也是如此。现在我想签出Version2.0中的类似文件

//Development/MyProject/Version2.0/Coord/File1.cs
//Development/MyProject/Version2.0/Coord/File2.cs
...
//Development/MyProject/Version2.0/Coord/Filen.cs
//Development/MyProject/Version2.0/Common/File1.cs
...
//Development/MyProject/Version2.0/Common/Filen.cs

我可以通过查看在Version1.0 中签出的文件来执行此操作,然后转到Version2.0 中的每个目录并签出这些文件。这是一项乏味的工作。

有什么光明正大的方法吗?

【问题讨论】:

  • 您是否尝试在 Version2.0 中检出在 version1.0 树中检出的 exact 文件集?
  • 您可以通过一些简单的脚本来显着减少繁琐。管道'p4 打开' | sed 's/Version1.0/Version2.0/' | p4 -x - 编辑。或类似的东西。
  • @Mark 是的。我正在尝试做同样的事情......

标签: perforce vcs-checkout changelist


【解决方案1】:

从 linux/Unix/macOS shell,我建议使用以下方法。除非您在那里安装了 unix 工具,否则在 Windows 中会有很大不同。

  1. 查看您的所有 Version1.0 文件。
  2. cd 到您的 Version1.0 目录
  3. 运行以下命令行:

p4 opened ... | sed 's/\#[1-9].*$//' | sed 's/\/Version1.0\//\/Version2.0\//' | p4 -x - edit

注意:如果您的任何文件的名称中包含“#”符号,则需要进行一些调整。这是一个快速而肮脏的修复。还要感谢上面的 Bryan Pendleton,他基本上说了同样的话。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-12
    • 2010-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多