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

Commit bccfbd0

Browse files
committed
Rename CreateCurrentBranchModel to GetBranch
1 parent 1d92bef commit bccfbd0

File tree

10 files changed

+11
-11
lines changed

10 files changed

+11
-11
lines changed

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 CreateCurrentBranchModel(ILocalRepositoryModel model) => null;
12+
public IBranch 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/ViewModels/GitHubPane/PullRequestCreationViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public async Task InitializeAsync(ILocalRepositoryModel repository, IConnection
142142
{
143143
modelService = await modelServiceFactory.CreateAsync(connection);
144144
activeLocalRepo = repository;
145-
SourceBranch = gitService.CreateCurrentBranchModel(repository);
145+
SourceBranch = gitService.GetBranch(repository);
146146

147147
var obs = modelService.ApiClient.GetRepository(repository.Owner, repository.Name)
148148
.Select(r => new RemoteRepositoryModel(r))
@@ -212,7 +212,7 @@ async Task LoadInitialState(string draftKey)
212212

213213
void LoadDescriptionFromCommits()
214214
{
215-
SourceBranch = gitService.CreateCurrentBranchModel(activeLocalRepo);
215+
SourceBranch = gitService.GetBranch(activeLocalRepo);
216216

217217
var uniqueCommits = this.WhenAnyValue(
218218
x => x.SourceBranch,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public async Task Load(PullRequestDetailModel pullRequest)
405405

406406
var localBranches = await pullRequestsService.GetLocalBranches(LocalRepository, pullRequest).ToList();
407407

408-
var currentBranch = gitService.CreateCurrentBranchModel(LocalRepository);
408+
var currentBranch = gitService.GetBranch(LocalRepository);
409409
IsCheckedOut = localBranches.Contains(currentBranch);
410410

411411
if (IsCheckedOut)

src/GitHub.Exports/Services/GitService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public ILocalRepositoryModel CreateLocalRepositoryModel(string localPath)
5252
return model;
5353
}
5454

55-
public IBranch CreateCurrentBranchModel(ILocalRepositoryModel model)
55+
public IBranch GetBranch(ILocalRepositoryModel model)
5656
{
5757
var localPath = model.LocalPath;
5858
using (var repo = GetRepository(localPath))

src/GitHub.Exports/Services/IGitService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface IGitService
1919
/// </summary>
2020
/// <param name="model">The <see cref="ILocalRepositoryModel" /> to create a current branch model for.</param>
2121
/// <returns>A new branch model.</returns>
22-
IBranch CreateCurrentBranchModel(ILocalRepositoryModel model);
22+
IBranch GetBranch(ILocalRepositoryModel model);
2323

2424
/// <summary>
2525
/// Returns the URL of the remote for the specified <see cref="repository"/>. If the repository

src/GitHub.VisualStudio/Commands/OpenFromClipboardCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public override async Task Execute(string url)
9999
if (hasChanges)
100100
{
101101
// TODO: What if this returns null because we're not on a branch?
102-
var currentBranch = gitService.Value.CreateCurrentBranchModel(activeRepository);
102+
var currentBranch = gitService.Value.GetBranch(activeRepository);
103103
var branchName = currentBranch.Name;
104104

105105
// AnnotateFile expects a branch name so we use the current branch

test/GitHub.App.UnitTests/ViewModels/GitHubPane/PullRequestCreationViewModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static TestData PrepareTestData(
9797
var targetRepo = targetRepoOwner == sourceRepoOwner ? sourceRepo : sourceRepo.Parent;
9898
var targetBranch = targetBranchName != targetRepo.DefaultBranch.Name ? new BranchModel(targetBranchName, targetRepo) : targetRepo.DefaultBranch;
9999

100-
gitService.CreateCurrentBranchModel(activeRepo).Returns(sourceBranch);
100+
gitService.GetBranch(activeRepo).Returns(sourceBranch);
101101
api.GetRepository(Args.String, Args.String).Returns(Observable.Return(githubRepo));
102102
ms.ApiClient.Returns(api);
103103

test/GitHub.App.UnitTests/ViewModels/GitHubPane/PullRequestDetailViewModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static Tuple<PullRequestDetailViewModel, IPullRequestService> CreateTargetAndSer
553553
var repository = Substitute.For<ILocalRepositoryModel>();
554554
var currentBranchModel = new BranchModel(currentBranch, repository);
555555
var gitService = Substitute.For<IGitService>();
556-
gitService.CreateCurrentBranchModel(repository).Returns(currentBranchModel);
556+
gitService.GetBranch(repository).Returns(currentBranchModel);
557557
repository.CloneUrl.Returns(new UriString(Uri.ToString()));
558558
repository.LocalPath.Returns(@"C:\projects\ThisRepo");
559559
repository.Name.Returns("repo");

test/GitHub.TeamFoundation.UnitTests/VSGitExtTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public ILocalRepositoryModel CreateLocalRepositoryModel(string localPath)
311311
return result;
312312
}
313313

314-
public IBranch CreateCurrentBranchModel(ILocalRepositoryModel model) => throw new NotImplementedException();
314+
public IBranch GetBranch(ILocalRepositoryModel model) => throw new NotImplementedException();
315315
public Task<string> GetLatestPushedSha(string path, string remote = "origin") => throw new NotImplementedException();
316316
public UriString GetRemoteUri(IRepository repo, string remote = "origin") => throw new NotImplementedException();
317317
public IRepository GetRepository(string path) => throw new NotImplementedException();

test/GitHub.VisualStudio.UnitTests/Commands/OpenFromClipboardCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static OpenFromClipboardCommand CreateOpenFromClipboardCommand(
197197
var gitService = Substitute.For<IGitService>();
198198
var currentBranch = Substitute.For<IBranch>();
199199
currentBranch.Name.Returns(currentBranchName);
200-
gitService.CreateCurrentBranchModel(activeRepository).Returns(currentBranch);
200+
gitService.GetBranch(activeRepository).Returns(currentBranch);
201201
if (resolveBlobResult != null)
202202
{
203203
gitHubContextService.ResolveBlob(repositoryDir, contextFromClipboard).Returns(resolveBlobResult.Value);

0 commit comments

Comments
 (0)