Reputation: 2607
In Cygwin bash, how can I list all files opened in the current workspace grouped by pending changelist (ignoring empty or shelved changelists)?
For example, if I've the following files opened in the following changelists, I wish to display it in this (or similar) format:
1234: Changelist 1234's description
//path1/file1 1 add text
//path2/file2 2 edit text
5678: Changelist 5678's description
//path2/file3 3 edit xbinary
p4 opened|sed "s/\([-#()]\|change\)/ /g"|column -t|sort -k 4
sort-of groups them by changelist number:
//path1/file1 1 add 1234 text
//path2/file2 2 edit 1234 text
//path2/file3 3 edit 5678 xbinary
but I'd like to see each changelist number and description as a header.
Upvotes: 3
Views: 4001
Reputation: 31
This is my piece of code in .bashrc to create a p4pending alias to achieve the similar goal. I use 'p4 changes' to generate the header for each changelist, and 'p4 opened -c' to list the files opened in the changelist. This gives me pretty much same result as I get in P4V.
__desc_chg()
{
echo "$1"
num=`echo $1 | awk '{print $2}'`
p4 opened -c $num 2>&1 | awk '{print " "$1,$2,$3,$6}'
echo
}
__p4pending()
{
__desc_chg "Change default by $P4USER@$P4CLIENT *pending*"
p4 changes -u $P4USER -c $P4CLIENT -s pending | sort -k2 -n | while read -r l; do __desc_chg "$l"; done
}
alias p4pending='__p4pending'
Upvotes: 3
Reputation: 2543
The easiest approach would be something like this:
p4 changes -s pending -c $P4CLIENT | awk '{print $2}' | p4 -x - describe -s
This lists all pending changes for your current client (aka workspace) and calls p4 describe -s
.
Upvotes: 4