how many sync'd files for a set of clients? (vs locked clients)client have locked
Posted 11 June 2020 - 09:06 PM
p4 -c <client> have | wc -l
is going to fail.
We do not want to have to unlock (edit) each client to run the have, then relock (edit) the client again. We have lots of user-run and automated scripts that edit clients on the fly, and there's potential for problems if the two processes overlap. While the probability is not high, one of our priorities is that Everything Just Works.
Is there a better way to get this data? I'm somewhat frustrated that superusers don't have a way to universally override a locked client. The -f option is available for *some* commands, but not "p4 have".
Posted 11 June 2020 - 09:44 PM
p4 -F "sizes -s @%domainName%" clients | p4 -F "%fileCount% files %path%" -x - run | sort -n -r
If you're on Windows, beware the %path% expansion (and you might want to use the Cygwin sort instead of the native one because the CMD version doesn't have a "numeric" flag):
C:\Perforce\test>p4 -F "sizes -s @%domainName%" clients | p4 -F ^"%fileCount% files ^%path^%^" -x - run | sort /R 38 files @Samwise-dvcs-1509687817 0 files @Widget-COMPY386 0 files @Sprocket-COMPY386
Posted 11 June 2020 - 10:35 PM
Posted 11 June 2020 - 11:14 PM
Posted 12 June 2020 - 03:26 PM
Posted 12 June 2020 - 10:18 PM
Hard for me to guess at this point, but I'd doubt it.
My thinking on having it be undoc in the first place was that it's impossible to "document" it to the standard of the rest of the end user documentation without going pretty deep into the specifics of the server messages -- how they're actually string dictionaries, how they get parsed and substituted, what specific values you'll get from all the specific messages that each command can produce (there are thousands of them!), lots of examples of usage with different commands, etc.
It's a feature that the average end user is going to be very confused by (as in either asking "why is this something you'd ever want to do in the first place?" or worse yet, deciding that this is something you need to do as part of a normal workflow -- I've seen people do this with -Ztag and then wonder why Perforce doesn't bother to have human-readable output), but the power user who's already spent some time using regexes to script around CLI output will A. immediately grok the usefulness of being able to rewrite the message themselves without needing twenty pages of doc explaining it and B. probably not mind doing a bit of experimentation to figure out how to make it useful.
Posted 13 June 2020 - 10:41 PM
1. A less elegant way to do this but one that doesn't hammer a server with queries would be to just dump db.have and sort/grep/awk/wc what you need out of it. In my case, our db.have was only about half a TB so it was just barely manageable, but after the overhead of dumping and sorting, it was quicker over the medium term to get the data out of it that I needed. At the time I was more concerned with older clients, so the data didn't change or get stale over the few days I monkeyed around with it. It was also a one time assessment, not a continual process over a long period of time. Quick and dirty is my MO.
2. After I found out about -F, I eventually got to the point where the regular output of '-ztag' started to look weird and unfamiliar. I always have/had trouble processing around newlines in output so -F ended up cutting out a huge number of headaches for me. Your work on that is much appreciated!
Currently unemployed, looking for work in Boise, ID!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users