Reputation: 61
Is it possible to get the list of depots (name of the depot) that have no changelist created along with their creation date.
Upvotes: 0
Views: 77
Reputation: 71517
Run p4 changes
against each depot, and print the name/time of each that has no results.
Here's a quick example using P4Python:
from datetime import datetime
from P4 import P4
with P4().connect() as p4:
for d in p4.run_depots():
depot = d['name']
if not p4.run_changes("-m1", f"//{depot}/..."):
print(depot, datetime.fromtimestamp(int(d['time'])))
When I run this script against my own local server it lists all the depots I've made that don't have any changelists in them:
Sprocket 2019-07-25 00:02:31
Widget 2019-07-24 23:45:04
repo 2020-04-28 09:53:13
spec 2022-02-08 08:23:23
compared to the full list of depots from p4 depots
:
Depot Sprocket 2019/07/25 stream 1 Sprocket/... 'Created by Samwise. '
Depot Widget 2019/07/24 stream 1 Widget/... 'Created by Samwise. '
Depot collaborators 2020/07/12 stream 1 collaborators/... 'Created by Samwise. '
Depot depot 2019/09/22 local depot/... 'Created by Samwise. '
Depot repo 2020/04/28 local repo/... 'Created by Samwise. '
Depot spec 2022/02/08 spec .p4s spec/... 'Created by Samwise. '
Depot stream 2017/11/02 stream stream/... ''
Note that the time
on the depot is the modification time; the depot spec doesn't maintain the original creation time. However, it's likely that if no changelists have ever been submitted into a depot, the depot spec itself hasn't been modified since its creation either.
Upvotes: 1