Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 5765c18

Browse files
committed
Remove Octokit dependency from BranchModel
BranchModel is now a pure model. 🎉
1 parent b1db91f commit 5765c18

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/GitHub.App/Services/ModelService.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public IObservable<IPullRequestModel> CreatePullRequest(ILocalRepositoryModel so
270270
new NewPullRequest(title,
271271
string.Format(CultureInfo.InvariantCulture, "{0}:{1}", sourceRepository.Owner, sourceBranch.Name),
272272
targetBranch.Name)
273-
{ Body = body },
273+
{ Body = body },
274274
targetRepository.Owner,
275275
targetRepository.Name)
276276
.Select(PullRequestCacheItem.Create)
@@ -366,7 +366,7 @@ public IObservable<IBranch> GetBranches(IRepositoryModel repo)
366366

367367
return Observable.Defer(() => keyobs
368368
.SelectMany(key => ApiClient.GetBranches(repo.CloneUrl.Owner, repo.CloneUrl.RepositoryName)))
369-
.Select(x => new BranchModel(x, repo));
369+
.Select(x => new BranchModel(x.Name, repo));
370370
}
371371

372372
static GitIgnoreItem Create(GitIgnoreCacheItem item)
@@ -452,7 +452,7 @@ public IObservable<Unit> InsertUser(AccountCacheItem user)
452452
}
453453

454454
protected virtual void Dispose(bool disposing)
455-
{}
455+
{ }
456456

457457
public void Dispose()
458458
{
@@ -493,7 +493,7 @@ public static RepositoryCacheItem Create(Repository apiRepository)
493493
return new RepositoryCacheItem(apiRepository);
494494
}
495495

496-
public RepositoryCacheItem() {}
496+
public RepositoryCacheItem() { }
497497

498498
public RepositoryCacheItem(Repository apiRepository)
499499
{
@@ -529,7 +529,7 @@ public static PullRequestCacheItem Create(PullRequest pr)
529529
return new PullRequestCacheItem(pr);
530530
}
531531

532-
public PullRequestCacheItem() {}
532+
public PullRequestCacheItem() { }
533533

534534
public PullRequestCacheItem(PullRequest pr)
535535
{
@@ -563,7 +563,7 @@ public PullRequestCacheItem(PullRequest pr)
563563
Timestamp = UpdatedAt;
564564
}
565565

566-
public string Title {get; set; }
566+
public string Title { get; set; }
567567
public int Number { get; set; }
568568
public GitReferenceCacheItem Base { get; set; }
569569
public GitReferenceCacheItem Head { get; set; }
@@ -574,7 +574,7 @@ public PullRequestCacheItem(PullRequest pr)
574574
public DateTimeOffset CreatedAt { get; set; }
575575
public DateTimeOffset UpdatedAt { get; set; }
576576
public string Body { get; set; }
577-
577+
578578
// Nullable for compatibility with old caches.
579579
public PullRequestStateEnum? State { get; set; }
580580

src/GitHub.Exports/Models/BranchModel.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,7 @@ public BranchModel(string name, IRepositoryModel repo)
2020

2121
Name = DisplayName = name;
2222
Repository = repo;
23-
Id = String.Format(CultureInfo.InvariantCulture, "{0}/{1}", Repository.Owner, Name);
24-
}
25-
26-
public BranchModel(Octokit.Branch branch, IRepositoryModel repo)
27-
{
28-
Extensions.Guard.ArgumentNotNull(branch, nameof(branch));
29-
Extensions.Guard.ArgumentNotNull(repo, nameof(repo));
30-
31-
Name = DisplayName = branch.Name;
32-
Repository = repo;
33-
Id = String.Format(CultureInfo.InvariantCulture, "{0}/{1}", Repository.Owner, Name);
23+
Id = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", Repository.Owner, Name);
3424
}
3525

3626
public string Id { get; private set; }

0 commit comments

Comments
 (0)