【发布时间】:2022-01-18 00:53:17
【问题描述】:
################File-1.json####################
{
"aaa-prod-release-branch": {
"value": "release/S1.1-000000T01"
},
"bbb-prod-release-branch": {
"value": "release/S2.2-000000T02"
},
"ccc-prod-release-branch": {
"value": "release/S3.3-000000T03"
}
}
################File-2.json####################
{
"aaa-current-release-branch": {
"value": "release/S1.1-000000T01"
},
"bbb-current-release-branch": {
"value": "release/S2.2-000000T02"
},
"ccc-current-release-branch": {
"value": "release/S3.3-000000T044"
},
"ddd-current-release-branch": {
"value": "releases/R4.4-000000T04"
}
}
我有两个包含上述内容的 JSON 文件。我需要比较这两个文件并在powershell中获得差异。
- 仅比较两个文件中存在的存储库的分支名称,并获取相应存储库的分支名称。
例如:只比较 aaa、bbb 和 ccc 分支,而不是 ddd,因为它在两个文件中都不存在。
对于 file-1.json 中的每个 repo (aaa, bbb, ccc) 值(存在于两个文件中),我需要比较 File-2.json 中的各个 repo 值。
示例: ccc-prod-release-branch(cc 是 repo 名称)值在 File-2.json 中不同。在这种情况下,在这种情况下获取分支值和 repo 名称 ccc。
发布/S3.3-000000T03
发布/S3.3-000000T044
然后使用上面的值来克隆 ccc repo 并比较这两个分支。我需要一种在 powershell 中执行此操作的方法。
对于 ddd-current-release-branch 分支,因为它是新分支,我只想运行一个克隆并获取该分支中的所有提交。
如何在 powershell 脚本中执行此操作。 ?
【问题讨论】:
标签: json git powershell