Retrieving all changesets
I'd like to write a little plug-in to collect statistics on changesets -- how many, which users have done, how many file changes have occurred, etc. I think I can handle it once I have a ITeamRepository handle, but I am not sure how to get this initial handle. The code samples in the SDK wiki all look like this:
ITeamRepository repo = ...; // assuming you have this So my questions are: 1. How do I get that initial handle? 2. Once I get that, is there a direct method to walk through changesets? Or do I need to walk through streams or some other object first to "get" to changesets? 3. In the repository, if a changeset "appears" in multiple streams (ie, it was delivered to more than one stream), is there still only one changeset object? (I am hoping so) Thanks in advance, Mike Johnson |
One answer
1) One way to get a repo is
TeamPlatform.getTeamRepositoryService().getTeamRepository(uri) 2) Scoping your search of changesets through streams or authors or some other criteria is recommended because there can potentially be thousands of change sets that would make iterating through your result unmanageable. There is the IChangeSetSearchCriteria structure that you can populate and then pass to SCMPlatform.getWorkspaceManager(repo).findChangeSets(criteria, maxResults, progress). - note that there's a hidden max-result cap of 512 to prevent abusing the DB and marshalling a giant list. 3) Yes, change sets can be uniquely identified by comparing their itemIds. and yes, a single changeset can be found in multiple streams. You might have many instances of java objects that represent the same changeset. So to test equality you need to test changeset1.getItemId().equals(changeset2.getItemId()), or for short changeset1.sameItemId(changeset2) On Mon, 25 Jan 2010 13:52:59 -0500, micjohnson997 <michael> wrote: I'd like to write a little plug-in to collect statistics on changesets -- |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.