Skip to content

Commit

Permalink
Rename "Atlassian Stash" to Bitbucket
Browse files Browse the repository at this point in the history
No functionality change
gitextensions#3334 updated the diplayname. Stash was still used within the code and in filenames. This was confusing both to work with "Git stashes" and Bitbucket.
Handled in gitextensions#4204
  • Loading branch information
gerhardol committed Dec 9, 2017
1 parent a622a8f commit 2b9b2ee
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 118 deletions.
5 changes: 4 additions & 1 deletion GitExtensions.VS2015.sln
Expand Up @@ -102,7 +102,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Git.hub", "Externals\Git.hu
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBug", "Externals\NBug\NBug\NBug.csproj", "{62CED1D5-F603-40DE-8BF5-3E49D3A392F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stash", "Plugins\Stash\Stash.csproj", "{50AEAB6C-83C4-45F8-AA01-90E1405C48AF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitbucket", "Plugins\Stash\Bitbucket.csproj", "{50AEAB6C-83C4-45F8-AA01-90E1405C48AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JenkinsIntegration", "Plugins\BuildServerIntegration\JenkinsIntegration\JenkinsIntegration.csproj", "{E6AAC693-815B-4D1A-83D7-F4DE36072793}"
EndProject
Expand Down Expand Up @@ -705,4 +705,7 @@ Global
{93CE3A27-5A63-4436-8C64-CBCA75322C5B} = {020F800B-9170-4BB3-83C9-FCF83596D83C}
{626CA9EB-DB83-4BEB-87D5-15E3B397EF57} = {3D5CA0E0-EF51-4488-A8B7-86CC330D7AD8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ECECB7EA-BCCF-44AD-B63E-C2FA45589FB0}
EndGlobalSection
EndGlobal
7 changes: 2 additions & 5 deletions GitExtensions/GitExtensions.csproj
Expand Up @@ -162,9 +162,9 @@
<Name>ReleaseNotesGenerator</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Plugins\Stash\Stash.csproj">
<ProjectReference Include="..\Plugins\Stash\Bitbucket.csproj">
<Project>{50AEAB6C-83C4-45F8-AA01-90E1405C48AF}</Project>
<Name>Stash</Name>
<Name>Bitbucket</Name>
</ProjectReference>
<ProjectReference Include="..\Plugins\Statistics\GitImpact\GitImpact.csproj">
<Project>{0B131F9D-BB10-4C3E-9656-5AB858158DE5}</Project>
Expand Down Expand Up @@ -232,18 +232,15 @@
<PluginBinary Include="..\Plugins\*\bin\$(Configuration)\*.dll" />
<PluginBinary Include="..\Plugins\Statistics\*\bin\$(Configuration)\*.dll" />
<PluginBinary Include="..\Plugins\BuildServerIntegration\*\bin\$(Configuration)\*.dll" />

<!-- Plugin symbols-->
<PluginBinary Include="..\Plugins\*\bin\$(Configuration)\*.pdb" />
<PluginBinary Include="..\Plugins\Statistics\*\bin\$(Configuration)\*.pdb" />
<PluginBinary Include="..\Plugins\BuildServerIntegration\*\bin\$(Configuration)\*.pdb" />

<!-- Plugin satellite assemblies -->
<PluginSatelliteBinary Include="..\Plugins\*\bin\$(Configuration)\*\*.dll" />
<PluginSatelliteBinary Include="..\Plugins\Statistics\*\bin\$(Configuration)\*\*.dll" />
<PluginSatelliteBinary Include="..\Plugins\BuildServerIntegration\*\bin\$(Configuration)\*\*.dll" />
</ItemGroup>

<ItemGroup>
<None Include="@(PluginBinary)" Exclude="..\Plugins\**\Microsoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll;..\Plugins\**\Microsoft.WITDataStore.dll">
<Link>Plugins\%(Filename)%(Extension)</Link>
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Stash/ApprovePullRequest.cs
Expand Up @@ -2,9 +2,9 @@
using Newtonsoft.Json.Linq;
using RestSharp;

namespace Stash
namespace Bitbucket
{
class ApprovePullRequest : StashRequestBase<JObject>
class ApprovePullRequest : BitbucketRequestBase<JObject>
{
private readonly MergeRequestInfo _info;

Expand Down
14 changes: 7 additions & 7 deletions Plugins/Stash/Stash.csproj → Plugins/Stash/Bitbucket.csproj
Expand Up @@ -64,16 +64,16 @@
<Compile Include="GetRelatedRepoRequest.cs" />
<Compile Include="GetRepoRequest.cs" />
<Compile Include="GetUserRequest.cs" />
<Compile Include="StashPlugin.cs" />
<Compile Include="BitbucketPlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
<Compile Include="StashPullRequestForm.cs">
<Compile Include="BitbucketPullRequestForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="StashPullRequestForm.Designer.cs">
<DependentUpon>StashPullRequestForm.cs</DependentUpon>
<Compile Include="BitbucketPullRequestForm.Designer.cs">
<DependentUpon>BitbucketPullRequestForm.cs</DependentUpon>
</Compile>
<Compile Include="StashRequestBase.cs" />
<Compile Include="BitbucketRequestBase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\GitCommands\GitCommands.csproj">
Expand All @@ -98,8 +98,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="StashPullRequestForm.resx">
<DependentUpon>StashPullRequestForm.cs</DependentUpon>
<EmbeddedResource Include="BitbucketPullRequestForm.resx">
<DependentUpon>BitbucketPullRequestForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions Plugins/Stash/BitbucketPlugin.cs
@@ -0,0 +1,35 @@
using System.Windows.Forms;
using GitUIPluginInterfaces;
using ResourceManager;

namespace Bitbucket
{
public class BitbucketPlugin : GitPluginBase
{
public readonly StringSetting BitbucketUsername = new StringSetting("Bitbucket Username", string.Empty);
public readonly PasswordSetting BitbucketPassword = new PasswordSetting("Bitbucket Password", string.Empty);
public readonly StringSetting BitbucketBaseUrl = new StringSetting("Specify the base URL to Bitbucket", "https://example.bitbucket.com");
public readonly BoolSetting BitbucketDisableSsl = new BoolSetting("Disable SSL verification", false);

public BitbucketPlugin()
{
SetNameAndDescription("Create Bitbucket Pull Request");
Translate();
}

public override bool Execute(GitUIBaseEventArgs gitUiCommands)
{
using (var frm = new BitbucketPullRequestForm(this, base.Settings, gitUiCommands))
frm.ShowDialog(gitUiCommands.OwnerForm);
return true;
}

public override System.Collections.Generic.IEnumerable<ISetting> GetSettings()
{
yield return BitbucketUsername;
yield return BitbucketPassword;
yield return BitbucketBaseUrl;
yield return BitbucketDisableSsl;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -8,24 +8,24 @@
using System.Threading;
using ResourceManager;

namespace Stash
namespace Bitbucket
{
public partial class StashPullRequestForm : GitExtensionsFormBase
public partial class BitbucketPullRequestForm : GitExtensionsFormBase
{
private readonly TranslationString _yourRepositoryIsNotInStash = new TranslationString("Your repository is not hosted in Bitbucket.");
private readonly TranslationString _yourRepositoryIsNotInBitbucket = new TranslationString("Your repository is not hosted in Bitbucket.");
private readonly TranslationString _commited = new TranslationString("{0} committed\n{1}");
private readonly TranslationString _success = new TranslationString("Success");
private readonly TranslationString _error = new TranslationString("Error");

private Settings _settings;
private readonly StashPlugin _plugin;
private readonly BitbucketPlugin _plugin;
private readonly GitUIBaseEventArgs _gitUiCommands;
private readonly ISettingsSource _settingsContainer;
private readonly BindingList<StashUser> _reviewers = new BindingList<StashUser>();
private readonly List<string> _stashUsers = new List<string>();
private readonly BindingList<BitbucketUser> _reviewers = new BindingList<BitbucketUser>();
private readonly List<string> _bitbucketUsers = new List<string>();


public StashPullRequestForm(StashPlugin plugin, ISettingsSource settings, GitUIBaseEventArgs gitUiCommands)
public BitbucketPullRequestForm(BitbucketPlugin plugin, ISettingsSource settings, GitUIBaseEventArgs gitUiCommands)
{
InitializeComponent();
Translate();
Expand All @@ -35,16 +35,16 @@ public StashPullRequestForm(StashPlugin plugin, ISettingsSource settings, GitUIB
_gitUiCommands = gitUiCommands;
}

private void StashPullRequestFormLoad(object sender, EventArgs e)
private void BitbucketPullRequestFormLoad(object sender, EventArgs e)
{
_settings = Settings.Parse(_gitUiCommands.GitModule, _settingsContainer, _plugin);
if (_settings == null)
{
MessageBox.Show(_yourRepositoryIsNotInStash.Text);
MessageBox.Show(_yourRepositoryIsNotInBitbucket.Text);
Close();
return;
}
//_stashUsers.AddRange(GetStashUsers().Select(a => a.Slug));
//_bitbucketUsers.AddRange(GetBitbucketUsers().Select(a => a.Slug));
ThreadPool.QueueUserWorkItem(state =>
{
var repositories = GetRepositories();
Expand All @@ -64,7 +64,7 @@ private void StashPullRequestFormLoad(object sender, EventArgs e)
});
}

private void StashViewPullRequestFormLoad(object sender, EventArgs e)
private void BitbucketViewPullRequestFormLoad(object sender, EventArgs e)
{
if (_settings == null)
return;
Expand Down Expand Up @@ -131,29 +131,29 @@ private void BtnCreateClick(object sender, EventArgs e)
if (response.Success)
{
MessageBox.Show(_success.Text);
StashViewPullRequestFormLoad(null, null);
BitbucketViewPullRequestFormLoad(null, null);
}
else
MessageBox.Show(string.Join(Environment.NewLine, response.Messages),
_error.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}

private IEnumerable<StashUser> GetStashUsers()
private IEnumerable<BitbucketUser> GetBitbucketUsers()
{
var list = new List<StashUser>();
var list = new List<BitbucketUser>();
var getUser = new GetUserRequest(_settings);
var result = getUser.Send();
if (result.Success)
{
foreach (var value in result.Result["values"])
{
list.Add(new StashUser { Slug = value["slug"].ToString() });
list.Add(new BitbucketUser { Slug = value["slug"].ToString() });
}
}
return list;
}
Dictionary<Repository, IEnumerable<string>> Branches = new Dictionary<Repository,IEnumerable<string>>();
private IEnumerable<string> GetStashBranches(Repository selectedRepo)
private IEnumerable<string> GetBitbucketBranches(Repository selectedRepo)
{
if (Branches.ContainsKey(selectedRepo))
{
Expand Down Expand Up @@ -181,7 +181,7 @@ private void ReviewersDataGridEditingControlShowing(object sender, DataGridViewE
cellEdit.AutoCompleteCustomSource = new AutoCompleteStringCollection();
cellEdit.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cellEdit.AutoCompleteSource = AutoCompleteSource.CustomSource;
cellEdit.AutoCompleteCustomSource.AddRange(_stashUsers.ToArray());
cellEdit.AutoCompleteCustomSource.AddRange(_bitbucketUsers.ToArray());
}
}

Expand All @@ -197,7 +197,7 @@ private void DdlRepositoryTargetSelectedValueChanged(object sender, EventArgs e)

private void RefreshDDLBranch(ComboBox comboBox, object selectedValue)
{
List<string> lsNames = (GetStashBranches((Repository)selectedValue)).ToList();
List<string> lsNames = (GetBitbucketBranches((Repository)selectedValue)).ToList();
lsNames.Sort();
lsNames.Insert(0, "");
comboBox.DataSource = lsNames;
Expand Down Expand Up @@ -304,7 +304,7 @@ private void BtnMergeClick(object sender, EventArgs e)
if (response.Success)
{
MessageBox.Show(_success.Text);
StashViewPullRequestFormLoad(null, null);
BitbucketViewPullRequestFormLoad(null, null);
}
else
MessageBox.Show(string.Join(Environment.NewLine, response.Messages),
Expand All @@ -327,7 +327,7 @@ private void BtnApproveClick(object sender, EventArgs e)
if (response.Success)
{
MessageBox.Show(_success.Text);
StashViewPullRequestFormLoad(null, null);
BitbucketViewPullRequestFormLoad(null, null);
}
else
MessageBox.Show(string.Join(Environment.NewLine, response.Messages),
Expand Down
File renamed without changes.
Expand Up @@ -8,25 +8,25 @@
using System.Windows.Forms;
using RestSharp.Authenticators;

namespace Stash
namespace Bitbucket
{
class StashResponse<T>
class BitbucketResponse<T>
{
public bool Success { get; set; }
public IEnumerable<string> Messages { get; set; }
public T Result { get; set; }
}

abstract class StashRequestBase<T>
abstract class BitbucketRequestBase<T>
{
protected Settings Settings { get; private set; }

protected StashRequestBase(Settings settings)
protected BitbucketRequestBase(Settings settings)
{
Settings = settings;
}

public StashResponse<T> Send()
public BitbucketResponse<T> Send()
{
if (Settings.DisableSSL)
{
Expand All @@ -35,7 +35,7 @@ public StashResponse<T> Send()
}
var client = new RestClient
{
BaseUrl = new System.Uri(Settings.StashUrl),
BaseUrl = new System.Uri(Settings.BitbucketUrl),
Authenticator = new HttpBasicAuthenticator(Settings.Username, Settings.Password)
};

Expand All @@ -50,7 +50,7 @@ public StashResponse<T> Send()

var response = client.Execute(request);
if (response.ResponseStatus != ResponseStatus.Completed)
return new StashResponse<T>
return new BitbucketResponse<T>
{
Success = false,
Messages = new[] {response.ErrorMessage}
Expand All @@ -61,7 +61,7 @@ public StashResponse<T> Send()
return ParseErrorResponse(response.Content);
}

return new StashResponse<T>
return new BitbucketResponse<T>
{
Success = true,
Result = ParseResponse(JObject.Parse(response.Content))
Expand All @@ -73,7 +73,7 @@ public StashResponse<T> Send()
protected abstract string ApiUrl { get; }
protected abstract T ParseResponse(JObject json);

private static StashResponse<T> ParseErrorResponse(string jsonString)
private static BitbucketResponse<T> ParseErrorResponse(string jsonString)
{
var json = new JObject();
try
Expand All @@ -84,13 +84,13 @@ private static StashResponse<T> ParseErrorResponse(string jsonString)
catch (JsonReaderException)
{
MessageBox.Show(jsonString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
var errorResponse = new StashResponse<T> { Success = false };
var errorResponse = new BitbucketResponse<T> { Success = false };
return errorResponse;
}
if (json["errors"] != null)
{
var messages = new List<string>();
var errorResponse = new StashResponse<T> {Success = false};
var errorResponse = new BitbucketResponse<T> {Success = false};
foreach (var error in json["errors"])
{
var sb = new StringBuilder();
Expand All @@ -111,9 +111,9 @@ private static StashResponse<T> ParseErrorResponse(string jsonString)
}
if (json["message"] != null)
{
return new StashResponse<T> {Success = false, Messages = new[] {json["message"].ToString()}};
return new BitbucketResponse<T> {Success = false, Messages = new[] {json["message"].ToString()}};
}
return new StashResponse<T> {Success = false, Messages = new[] {"Unknown error."}};
return new BitbucketResponse<T> {Success = false, Messages = new[] {"Unknown error."}};
}

}
Expand Down

0 comments on commit 2b9b2ee

Please sign in to comment.