如何获取没有更换主义者的Perforce仓库列表?

发布于 2025-02-12 14:21:45 字数 36 浏览 1 评论 0原文

是否可以获取没有创建的仓库列表(仓库的名称)及其创建日期。

Is it possible to get the list of depots (name of the depot) that have no changelist created along with their creation date.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迟月 2025-02-19 14:21:45

运行P4更改针对每个仓库,并打印每个没有结果的名称/时间。

这是一个使用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'])))

当我针对我自己的本地服务器运行此脚本时,它列出了我所做的所有仓库,它们中没有任何更改者:

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

p4 Depots的仓库列表相比/code>:

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/... ''

请注意,仓库上的时间修改 time;仓库规范无法维护原始创建时间时间。但是,如果没有变更者被提交到仓库中,则仓库规格本身也没有被修改以来。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文