问题
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?
Any suggestions are appreciated. Thanks and Best Regards
回答1:
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.
回答2:
p4 cstat //path/to/your/project...#have |grep -B1 have|tail -n2
@thegeco, this does not require high max_scanrows perforce limits
回答3:
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
回答4:
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.
回答5:
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.
回答6:
In P4V client you can:
- Open
Submitted
tab - Select
Files
underFilter:
dropdown - Select
Current depot or workspace tree selection
- Sort by
Change
and the top line will be your answer
回答7:
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
来源:https://stackoverflow.com/questions/9731415/get-the-changelist-number-of-current-workspace-directory