Perforce命令: p4 diff2
2012-05-28 17:45
225 查看
Perforce命令:
p4 diff2
概述
比较版本库中文件的两个版本
语法
p4 [g-opts] diff2 [-dflags -q -t -u]file1[rev] file2[rev]
p4 [g-opts] diff2 [-dflags -q -t -u] -bbranch [[fromfile[rev]] tofile[rev]]
描述
p4 diff2 命令使用Perforce服务器中内建的diff程序对版本库中的俩个文件版本进行比较。这些版本通常是指同一个文件的两个不同的版本,但是他们也可以是两个完全不同文件的版本。如果没有没有提供版本给文件参数,那么最新的版本被用来比较。
p4 diff2 不使用由环境变量P4DIFF定义的diff程序。p4
diff命令使用的diff算法在装有Perforce服务器机器上运行,而且一直使用服务器内建的diff 程序
你可以在指定文件参数的位置指定一个有(或没有)版本标识的文件模版;这样可以导致Perforce对那些匹配模版的成对文件执行diff 命令。如果你调用使用文件模版的p4
diff2命令,使用引号或反斜线可以从OS外壳中退出文件模版,那么确定在两个模版中的通配符相匹配。
Perforce presents the diffs in UNIX diffformat, prepended with a header. 起始部分的格式如下:
==== file1 (filetype1) - file2 (filetype2)==== summary
summary 可能出现的值和意义如下:
content: 文件版本的不同内容
types: 内容完全相同, 但是文件类型不同
identical: 版本的内容和文件类型都相同
如果文件file1 或 file2 在指定的版本中不存在,那么起始部分将显示summary 为 <none>.
选项
-q
Quietdiff.
只显示表头部分,并且在文件版本内容和类型不同时也不显示内容
-dflags
把标准的UNIX diff 选项之一作为参数运行diff 程序。阅读后面的《使用提示》
-b branchname
fromfile[rev] tofile[rev]
使用一个分支的定义去比较在两个分支代码行里的文件。被比较的文件可以被文件模版中的 fromfile 或 tofile 里的任意一个所限定
-t
比较甚至文件类型不是文本类型的文件的不同
-u
Generateunified output format, showing added and deleted lines with sufficient contextfor compatibility with the patch(1) utility. Only those
files that differ areincluded. File names and dates remain in Perforce syntax.
g-opts
阅读全局选项 部分
使用提示
Can File Arguments Use Revision Specifier?
Yes
Can File Arguments Use Revision Range?
NO
Minimal Access Level Required
readaccess necessary for both file revisions
The diff flagssupported by p4 diff2 are:
选项
名称
-dn
RCS输出格式,显示文件中增加的和删除的以及相关行的内容
-dc
文本输出格式,显示行编号范围和三行变更内容
-ds
总结输出格式,只显示总共增加,删除或修改的行数量
-du
unified输出格式 showing
added and deleted lines with sufficient context forcompatibility with the patch(1) utility.
-db
忽略在空格中做的改变
-dw
忽略连在一起的空格
为了传递超过一个的选项给diff 程序,可以打包他们。例如
p4 diff2 -dub file1 file2
specifies a unified diff that ignoreschanges in whitespace.
The header lineof a unified diff produced with the -du option for patch(1) use displays thediffed files in Perforce syntax, not local syntax.
当 p4 diff2 命令被用来对比较二进制文件时, 该行
... files differ ...
会被显示出来,如果他们没有被识别的话。
选项 -b branch [[fromfile[rev]]
tofile[rev] ] 在第一次看见是可能觉得不正确。Since
the branch specification maps fromfiles to tofiles, why wouldyou specify both fromfile and tofile file patterns? You wouldn't, but thissyntax allows you to specify a fromfile file pattern and a tofile revision, ora fromfile revision and a tofile file pattern.
举例
p4 diff2 -ds file#1 file
比较 file 文件的第二个版本和最新版本,并显示文件中内容被添加,更改或删除的信息
p4 diff2
file@34 file@1998/12/04
Diff the revision of file that was in thedepot after changelist 34 was submitted against the revision in the depot atmidnight on December 4,
1998.
p4 diff2
//depot/rel1/... //depot/rel2/...#4
比较在版本库 //depot/rel1 中的所有最新文件与版本库 //depot/rel2 第四个版本文件
p4 diff2
//depot/rel1/* //depot/rel2/...
不允许。每个文件的通配符模式必须匹配
p4 diff2
-b branch2 //depot/rel2/...#2 @50
Compare the second revision of the filesin //depot/rel2/... to the files branched from it by branch specificationbranch2 at the revision they
were at in changelist 50.
相关命令
比较客户工作区中文件与版本库中的版本文件
p4 diff
查看一个文件的全部内容
p4 print
p4 diff2
概述
比较版本库中文件的两个版本
语法
p4 [g-opts] diff2 [-dflags -q -t -u]file1[rev] file2[rev]
p4 [g-opts] diff2 [-dflags -q -t -u] -bbranch [[fromfile[rev]] tofile[rev]]
描述
p4 diff2 命令使用Perforce服务器中内建的diff程序对版本库中的俩个文件版本进行比较。这些版本通常是指同一个文件的两个不同的版本,但是他们也可以是两个完全不同文件的版本。如果没有没有提供版本给文件参数,那么最新的版本被用来比较。
p4 diff2 不使用由环境变量P4DIFF定义的diff程序。p4
diff命令使用的diff算法在装有Perforce服务器机器上运行,而且一直使用服务器内建的diff 程序
你可以在指定文件参数的位置指定一个有(或没有)版本标识的文件模版;这样可以导致Perforce对那些匹配模版的成对文件执行diff 命令。如果你调用使用文件模版的p4
diff2命令,使用引号或反斜线可以从OS外壳中退出文件模版,那么确定在两个模版中的通配符相匹配。
Perforce presents the diffs in UNIX diffformat, prepended with a header. 起始部分的格式如下:
==== file1 (filetype1) - file2 (filetype2)==== summary
summary 可能出现的值和意义如下:
content: 文件版本的不同内容
types: 内容完全相同, 但是文件类型不同
identical: 版本的内容和文件类型都相同
如果文件file1 或 file2 在指定的版本中不存在,那么起始部分将显示summary 为 <none>.
选项
-q
Quietdiff.
只显示表头部分,并且在文件版本内容和类型不同时也不显示内容
-dflags
把标准的UNIX diff 选项之一作为参数运行diff 程序。阅读后面的《使用提示》
-b branchname
fromfile[rev] tofile[rev]
使用一个分支的定义去比较在两个分支代码行里的文件。被比较的文件可以被文件模版中的 fromfile 或 tofile 里的任意一个所限定
-t
比较甚至文件类型不是文本类型的文件的不同
-u
Generateunified output format, showing added and deleted lines with sufficient contextfor compatibility with the patch(1) utility. Only those
files that differ areincluded. File names and dates remain in Perforce syntax.
g-opts
阅读全局选项 部分
使用提示
Can File Arguments Use Revision Specifier?
Yes
Can File Arguments Use Revision Range?
NO
Minimal Access Level Required
readaccess necessary for both file revisions
The diff flagssupported by p4 diff2 are:
选项
名称
-dn
RCS输出格式,显示文件中增加的和删除的以及相关行的内容
-dc
文本输出格式,显示行编号范围和三行变更内容
-ds
总结输出格式,只显示总共增加,删除或修改的行数量
-du
unified输出格式 showing
added and deleted lines with sufficient context forcompatibility with the patch(1) utility.
-db
忽略在空格中做的改变
-dw
忽略连在一起的空格
为了传递超过一个的选项给diff 程序,可以打包他们。例如
p4 diff2 -dub file1 file2
specifies a unified diff that ignoreschanges in whitespace.
The header lineof a unified diff produced with the -du option for patch(1) use displays thediffed files in Perforce syntax, not local syntax.
当 p4 diff2 命令被用来对比较二进制文件时, 该行
... files differ ...
会被显示出来,如果他们没有被识别的话。
选项 -b branch [[fromfile[rev]]
tofile[rev] ] 在第一次看见是可能觉得不正确。Since
the branch specification maps fromfiles to tofiles, why wouldyou specify both fromfile and tofile file patterns? You wouldn't, but thissyntax allows you to specify a fromfile file pattern and a tofile revision, ora fromfile revision and a tofile file pattern.
举例
p4 diff2 -ds file#1 file
比较 file 文件的第二个版本和最新版本,并显示文件中内容被添加,更改或删除的信息
p4 diff2
file@34 file@1998/12/04
Diff the revision of file that was in thedepot after changelist 34 was submitted against the revision in the depot atmidnight on December 4,
1998.
p4 diff2
//depot/rel1/... //depot/rel2/...#4
比较在版本库 //depot/rel1 中的所有最新文件与版本库 //depot/rel2 第四个版本文件
p4 diff2
//depot/rel1/* //depot/rel2/...
不允许。每个文件的通配符模式必须匹配
p4 diff2
-b branch2 //depot/rel2/...#2 @50
Compare the second revision of the filesin //depot/rel2/... to the files branched from it by branch specificationbranch2 at the revision they
were at in changelist 50.
相关命令
比较客户工作区中文件与版本库中的版本文件
p4 diff
查看一个文件的全部内容
p4 print
相关文章推荐
- linux下perforce(p4)的使用方法和命令
- p4(Perforce)修改默认Diff工具
- linux下perforce(p4)的使用方法和命令
- 几个有用的命令 find,diff,cmp,cat
- Linux下打补丁命令------diff和patch的使用
- linux sed、awk、diff命令常用操作
- perforce(p4) 使用
- linux下diff和patch命令学习笔记
- linux ---- diff命令
- Git(III)add,commit,diff,log命令
- 【linux】利用patch和diff命令制作文件补丁
- Linux常用文本比对命令——diff
- Unix/Linux文件比较命令: comm命令, diff命令
- diff命令修补命令patch详解
- diff 命令用法--如何打补丁【原创--学习笔记】
- linux中的diff命令
- diff命令具体解释
- Linux命令 diff 文件比对
- Linux命令——diff
- 每天一个linux命令(36):diff 命令