public ActionResult Blob(string id, string name, string encodedPath)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var path = PathEncoder.Decode(encodedPath);
                    string referenceName;
                    var model = browser.BrowseBlob(name, path, out referenceName);
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(name, path);

                    model.Text = FileDisplayHandler.GetText(model.Data);
                    model.IsText = model.Text != null;
                    if (model.IsText)
                        model.TextBrush = FileDisplayHandler.GetBrush(path);
                    else
                        model.IsImage = FileDisplayHandler.IsImage(path);

                    return View(model);
                }
            }
            return View();
        }
        public ActionResult LastedCommit(int page = 1)
        {
            page = page >= 1 ? page : 1;
            int pageSize = 10;

            var di = new DirectoryInfo(UserConfiguration.Current.Repositories);
            var allRepo = di.GetDirectories("*.*", SearchOption.TopDirectoryOnly);

            var list = new List<ActivityCommitModels>();
            var repoList = this.GetIndexModel();

            foreach (var repoPath in allRepo)
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repoPath.Name)))
                {
                    var name = PathEncoder.Decode("");
                    string referenceName;
                    int totalCount;
                    var commits = browser.GetCommits(name, 1, 10, out referenceName, out totalCount).ToList();

                    if (commits.Count < 1)
                        continue;

                    var com = commits.OrderByDescending(c => c.Date).FirstOrDefault();

                    var id = com.ID;
                    var committer = com.Author;
                    var committMail = com.AuthorEmail;
                    var committWhen = com.Date;
                    var message = com.Message;

                    if (repoList.Where(r => r.Name == repoPath.Name).FirstOrDefault() == null)
                        continue;

                    var repoGuid = repoList.Where(r => r.Name == repoPath.Name).FirstOrDefault().Id;

                    var ac = new ActivityCommitModels();
                    ac.ProjectName = repoPath.Name;
                    ac.CommitterName = committer;
                    ac.Email = committMail;
                    ac.When = committWhen;
                    ac.Message = message;
                    ac.idSha = id;
                    ac.id = repoGuid;
                    list.Add(ac);

                }
            }

            ViewBag.TotalCount = list.Count;
            var sortList = list.OrderByDescending(c => c.When).ToList();

            if (page >= 1 && pageSize >= 1)
            {
                sortList = sortList.Skip((page - 1) * pageSize).Take(pageSize).ToList();
            }

            return View(sortList);
        }
        public ActionResult Show(string repository, string tree, string path)
        {
            var browser = new RepositoryBrowser(Path.Combine(UserConfigurationManager.Repositories, repository));

            var leaf = browser.GetLeaf(tree, path);
            if (leaf != null)
            {
                return new FileStreamResult(new MemoryStream(leaf.RawData), FileDisplayHandler.GetMimeType(Path.GetFileName(path)));
            }
            return null;
        }
        public ActionResult Commit(string id, string commit)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var model = browser.GetCommitDetail(commit);
                    model.Name = id;
                    return View(model);
                }
            }

            return View();
        }
        public ActionResult Commits(string id, string name)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfigurationManager.Repositories, id)))
                {
                    string currentBranchName;
                    var commits = browser.GetCommits(name, out currentBranchName);
                    PopulateBranchesData(browser, currentBranchName);
                    return View(new RepositoryCommitsModel { Commits = commits, Name = id });
                }
            }

            return View();
        }
        public ActionResult Blob(string id, string encodedName, string encodedPath)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var name = PathEncoder.Decode(encodedName);
                    var path = PathEncoder.Decode(encodedPath);
                    string referenceName;
                    var model = browser.BrowseBlob(name, path, out referenceName);
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(path);

                    return View(model);
                }
            }
            return View();
        }
 private void PopulateBranchesData(RepositoryBrowser browser, string branchName)
 {
     ViewData["currentBranch"] = branchName;
     ViewData["branches"] = browser.GetBranches();
 }
        public ActionResult Raw(string id, string name, string path)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    string referenceName;
                    var model = browser.BrowseBlob(name, path, out referenceName);

                    return File(model.Data, "application/octet-stream", model.Name);
                }
            }
            return View();
        }
 private void PopulateBranchesData(RepositoryBrowser browser, string referenceName)
 {
     ViewData["referenceName"] = referenceName;
     ViewData["branches"] = browser.GetBranches();
     ViewData["tags"] = browser.GetTags();
 }
        public ActionResult Detail(Guid id)
        {
            ViewBag.ID = id;

            var model = ConvertRepositoryModel(RepositoryRepository.GetRepository(id), User);
            if (model != null)
            {
                model.IsCurrentUserAdministrator = RepositoryPermissionService.HasPermission(User.Id(), model.Id, RepositoryAccessLevel.Administer);
                SetGitUrls(model);
            }
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, model.Name)))
            {
                string defaultReferenceName;
                browser.BrowseTree(null, null, out defaultReferenceName);
                RouteData.Values.Add("encodedName", defaultReferenceName);
            }

            return View(model);
        }
        public ActionResult History(string id, string encodedPath, string encodedName)
        {
            ViewBag.ID = id;
            ViewBag.ShowShortMessageOnly = true;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var path = PathEncoder.Decode(encodedPath);
                    var name = PathEncoder.Decode(encodedName);
                    string referenceName;
                    var commits = browser.GetHistory(path, name, out referenceName);
                    return View(new RepositoryCommitsModel { Commits = commits, Name = id });
                }
            }

            return View();
        }
        public ActionResult Tree(string id, string encodedName, string encodedPath)
        {
            bool includeDetails = Request.IsAjaxRequest();

            if (String.IsNullOrEmpty(id))
                return View();

            ViewBag.ID = id;
            var name = PathEncoder.Decode(encodedName);
            var path = PathEncoder.Decode(encodedPath);

            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
            {
                string referenceName;
                var files = browser.BrowseTree(name, path, out referenceName, includeDetails);

                var readme = files.Where(x => x.Path.Equals("readme.md", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                string readmeTxt = string.Empty;
                if (readme != null)
                {
                    string refereceName;
                    var blob = browser.BrowseBlob(name, readme.Path, out refereceName);
                    readmeTxt = blob.Text;
                }
                var model = new RepositoryTreeModel
                {
                    Name = id,
                    Branch = name,
                    Path = path,
                    Files = files.OrderByDescending(i => i.IsTree).ThenBy(i => i.Name),
                    Readme = readmeTxt
                };

                if (includeDetails)
                {
                    return Json(model, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(path);
                    return View(model);
                }
            }
        }
예제 #13
0
        public ActionResult Commits(Guid id, string encodedName, int?page = null)
        {
            page = page >= 1 ? page : 1;


            ViewBag.ShowShortMessageOnly = true;
            var repo = RepositoryRepository.GetRepository(id);

            ViewBag.ID     = id;
            ViewBag.Name   = repo.Name;
            ViewBag.GitUrl = GitUrl(repo.Name);
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                var    name = PathEncoder.Decode(encodedName);
                string referenceName;
                int    totalCount;
                var    commits = browser.GetCommits(name, page.Value, 10, out referenceName, out totalCount);
                PopulateBranchesData(browser, referenceName);
                ViewBag.TotalCount = totalCount;

                var linksreg = repo.LinksUseGlobal ? UserConfiguration.Current.LinksRegex : repo.LinksRegex;
                var linksurl = repo.LinksUseGlobal ? UserConfiguration.Current.LinksUrl : repo.LinksUrl;
                foreach (var commit in commits)
                {
                    var links = new List <string>();
                    if (!string.IsNullOrEmpty(linksreg))
                    {
                        try
                        {
                            var matches = Regex.Matches(commit.Message, linksreg);
                            if (matches.Count > 0)
                            {
                                foreach (Match match in matches)
                                {
                                    IEnumerable <Group> groups = match.Groups.Cast <Group>();
                                    var link = "";
                                    try
                                    {
                                        var m = groups.Select(x => x.ToString()).ToArray();
                                        link = string.Format(linksurl, m);
                                    }
                                    catch (FormatException e)
                                    {
                                        link = "An error occured while trying to format the link. Exception: " + e.Message;
                                    }
                                    links.Add(link);
                                }
                            }
                        }
                        catch (ArgumentException e)
                        {
                            links.Add("An error occured while trying to match the regualar expression. Error: " + e.Message);
                        }
                    }
                    commit.Links = links;
                }
                return(View(new RepositoryCommitsModel
                {
                    Commits = commits,
                    Name = repo.Name,
                    Logo = new RepositoryLogoDetailModel(repo.Logo)
                }));
            }
        }
 public ActionResult Detail(string id)
 {
     ViewBag.ID = id;
     if (!String.IsNullOrEmpty(id))
     {
         var model = ConvertRepositoryModel(RepositoryRepository.GetRepository(id));
         if (model != null)
         {
             model.IsCurrentUserAdministrator = RepositoryPermissionService.IsRepositoryAdministrator(User.Identity.Name, id);
         }
         using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
         {
             string defaultReferenceName;
             browser.BrowseTree(null, null, out defaultReferenceName);
             RouteData.Values.Add("encodedName", defaultReferenceName);
         }
         return View(model);
     }
     return View();
 }
        public ActionResult Blame(Guid id, string encodedName, string encodedPath)
        {
            ViewBag.ID = id;
            ViewBag.ShowShortMessageOnly = true;
            var repo = RepositoryRepository.GetRepository(id);
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                var name = PathEncoder.Decode(encodedName);
                var path = PathEncoder.Decode(encodedPath);
                string referenceName;
                var model = browser.GetBlame(name, path, out referenceName);
                model.Logo = new RepositoryLogoDetailModel(repo.Logo);
                PopulateBranchesData(browser, referenceName);
                PopulateAddressBarData(path);

                return View(model);
            }
        }
예제 #16
0
        public ActionResult Detail(Guid id)
        {
            var mater = ConvertRepositoryModel(RepositoryRepository.GetRepository(id), User);

            if (mater != null)
            {
                mater.IsCurrentUserAdministrator = RepositoryPermissionService.HasPermission(User.Id(), mater.Id, RepositoryAccessLevel.Administer);
                SetGitUrls(mater);
            }
            ViewBag.ID     = id;
            ViewBag.Name   = mater.Name;
            ViewBag.GitUrl = mater.GitUrl;

            //using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, model.Name)))
            //{
            //    string defaultReferenceName;
            //    browser.BrowseTree(null, null, out defaultReferenceName);
            //    RouteData.Values.Add("encodedName", defaultReferenceName);
            //}
            bool includeDetails = Request.IsAjaxRequest();


            var name = PathEncoder.Decode(null);
            var path = PathEncoder.Decode(null);

            var repo = RepositoryRepository.GetRepository(id);
            var repositoryDetailModel = ConvertRepositoryModel(repo, User);


            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                string referenceName;
                var    files = browser.BrowseTree(name, path, out referenceName, includeDetails).ToList();
                PopulateBranchesData(browser, referenceName);
                var    readme    = files.FirstOrDefault(x => x.Name.Equals("readme.md", StringComparison.OrdinalIgnoreCase));
                string readmeTxt = string.Empty;
                if (readme != null)
                {
                    string refereceName;
                    var    blob = browser.BrowseBlob(name, readme.Path, out refereceName);
                    readmeTxt = blob.Text;
                }
                var model = new RepositoryTreeModel
                {
                    Name   = repo.Name,
                    Branch = name ?? referenceName,
                    Path   = path,
                    Readme = readmeTxt,
                    Logo   = new RepositoryLogoDetailModel(repo.Logo),
                    Files  = files.OrderByDescending(i => i.IsTree).ThenBy(i => i.Name)
                };

                if (includeDetails)
                {
                    return(Json(model, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(path);
                    return(View(model));
                }
            }
        }
        public ActionResult Tags(Guid id, string encodedName, int page = 1)
        {
            page = page >= 1 ? page : 1;

            ViewBag.ID = id;
            ViewBag.ShowShortMessageOnly = true;
            var repo = RepositoryRepository.GetRepository(id);
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                var name = PathEncoder.Decode(encodedName);
                string referenceName;
                int totalCount;
                var commits = browser.GetTags(name, page, 10, out referenceName, out totalCount);
                PopulateBranchesData(browser, referenceName);
                ViewBag.TotalCount = totalCount;
                return View(new RepositoryCommitsModel {
                    Commits = commits,
                    Name = repo.Name,
                    Logo = new RepositoryLogoDetailModel(repo.Logo)
                });
            }
        }
        public ActionResult Raw(Guid id, string encodedName, string encodedPath, bool display = false)
        {
            ViewBag.ID = id;

            var repo = RepositoryRepository.GetRepository(id);
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                var name = PathEncoder.Decode(encodedName);
                var path = PathEncoder.Decode(encodedPath);
                string referenceName;
                var model = browser.BrowseBlob(name, path, out referenceName);
                model.Logo = new RepositoryLogoDetailModel(repo.Logo);

                if (!display)
                {
                    return File(model.Data, "application/octet-stream", model.Name);
                }
                if (model.IsText)
                {
                    return Content(model.Text, "text/plain", model.Encoding);
                }
                if (model.IsImage)
                {
                    return File(model.Data, MimeTypeMap.GetMimeType(Path.GetExtension(model.Name.ToLower())), model.Name);
                }
            }

            return HttpNotFound();
        }
 public ActionResult History(Guid id, string encodedPath, string encodedName)
 {
     ViewBag.ID = id;
     ViewBag.ShowShortMessageOnly = true;
     var repo = RepositoryRepository.GetRepository(id);
     using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
     {
         var path = PathEncoder.Decode(encodedPath);
         var name = PathEncoder.Decode(encodedName);
         string referenceName;
         var commits = browser.GetHistory(path, name, out referenceName);
         return View(new RepositoryCommitsModel {
             Commits = commits,
             Name = repo.Name,
             Logo = new RepositoryLogoDetailModel(repo.Logo)
         });
     }
 }
        public ActionResult Tree(string id, string name, string path)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    string referenceName;
                    var files = browser.BrowseTree(name, path, out referenceName);
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(name, path);

                    var model = new RepositoryTreeModel();
                    model.Name = id;
                    //model.IsTree = true;
                    model.Files = files.OrderByDescending(i => i.IsTree).ThenBy(i => i.Name);
                    return View(model);
                }
            }
            return View();
        }
        public ActionResult Commits(string id, string encodedName, int page = 1)
        {
            page = page >= 1 ? page : 1;
            
            ViewBag.ID = id;
            ViewBag.ShowShortMessageOnly = true;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var name = PathEncoder.Decode(encodedName);
                    string referenceName;
                    int totalCount;
                    var commits = browser.GetCommits(name, page, 10, out referenceName, out totalCount);
                    PopulateBranchesData(browser, referenceName);
                    ViewBag.TotalCount = totalCount;
                    return View(new RepositoryCommitsModel { Commits = commits, Name = id });
                }
            }

            return View();
        }
        public ActionResult Tree(string id, string encodedName, string encodedPath)
        {
            bool includeDetails = Request.IsAjaxRequest(); 

            if (String.IsNullOrEmpty(id))
                return View();

            ViewBag.ID = id;
            var name = PathEncoder.Decode(encodedName);
            var path = PathEncoder.Decode(encodedPath);

            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
            {
                string referenceName;
                var files = browser.BrowseTree(name, path, out referenceName, includeDetails);

                var model = new RepositoryTreeModel
                {
                    Name = id,
                    Branch = name,
                    Path = path,
                    Files = files.OrderByDescending(i => i.IsTree).ThenBy(i => i.Name),
                };

                if (includeDetails)
                {
                    return Json(model, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    PopulateBranchesData(browser, referenceName);
                    PopulateAddressBarData(name, path);
                    return View(model);
                }
            }
        }
 public ActionResult Commit(Guid id, string commit)
 {
     ViewBag.ID = id;
     ViewBag.ShowShortMessageOnly = false;
     var repo = RepositoryRepository.GetRepository(id);
     using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
     {
         var model = browser.GetCommitDetail(commit);
         model.Name = repo.Name;
         model.Logo = new RepositoryLogoDetailModel(repo.Logo);
         return View(model);
     }
 }
        public ActionResult Download(string id, string encodedName, string encodedPath)
        {
            if (String.IsNullOrEmpty(id))
                return HttpNotFound();

            var name = PathEncoder.Decode(encodedName);
            var path = PathEncoder.Decode(encodedPath);

            Response.BufferOutput = false;
            Response.Charset = "";
            Response.ContentType = "application/zip";

            string headerValue = ContentDispositionUtil.GetHeaderValue((name ?? id) + ".zip");
            Response.AddHeader("Content-Disposition", headerValue);

            using (var outputZip = new ZipFile())
            {
                outputZip.UseZip64WhenSaving = Zip64Option.Always;
                outputZip.AlternateEncodingUsage = ZipOption.AsNecessary;
                outputZip.AlternateEncoding = Encoding.Unicode;

                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    AddTreeToZip(browser, name, path, outputZip);
                }

                outputZip.Save(Response.OutputStream);

                return new EmptyResult();
            }
        }
        public ActionResult Commits(string id, string encodedName)
        {
            ViewBag.ID = id;
            if (!String.IsNullOrEmpty(id))
            {
                using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
                {
                    var name = PathEncoder.Decode(encodedName);
                    string referenceName;
                    var commits = browser.GetCommits(name, out referenceName);
                    PopulateBranchesData(browser, referenceName);
                    return View(new RepositoryCommitsModel { Commits = commits, Name = id });
                }
            }

            return View();
        }
        public ActionResult Raw(string id, string encodedName, string encodedPath, bool display = false)
        {
            ViewBag.ID = id;
            if (String.IsNullOrEmpty(id))
                return HttpNotFound();

            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, id)))
            {
                var name = PathEncoder.Decode(encodedName);
                var path = PathEncoder.Decode(encodedPath);
                string referenceName;
                var model = browser.BrowseBlob(name, path, out referenceName);

                if (!display)
                {
                    return File(model.Data, "application/octet-stream", model.Name);
                }
                if (model.IsText)
                {
                    return Content(model.Text, "text/plain", model.Encoding);
                }
                if (model.IsImage)
                {
                    return File(model.Data, FileDisplayHandler.GetMimeType(model.Name), model.Name);
                }
            }

            return HttpNotFound();
        }
