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

Commit 9e341e0

Browse files
committed
Remove IBranch interface from BranchModel
1 parent 5765c18 commit 9e341e0

File tree

26 files changed

+135
-150
lines changed

26 files changed

+135
-150
lines changed

src/GitHub.App/Models/RemoteRepositoryModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class RemoteRepositoryModel : RepositoryModel, IRemoteRepositoryModel,
2121
/// <param name="isFork">Whether the repository is a fork.</param>
2222
/// <param name="ownerAccount">The repository owner account.</param>
2323
/// <param name="parent">The parent repository if this repository is a fork.</param>
24-
public RemoteRepositoryModel(long id, string name, UriString cloneUrl, bool isPrivate, bool isFork, IAccount ownerAccount, IRemoteRepositoryModel parent)
24+
public RemoteRepositoryModel(long id, string name, UriString cloneUrl, bool isPrivate, bool isFork, IAccount ownerAccount, IRemoteRepositoryModel parent)
2525
: base(name, cloneUrl)
2626
{
2727
Guard.ArgumentNotEmptyString(name, nameof(name));
@@ -56,7 +56,7 @@ public RemoteRepositoryModel(Octokit.Repository repository)
5656
Parent.DefaultBranch.DisplayName = Parent.DefaultBranch.Id;
5757
}
5858

