Perforce查看workspace sync到的changlist

简介:

一 查看workspace sync到的changelist 

perforce的workspace其实是一些特定版本的文件的 结合,相比只将workspace对应到某个特定的changelist,此方法更灵活。changelist和文件间的关系为:每个 changelist其实是某些特定版本文件的集合,但是并不是所有的版本的文件结合都对应到一个changelist。perforce允许用户将 workspace同步到文件的某些特定版本,不一定对应一个chagnelist。

 

使用如下三步来确定workspace的最新状态
p4 changes 命令可以查看workspace中文件集合所对应的最高chagnelist:
p4 changes -m1 //...#have

 

可以使用如下命令查看workspace中是否所有的文件都被sync到了最高changelist:
p4 sync -n @<changelist retuned by p4 changes>
如果以上命令显示所有的文件都已经是updated,则表示workspace当前被sync到了最高changelist。

 

同时使用如下命令来确保没有文件被修改但是还没有提交:
p4 opened

 

注意如下的depot语法是等价的:
//<workspace name>/...
//...@<workspace name>
//...#have
所以从perforce的官方的knowledgebase中看到的命令是p4 changes -m1 //...@<workspace name>

 

有的时候如果文件太多的话,会出现错误,可以使用如下方法:

$ p4 changes -m1 "./...#have"  
Request too large (over 850000); see 'p4 help maxresults'.
$ p4 -G files "./...#have" | python c:/cygwin/usr/local/bin/p4lastchange.py Files: 266948 2427657

 

 

p4lastchange.py 

 

#! /usr/bin/env python
import sys, os, marshal
if os.name == "nt":
    # Disable newline translation in Windows.  Other operating systems do not
    # translate file contents.
    import msvcrt
    msvcrt.setmode( sys.stdin.fileno(), os.O_BINARY )
lastcl = 0
num = 0
try:
    while 1:
        dict = marshal.load(sys.stdin)
        num = num + 1
        for key in dict.keys():
            # print "%s: %s" % (key,dict[key])
            if key == "change":
                cl = int(dict[key])
                if cl > lastcl:
                    lastcl = cl
except EOFError:
    pass
print "Files: %s" % num
print lastcl

 

 

二 p4 cstat

cstat -- Dump change/sync status for current client  
p4 cstat [files...]
Lists changes that are needed, had or partially synced in the current client. The output is returned in tagged format, similar to the fstat command. The fields that cstat displays are:
change changelist number status 'have', 'need' or 'partial'

 

 

p4 changes的更多使用

p4 changes -m 5 //depot/project/...
Show the last five submitted changelists that include any file under the  project directory
p4 changes -m 5 -c eds_elm
Show the last five submitted changelists from client workspace  eds_elm.
p4 changes -m 5 -u edk
Show the last five submitted changelists from user  edk.
p4 changes file.c@2000/05/01,2000/06/01
Show any changelists that include file  file.c, as mapped to the depot through the client view, during the month of May 2000.
p4 changes -m 1 -s submitted
Output a single line showing the changelist number of the last submitted changelist.
p4 changes @2001/04/01,@now
Display all changelists submitted from April 1, 2001 to the present.
p4 changes @2001/04/01
Display all changelists submitted  before April 1, 2000.

 

 

本文转自莫水千流博客园博客,原文链接:http://www.cnblogs.com/zhoug2020/p/3481462.html,如需转载请自行联系原作者

相关文章
|
10月前
|
存储 Kubernetes Docker
volume 、namespace
volume 、namespace
|
11月前
|
前端开发 容器
什么是space-around
什么是space-around
117 0
|
数据可视化 Java
CiteSpace的安装
CiteSpace的安装
232 0
|
存储
Creating a workspace:创建一个工作空间
Creating a workspace:创建一个工作空间
298 0
Creating a workspace:创建一个工作空间
关于catkin_init_workspace找不到命令的原因
关于catkin_init_workspace找不到命令的原因
485 3
关于catkin_init_workspace找不到命令的原因
|
图形学
Unity 报错之 The type or namespace name 'UI' does not exist in the namespace 'UnityEngine'
关于Unity2017 升级到 Unity2019 两个问题。 The type or namespace name 'UI' does not exist in the namespace 'UnityEngine'
3044 0
Unity 报错之 The type or namespace name 'UI' does not exist in the namespace 'UnityEngine'
|
SQL Oracle 关系型数据库
MANAGE TABLESPACE
一、官档 BOOK → Database SQL Language Reference → 12 SQL Statements: ALTER TABLE to ALTER TABLESPACE → ALTER TABLESPACE 二、扩容表空间 扩大数据库的第三种方法是手工增大数据文件(datafile)的容量或使表空间(tablespace)内的数据文件容量可以随需动态地增长。
1266 0