예제 #27
0
 private void PopulateBranchesData(RepositoryBrowser browser, string branchName)
 {
     ViewData["currentBranch"] = branchName;
     ViewData["branches"]      = browser.GetBranches();
 }
        private static void AddTreeToZip(RepositoryBrowser browser, string name, string path, ZipFile outputZip)
        {
            string referenceName;
            var treeNode = browser.BrowseTree(name, path, out referenceName);

            foreach (var item in treeNode)
            {
                if (item.IsLink)
                {
                    outputZip.AddDirectoryByName(Path.Combine(item.TreeName, item.Path));
                }
                else if (!item.IsTree)
                {
                    string blobReferenceName;
                    var model = browser.BrowseBlob(item.TreeName, item.Path, out blobReferenceName);
                    outputZip.AddEntry(Path.Combine(item.TreeName, item.Path), model.Data);
                }
                else
                {
                    // recursive call
                    AddTreeToZip(browser, item.TreeName, item.Path, outputZip);
                }
            }
        }
 public ActionResult Tree(string id, string name, string path)
 {
     ViewBag.ID = id;
     if (!String.IsNullOrEmpty(id))
     {
         bool download = false;
         if (path != null)
         {
             if (path.EndsWith(".browse"))
             {
                 path = path.Substring(0, path.Length - 7);
             }
             else if (path.EndsWith(".download"))
             {
                 path = path.Substring(0, path.Length - 9);
                 download = true;
             }
         }
         path = path != null ? path.Replace(".browse", "") : null;
         using (var browser = new RepositoryBrowser(Path.Combine(UserConfigurationManager.Repositories, id)))
         {
             string branchName;
             var files = browser.Browse(name, path, out branchName);
             PopulateBranchesData(browser, branchName);
             PopulateAddressBarData(name, path);
             return DisplayFiles(files, path, id, download);
         }
     }
     return View();
 }
