Each time we do a build, we have to record the changelist number of source files for tracking. We have different projects (under different directories) and they are synced at different changelist number. May you please show me how can we get the changelist number of a specific directory?
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 changes -m1 ...#have
in the workspace root is giving me a revision 2 days older than the day workspace was synced. Why can this be? –
Equivalent p4 changes -c ${CLIENT_NAME}
–
Cloudless 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
#have
part because that command works exactly as advertised. –
Opus p4 changes -m1 '#have'
–
Iva p4 cstat //path/to/your/project...#have |grep -B1 have|tail -n2
@thegeko, this does not require high max_scanrows perforce limits
p4 changes ... #have
works too. –
Equivalent 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.
Using just the workspace path, p4 changes -m1 /path/to/your/workspace/...#have
(or cd /path/to/your/workspace; p4 changes -m1 $(pwd)/...#have
) gives you the highest changelist number of the files in the workspace. This is similar to the accepted answer above from user1054341 p4 changes -m1 //your-client-name...#have
, but you don't have to remember the client name.
A path to a subdirectory in the client gives you the latest changelist in that subdirectory and its children, e.g. p4 changes -m1 /path/to/your/workspace/src/module1/...#have
. This can be run from any directory within the workspace.
Omitting #have
shows the latest changelist checked in to the depot.
These commands must be run from a directory in the workspace.
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
© 2022 - 2025 — McMap. All rights reserved.