I have a specific change list, and from the command line I want to list all files that were a part of that change list. How do I do this?
That's the describe command. To describe a particular changelist, you want p4 describe <changelist number>
.
Update:
If you only want the file names, you can use the files command with the -F option to override the output format: p4 -Ztag -F "%depotFile%" files @=<changelist>
See http://www.perforce.com/blog/130826/fun-formatting for more information about the -F option.
user114245 gave the best answer, but only in a comment. I'm adding as an answer to give it more visibility, and to improve a little.
For change 12345, this is the closest you can get with just a p4
command
p4 files @=12345
which gives only this output
//depot/file1#3 - delete change 3 (text)
//depot/file2#3 - edit change 3 (text)
//depot/file5#1 - add change 3 (text)
If you want to remove the extraneous info about each file, you'll need to process that output through more tools on the command line. Assuming a standard unixy environment, you can use a single sed
command like so
p4 files @=12345 | sed s/#.*//
to get the desired result
//depot/file1
//depot/file2
//depot/file5
The currently accepted answer by Mike is this
p4 describe 12345
which gives all of this extra detail in the output
Change 12345 by day@client1 on 2013/06/21 00:25:28
Some example changes
Affected files ...
... //depot/file1#3 delete
... //depot/file2#3 edit
... //depot/file5#1 add
Differences ...
==== //depot/file2#3 (text) ====
1c1
< This is file 2
---
> This is file 2 - edited
That was improved on by Doug's answer which uses grep and awk to filter out the noise and just leave the files changed, but the command is quite long
p4 describe -s 12345 | grep '^\.\.\.' | awk '{print $2}'
I think the solution given here is neater.
Mike O'Connor's answer helped me too.
As for just getting a list of files changed, couldn't it just be as easy as this?
p4 describe -s {change number} | grep '^\.\.\.' | awk '{print $2}'
that's what I'm going to use.
If your changelist is still pending, you can run p4 opened
or p4 opened -c <changeListNumber>
for a specific (unsubmitted) changelist number.
From the official documentation: "List files that are open in pending changelists."
p4 change -o
It has the list of files at the end.
来源:https://stackoverflow.com/questions/6387349/how-to-list-all-the-files-changed-by-a-perforce-change-list