try catch all the things
This commit is contained in:
parent
895f322bd6
commit
5873bdb2a6
@ -93,12 +93,20 @@ public class CommitDetail
|
|||||||
{
|
{
|
||||||
var branchResult = repo.Branches[branchName];
|
var branchResult = repo.Branches[branchName];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
if (branchResult == null)
|
if (branchResult == null)
|
||||||
{
|
{
|
||||||
branchResult = repo.Branches[$"origin/{branchName}"];
|
branchResult = repo.Branches[$"origin/{branchName}"];
|
||||||
var remoteBranch = repo.CreateBranch(branchName, branchResult.Tip);
|
var remoteBranch = repo.CreateBranch(branchName, branchResult.Tip);
|
||||||
repo.Branches.Update(remoteBranch, b => b.UpstreamBranch = $"refs/heads/{branchName}");
|
repo.Branches.Update(remoteBranch, b => b.UpstreamBranch = $"refs/heads/{branchName}");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Cannot fetch {branchName} branch.");
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var c in branchResult.Commits)
|
foreach (var c in branchResult.Commits)
|
||||||
{
|
{
|
||||||
@ -119,6 +127,8 @@ public class CommitDetail
|
|||||||
public void GetCommitsByTag(string tagName)
|
public void GetCommitsByTag(string tagName)
|
||||||
{
|
{
|
||||||
using (var repo = new Repository(Directory.GetCurrentDirectory()))
|
using (var repo = new Repository(Directory.GetCurrentDirectory()))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var tagResult = repo.Tags[tagName].Target.Sha;
|
var tagResult = repo.Tags[tagName].Target.Sha;
|
||||||
|
|
||||||
@ -142,7 +152,12 @@ public class CommitDetail
|
|||||||
int commitCount = query.Where(r => r.Author.Name == a).Count();
|
int commitCount = query.Where(r => r.Author.Name == a).Count();
|
||||||
_commitDetails.Add(a, commitCount);
|
_commitDetails.Add(a, commitCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Cannot find the tag {tagName}");
|
||||||
|
Environment.Exit(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ static class Program
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System.Console.WriteLine("This should not happen...");
|
System.Console.WriteLine("This should not happen...");
|
||||||
Environment.Exit(90);
|
Environment.Exit(4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user