Пример #1
0
 private static void ApplyTeams(ITeamClassifier teamClassifier, Artifact artifact, ChangeSet changeset)
 {
     if (teamClassifier != null)
     {
         // If a classifier is given use it ...
         artifact.Teams.Add(teamClassifier.GetAssociatedTeam(changeset.Committer, changeset.Date));
     }
 }
Пример #2
0
        private string GetTeam(ChangeSet cs, ITeamClassifier teamClassifier)
        {
            var team = cs.Committer;

            if (teamClassifier != null)
            {
                team = teamClassifier.GetAssociatedTeam(cs.Committer, cs.Date);
                if (team == "NOT_CLASSIFIED")
                {
                    Trace.WriteLine("Not classified developer: " + cs.Committer + " " + cs.Date.ToShortDateString());
                    _notClassifiedDevelopers.AddToValue(cs.Committer, 1);
                }
            }

            return(team);
        }
Пример #3
0
        /// <summary>
        /// returns the team communication path.
        /// If no team classifier is provided, the developer himself is used.
        /// </summary>
        public Dictionary <OrderedPair, uint> AnalyzeTeamCommunication(ChangeSetHistory history, ITeamClassifier teamClassifier)
        {
            // file id -> dictionary{team, #commits}
            var fileToCommitsPerTeam = new Dictionary <string, Dictionary <string, uint> >();

            foreach (var cs in history.ChangeSets)
            {
                // Associated team (or developer)
                var team = GetTeam(cs, teamClassifier);

                foreach (var item in cs.Items)
                {
                    // Add team to file
                    if (!fileToCommitsPerTeam.Keys.Contains(item.Id))
                    {
                        fileToCommitsPerTeam.Add(item.Id, new Dictionary <string, uint>());
                    }

                    var commitsPerTeam = fileToCommitsPerTeam[item.Id];
                    commitsPerTeam.AddToValue(team, 1);
                }
            }

            // We know for each file which team did how many changes
            // Each file that was accessed by two teams leads to a link between the teams.

            // pair of teams -> number of commits.
            var teamCommunicationPaths = new Dictionary <OrderedPair, uint>();

            foreach (var file in fileToCommitsPerTeam)
            {
                var currentFileTeams = file.Value.Keys.ToList();

                // Build team subsets that get counted as one path.
                for (var index = 0; index < currentFileTeams.Count - 1; index++)
                {
                    for (var index2 = 1; index2 < currentFileTeams.Count; index2++)
                    {
                        var teamPair = new OrderedPair(currentFileTeams[index], currentFileTeams[index2]);

                        // The team combination that worked together at least one time at the same file
                        // gets a point.
                        teamCommunicationPaths.AddToValue(teamPair, 1);
                    }
                }
            }

            return(teamCommunicationPaths);
        }