Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
80abca2
Remove IGitService dependency from RepositoryModel
jcansdale Oct 23, 2018
1177e93
Move LocalRepositoryModel ctor into GitService 1/2
jcansdale Oct 23, 2018
c6c8b84
Move LocalRepositoryModel ctor into GitService 2/2
jcansdale Oct 23, 2018
edb8232
Fix tests after LocalRepositoryModel refactor
jcansdale Oct 23, 2018
835e561
Move GenerateUrl to LinkCommandBase
jcansdale Oct 23, 2018
fe2dcf8
Convert LocalRepositoryModel to GitService tests
jcansdale Oct 23, 2018
683ad50
Move LocalReposotoryModel.Refresh to GitService
jcansdale Oct 23, 2018
59e5652
Remove LocalRepositoryModel.HeadSha property
jcansdale Oct 23, 2018
01d2e46
Remove CreateLocalRepositoryModel overload
jcansdale Oct 23, 2018
7bab478
Read the current branch when model is created
jcansdale Oct 23, 2018
e3f8114
Clean up LocalRepositoryModel
jcansdale Oct 23, 2018
2f13d62
ClonePath -> CloneUri
jcansdale Oct 30, 2018
c61d0f2
Make GitService.Refresh the CurrentBranch
jcansdale Oct 30, 2018
473fa48
Merge branch 'master' into fixes/2007-refactor-repository-models
jcansdale Oct 30, 2018
47430fd
Add workaround for out of date CurrentBranch issue
jcansdale Oct 31, 2018
713d9c4
Refactor to IGitService.CreateCurrentBranchModel
jcansdale Oct 31, 2018
0f59f7e
Make GetPullRequestForCurrentBranch return (tuple)
jcansdale Oct 31, 2018
42d09fa
Avoid firing StatusChanged if we're not on a repo
jcansdale Oct 31, 2018
a47af2b
Suppress "Do not directly await a Task" warning
jcansdale Oct 31, 2018
db41ef9
Get rid of LocalRepositoryModelFactory
jcansdale Oct 31, 2018
06d17e0
Merge branch 'master' into fixes/2007-refactor-repository-models
jcansdale Oct 31, 2018
a4c8386
Rename IGitService.Refresh to RefreshCloneUrl
jcansdale Oct 31, 2018
eb7f1db
Remove repo watching responsibilities from TESH
jcansdale Nov 1, 2018
925279f
Remove obsolete RefreshCloneUrl API
jcansdale Nov 1, 2018
c16c91c
Remove unused logger
jcansdale Nov 1, 2018
5fddfa8
Add xmldocs to ITeamExplorerServiceHolder
jcansdale Nov 1, 2018
2b160f8
Fix error CA2214
jcansdale Nov 1, 2018
bf4c2f9
Remove commented out code
jcansdale Nov 1, 2018
1d92bef
Add comment about when StatusChanged fires
jcansdale Nov 2, 2018
bccfbd0
Rename CreateCurrentBranchModel to GetBranch
jcansdale Nov 2, 2018
b1db91f
Remove IGitService dependency from BranchModel
jcansdale Nov 2, 2018
5765c18
Remove Octokit dependency from BranchModel
jcansdale Nov 2, 2018
9e341e0
Remove IBranch interface from BranchModel
jcansdale Nov 2, 2018
d702536
Remove the interface from RepositoryModel
jcansdale Nov 2, 2018
a1ff038
Correct model file names
jcansdale Nov 2, 2018
e2b74f9
Remove interfaces from Remote/RepositoryModel
jcansdale Nov 5, 2018
ec71110
Fix tests that use repository models
jcansdale Nov 5, 2018
dcbf8d1
Fix tests in PullRequestCreationViewModelTests
jcansdale Nov 5, 2018
c360269
Make PrepareTestData default to return no branches
jcansdale Nov 5, 2018
79af9ae
Remove Octokit.Repository dependency
jcansdale Nov 6, 2018
2ef556b
Clean up *Designer classes
jcansdale Nov 6, 2018
337771d
Merge branch 'master' into refactor/repository-model-part3
grokys Nov 7, 2018
9930758
Return Account.cs to GitHub.App
jcansdale Nov 7, 2018
7dae810
Only refresh Team Explorer when new repo
jcansdale Nov 7, 2018
1ba9d20
Remove unused changed in RepoChanged(bool changed)
jcansdale Nov 7, 2018
17716ef
Refresh NavigationItem visibility on construction
jcansdale Nov 8, 2018
c2a96b4
Remove commented out code
jcansdale Nov 8, 2018
5177f2d
Don't suppress CA2007:Do not directly await a Task
jcansdale Nov 8, 2018
eb47902
Avoid redundant repository change events
jcansdale Nov 8, 2018
0d35867
Merge branch 'master' into refactor/repository-model-part3
jcansdale Nov 8, 2018
ba6278c
Remove unused ITeamExplorerServiceHolder holder
jcansdale Nov 8, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/GitHub.App/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.App.Resources.resources")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String)")]
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String,System.Text.Encoding)")]

// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public SelectPageViewModelDesigner()
public IReadOnlyList<IRepositoryItemViewModel> Items { get; }
public ICollectionView ItemsView { get; }
public IRepositoryItemViewModel SelectedItem { get; set; }
public IRepositoryModel Repository { get; }
public RepositoryModel Repository { get; }

public void Initialize(IConnection connection)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ public ForkRepositoryExecuteViewModelDesigner()

public string Title => null;

public IRepositoryModel SourceRepository { get; set; }
public RepositoryModel SourceRepository { get; set; }

public IRepositoryModel DestinationRepository { get; set; }
public RepositoryModel DestinationRepository { get; set; }

public IAccount DestinationAccount { get; }

Expand All @@ -57,7 +57,7 @@ public ForkRepositoryExecuteViewModelDesigner()

public string Error { get; } = "I AM ERROR";

public Task InitializeAsync(ILocalRepositoryModel sourceRepository, IAccount destinationAccount, IConnection connection)
public Task InitializeAsync(LocalRepositoryModel sourceRepository, IAccount destinationAccount, IConnection connection)
{
return Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public ForkRepositorySelectViewModelDesigner()

public IObservable<object> Done => null;

public IReadOnlyList<IRemoteRepositoryModel> ExistingForks { get; set; }
public IReadOnlyList<RemoteRepositoryModel> ExistingForks { get; set; }

public bool IsLoading { get; set; }

public string Title => null;

public ReactiveCommand<IAccount, Unit> SelectedAccount => null;

public ReactiveCommand<IRemoteRepositoryModel, Unit> SwitchOrigin => null;
public ReactiveCommand<RemoteRepositoryModel, Unit> SwitchOrigin => null;

public Task InitializeAsync(ILocalRepositoryModel repository, IConnection connection)
public Task InitializeAsync(LocalRepositoryModel repository, IConnection connection)
{
return Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public ForkRepositorySwitchViewModelDesigner()

public IObservable<object> Done => null;

public IRepositoryModel SourceRepository { get; }
public RepositoryModel SourceRepository { get; }

public IRepositoryModel DestinationRepository { get; }
public RepositoryModel DestinationRepository { get; }

public ReactiveCommand<Unit, Unit> SwitchFork => null;

Expand All @@ -41,7 +41,7 @@ public ForkRepositorySwitchViewModelDesigner()

public bool UpdateOrigin { get; set; } = true;

public void Initialize(ILocalRepositoryModel sourceRepository, IRemoteRepositoryModel remoteRepository)
public void Initialize(LocalRepositoryModel sourceRepository, RemoteRepositoryModel remoteRepository)
{
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/GitHub.App/SampleData/GitServiceDesigner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using GitHub.Models;
using GitHub.Primitives;
using GitHub.Services;
using LibGit2Sharp;
Expand All @@ -7,6 +8,8 @@ namespace GitHub.SampleData
{
class GitServiceDesigner : IGitService
{
public LocalRepositoryModel CreateLocalRepositoryModel(string localPath) => null;
public BranchModel GetBranch(LocalRepositoryModel model) => null;
public Task<string> GetLatestPushedSha(string path, string remote = "origin") => Task.FromResult<string>(null);
public UriString GetRemoteUri(IRepository repo, string remote = "origin") => null;
public IRepository GetRepository(string path) => null;
Expand Down
39 changes: 8 additions & 31 deletions src/GitHub.App/SampleData/LocalRepositoryModelDesigner.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,16 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using GitHub.Models;
using GitHub.Models;
using GitHub.Primitives;
using GitHub.UI;
using GitHub.Exports;

namespace GitHub.App.SampleData
{
public class LocalRepositoryModelDesigner : ILocalRepositoryModel
public class LocalRepositoryModelDesigner : LocalRepositoryModel
{
public UriString CloneUrl { get; set; }
public IBranch CurrentBranch { get; set; }
public Octicon Icon { get; set; }
public string LocalPath { get; set; }
public string Name { get; set; }
public string Owner { get; set; }

#pragma warning disable CS0067
public event PropertyChangedEventHandler PropertyChanged;
#pragma warning restore CS0067

public Task<UriString> GenerateUrl(LinkType linkType, string path = null, int startLine = -1, int endLine = -1)
{
throw new NotImplementedException();
}

public void Refresh()
{
throw new NotImplementedException();
}

public void SetIcon(bool isPrivate, bool isFork)
{
throw new NotImplementedException();
}
public new UriString CloneUrl { get; set; }
public BranchModel CurrentBranch { get; set; }
public new Octicon Icon { get; set; }
public new string LocalPath { get; set; }
public new string Name { get; set; }
public new string Owner { get; set; }
}
}
26 changes: 16 additions & 10 deletions src/GitHub.App/SampleData/PullRequestCreationViewModelDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ public class PullRequestCreationViewModelDesigner : PanePageViewModelBase, IPull
{
public PullRequestCreationViewModelDesigner()
{
Branches = new List<IBranch>
var repositoryModel = new LocalRepositoryModel
{
new BranchModel("master", new LocalRepositoryModel("http://github.com/user/repo", new GitServiceDesigner())),
new BranchModel("don/stub-ui", new LocalRepositoryModel("http://github.com/user/repo", new GitServiceDesigner())),
new BranchModel("feature/pr/views", new LocalRepositoryModel("http://github.com/user/repo", new GitServiceDesigner())),
new BranchModel("release-1.0.17.0", new LocalRepositoryModel("http://github.com/user/repo", new GitServiceDesigner())),
Name = "repo",
CloneUrl = "http://github.com/user/repo"
};

Branches = new List<BranchModel>
{
new BranchModel("master", repositoryModel),
new BranchModel("don/stub-ui", repositoryModel),
new BranchModel("feature/pr/views", repositoryModel),
new BranchModel("release-1.0.17.0", repositoryModel),
}.AsReadOnly();

TargetBranch = new BranchModel("master", new LocalRepositoryModel("http://github.com/user/repo", new GitServiceDesigner()));
TargetBranch = new BranchModel("master", repositoryModel);
SourceBranch = Branches[2];

SelectedAssignee = "Haacked (Phil Haack)";
Expand All @@ -34,9 +40,9 @@ public PullRequestCreationViewModelDesigner()
};
}

public IBranch SourceBranch { get; set; }
public IBranch TargetBranch { get; set; }
public IReadOnlyList<IBranch> Branches { get; set; }
public BranchModel SourceBranch { get; set; }
public BranchModel TargetBranch { get; set; }
public IReadOnlyList<BranchModel> Branches { get; set; }

public string SelectedAssignee { get; set; }
public List<string> Users { get; set; }
Expand All @@ -50,6 +56,6 @@ public PullRequestCreationViewModelDesigner()

public ReactivePropertyValidator BranchValidator { get; }

public Task InitializeAsync(ILocalRepositoryModel repository, IConnection connection) => Task.CompletedTask;
public Task InitializeAsync(LocalRepositoryModel repository, IConnection connection) => Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public PullRequestDetailViewModelDesigner()

public PullRequestDetailModel Model { get; }
public IPullRequestSession Session { get; }
public ILocalRepositoryModel LocalRepository { get; }
public LocalRepositoryModel LocalRepository { get; }
public string RemoteRepositoryOwner { get; }
public int Number { get; set; }
public IActorViewModel Author { get; set; }
Expand All @@ -127,7 +127,7 @@ public PullRequestDetailViewModelDesigner()

public IReadOnlyList<IPullRequestCheckViewModel> Checks { get; }

public Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner, string repo, int number) => Task.CompletedTask;
public Task InitializeAsync(LocalRepositoryModel localRepository, IConnection connection, string owner, string repo, int number) => Task.CompletedTask;

public string GetLocalFilePath(IPullRequestFileNode file)
{
Expand Down
8 changes: 4 additions & 4 deletions src/GitHub.App/SampleData/PullRequestListViewModelDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ public PullRequestListViewModelDesigner()
public IUserFilterViewModel AuthorFilter { get; set; }
public IReadOnlyList<IIssueListItemViewModelBase> Items { get; }
public ICollectionView ItemsView { get; }
public ILocalRepositoryModel LocalRepository { get; set; }
public LocalRepositoryModel LocalRepository { get; set; }
public IssueListMessage Message { get; set; }
public IRepositoryModel RemoteRepository { get; set; }
public IReadOnlyList<IRepositoryModel> Forks { get; }
public RepositoryModel RemoteRepository { get; set; }
public IReadOnlyList<RepositoryModel> Forks { get; }
public string SearchQuery { get; set; }
public string SelectedState { get; set; }
public string StateCaption { get; set; }
Expand All @@ -66,6 +66,6 @@ public PullRequestListViewModelDesigner()
public ReactiveCommand<IIssueListItemViewModelBase, Unit> OpenItem { get; }
public ReactiveCommand<IPullRequestListItemViewModel, IPullRequestListItemViewModel> OpenItemInBrowser { get; }

public Task InitializeAsync(ILocalRepositoryModel repository, IConnection connection) => Task.CompletedTask;
public Task InitializeAsync(LocalRepositoryModel repository, IConnection connection) => Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public PullRequestReviewAuthoringViewModelDesigner()
public bool CanApproveRequestChanges { get; set; }
public IReadOnlyList<IPullRequestReviewFileCommentViewModel> FileComments { get; }
public IPullRequestFilesViewModel Files { get; }
public ILocalRepositoryModel LocalRepository { get; set; }
public LocalRepositoryModel LocalRepository { get; set; }
public PullRequestReviewModel Model { get; set; }
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; }
public string OperationError { get; set; }
Expand All @@ -55,7 +55,7 @@ public PullRequestReviewAuthoringViewModelDesigner()
public ReactiveCommand<Unit, Unit> Cancel { get; }

public Task InitializeAsync(
ILocalRepositoryModel localRepository,
LocalRepositoryModel localRepository,
IConnection connection,
string owner,
string repo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public PullRequestReviewViewModelDesigner()
public IReadOnlyList<IPullRequestReviewFileCommentViewModel> FileComments { get; set; }
public bool IsExpanded { get; set; }
public bool HasDetails { get; set; }
public ILocalRepositoryModel LocalRepository { get; set; }
public LocalRepositoryModel LocalRepository { get; set; }
public PullRequestReviewModel Model { get; set; }
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; }
public IReadOnlyList<IPullRequestReviewFileCommentViewModel> OutdatedFileComments { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ public PullRequestUserReviewsViewModelDesigner()
};
}

public ILocalRepositoryModel LocalRepository { get; set; }
public LocalRepositoryModel LocalRepository { get; set; }
public string RemoteRepositoryOwner { get; set; }
public int PullRequestNumber { get; set; }
public IActorViewModel User { get; set; }
public IReadOnlyList<IPullRequestReviewViewModel> Reviews { get; set; }
public string PullRequestTitle { get; set; }
public ReactiveCommand<Unit, Unit> NavigateToPullRequest { get; }

public Task InitializeAsync(ILocalRepositoryModel localRepository, IConnection connection, string owner, string repo, int pullRequestNumber, string login)
public Task InitializeAsync(LocalRepositoryModel localRepository, IConnection connection, string owner, string repo, int pullRequestNumber, string login)
{
return Task.CompletedTask;
}
Expand Down
43 changes: 12 additions & 31 deletions src/GitHub.App/SampleData/RemoteRepositoryModelDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,18 @@
namespace GitHub.SampleData
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1036:OverrideMethodsOnComparableTypes")]
public class RemoteRepositoryModelDesigner : IRemoteRepositoryModel
public class RemoteRepositoryModelDesigner : RemoteRepositoryModel
{
public UriString CloneUrl { get; set; }
public DateTimeOffset CreatedAt { get; set; }
public IBranch DefaultBranch { get; set; }
public Octicon Icon { get; set; }
public long Id { get; set; }
public bool IsFork { get; set; }
public string Name { get; set; }
public string Owner { get; set; }
public IAccount OwnerAccount { get; set; }
public IRemoteRepositoryModel Parent { get; set; }
public DateTimeOffset UpdatedAt { get; set; }

public int CompareTo(IRemoteRepositoryModel other)
{
return 0;
}

public void CopyFrom(IRemoteRepositoryModel other)
{
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
public bool Equals(IRemoteRepositoryModel other)
{
return false;
}

public void SetIcon(bool isPrivate, bool isFork)
{
}
public new UriString CloneUrl { get; set; }
public new DateTimeOffset CreatedAt { get; set; }
public new BranchModel DefaultBranch { get; set; }
public new Octicon Icon { get; set; }
public new long Id { get; set; }
public new bool IsFork { get; set; }
public new string Name { get; set; }
public new string Owner { get; set; }
public new IAccount OwnerAccount { get; set; }
public new RemoteRepositoryModel Parent { get; set; }
public new DateTimeOffset UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RepositoryRecloneViewModelDesigner : ViewModelBase, IRepositoryRecl
public ReactivePropertyValidator<string> BaseRepositoryPathValidator { get; }
public ICommand BrowseForDirectory { get; }
public ReactiveCommand<Unit, Unit> CloneCommand { get; }
public IRepositoryModel SelectedRepository { get; set; }
public RepositoryModel SelectedRepository { get; set; }
public IObservable<object> Done { get; }

public Task InitializeAsync(IConnection connection) => Task.CompletedTask;
Expand Down
2 changes: 1 addition & 1 deletion src/GitHub.App/SampleData/SampleViewModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public IConnection SelectedConnection
[ExcludeFromCodeCoverage]
public static class RepositoryModelDesigner
{
public static IRemoteRepositoryModel Create(string name = null, string owner = null)
public static RemoteRepositoryModel Create(string name = null, string owner = null)
{
name = name ?? "octocat";
owner = owner ?? "github";
Expand Down
4 changes: 2 additions & 2 deletions src/GitHub.App/Services/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task<CloneDialogResult> ShowCloneDialog(IConnection connection, str
}
}

public async Task<string> ShowReCloneDialog(IRepositoryModel repository)
public async Task<string> ShowReCloneDialog(RepositoryModel repository)
{
Guard.ArgumentNotNull(repository, nameof(repository));

Expand Down Expand Up @@ -91,7 +91,7 @@ public async Task<IConnection> ShowLoginDialog()
return (IConnection)await showDialog.Show(viewModel);
}

public async Task ShowForkDialog(ILocalRepositoryModel repository, IConnection connection)
public async Task ShowForkDialog(LocalRepositoryModel repository, IConnection connection)
{
Guard.ArgumentNotNull(repository, nameof(repository));
Guard.ArgumentNotNull(connection, nameof(connection));
Expand Down
Loading