P4 -s describe changelist - perforce

Is there an straight forward command to get only the submitted description of a CL and not the affected files ? I want to get only the one-liner descriptions of a list of change lists and print them all in one file with the CL number.

Take a look at the "p4 changes" command -- that sounds like it might already have roughly the format you're looking for?
Otherwise, you can get the full description with a command like:
p4 -Ztag -F %Description% change -o CHANGENUM

A bit late, but this might be what you where looking for:
p4 changes -e [changelist#] -r -m 1

This will give description of all changelists submitted between two dates
p4 changes -u <username> -l //<depot>/...#2020/01/01,#2021/01/10

Related

perforce: 'p4 changes' with its change 'diff' between two changesets

is there a way to list out all the changes with each change's subject and its change difference between two changesets?
p4 diff2 -u //depot/build/stage/gobuild/...#676277 //depot/build/stage/gobuild/...#676640
this giving only consolidated diff
Here's how to script Bartek's answer, in one easy line:
p4 -Ztag -F "describe %change%" changes -s submitted #676277,676640 | p4 -x - run
If you want to massage the output further you'll need to buckle down and learn a scripting language -- the p4 command line can do a lot on its own but it's no substitute for Perl. :)
p4 changes won't show you diffs. You could use it for collecting changelist numbers and then you could call p4 describe for each which will produce a diff.
See p4 help describe for the formats of diffs.

p4 describe for multiple changelists

I want to redirect the output pf "p4 describe" for a set of Changelists, into a xls file.
As I saw the syntax for p4 describe, we can only give a single changelist with "p4 describe" for ex: p4 describe -df .
Could you please help me get p4 describe for multiple CLs?
Here's the syntax for 'p4 describe', from 'p4 help describe':
describe -- Display a changelist description
p4 describe [-d<flags> -s -S -f -O] changelist# ...
Note that '...' at the end. That means that you can pass multiple arguments.
So, for example,
p4 describe -df 1704 1722 1903
works fine, and describes each changelist, in turn, one after the next, in a single command.
Now, as to the bit about trying to put this in a xls file, I'm confused, because I'm not sure what sort of xls file you're talking about. The output of describe doesn't seem very useful as a spreadsheet, to me.

Perforce: How to get a list of CL description

I was preparing a report based on the CL's submitted in perforce for a particular period(eg: from 1/11/2014 to 30/11/2014) .
Is there any way that I can get list of CL- descriptions of the CL's in an excel for that period?
I tried using "p4 changes" perforce command, but that gives me only the list of submitted changes. I want the CL descriptions.
Specify the '-l' flag:
p4 changes -l //...#2014/01/11,#2014/11/30
From 'p4 help changes':
The -l flag displays the full text of the changelist
descriptions.
The -L flag displays the changelist descriptions, truncated to 250
characters if longer.
So if you don't want the complete changelist description, but only a short description, you can use -L instead of -l.
One minor correction. Since you want submitted changelists, use the -s flag:
p4 changes -l -s submitted //...#2014/01/11,#2014/11/30
So that you get changelists with the status of "submitted."

How to view Shelved P4 Changes?

One of our team member (located in different region) has shelved changes in P4 with changelist 1234.
Now, if I want to see what files are modified snf what are the changes, how can I do this?
What is the P4 command that I should use to see the changes made by our team member?
p4 describe -S 1234 should to the trick, see the documentation on describe.
To see the file content you would unshelve the files into your workspace (assuming you have a workspace for the same project your colleague is working on).
Create a new (empty) changelist with p4 change (results in e.g. 2345), then use p4 unshelve (docu) to get the modified files to your workspace:
p4 unshelve -s 1234 -c 2345
If you don't want the modified files in your workspace any longer, you can p4 revert -c 2345 them.
Using the GUI, go to Pending and remove all filters except by user, where you will put the other developer's ID. From there you should be able to see her Changelists, including the ones having shelved files. Right click on the Shelved Files icon and select Unshelve. You will have to have a workspace active that includes the files that you are trying to unshelve.
Using UI client, press Ctrl+G. Dialog window is appears. Select Changelist in combobox and input number of changelist.
Let's assume that changelist 123456 is the shelved changelist in question. As a previous answer mentioned, the way to list the files are associated with that changelist is via the p4 describe -s <changelist> command. Like so:
$ p4 describe -s 123456
Change 123456 by john.doe#JohnsBranch on 2013/10/24 15:38:10 *pending*
[Shelving my changes for Jane.]
Fix memory corruption caused by uninitialized pointer.
Affected files ...
... //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1 edit
Once you know the file(s) in question, there are a couple of ways to diff the files without a corresponding workspace. Method #1 is to use p4 print:
$ p4 print -q //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1 > /tmp/old
$ p4 print -q //depot/branches/JohnsBranch/kernel/vm/pageutils.c#=123456 > /tmp/new
$ diff /tmp/old /tmp/new # Or use kdiff3, tkdiff, etc.
...
<diff output here>
The other method is to use p4 diff2:
$ p4 diff2 //depot/branches/JohnsBranch/kernel/vm/pageutils.c#1 //depot/branches/JohnsBranch/kernel/vm/pageutils.c#=123456
...
<diff output here based on Perforce server's diff algorithm>
Both methods can be easily incorporated into the scripting language of choice.
jhwist's solution is good if you want to see the files' diffs.
If you want to see just the shelved files, use p4 describe -sS 1234.
The lower case s restricts the output from including file diffs.
If you wanted to see the actual content of the files, you could use:
p4 print <file>#=<shelved_change>
The #= means to look at the shelved change, where as # means to look at the change.
If you want to see only the list of files inside a ChangeList (whether it's a shelve, pending or submitted CL), without extra data, grep the result:
p4 describe -S 12345 | grep -oP '(?=//).*(?=#)'
In P4V UI, select
Search - > Go To
then choose type of changelist (in your case 'Pending changelist'), enter changelist number and click "OK".
You may try
p4 -ztag describe <changeno>
The description contains a string called '... shelved' if it is shelved.

How can I change the description of a existing changelist in command line?

The command "p4 change" prompts a editor and needs a form. But I want to do this in command line.
How can I achieve this?
Use the following command:
p4 change -u CL_number
For details, please visit this page.
This command line worked for me:
p4 --field Description="New CL description here" change -o *changelist_number* | p4 change -i
There's always the -i command:
Read a changelist description from standard input. Input must be in the same format used by the p4 change form.
As Bryan points out in his comment the best approach is probably to run change -o, redirect the output to a file, process the file with other shell commands, and then send that file back to the server with change -i.
Source
But you can always change the description when you submit:
p4 submit -d "description"
This only works on the default change list.
Source

Resources