haves.sh #1

  • //
  • guest/
  • michael_shields/
  • scripts/
  • haves.sh
  • View
  • Commits
  • Open Download .zip Download (980 B)
#!/bin/sh

# Find clients that have interesting files synced.
#
# For each client, execute:
#
#   p4 -c <client> -H <host> have <files>
#
# where <files> is the argument to this script.
#
# Known issues:
#
#   Locked clients will cause the p4 have to fail due to an incorrect user
#   attempting to use the client. But don't be tempted to parse out the
#   client's owner and use it with the -u flag: you'll add all those
#   users that had been previously deleted.
#
#   Backslash characters ("\") in the client name are not assigned correctly
#   by awk. This will cause the p4 have to fail due to an unknown client.
#   Using sub( "^\.\.\. client ", "" ); client = $0 doesn't seem to help.

awk=awk
echo=echo
egrep=egrep
p4=p4

$p4 -Ztag clients | $egrep '^\.\.\. client |^\.\.\. Host ' | $awk '{ client = $3; getline; sub( "^\.\.\. Host ", "" ); printf "%s %s\n", client, $0 }' | while read client host
do
	$echo Client: $client
	$p4 -c $client -H "$host" have $1
	$echo
done
# Change User Description Committed
#1 1972 Michael Shields Add script to find clients that have interesting files synced.