示例#1
0
 private async Task <ImmutableList <string> > GetUpstreamBranches(string branch, Dictionary <string, ImmutableList <string> > upstreamBranchListings)
 {
     if (!upstreamBranchListings.ContainsKey(branch))
     {
         var result = (
             from b in (await settings.GetUpstreamBranches(branch).FirstOrDefaultAsync())
             select b.GroupName
             ).ToImmutableList();
         var removed = new HashSet <string>();
         foreach (var entry in result.ToArray())
         {
             if (removed.Contains(entry))
             {
                 // already found this as an exception
                 continue;
             }
             foreach (var newEntry in (await settings.GetAllUpstreamBranches(entry).FirstOrDefaultAsync()).Select(b => b.GroupName))
             {
                 removed.Add(newEntry);
             }
         }
         upstreamBranchListings[branch] = result.Except(removed).ToImmutableList();
     }
     return(upstreamBranchListings[branch]);
 }
示例#2
0
 public async Task <string[]> UpstreamBranches(string branchName)
 {
     return(await branchSettings.GetUpstreamBranches(branchName).FirstAsync());
 }