Get list of all files with the user who checked in the latest version in TFS - version-control

Is there a way in TFS to get a list of files under source control with the user who checked in the latest version/version you have locally.
The closest functionality to this that i can find is in the source control explorer window you can see each files with the latest check-in date, but not with the user who checked it in.

There is no way currently from the VS Source control explorer. The best you can get is using the Web TFS version. You will see the name of the user in the comments section (in orange in the image below) along with changset # and any comment.
If that doesn't work for you somehow then you can either use TFS Api or SQL query against TFS DB. Following SQL should give you the result.
SELECT TOP 10
V.ChildItem AS [FileName],
I.DisplayName AS [ChangedBy],
CS.CreationDate AS [ChangeDate]
FROM tbl_Changeset CS
INNER JOIN tbl_Identity I
ON I.IdentityID = CS.OwnerID
INNER JOIN tbl_Version V
ON V.VersionFrom = CS.ChangesetID

Related

Is there any way to find the "feed size" in azure artifacts?

Is there any way to find the individual feed size in azure artifacts in azure devops? Using any kind of api call or any other way.
Microsoft is changing the lisencing for azure artifacts, I would wanna know which feed is taking up the most space, so I can take suitable steps to take care of this.
I've tried the feed management api to get the details of the feeds, but unfortunately that api doesn't display the size.
Use this in tfs database if you use Azure Devops Server.
select
[f].FeedName,
sum(cast([list].BlockFileLength as decimal(38)))/1024.0/1024.0 AS SizeInMb
from
BlobStore.tbl_Blob [blob]
join BlobStore.tbl_BlockList [list] on [list].BlobId = [blob].BlobId
join [Feed].[tbl_PackageVersionIndex] [fd] on '0x'+[fd].StorageId = CONVERT(varchar(max),blob.BlobId ,1)
join [Feed].[tbl_Feed] [f] on [fd].FeedId = [f].FeedId
join [Feed].[tbl_PackageIndex] [p] on [p].PackageId = [fd].PackageId
group by
[f].FeedName
order by
SizeInMb desc
select
[f].FeedName,
[p].PackageName,
sum(cast([list].BlockFileLength as decimal(38)))/1024.0/1024.0 AS SizeInMb,
(select count(pvi.PackageVersionId) from [Feed].[tbl_PackageVersionIndex] [pvi]
where pvi.FeedId = f.FeedId and pvi.PackageId = p.PackageId) as Versions
from
BlobStore.tbl_Blob [blob]
join BlobStore.tbl_BlockList [list] on [list].BlobId = [blob].BlobId
join [Feed].[tbl_PackageVersionIndex] [fd] on '0x'+[fd].StorageId = CONVERT(varchar(max),blob.BlobId ,1)
join [Feed].[tbl_Feed] [f] on [fd].FeedId = [f].FeedId
join [Feed].[tbl_PackageIndex] [p] on [p].PackageId = [fd].PackageId
group by
[f].FeedName,
[p].PackageName,
f.FeedId,
p.PackageId
order by SizeInMb desc
At the moment ,there is no directly way to get the size of the feed, either from the UI or the rest api. This feature is currently not supported in azure devops.
As an inconvenient method, you can get the size of each package through the download option, and then you can add the size of these packages to get the size of the feed.
I created a feature suggestion ticket for you on our Developer Community form , which is our main forum for product suggestions. You can comment and vote there to increase priority.
The suggestion ticket has been closed:
To see the feed size:
Go to your Azure DevOps Organization and pick a project
Select the Project setting -> Storage
Under Storage Type, Select “View storage breakdown”
Then you can see the storage size of your feeds.

How to query advanced issue handling on github (use of milestones and projects)?

I'd like to get the repositories that make the most active use of milestones and/or projects. By "most active" I mean something like most cards moved on a project board or most issues added to a milestone.
I tried GH Archive which has yearly datasets on Google bigquery. I ran this query
SELECT
JSON_EXTRACT(payload, '$.action')
FROM
[githubarchive:year.2017]
WHERE
type in ("IssuesEvent")
and JSON_EXTRACT(payload, '$.action') in ("milestoned", "labeled", "assigned")
LIMIT
20
and this query
SELECT
type
FROM
[githubarchive:year.2017]
WHERE
type IN ("MilestoneEvent",
"ProjectEvent",
"ProjectCardEvent")
LIMIT
20
Both return zero results. Does GH Archive not import all events? Am I making a mistake in the queries? Is there another source where I can get this information?

BigQuery github dataset returns wrong results

So, I'm trying to do some queries using bigquery-public-data:github_repos.files, which was updated on May 25, 2018, 2:07:03 AM, in theory, it contains all files data from github - as it says in the description of the table:
File metadata for all files at HEAD.
Join with [bigquery-public-data:github_repos.contents] on id columns
to search text.
So, I have this tool called goreleaser, to use it, users create a file named .goreleaser.yaml. To have an idea of how many repositories are using it, I was using the github search, something like this a search for filename:goreleaser extension:yaml extension:yml path:/, you can see the results on this link.
This shows 1k+ results, and gets results for all these possible names:
goreleaser.yml
goreleaser.yaml
.goreleaser.yml
.goreleaser.yaml
The problem is, github shows the 1k result count, but you can only paginate until 1k or so. I wrote some code in Go using the API and etc, you see it here.
Anyway, I tried to do something similar with bigquery, here is my foolish attempt:
SELECT repo_name, path
FROM [bigquery-public-data:github_repos.files]
WHERE REGEXP_MATCH(path, r'\.?goreleaser.ya?ml')
This will include the vendored tools, which is not ok, but that's not the problem. The problem is that even with the vendored tools, it only shows ~500 results, not 1k.
PS: I also tried the simplified version matching path with LIKE and etc, same results.
So, either I'm doing something horribly wrong, this table does not include all data as it says it does or github search is lying to me.
Any advice?
Thanks!
Not every project in GitHub is mirrored on BigQuery's repo dataset.
Let's look at all projects that got more than 40 stars in April, vs what we can find mirrored in BigQuery's repos:
SELECT COUNT(name) april_projects_gt_stars, COUNT(repo_name) projects_mirrored
FROM (
SELECT DISTINCT repo_name, name, c
FROM `bigquery-public-data.github_repos.files` a
RIGHT JOIN (
SELECT repo.name, COUNT(*) c
FROM `githubarchive.month.201804`
WHERE type='WatchEvent'
GROUP BY 1
HAVING c>40
) b
ON repo_name=name
)
9522 vs 3995. Why?
Only open source projects are mirrored. This according to the open source detected license - if GitHub can't tell what license a project is using, the project can't be mirrored.
New projects: The pipeline might miss some new projects. Please report them.