예제 #30
0
 private void PopulateBranchesData(RepositoryBrowser browser, string referenceName)
 {
     ViewData["referenceName"] = referenceName;
     ViewData["branches"]      = browser.GetBranches();
     ViewData["tags"]          = browser.GetTags();
 }
        public ActionResult Commits(Guid id, string encodedName, int page = 1)
        {
            page = page >= 1 ? page : 1;

            ViewBag.ID = id;
            ViewBag.ShowShortMessageOnly = true;
            var repo = RepositoryRepository.GetRepository(id);
            using (var browser = new RepositoryBrowser(Path.Combine(UserConfiguration.Current.Repositories, repo.Name)))
            {
                var name = PathEncoder.Decode(encodedName);
                string referenceName;
                int totalCount;
                var commits = browser.GetCommits(name, page, 10, out referenceName, out totalCount);
                PopulateBranchesData(browser, referenceName);
                ViewBag.TotalCount = totalCount;

                var linksreg = repo.LinksUseGlobal ? UserConfiguration.Current.LinksRegex : repo.LinksRegex;
                var linksurl = repo.LinksUseGlobal ? UserConfiguration.Current.LinksUrl : repo.LinksUrl;
                foreach (var commit in commits)
                {
                    var links = new List<string>();
                    if (!string.IsNullOrEmpty(linksreg))
                    {
                        try
                        {
                            var matches = Regex.Matches(commit.Message, linksreg);
                            if (matches.Count > 0)
                            {
                                foreach (Match match in matches)
                                {
                                    IEnumerable<Group> groups = match.Groups.Cast<Group>();
                                    var link = "";
                                    try
                                    {
                                        var m = groups.Select(x => x.ToString()).ToArray();
                                        link = string.Format(linksurl, m);
                                    }
                                    catch (FormatException e)
                                    {
                                        link = "An error occured while trying to format the link. Exception: " + e.Message;
                                    }
                                    links.Add(link);
                                }
                            }
                        }
                        catch (ArgumentException e)
                        {
                            links.Add("An error occured while trying to match the regualar expression. Error: " + e.Message);
                        }
                    }
                    commit.Links = links;
                }
                return View(new RepositoryCommitsModel {
                    Commits = commits,
                    Name = repo.Name,
                    Logo = new RepositoryLogoDetailModel(repo.Logo)
                });
            }
        }