diff --git a/.gitignore b/.gitignore index 43ae5bb..bd48a80 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ _ReSharper.GitTfs.GitExtensions.Plugin *.user *.suo [Oo]bj +/packages \ No newline at end of file diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config new file mode 100644 index 0000000..6a318ad --- /dev/null +++ b/.nuget/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe new file mode 100644 index 0000000..4645f4b Binary files /dev/null and b/.nuget/NuGet.exe differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets new file mode 100644 index 0000000..d1edc54 --- /dev/null +++ b/.nuget/NuGet.targets @@ -0,0 +1,135 @@ + + + + $(MSBuildProjectDirectory)\..\ + + + false + + + false + + + true + + + false + + + + + + + + + + + $(SolutionDir).nuget + packages.config + + + + + $(NuGetToolsPath)\NuGet.exe + @(PackageSource) + + "$(NuGetExePath)" + mono --runtime=v4.0.30319 $(NuGetExePath) + + $(TargetDir.Trim('\\')) + + -RequireConsent + + $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) " + $(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols + + + + RestorePackages; + $(BuildDependsOn); + + + + + $(BuildDependsOn); + BuildPackage; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.nuget/Nuget.sh b/.nuget/Nuget.sh new file mode 100644 index 0000000..bedd41a --- /dev/null +++ b/.nuget/Nuget.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +if [ ! -d 'packages' ]; then + mkdir packages +fi +if [ "$1" = "NoMono" ] ; then + + find ./ -name packages.config -exec .nuget/NuGet.exe install {} -o packages \; + +else + find ./ -name packages.config -exec mono --runtime=v4.0.30319 .nuget/NuGet.exe install {} -o packages \; +fi + diff --git a/GitTfsPlugin.cs b/GitTfsPlugin.cs index bbf067e..dcc4a8e 100644 --- a/GitTfsPlugin.cs +++ b/GitTfsPlugin.cs @@ -7,31 +7,11 @@ namespace GitTfs.GitExtensions.Plugin { - public class GitTfsPlugin : IGitPlugin + public class GitTfsPlugin : GitPluginBase { - public void Register(IGitUICommands gitUiCommands) + public override bool Execute(GitUIBaseEventArgs gitUiCommands) { - var existingKeys = Settings.GetAvailableSettings(); - - var settingsToAdd = from field in typeof(SettingKeys).GetFields(BindingFlags.Public | BindingFlags.Static) - let key = (string)field.GetValue(null) - where !existingKeys.Contains(key) - select key; - - foreach (var settingToAdd in settingsToAdd) - { - Settings.AddSetting(settingToAdd, string.Empty); - } - - } - - public void Unregister(IGitUICommands gitUiCommands) - { - } - - public bool Execute(GitUIBaseEventArgs gitUiCommands) - { - if (string.IsNullOrEmpty(gitUiCommands.GitModule.GitWorkingDir)) + if (string.IsNullOrEmpty(gitUiCommands.GitModule.WorkingDir)) { return true; } @@ -58,13 +38,11 @@ private static IEnumerable GetTfsRemotes(IGitUICommands commands) : Enumerable.Empty(); } - public string Description + public override string Description { - get { return "git-tfs"; } + get { return "Git-Tfs"; } } - public IGitPluginSettingsContainer Settings { get; set; } - public SettingsContainer PluginSettings { get { return new SettingsContainer(Settings); } diff --git a/SettingsContainer.cs b/SettingsContainer.cs index 877d377..5a3a412 100644 --- a/SettingsContainer.cs +++ b/SettingsContainer.cs @@ -6,17 +6,17 @@ namespace GitTfs.GitExtensions.Plugin { public class SettingsContainer { - private readonly IGitPluginSettingsContainer _container; + private readonly ISettingsSource _container; - public SettingsContainer(IGitPluginSettingsContainer container) + public SettingsContainer(ISettingsSource container) { _container = container; } public string TfsRemote { - get { return _container.GetSetting(SettingKeys.TfsRemote); } - set { _container.SetSetting(SettingKeys.TfsRemote, value); } + get { return _container.GetValue(SettingKeys.TfsRemote, null , x => x); } + set { _container.SetValue(SettingKeys.TfsRemote, value, x => x); } } public PullSetting? PullSetting @@ -40,17 +40,15 @@ public ShelveSettingsContainer ShelveSettings where T : struct { var type = typeof (T); - var value = _container.GetSetting(key); - - return (from name in Enum.GetNames(type) - where name == value - select (T?) Enum.Parse(type, name)).FirstOrDefault(); + return _container.GetValue(key, default(T), x => (from name in Enum.GetNames(type) + where name == x + select (T?) Enum.Parse(type, name)).FirstOrDefault()); } private void SetEnumSettingValue(string key, T? value) where T : struct { - _container.SetSetting(key, value.HasValue ? value.ToString() : string.Empty); + _container.SetValue(key, value, x => x.HasValue ? x.ToString() : string.Empty); } } } diff --git a/ShelveSettingsContainer.cs b/ShelveSettingsContainer.cs index 7b9c9c4..ff51654 100644 --- a/ShelveSettingsContainer.cs +++ b/ShelveSettingsContainer.cs @@ -4,17 +4,17 @@ namespace GitTfs.GitExtensions.Plugin { public class ShelveSettingsContainer { - private readonly IGitPluginSettingsContainer _container; + private readonly ISettingsSource _container; - public ShelveSettingsContainer(IGitPluginSettingsContainer container) + public ShelveSettingsContainer(ISettingsSource container) { _container = container; } public string Name { - get { return _container.GetSetting(SettingKeys.ShelvesetName); } - set { _container.SetSetting(SettingKeys.ShelvesetName, value); } + get { return _container.GetValue(SettingKeys.ShelvesetName, string.Empty, x => x); } + set { _container.SetValue(SettingKeys.ShelvesetName, value, x => x); } } public bool Overwrite @@ -26,7 +26,7 @@ public bool Overwrite } set { - _container.SetSetting(SettingKeys.OverwriteShelveset, value.ToString()); + _container.SetValue(SettingKeys.OverwriteShelveset, value, x => x.ToString()); } } } diff --git a/gitextensions b/gitextensions index 5765828..561cd8f 160000 --- a/gitextensions +++ b/gitextensions @@ -1 +1 @@ -Subproject commit 576582891c6312c3f9d354be5583059ca12cae56 +Subproject commit 561cd8f4c29140628e20ae2928af7adccaec03c6 diff --git a/packages/repositories.config b/packages/repositories.config new file mode 100644 index 0000000..39a0169 --- /dev/null +++ b/packages/repositories.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file