diff --git a/TGit/Commands/ContextMenuCommands.cs b/TGit/Commands/ContextMenuCommands.cs index 31645d0..1f681fd 100644 --- a/TGit/Commands/ContextMenuCommands.cs +++ b/TGit/Commands/ContextMenuCommands.cs @@ -3,38 +3,39 @@ using System; using System.IO; using System.Windows.Forms; +using Microsoft.VisualStudio.Shell; namespace SamirBoulema.TGit.Commands { public class ContextMenuCommands { - private readonly CommandHelper _commandHelper; private readonly DTE _dte; private readonly OptionPageGrid _generalOptions; + private readonly OleMenuCommandService _mcs; - public ContextMenuCommands(CommandHelper commandHelper, DTE dte, OptionPageGrid generalOptions) + public ContextMenuCommands(OleMenuCommandService mcs, DTE dte, OptionPageGrid generalOptions) { - _commandHelper = commandHelper; _dte = dte; + _mcs = mcs; _generalOptions = generalOptions; } public void AddCommands() { - _commandHelper.AddCommand(ShowLogContextCommand, PkgCmdIDList.ShowLogContext); - _commandHelper.AddCommand(DiskBrowserContextCommand, PkgCmdIDList.DiskBrowserContext); - _commandHelper.AddCommand(RepoBrowserContextCommand, PkgCmdIDList.RepoBrowserContext); + CommandHelper.AddCommand(_mcs, ShowLogContextCommand, PkgCmdIDList.ShowLogContext); + CommandHelper.AddCommand(_mcs, DiskBrowserContextCommand, PkgCmdIDList.DiskBrowserContext); + CommandHelper.AddCommand(_mcs, RepoBrowserContextCommand, PkgCmdIDList.RepoBrowserContext); - _commandHelper.AddCommand(BlameContextCommand, PkgCmdIDList.BlameContext); + CommandHelper.AddCommand(_mcs, BlameContextCommand, PkgCmdIDList.BlameContext); - _commandHelper.AddCommand(MergeContextCommand, PkgCmdIDList.MergeContext); + CommandHelper.AddCommand(_mcs, MergeContextCommand, PkgCmdIDList.MergeContext); - _commandHelper.AddCommand(PullContextCommand, PkgCmdIDList.PullContext); - _commandHelper.AddCommand(FetchContextCommand, PkgCmdIDList.FetchContext); - _commandHelper.AddCommand(CommitContextCommand, PkgCmdIDList.CommitContext); - _commandHelper.AddCommand(RevertContextCommand, PkgCmdIDList.RevertContext); - _commandHelper.AddCommand(DiffContextCommand, PkgCmdIDList.DiffContext); - _commandHelper.AddCommand(PrefDiffContextCommand, PkgCmdIDList.PrefDiffContext); + CommandHelper.AddCommand(_mcs, PullContextCommand, PkgCmdIDList.PullContext); + CommandHelper.AddCommand(_mcs, FetchContextCommand, PkgCmdIDList.FetchContext); + CommandHelper.AddCommand(_mcs, CommitContextCommand, PkgCmdIDList.CommitContext); + CommandHelper.AddCommand(_mcs, RevertContextCommand, PkgCmdIDList.RevertContext); + CommandHelper.AddCommand(_mcs, DiffContextCommand, PkgCmdIDList.DiffContext); + CommandHelper.AddCommand(_mcs, PrefDiffContextCommand, PkgCmdIDList.PrefDiffContext); } private void ShowLogContextCommand(object sender, EventArgs e) diff --git a/TGit/Commands/GitFlowMenuCommands.cs b/TGit/Commands/GitFlowMenuCommands.cs index aa41be9..1567e60 100644 --- a/TGit/Commands/GitFlowMenuCommands.cs +++ b/TGit/Commands/GitFlowMenuCommands.cs @@ -3,19 +3,18 @@ using System; using System.IO; using System.Windows.Forms; +using Microsoft.VisualStudio.Shell; namespace SamirBoulema.TGit.Commands { public class GitFlowMenuCommands { - private readonly CommandHelper _commandHelper; - private readonly string _gitBin; private readonly OptionPageGrid _options; + private readonly OleMenuCommandService _mcs; - public GitFlowMenuCommands(CommandHelper commandHelper, OptionPageGrid options) + public GitFlowMenuCommands(OleMenuCommandService mcs, OptionPageGrid options) { - _commandHelper = commandHelper; - _gitBin = FileHelper.GetMSysGit(); + _mcs = mcs; _options = options; } @@ -23,71 +22,72 @@ public void AddCommands() { //GitFlow Commands //Start/Finish Feature - var startFeature = _commandHelper.CreateCommand(StartFeatureCommand, PkgCmdIDList.StartFeature); - startFeature.BeforeQueryStatus += _commandHelper.GitFlow_BeforeQueryStatus; - _commandHelper.AddCommand(startFeature); + var startFeature = CommandHelper.CreateCommand(StartFeatureCommand, PkgCmdIDList.StartFeature); + startFeature.BeforeQueryStatus += CommandHelper.GitFlow_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, startFeature); - var finishFeature = _commandHelper.CreateCommand(FinishFeatureCommand, PkgCmdIDList.FinishFeature); - finishFeature.BeforeQueryStatus += _commandHelper.Feature_BeforeQueryStatus; - _commandHelper.AddCommand(finishFeature); + var finishFeature = CommandHelper.CreateCommand(FinishFeatureCommand, PkgCmdIDList.FinishFeature); + finishFeature.BeforeQueryStatus += CommandHelper.Feature_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, finishFeature); //Start/Finish Release - var startRelease = _commandHelper.CreateCommand(StartReleaseCommand, PkgCmdIDList.StartRelease); - startRelease.BeforeQueryStatus += _commandHelper.GitFlow_BeforeQueryStatus; - _commandHelper.AddCommand(startRelease); + var startRelease = CommandHelper.CreateCommand(StartReleaseCommand, PkgCmdIDList.StartRelease); + startRelease.BeforeQueryStatus += CommandHelper.GitFlow_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, startRelease); - var finishRelease = _commandHelper.CreateCommand(FinishReleaseCommand, PkgCmdIDList.FinishRelease); - finishRelease.BeforeQueryStatus += _commandHelper.Release_BeforeQueryStatus; - _commandHelper.AddCommand(finishRelease); + var finishRelease = CommandHelper.CreateCommand(FinishReleaseCommand, PkgCmdIDList.FinishRelease); + finishRelease.BeforeQueryStatus += CommandHelper.Release_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, finishRelease); //Start/Finish Hotfix - var startHotfix = _commandHelper.CreateCommand(StartHotfixCommand, PkgCmdIDList.StartHotfix); - startHotfix.BeforeQueryStatus += _commandHelper.GitFlow_BeforeQueryStatus; - _commandHelper.AddCommand(startHotfix); + var startHotfix = CommandHelper.CreateCommand(StartHotfixCommand, PkgCmdIDList.StartHotfix); + startHotfix.BeforeQueryStatus += CommandHelper.GitFlow_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, startHotfix); - var finishHotfix = _commandHelper.CreateCommand(FinishHotfixCommand, PkgCmdIDList.FinishHotfix); - finishHotfix.BeforeQueryStatus += _commandHelper.Hotfix_BeforeQueryStatus; - _commandHelper.AddCommand(finishHotfix); + var finishHotfix = CommandHelper.CreateCommand(FinishHotfixCommand, PkgCmdIDList.FinishHotfix); + finishHotfix.BeforeQueryStatus += CommandHelper.Hotfix_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, finishHotfix); //Init - var init = _commandHelper.CreateCommand(InitCommand, PkgCmdIDList.Init); - init.BeforeQueryStatus += _commandHelper.GitHubFlow_BeforeQueryStatus; - _commandHelper.AddCommand(init); + var init = CommandHelper.CreateCommand(InitCommand, PkgCmdIDList.Init); + init.BeforeQueryStatus += CommandHelper.GitHubFlow_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, init); //GitHubFlow Commands //Start/Finish Feature - _commandHelper.AddCommand(StartFeatureGitHubCommand, PkgCmdIDList.StartFeatureGitHub); - var finishFeatureGitHub = _commandHelper.CreateCommand(FinishFeatureGitHubCommand, PkgCmdIDList.FinishFeatureGitHub); - finishFeatureGitHub.BeforeQueryStatus += _commandHelper.Feature_BeforeQueryStatus; - _commandHelper.AddCommand(finishFeatureGitHub); + CommandHelper.AddCommand(_mcs, StartFeatureGitHubCommand, PkgCmdIDList.StartFeatureGitHub); + var finishFeatureGitHub = CommandHelper.CreateCommand(FinishFeatureGitHubCommand, PkgCmdIDList.FinishFeatureGitHub); + finishFeatureGitHub.BeforeQueryStatus += CommandHelper.Feature_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, finishFeatureGitHub); } private void InitCommand(object sender, EventArgs e) { if (string.IsNullOrEmpty(EnvHelper.SolutionDir)) return; - var flowDialog = new Flow(); - if (flowDialog.ShowDialog() == DialogResult.OK) - { - /* 1. Add GitFlow config options + var flowDialog = new FlowDialog(); + if (flowDialog.ShowDialog() != DialogResult.OK) return; + + /* 1. Add GitFlow config options * 2. Checkout develop branch (create if it doesn't exist, reset if it does) * 3. Push develop branch */ - ProcessHelper.StartProcessGui( - "cmd.exe", - $"/c cd \"{EnvHelper.SolutionDir}\" && " + - GitHelper.GetSshSetup() + - FormatCliCommand($"config --add gitflow.branch.master {flowDialog.FlowOptions.MasterBranch}") + - FormatCliCommand($"config --add gitflow.branch.develop {flowDialog.FlowOptions.DevelopBranch}") + - FormatCliCommand($"config --add gitflow.prefix.feature {flowDialog.FlowOptions.FeaturePrefix}") + - FormatCliCommand($"config --add gitflow.prefix.release {flowDialog.FlowOptions.ReleasePrefix}") + - FormatCliCommand($"config --add gitflow.prefix.hotfix {flowDialog.FlowOptions.HotfixPrefix}") + - (GitHelper.RemoteBranchExists(flowDialog.FlowOptions.DevelopBranch) ? - "echo." : - FormatCliCommand($"checkout -b {flowDialog.FlowOptions.DevelopBranch}", false)), - "Initializing GitFlow" + ProcessHelper.StartProcessGui( + "cmd.exe", + $"/c cd \"{EnvHelper.SolutionDir}\" && " + + GitHelper.GetSshSetup() + + FormatCliCommand($"config --add gitflow.branch.master {flowDialog.FlowOptions.MasterBranch}") + + FormatCliCommand($"config --add gitflow.branch.develop {flowDialog.FlowOptions.DevelopBranch}") + + FormatCliCommand($"config --add gitflow.prefix.feature {flowDialog.FlowOptions.FeaturePrefix}") + + FormatCliCommand($"config --add gitflow.prefix.release {flowDialog.FlowOptions.ReleasePrefix}") + + FormatCliCommand($"config --add gitflow.prefix.hotfix {flowDialog.FlowOptions.HotfixPrefix}") + + (GitHelper.RemoteBranchExists(flowDialog.FlowOptions.DevelopBranch) ? + "echo." : + FormatCliCommand($"checkout -b {flowDialog.FlowOptions.DevelopBranch}", false)), + "Initializing GitFlow" ); - } + EnvHelper.GetFlowOptions(); + EnvHelper.GetBranchName(); } private void StartFeatureCommand(object sender, EventArgs e) @@ -139,7 +139,7 @@ private void FinishFeatureCommand(object sender, EventArgs e) if (string.IsNullOrEmpty(EnvHelper.SolutionDir)) return; var featureBranch = GitHelper.GetCurrentBranchName(false); var featureName = GitHelper.GetCurrentBranchName(true); - var flowOptions = GitHelper.GetFlowOptions(); + EnvHelper.GetFlowOptions(); /* 1. Switch to the develop branch * 2. Pull latest changes on develop @@ -152,10 +152,10 @@ private void FinishFeatureCommand(object sender, EventArgs e) "cmd.exe", $"/c cd \"{EnvHelper.SolutionDir}\" && " + GitHelper.GetSshSetup() + - FormatCliCommand($"checkout {flowOptions.DevelopBranch}") + + FormatCliCommand($"checkout {EnvHelper.FlowOptions.DevelopBranch}") + FormatCliCommand("pull") + FormatCliCommand($"merge --no-ff {featureBranch}") + - FormatCliCommand($"push origin {flowOptions.DevelopBranch}", false), + FormatCliCommand($"push origin {EnvHelper.FlowOptions.DevelopBranch}", false), $"Finishing feature {featureName}", featureBranch, null, _options ); @@ -163,7 +163,7 @@ private void FinishFeatureCommand(object sender, EventArgs e) private string FormatCliCommand(string gitCommand, bool appendNextLine = true) { - return $"echo ^> {Path.GetFileNameWithoutExtension(_gitBin)} {gitCommand} && \"{_gitBin}\" {gitCommand}{(appendNextLine ? " && " : string.Empty)}"; + return $"echo ^> {Path.GetFileNameWithoutExtension(EnvHelper.Git)} {gitCommand} && \"{EnvHelper.Git}\" {gitCommand}{(appendNextLine ? " && " : string.Empty)}"; } private void FinishFeatureGitHubCommand(object sender, EventArgs e) @@ -219,7 +219,7 @@ private void FinishReleaseCommand(object sender, EventArgs e) if (string.IsNullOrEmpty(EnvHelper.SolutionDir)) return; var releaseBranch = GitHelper.GetCurrentBranchName(false); var releaseName = GitHelper.GetCurrentBranchName(true); - var flowOptions = GitHelper.GetFlowOptions(); + EnvHelper.GetFlowOptions(); /* 1. Switch to the master branch * 2. Pull latest changes on master @@ -238,15 +238,15 @@ private void FinishReleaseCommand(object sender, EventArgs e) "cmd.exe", $"/c cd \"{EnvHelper.SolutionDir}\" && " + GitHelper.GetSshSetup() + - FormatCliCommand($"checkout {flowOptions.MasterBranch}") + + FormatCliCommand($"checkout {EnvHelper.FlowOptions.MasterBranch}") + FormatCliCommand("pull") + FormatCliCommand($"merge --no-ff {releaseBranch}") + FormatCliCommand($"tag {releaseName}") + - FormatCliCommand($"checkout {flowOptions.DevelopBranch}") + + FormatCliCommand($"checkout {EnvHelper.FlowOptions.DevelopBranch}") + FormatCliCommand("pull") + FormatCliCommand($"merge --no-ff {releaseBranch}") + - FormatCliCommand($"push origin {flowOptions.DevelopBranch}") + - FormatCliCommand($"push origin {flowOptions.MasterBranch}") + + FormatCliCommand($"push origin {EnvHelper.FlowOptions.DevelopBranch}") + + FormatCliCommand($"push origin {EnvHelper.FlowOptions.MasterBranch}") + FormatCliCommand($"push origin {releaseName}", false), $"Finishing release {releaseName}", releaseBranch, null, _options @@ -281,7 +281,7 @@ private void FinishHotfixCommand(object sender, EventArgs e) if (string.IsNullOrEmpty(EnvHelper.SolutionDir)) return; var hotfixBranch = GitHelper.GetCurrentBranchName(false); var hotfixName = GitHelper.GetCurrentBranchName(true); - var flowOptions = GitHelper.GetFlowOptions(); + EnvHelper.GetFlowOptions(); /* 1. Switch to the master branch * 2. Pull latest changes on master @@ -300,15 +300,15 @@ private void FinishHotfixCommand(object sender, EventArgs e) "cmd.exe", $"/c cd \"{EnvHelper.SolutionDir}\" && " + GitHelper.GetSshSetup() + - FormatCliCommand($"checkout {flowOptions.MasterBranch}") + + FormatCliCommand($"checkout {EnvHelper.FlowOptions.MasterBranch}") + FormatCliCommand("pull") + FormatCliCommand($"merge --no-ff {hotfixBranch}") + FormatCliCommand($"tag {hotfixName}") + - FormatCliCommand($"checkout {flowOptions.DevelopBranch}") + + FormatCliCommand($"checkout {EnvHelper.FlowOptions.DevelopBranch}") + FormatCliCommand("pull") + FormatCliCommand($"merge --no-ff {hotfixBranch}") + - FormatCliCommand($"push origin {flowOptions.DevelopBranch}") + - FormatCliCommand($"push origin {flowOptions.MasterBranch}") + + FormatCliCommand($"push origin {EnvHelper.FlowOptions.DevelopBranch}") + + FormatCliCommand($"push origin {EnvHelper.FlowOptions.MasterBranch}") + FormatCliCommand($"push origin {hotfixName}", false), $"Finishing hotfix {hotfixName}", hotfixBranch, null, _options diff --git a/TGit/Commands/MainMenuCommands.cs b/TGit/Commands/MainMenuCommands.cs index e1313f5..ad0f475 100644 --- a/TGit/Commands/MainMenuCommands.cs +++ b/TGit/Commands/MainMenuCommands.cs @@ -1,47 +1,49 @@ using EnvDTE; using SamirBoulema.TGit.Helpers; using System; +using Microsoft.VisualStudio.Shell; namespace SamirBoulema.TGit.Commands { public class MainMenuCommands { - private readonly CommandHelper _commandHelper; private readonly DTE _dte; + private readonly OleMenuCommandService _mcs; private readonly OptionPageGrid _generalOptions; - public MainMenuCommands(CommandHelper commandHelper, DTE dte, OptionPageGrid generalOptions) + public MainMenuCommands(OleMenuCommandService mcs, DTE dte, OptionPageGrid generalOptions) { - _commandHelper = commandHelper; _dte = dte; + _mcs = mcs; _generalOptions = generalOptions; } public void AddCommands() { - _commandHelper.AddCommand(ShowChangesCommand, PkgCmdIDList.ShowChanges); - _commandHelper.AddCommand(PullCommand, PkgCmdIDList.Pull); - _commandHelper.AddCommand(FetchCommand, PkgCmdIDList.Fetch); - _commandHelper.AddCommand(CommitCommand, PkgCmdIDList.Commit); - _commandHelper.AddCommand(PushCommand, PkgCmdIDList.Push); + CommandHelper.AddCommand(_mcs, ShowChangesCommand, PkgCmdIDList.ShowChanges); + CommandHelper.AddCommand(_mcs, PullCommand, PkgCmdIDList.Pull); + CommandHelper.AddCommand(_mcs, FetchCommand, PkgCmdIDList.Fetch); + CommandHelper.AddCommand(_mcs, CommitCommand, PkgCmdIDList.Commit); + CommandHelper.AddCommand(_mcs, PushCommand, PkgCmdIDList.Push); - _commandHelper.AddCommand(ShowLogCommand, PkgCmdIDList.ShowLog); - _commandHelper.AddCommand(DiskBrowserCommand, PkgCmdIDList.DiskBrowser); - _commandHelper.AddCommand(RepoBrowserCommand, PkgCmdIDList.RepoBrowser); + CommandHelper.AddCommand(_mcs, ShowLogCommand, PkgCmdIDList.ShowLog); + CommandHelper.AddCommand(_mcs, DiskBrowserCommand, PkgCmdIDList.DiskBrowser); + CommandHelper.AddCommand(_mcs, RepoBrowserCommand, PkgCmdIDList.RepoBrowser); - _commandHelper.AddCommand(CreateStashCommand, PkgCmdIDList.CreateStash); - var applyStash = _commandHelper.CreateCommand(ApplyStashCommand, PkgCmdIDList.ApplyStash); - applyStash.BeforeQueryStatus += _commandHelper.ApplyStash_BeforeQueryStatus; - _commandHelper.AddCommand(applyStash); + CommandHelper.AddCommand(_mcs, CreateStashCommand, PkgCmdIDList.CreateStash); + var applyStash = CommandHelper.CreateCommand(ApplyStashCommand, PkgCmdIDList.ApplyStash); + applyStash.BeforeQueryStatus += CommandHelper.ApplyStash_BeforeQueryStatus; + CommandHelper.AddCommand(_mcs, applyStash); - _commandHelper.AddCommand(BranchCommand, PkgCmdIDList.Branch); - _commandHelper.AddCommand(SwitchCommand, PkgCmdIDList.Switch); - _commandHelper.AddCommand(MergeCommand, PkgCmdIDList.Merge); + CommandHelper.AddCommand(_mcs, BranchCommand, PkgCmdIDList.Branch); + CommandHelper.AddCommand(_mcs, SwitchCommand, PkgCmdIDList.Switch); + CommandHelper.AddCommand(_mcs, MergeCommand, PkgCmdIDList.Merge); - _commandHelper.AddCommand(RevertCommand, PkgCmdIDList.Revert); - _commandHelper.AddCommand(ResolveCommand, PkgCmdIDList.Resolve); - _commandHelper.AddCommand(SyncCommand, PkgCmdIDList.Sync); - _commandHelper.AddCommand(CleanupCommand, PkgCmdIDList.Cleanup); + CommandHelper.AddCommand(_mcs, RevertCommand, PkgCmdIDList.Revert); + CommandHelper.AddCommand(_mcs, ResolveCommand, PkgCmdIDList.Resolve); + CommandHelper.AddCommand(_mcs, SyncCommand, PkgCmdIDList.Sync); + CommandHelper.AddCommand(_mcs, CleanupCommand, PkgCmdIDList.Cleanup); + CommandHelper.AddCommand(_mcs, BrowseRefCommand, PkgCmdIDList.BrowseRef); } private void PreCommand() @@ -142,5 +144,11 @@ private void SyncCommand(object sender, EventArgs e) PreCommand(); ProcessHelper.StartTortoiseGitProc($"/command:sync /path:\"{EnvHelper.SolutionDir}\""); } + + private void BrowseRefCommand(object sender, EventArgs e) + { + PreCommand(); + ProcessHelper.StartTortoiseGitProc($"/command:refbrowse /path:\"{EnvHelper.SolutionDir}\""); + } } } diff --git a/TGit/Flow.Designer.cs b/TGit/FlowDialog.Designer.cs similarity index 99% rename from TGit/Flow.Designer.cs rename to TGit/FlowDialog.Designer.cs index afbb21c..ee090cf 100644 --- a/TGit/Flow.Designer.cs +++ b/TGit/FlowDialog.Designer.cs @@ -1,6 +1,6 @@ namespace SamirBoulema.TGit { - partial class Flow + partial class FlowDialog { /// /// Required designer variable. @@ -28,7 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Flow)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlowDialog)); this.developTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); diff --git a/TGit/Flow.cs b/TGit/FlowDialog.cs similarity index 91% rename from TGit/Flow.cs rename to TGit/FlowDialog.cs index 501a786..14a918c 100644 --- a/TGit/Flow.cs +++ b/TGit/FlowDialog.cs @@ -3,11 +3,11 @@ namespace SamirBoulema.TGit { - public partial class Flow : Form + public partial class FlowDialog : Form { public FlowOptions FlowOptions; - public Flow() + public FlowDialog() { InitializeComponent(); } diff --git a/TGit/Flow.resx b/TGit/FlowDialog.resx similarity index 100% rename from TGit/Flow.resx rename to TGit/FlowDialog.resx diff --git a/TGit/Guids.cs b/TGit/Guids.cs index 6ee2c8e..7b0acce 100644 --- a/TGit/Guids.cs +++ b/TGit/Guids.cs @@ -2,7 +2,7 @@ namespace SamirBoulema.TGit { - static class GuidList + internal static class GuidList { public const string GuidTgitPkgString = "6c58d6e5-11ba-43ba-9a63-a624f264ec06"; public const string GuidTgitCmdSetString = "6a672d8c-b58f-4329-9bc9-015fc15f9d1a"; diff --git a/TGit/Helpers/CommandHelper.cs b/TGit/Helpers/CommandHelper.cs index e8e5a99..e24f992 100644 --- a/TGit/Helpers/CommandHelper.cs +++ b/TGit/Helpers/CommandHelper.cs @@ -4,26 +4,19 @@ namespace SamirBoulema.TGit.Helpers { - public class CommandHelper + public static class CommandHelper { - private readonly OleMenuCommandService _mcs; - - public CommandHelper(OleMenuCommandService mcs) - { - _mcs = mcs; - } - - public void AddCommand(EventHandler handler, uint commandId) + public static void AddCommand(OleMenuCommandService mcs, EventHandler handler, uint commandId) { - _mcs.AddCommand(CreateCommand(handler, commandId)); + mcs.AddCommand(CreateCommand(handler, commandId)); } - public void AddCommand(MenuCommand command) + public static void AddCommand(OleMenuCommandService mcs, MenuCommand command) { - _mcs.AddCommand(command); + mcs.AddCommand(command); } - public OleMenuCommand CreateCommand(EventHandler handler, uint commandId) + public static OleMenuCommand CreateCommand(EventHandler handler, uint commandId) { var menuCommandId = new CommandID(GuidList.GuidTgitCmdSet, (int)commandId); var menuItem = new OleMenuCommand(handler, menuCommandId); @@ -31,50 +24,50 @@ public OleMenuCommand CreateCommand(EventHandler handler, uint commandId) return menuItem; } - public OleMenuCommand CreateCommand(uint commandId) + public static OleMenuCommand CreateCommand(uint commandId) { return CreateCommand(null, commandId); } - public void ApplyStash_BeforeQueryStatus(object sender, EventArgs e) + public static void ApplyStash_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand) sender).Enabled = EnvHelper.HasStash; } - public void Feature_BeforeQueryStatus(object sender, EventArgs e) + public static void Feature_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand)sender).Visible = EnvHelper.HasSolutionDir() && EnvHelper.IsGitFlow; ((OleMenuCommand)sender).Enabled = EnvHelper.HasSolutionDir() && EnvHelper.BranchName.StartsWith(EnvHelper.FlowOptions.FeaturePrefix); } - public void Hotfix_BeforeQueryStatus(object sender, EventArgs e) + public static void Hotfix_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand)sender).Visible = EnvHelper.HasSolutionDir() && EnvHelper.IsGitFlow; ((OleMenuCommand)sender).Enabled = EnvHelper.HasSolutionDir() && EnvHelper.BranchName.StartsWith(EnvHelper.FlowOptions.HotfixPrefix); } - public void Release_BeforeQueryStatus(object sender, EventArgs e) + public static void Release_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand)sender).Visible = EnvHelper.HasSolutionDir() && EnvHelper.IsGitFlow; ((OleMenuCommand)sender).Enabled = EnvHelper.HasSolutionDir() && EnvHelper.BranchName.StartsWith(EnvHelper.FlowOptions.ReleasePrefix); } - public void Solution_BeforeQueryStatus(object sender, EventArgs e) + public static void Solution_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand) sender).Enabled = EnvHelper.HasSolutionDir(); } - public void SolutionVisibility_BeforeQueryStatus(object sender, EventArgs e) + public static void SolutionVisibility_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand) sender).Visible = EnvHelper.HasSolutionDir(); } - public void GitFlow_BeforeQueryStatus(object sender, EventArgs e) + public static void GitFlow_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand) sender).Visible = EnvHelper.HasSolutionDir() && EnvHelper.IsGitFlow; } - public void GitHubFlow_BeforeQueryStatus(object sender, EventArgs e) + public static void GitHubFlow_BeforeQueryStatus(object sender, EventArgs e) { ((OleMenuCommand) sender).Visible = EnvHelper.HasSolutionDir() && !EnvHelper.IsGitFlow; } diff --git a/TGit/IconMappings.csv b/TGit/IconMappings.csv index ae688d8..e209db8 100644 --- a/TGit/IconMappings.csv +++ b/TGit/IconMappings.csv @@ -16,3 +16,4 @@ fec49b6d-c04a-42bd-b021-b8b2e5cfb291,15,d53d7256-d44d-4245-bdd2-bfd22943659c,15 fec49b6d-c04a-42bd-b021-b8b2e5cfb291,16,d53d7256-d44d-4245-bdd2-bfd22943659c,16 fec49b6d-c04a-42bd-b021-b8b2e5cfb291,17,d53d7256-d44d-4245-bdd2-bfd22943659c,17 fec49b6d-c04a-42bd-b021-b8b2e5cfb291,18,d53d7256-d44d-4245-bdd2-bfd22943659c,18 +fec49b6d-c04a-42bd-b021-b8b2e5cfb291,19,d53d7256-d44d-4245-bdd2-bfd22943659c,19 \ No newline at end of file diff --git a/TGit/Images.imagemanifest b/TGit/Images.imagemanifest index 12be814..3e76dfa 100644 --- a/TGit/Images.imagemanifest +++ b/TGit/Images.imagemanifest @@ -26,6 +26,7 @@ + @@ -82,6 +83,9 @@ + + + \ No newline at end of file diff --git a/TGit/Images.vsct b/TGit/Images.vsct index ac9da50..7b36107 100644 --- a/TGit/Images.vsct +++ b/TGit/Images.vsct @@ -31,6 +31,7 @@ + diff --git a/TGit/PkgCmdID.cs b/TGit/PkgCmdID.cs index 858b014..808be56 100644 --- a/TGit/PkgCmdID.cs +++ b/TGit/PkgCmdID.cs @@ -55,5 +55,6 @@ static class PkgCmdIDList public const uint Resolve = 0x137; public const uint Sync = 0x138; public const uint Init = 0x139; + public const uint BrowseRef = 0x140; } } \ No newline at end of file diff --git a/TGit/Resources/Images/BrowseRef.xaml b/TGit/Resources/Images/BrowseRef.xaml new file mode 100644 index 0000000..87d4d89 --- /dev/null +++ b/TGit/Resources/Images/BrowseRef.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/TGit/Resources/octicons.png b/TGit/Resources/octicons.png index c72f994..f8dd084 100644 Binary files a/TGit/Resources/octicons.png and b/TGit/Resources/octicons.png differ diff --git a/TGit/Resources/octicons.pxd b/TGit/Resources/octicons.pxd index af7ab37..eb69b1b 100644 Binary files a/TGit/Resources/octicons.pxd and b/TGit/Resources/octicons.pxd differ diff --git a/TGit/TGIT.csproj b/TGit/TGIT.csproj index 2abf671..632361a 100644 --- a/TGit/TGIT.csproj +++ b/TGit/TGIT.csproj @@ -172,11 +172,11 @@ - + Form - - Flow.cs + + FlowDialog.cs Form @@ -212,8 +212,8 @@ - - Flow.cs + + FlowDialog.cs Credentials.cs @@ -305,6 +305,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer diff --git a/TGit/TGIT.vsct b/TGit/TGIT.vsct index 80034fa..b03d893 100644 --- a/TGit/TGIT.vsct +++ b/TGit/TGIT.vsct @@ -297,6 +297,14 @@ + +