在 Azure DevOps Server 2020 中,存在数据仓库并在 tfs_warehouse 数据库中维护。该数据库包含一个 FactCodeChurn 表,其中包含
LinesAdded
、LinesModified
、LinesDeleted
和 NetLinesAdded
列。
Azure DevOps Server 2022 不再使用 analytics 和 tfs_warehouse 数据库。
如何获取 Azure DevOps Server 2022 中 TFVC / GIT 中特定变更集/提交的代码改动信息?
不确定这是否是您要查找的内容,但您可以使用 Azure DevOps REST API 的 Diffs - Get 端点来查找基础提交和目标提交之间最接近的公共提交(合并基础),并获取基本提交和目标提交或公共提交和目标提交之间的差异。
示例 - 存储库中提交 ID
c093714168cdd190c1e171a803e996d685454352
和 2f271272a1548da5a6507b4a29f3af943094c6b4
之间的差异 my-repo
:
GET https://dev.azure.com/fabrikam/MyProject/_apis/git/repositories/my-repo/diffs/commits?baseVersion=c093714168cdd190c1e171a803e996d685454352&baseVersionType=commit&targetVersion=2f271272a1548da5a6507b4a29f3af943094c6b4&targetVersionType=commit&api-version=7.1-preview.1
回复示例:
{
"allChangesIncluded": true,
"changeCounts": {
"Edit": 15,
"Add": 1
},
"changes": [
{
"item": {
"objectId": "bde769ee42117ea4ea87d5ec29ebdad6d3db90e6",
"originalObjectId": "5a99d58c0ee5d8ea32a837c0f3e1c384d9b3f35c",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/CustomerAddressModule",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//CustomerAddressModule?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "062c2370b4a773e4d1240d0591f05236ea6bffd5",
"originalObjectId": "ac01e969c8f57a5ce4404c8314d28c376b9741aa",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/CustomerAddressModule/CustomerAddressModule",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//CustomerAddressModule/CustomerAddressModule?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "44d4defe7505e786c7843bb8d48742fbd7fb2a5d",
"originalObjectId": "c7b2717ed43cf3a146178efe8c6b56f15e04e206",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/CustomerAddressModule/CustomerAddressModule/Form1.cs",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//CustomerAddressModule/CustomerAddressModule/Form1.cs?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "86611e6e2a985a667b2d744d3e133c035d050fdc",
"originalObjectId": "1880da2a57cc772c0e8cd1725911e05fb9dea384",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/CustomerAddressModule/CustomerAddressModule/Program.cs",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//CustomerAddressModule/CustomerAddressModule/Program.cs?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "3936f555cbfd2354766c928f24314f3371b26eb9",
"originalObjectId": "5ae8cdfbac92acedd2516c0cf47cb4e23834c907",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/HelloWorld",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//HelloWorld?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "12ab83fdf67f60340065fd6595f7b7d27ac43e64",
"originalObjectId": "91ffd59c44444779a707d22dca26481062912771",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/HelloWorld/src",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//HelloWorld/src?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "11c2143a3d6cdf7c183875b1c9bcd9ed1148946b",
"originalObjectId": "8c372a0d74743a1e6bde482b6ad1b7d3086400cc",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/HelloWorld/src/HelloWorld.java",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//HelloWorld/src/HelloWorld.java?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "5bb6f703f01eba72e9bb023891991f71e611b1e4",
"originalObjectId": "64e06bc4be939bffe64c65ae3c290e4c5206acf2",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "a1ec6decdcc91b432aadac506db6e56f6d75cc60",
"originalObjectId": "429e27bd5309b641581aed99ab7c26e3054ed1a0",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "a3237c23ed9a046387ddcacdf3b9c612bc884939",
"originalObjectId": "0d106d2f98e710ff86c5991991990a2e8f9819bd",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Project_Readme.html",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Project_Readme.html?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "5b029732598033bba1d7e7087b54f3030fe67c09",
"originalObjectId": "9b8bb976714f08fe5a2b82559a11ce35fa10c3cd",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Startup.cs",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Startup.cs?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "d1d5c2d49045d52bba6419652d6ecb2cd560dc29",
"originalObjectId": "cdf394b9560d7f9b1c97858d15962504def55642",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Views",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Views?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "ea6765e1976b9e8a6d4981fd8febebd574a91571",
"originalObjectId": "de4d162bd8e761438917de6aa79ca0296d42d113",
"gitObjectType": "tree",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Views/Home",
"isFolder": true,
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Views/Home?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "8052a02bee6f82ae02c4d408d1b5b98ab1bf56a6",
"originalObjectId": "49602fb29a79ea6e70746b1cfccbb080531aa6dc",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Views/Home/_Register.cshtml",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Views/Home/_Register.cshtml?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "b219db18b7fd7c45b05a0092846a8fbf1edbe18f",
"originalObjectId": "42f77316b7d166374ce8d6cb9f141b9e77c582f5",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/MyWebSite/MyWebSite/Web.config",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//MyWebSite/MyWebSite/Web.config?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "edit"
},
{
"item": {
"objectId": "f61bddbdf26a6365e02c94531abb370409c5aea3",
"gitObjectType": "blob",
"commitId": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"path": "/readme.md",
"url": "https://dev.azure.com/fabrikam/c34d5807-1734-4541-ad1c-d16e9ac1faca/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/items//readme.md?versionType=Commit&version=2f271272a1548da5a6507b4a29f3af943094c6b4"
},
"changeType": "add"
}
],
"commonCommit": "c093714168cdd190c1e171a803e996d685454352",
"baseCommit": "c093714168cdd190c1e171a803e996d685454352",
"targetCommit": "2f271272a1548da5a6507b4a29f3af943094c6b4",
"aheadCount": 22,
"behindCount": 0
}
您还可以获取分支之间的差异