Get the changelist number of current workspace directory

左心房为你撑大大i 提交于 2019-12-02 20:18:42

Also, there's p4 changes -m1 //path/to/your/project/...#have which, if run in the client workspace that synced the files for building, will give you the highest changelist number of the files in the workspace.

p4 cstat //path/to/your/project...#have |grep -B1 have|tail -n2

@thegeco, this does not require high max_scanrows perforce limits

user37337

You can also use the short version p4 changes -m1 #have if you don't want to specify the directory.

If you are using a shell for which "#" is a comment character like bash, remember to escape it as follows: p4 changes -m1 \#have

If your build system always syncs to head on the directory before building, you can use p4 changes -m 1 //path/to/your/project/... to get the head changelist number for that directory.

If you go with this method, I would suggest running the changes command before syncing, and then explicitly syncing to that changelist. That should eliminate the chance of someone checking in between the changes command and the sync command.

I use the "lazy manual way" (aka I don't know better) within the P4V client:

Use this in the "Submitted" tab filters: //yourproject/...#>have And it will show you which CLs you haven't synched, note the oldest one. Remove the #>have filter and see what's the CL that came before the one you just noted.

In P4V client you can:

  1. Open Submitted tab
  2. Select Files under Filter: dropdown
  3. Select Current depot or workspace tree selection
  4. Sort by Change and the top line will be your answer

In my case, I just want to know what changelist number is opened (not syned to) in a specific directory. For that, I do:

p4 opened -s | cut -d' ' -f5 | uniq
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!