59-
#region Equality Things
59+
#region Equality Things
6060
public void CopyFrom(IRemoteRepositoryModel other)
6161
{
6262
if (!Equals(other))
@@ -124,7 +124,7 @@ public int CompareTo(RemoteRepositoryModel other)
124124
{
125125
return !(lhs == rhs);
126126
}
127-
#endregion
127+
#endregion
128128

129129
/// <summary>
130130
/// Gets the account that is the ower of the repository.
@@ -159,7 +159,7 @@ public int CompareTo(RemoteRepositoryModel other)
159159
/// <summary>
160160
/// Gets the default branch for the repository.
161161
/// </summary>
162-
public IBranch DefaultBranch { get; }
162+
public BranchModel DefaultBranch { get; }
163163

164164
internal string DebuggerDisplay
165165
{

src/GitHub.App/SampleData/GitServiceDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace GitHub.SampleData
99
class GitServiceDesigner : IGitService
1010
{
1111
public ILocalRepositoryModel CreateLocalRepositoryModel(string localPath) => null;
12-
public IBranch GetBranch(ILocalRepositoryModel model) => null;
12+
public BranchModel GetBranch(ILocalRepositoryModel model) => null;
1313
public Task<string> GetLatestPushedSha(string path, string remote = "origin") => Task.FromResult<string>(null);
1414
public UriString GetRemoteUri(IRepository repo, string remote = "origin") => null;
1515
public IRepository GetRepository(string path) => null;

src/GitHub.App/SampleData/LocalRepositoryModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace GitHub.App.SampleData
1111
public class LocalRepositoryModelDesigner : ILocalRepositoryModel
1212
{
1313
public UriString CloneUrl { get; set; }
14-
public IBranch CurrentBranch { get; set; }
14+
public BranchModel CurrentBranch { get; set; }
1515
public Octicon Icon { get; set; }
1616
public string LocalPath { get; set; }
1717
public string Name { get; set; }

src/GitHub.App/SampleData/PullRequestCreationViewModelDesigner.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public PullRequestCreationViewModelDesigner()
2121
CloneUrl = "http://github.com/user/repo"
2222
};
2323

24-
Branches = new List<IBranch>
24+
Branches = new List<BranchModel>
2525
{
2626
new BranchModel("master", repositoryModel),
2727
new BranchModel("don/stub-ui", repositoryModel),
@@ -40,9 +40,9 @@ public PullRequestCreationViewModelDesigner()
4040
};
4141
}
4242

43-
public IBranch SourceBranch { get; set; }
44-
public IBranch TargetBranch { get; set; }
45-
public IReadOnlyList<IBranch> Branches { get; set; }
43+
public BranchModel SourceBranch { get; set; }
44+
public BranchModel TargetBranch { get; set; }
45+
public IReadOnlyList<BranchModel> Branches { get; set; }
4646

4747
public string SelectedAssignee { get; set; }
4848
public List<string> Users { get; set; }

src/GitHub.App/SampleData/RemoteRepositoryModelDesigner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class RemoteRepositoryModelDesigner : IRemoteRepositoryModel
1010
{
1111
public UriString CloneUrl { get; set; }
1212
public DateTimeOffset CreatedAt { get; set; }
13-
public IBranch DefaultBranch { get; set; }
13+
public BranchModel DefaultBranch { get; set; }
1414
public Octicon Icon { get; set; }
1515
public long Id { get; set; }
1616
public bool IsFork { get; set; }

src/GitHub.App/Services/ModelService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public ITrackingCollection<IRemoteRepositoryModel> GetRepositories(ITrackingColl
257257
}
258258

259259
public IObservable<IPullRequestModel> CreatePullRequest(ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository,
260-
IBranch sourceBranch, IBranch targetBranch,
260+
BranchModel sourceBranch, BranchModel targetBranch,
261261
string title, string body)
262262
{
263263
var keyobs = GetUserFromCache()
@@ -359,7 +359,7 @@ IObservable<IReadOnlyList<IRemoteRepositoryModel>> GetOrganizationRepositories(s
359359
});
360360
}
361361

362-
public IObservable<IBranch> GetBranches(IRepositoryModel repo)
362+
public IObservable<BranchModel> GetBranches(IRepositoryModel repo)
363363
{
364364
var keyobs = GetUserFromCache()
365365
.Select(user => string.Format(CultureInfo.InvariantCulture, "{0}|{1}|branch", user.Login, repo.Name));

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public async Task<Page<ActorModel>> ReadAssignableUsers(
318318

319319
public IObservable<IPullRequestModel> CreatePullRequest(IModelService modelService,
320320
ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository,
321-
IBranch sourceBranch, IBranch targetBranch,
321+
BranchModel sourceBranch, BranchModel targetBranch,
322322
string title, string body
323323
)
324324
{
@@ -635,7 +635,7 @@ public IObservable<TreeChanges> GetTreeChanges(ILocalRepositoryModel repository,
635635
});
636636
}
637637

638-
public IObservable<IBranch> GetLocalBranches(ILocalRepositoryModel repository, PullRequestDetailModel pullRequest)
638+
public IObservable<BranchModel> GetLocalBranches(ILocalRepositoryModel repository, PullRequestDetailModel pullRequest)
639639
{
640640
return Observable.Defer(() =>
641641
{
@@ -926,7 +926,7 @@ async Task MarkBranchAsPullRequest(IRepository repo, string branchName, string o
926926

927927
async Task<IPullRequestModel> PushAndCreatePR(IModelService modelService,
928928
ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository,
929-
IBranch sourceBranch, IBranch targetBranch,
929+
BranchModel sourceBranch, BranchModel targetBranch,
930930
string title, string body)
931931
{
932932
// PullRequestModel doesn't keep a reference to repo

src/GitHub.App/ViewModels/GitHubPane/PullRequestCreationViewModel.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection
161161

162162
githubObs.SelectMany(r =>
163163
{
164-
var b = Observable.Empty<IBranch>();
164+
var b = Observable.Empty<BranchModel>();
165165
if (r.IsFork)
166166
{
167167
b = modelService.GetBranches(r.Parent).Select(x =>
@@ -327,22 +327,22 @@ bool Initialized
327327
set { this.RaiseAndSetIfChanged(ref initialized, value); }
328328
}
329329

330-
IBranch sourceBranch;
331-
public IBranch SourceBranch
330+
BranchModel sourceBranch;
331+
public BranchModel SourceBranch
332332
{
333333
get { return sourceBranch; }
334334
set { this.RaiseAndSetIfChanged(ref sourceBranch, value); }
335335
}
336336

337-
IBranch targetBranch;
338-
public IBranch TargetBranch
337+
BranchModel targetBranch;
338+
public BranchModel TargetBranch
339339
{
340340
get { return targetBranch; }
341341
set { this.RaiseAndSetIfChanged(ref targetBranch, value); }
342342
}
343343

344-
IReadOnlyList<IBranch> branches;
345-
public IReadOnlyList<IBranch> Branches
344+
IReadOnlyList<BranchModel> branches;
345+
public IReadOnlyList<BranchModel> Branches
346346
{
347347
get { return branches; }
348348
set { this.RaiseAndSetIfChanged(ref branches, value); }

src/GitHub.Exports.Reactive/Services/IModelService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public interface IModelService : IDisposable
2828
IObservable<IPullRequestModel> GetPullRequest(string owner, string name, int number);
2929
ITrackingCollection<IPullRequestModel> GetPullRequests(IRepositoryModel repo, ITrackingCollection<IPullRequestModel> collection);
3030
IObservable<IPullRequestModel> CreatePullRequest(ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository,
31-
IBranch sourceBranch, IBranch targetBranch,
31+
BranchModel sourceBranch, BranchModel targetBranch,
3232
string title, string body);
33-
IObservable<IBranch> GetBranches(IRepositoryModel repo);
33+
IObservable<BranchModel> GetBranches(IRepositoryModel repo);
3434
IObservable<Unit> InvalidateAll();
3535
IObservable<string> GetFileContents(IRepositoryModel repo, string commitSha, string path, string fileSha);
3636
}

src/GitHub.Exports.Reactive/Services/IPullRequestService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Task<Page<ActorModel>> ReadAssignableUsers(
4343

4444
IObservable<IPullRequestModel> CreatePullRequest(IModelService modelService,
4545
ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository,
46-
IBranch sourceBranch, IBranch targetBranch,
46+
BranchModel sourceBranch, BranchModel targetBranch,
4747
string title, string body);
4848

4949
/// <summary>
@@ -103,7 +103,7 @@ IObservable<IPullRequestModel> CreatePullRequest(IModelService modelService,
103103
/// <param name="repository">The repository.</param>
104104
/// <param name="pullRequest">The pull request details.</param>
105105
/// <returns></returns>
106-
IObservable<IBranch> GetLocalBranches(ILocalRepositoryModel repository, PullRequestDetailModel pullRequest);
106+
IObservable<BranchModel> GetLocalBranches(ILocalRepositoryModel repository, PullRequestDetailModel pullRequest);
107107

108108
/// <summary>
109109
/// Ensures that all local branches for the specified pull request are marked as PR branches.

0 commit comments

Comments
 (0)