TFS 2013 Kanban board Done column (multiple complete states)

In TFS 2013 Microsoft "fixed" a bug which allowed to map a WorkItem's state to the "Done" state in the Kanban board.
This feature was heavily used in our company. There is a petition to bring it back back but I don't think it will make it:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/5589316-allow-multiple-complete-meta-state-mapping-in-tfs
In order to migrate TFS2012 to TFS2013 I would like to know where the customized "Done" state columns in TFS 2012 is stored in the database to create a report which shows which team used which WorkItem state as their "Done" state.
TFS2012 Kanban Board looked like that (note the dropdown):
TFS2013 Kanban Board looks like that (note NO dropdown):
I do have access to the TFS Collection database and I would like to create a SQL query which shows me all the customization of this column in TFS 2012.
How can I get for "My WorkItem" the for every Team Project and every Team the customized "Done" state in TFS2012 database?
What other tables do I need to link to in order to get those states?
So far I could only get the TeamId, Name, ColumnType ProjectId but not the effective WorkItem and the "Done" column customization. How can I do that?
SELECT
tbl_Board.TeamId,
tbl_Board.Revision,
tbl_BoardColumn.Name,
tbl_BoardColumn.ColumnType,
tbl_WorkItemTypeExtensions.Description,
tbl_BoardColumn.[Order],
tbl_WorkItemTypeExtensions.ProjectId
FROM
tbl_WorkItemTypeExtensions
RIGHT OUTER JOIN tbl_Board ON
tbl_WorkItemTypeExtensions.Id = tbl_Board.ExtensionId
LEFT OUTER JOIN tbl_BoardColumn ON
tbl_Board.Id = tbl_BoardColumn.BoardId
Experts do not recommend accessing TFS DB but you can use Tfs_WarehouseDatabase if Reporting is configured and Data from all project collections is collected and stored in tables that are optimized for reporting.
I do not have a knowledge about the db structures of TFS but going through few important online articles I managed understood quiet a few about it and as I understood the information that is required for you is in WorkItemsAretable.
Team Foundation Server Databases
Work item field and database schema reference
Stack overflow Question Access the Kanban Column (a Team-Specific Field) for a Work Item
With those queries below you can get the state of a certain work item on the Kanban board:
USE Tfs_DefaultCollection
SELECT TOP(10)
MarkerField + 1 as FieldId,
*
FROM tbl_WorkItemTypeExtensions with(nolock)
JOIN tbl_projects on tbl_WorkItemTypeExtensions.ProjectId = tbl_projects.project_id
WHERE tbl_projects.project_name LIKE '%ProjectName%
Copy the result from "FieldId" column to below's query at position XXXXXXXX
SELECT TOP 1000
wid.Id,
wia.State,
wid.StringValue as Kanban,
wia.[Work Item Type],
wia.Title,
tn.Name as Iteration
FROM tbl_WorkItemData wid with(nolock)
JOIN WorkItemsAre wia on wia.ID = wid.Id
JOIN TreeNodes tn on wia.IterationID = tn.ID
WHERE FieldId = XXXXXXXX and RevisedDate = '9999-01-01 00:00:00.000'
ORDER BY Id
Create a Detailed Report using Report Designer
Hope the sources that I have provided above will help your problem!
I contacted the Microsoft Support and they provided me the following answer to my question:
SELECT
board.TeamId,
boardColumn.Name,
workItemTypeExtensions.Rules
FROM
tbl_Board board JOIN
tbl_WorkItemTypeExtensions workItemTypeExtensions ON board.ExtensionId = workItemTypeExtensions.Id JOIN
tbl_projects projects ON workItemTypeExtensions.ProjectId = projects.project_id JOIN
tbl_BoardColumn boardColumn ON board.Id = boardColumn.BoardId
WHERE
projects.project_name LIKE '%< ENTER YOUR PROJECT NAME HERE >%' AND
boardColumn.ColumnType = 2
ORDER BY
board.TeamId,
boardColumn.[Order]
When I check XML in the "Rules" column there I can find exactly what I was looking for.

SQL Server Management Studio GROUP BY clause SHORTCUT

Is there is a shortcut or tool or something in T-SQL in SQL Server Management Studio that will allow you to automatically create a GROUP BY clause?
I put this as a comment ... but it is actually a solution.
Copy and paste all of your values which aren't in an aggregation function?
I find that the SELECT list contains my GROUP BY columns usually. Or vice versa so I copy, paste. And/or the ORDER BY.
Also, if you drag from Object Explorer Columns node for a table it puts a CSV list of columns in for you. This is a useful shortcut.
This is without using 3rd party tools like SSMS Tools Pack or Red Gate SQL Prompt