Some handy one-liner shell scripts. Note: if you're on Windows, all of these tools are available as part of the free Cygwin tookkit (www.cygwin.com). ============================================================ # Delete all jobs matching the pattern "job=DELETEME*". p4 jobs -e "job=DELETEME*" | cut -d " " -f 1 | xargs -n 1 p4 job -d # List all changelists that contributed via integration to target change CHANGE. p4 files @CHANGE,@CHANGE | sed s/#.*/@CHANGE/ | p4 -x - filelog -m1 | grep "^\.\.\. \.\.\." | grep -v "into" | grep -v "ignored by" | sed "s/.*\/\//\/\//" | p4 -x - changes # List all files opened on any client owned by USER, without using p4 opened -a. p4 -Ztag clients | grep -B3 "... Owner USER" | grep "... client" | cut -d ' ' -f 3 | xargs -n1 p4 opened -a -C # Delete all empty submitted changelists. p4 changes -s submitted | cut -d " " -f 2 | xargs -n1 p4 change -d -f # Not quite a one-liner, but almost. Prevents new user creation by putting # all current users into a group and then changing "user *" to "group *". p4 users | cut -d" " -f1 | sed -e "s/^/\t/" > users.txt p4 group -o everyone | cat - users.txt | p4 group -i p4 protect -o | sed -e "s/user \*/group \*/" | p4 protect -i # Returns output if and only if USER has access to FILE. (Doesn't necessarily work with wildcards.) p4 protects -u USER FILE | tail -n1 | grep -e " //"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 6258 | Sam Stafford | Added a new oneliner. | ||
#5 | 6061 | Sam Stafford | Not a one-liner, but still kinda neat. | ||
#4 | 5862 | Sam Stafford | A new one-liner: deleting all empty submitted changes. | ||
#3 | 5328 | Sam Stafford | List all files opened on any client by USER, without using p4 opened -a. | ||
#2 | 5126 | Sam Stafford |
Another neat one-liner. This one grabs the contributing integration records for a given target changelist and uses them to generate a list of changes that contributed to that one via integration. |
||
#1 | 5118 | Sam Stafford | Going to start keeping track of handy one-line Perforce scripts. |