├── .gitignore
├── .tfignore
├── DiffClassifier
├── DiffClassificationDefinitions.cs
├── DiffClassifier-screenshot.png
├── DiffClassifier.cs
├── DiffClassifier.csproj
├── DiffClassifierProvider.cs
├── Properties
│ ├── AssemblyInfo.cs
│ └── FxCopSuppressions.cs
└── source.extension.vsixmanifest
├── GitApi
├── DataServices
│ ├── Change.cs
│ ├── Commit.cs
│ ├── GitTreeObject.cs
│ ├── GraphLink.cs
│ ├── GraphNode.cs
│ ├── Ref.cs
│ └── RepositoryGraph.cs
├── DiffHunk.cs
├── DiffTool.cs
├── GitApi.csproj
├── GitBash.cs
├── GitBashResult.cs
├── GitFileStatus.cs
├── GitIntellisenseHelper.cs
├── GitRepository.cs
├── GitSccOptions.cs
├── Log.cs
└── Properties
│ └── AssemblyInfo.cs
├── GitUI
├── App.xaml
├── App.xaml.cs
├── GitIntellisenseHelper.cs
├── GitUI.csproj
├── GitViewModel.cs
├── HistoryViewCommands.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Options.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── ICSharpCode.AvalonEdit.dll
│ ├── Loading.png
│ ├── Microsoft.Windows.Shell.dll
│ ├── Patch-Mode.xshd
│ └── dragon.png
├── Themes
│ └── Generic.xaml
├── UI
│ ├── BottomToolBar.xaml
│ ├── BottomToolBar.xaml.cs
│ ├── BranchPicker.xaml
│ ├── BranchPicker.xaml.cs
│ ├── CommitBox.xaml
│ ├── CommitBox.xaml.cs
│ ├── CommitDetails.xaml
│ ├── CommitDetails.xaml.cs
│ ├── CommitHead.xaml
│ ├── CommitHead.xaml.cs
│ ├── CommitRemote.xaml
│ ├── CommitRemote.xaml.cs
│ ├── CommitTag.xaml
│ ├── CommitTag.xaml.cs
│ ├── GitConsole.xaml
│ ├── GitConsole.xaml.cs
│ ├── HistoryGraph.xaml
│ ├── HistoryGraph.xaml.cs
│ ├── Loading.xaml
│ ├── Loading.xaml.cs
│ ├── MainToolBar.xaml
│ ├── MainToolBar.xaml.cs
│ ├── MouseHandlingMode.cs
│ ├── PendingChanges.xaml
│ ├── PendingChanges.xaml.cs
│ └── ResourceDictionary.xaml
├── ZoomAndPan
│ ├── AnimationHelper.cs
│ ├── ZoomAndPanControl.cs
│ └── ZoomAndPanControl_IScrollInfo.cs
├── app.config
└── packages.config
├── IntegrationTests.testsettings
├── LICENSE
├── README.md
├── UnitTests.testsettings
├── VSIXProject2019
├── DiffClassifier
│ ├── DiffClassificationDefinitions.cs
│ ├── DiffClassifier.cs
│ └── DiffClassifierProvider.cs
├── GitChangesWindow.cs
├── GitChangesWindowControl.xaml
├── GitChangesWindowControl.xaml.cs
├── GitConsole.xaml
├── GitConsole.xaml.cs
├── GitSettings.xaml
├── GitSettings.xaml.cs
├── GitToolCommands.cs
├── GitTracker.cs
├── Guids.cs
├── MyPackage.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── Compare.png
│ ├── GitChangesWindowCommand.png
│ ├── History.png
│ ├── Icon128x128.png
│ ├── Images.png
│ ├── LICENSE.txt
│ ├── Loading.png
│ ├── Package.ico
│ ├── PendingCheckins.png
│ ├── Preview.png
│ ├── Refresh.png
│ ├── Settings.png
│ ├── Switch.png
│ ├── UndoCheckout.png
│ └── git_32.png
├── VSCommandTable.vsct
├── VSIXProject2019.csproj
├── VSPackage.Designer.cs
├── VSPackage.resx
├── art
│ ├── command.png
│ └── main.png
└── source.extension.vsixmanifest
├── VSIXProject2022
├── DiffClassifier
│ ├── DiffClassificationDefinitions.cs
│ ├── DiffClassifier.cs
│ └── DiffClassifierProvider.cs
├── GitChangesWindow.cs
├── GitChangesWindowControl.xaml
├── GitChangesWindowControl.xaml.cs
├── GitConsole.xaml
├── GitConsole.xaml.cs
├── GitSettings.xaml
├── GitSettings.xaml.cs
├── GitToolCommands.cs
├── GitTracker.cs
├── Guids.cs
├── MyPackage.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources
│ ├── Compare.png
│ ├── GitChangesWindowCommand.png
│ ├── History.png
│ ├── Icon128x128.png
│ ├── Images.png
│ ├── LICENSE.txt
│ ├── Loading.png
│ ├── Package.ico
│ ├── PendingCheckins.png
│ ├── Preview.png
│ ├── Refresh.png
│ ├── Settings.png
│ ├── Switch.png
│ ├── UndoCheckout.png
│ └── git_32.png
├── VSCommandTable.vsct
├── VSIXProject2022.csproj
├── VSPackage.Designer.cs
├── VSPackage.resx
├── art
│ ├── command.png
│ └── main.png
└── source.extension.vsixmanifest
├── VsGitToolsPackage.Tests
├── DiffToolTest.cs
├── GitRepositoryTest.cs
├── Properties
│ └── AssemblyInfo.cs
├── VsGitToolsPackage.Tests.csproj
└── packages.config
├── VsGitToolsPackage.sln
├── VsGitToolsPackage
├── DiffClassifier
│ ├── DiffClassificationDefinitions.cs
│ ├── DiffClassifier.cs
│ └── DiffClassifierProvider.cs
├── GitConsole.xaml
├── GitConsole.xaml.cs
├── GitToolCommands.cs
├── GlobalSuppressions.cs
├── Guids.cs
├── Key.snk
├── License.txt
├── MyControl.xaml
├── MyControl.xaml.cs
├── MyToolWindow.cs
├── PkgCmdID.cs
├── PlatformUI
│ ├── HeaderColors.cs
│ ├── PlatformColorHelper.cs
│ └── TreeViewColors.cs
├── Properties
│ └── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Resources
│ ├── Compare.png
│ ├── History.png
│ ├── Images.png
│ ├── Loading.png
│ ├── Package.ico
│ ├── PendingCheckins.png
│ ├── Preview.png
│ ├── Refresh.png
│ ├── Settings.png
│ ├── Switch.png
│ ├── UndoCheckout.png
│ └── git_32.png
├── SccOnIdleEvent.cs
├── Settings.xaml
├── Settings.xaml.cs
├── VSPackage.resx
├── VsGitToolsPackage.csproj
├── VsGitToolsPackage.vsct
├── VsGitToolsPackagePackage.cs
├── VsGitToolsPackage_IntegrationTests
│ ├── IntegrationTest Library
│ │ ├── DialogboxPurger.cs
│ │ ├── NativeMethods.cs
│ │ └── Utils.cs
│ ├── Key.snk
│ ├── MenuItemTest.cs
│ ├── PackageTest.cs
│ ├── SignOff-Tests
│ │ ├── CPPProjectTests.cs
│ │ ├── CSharpProjectTests.cs
│ │ ├── SolutionTests.cs
│ │ └── VBProjectTests.cs
│ ├── ToolWindowTest.cs
│ └── VsGitToolsPackage_IntegrationTests.csproj
├── VsGitToolsPackage_UnitTests
│ ├── Key.snk
│ ├── MenuItemTests
│ │ ├── MenuItemCallback.cs
│ │ └── UIShellServiceMock.cs
│ ├── MyToolWindowTest
│ │ ├── MyToolWindow.cs
│ │ ├── ShowToolWindow.cs
│ │ ├── UIShellServiceMock.cs
│ │ └── WindowFrameMock.cs
│ ├── PackageTest.cs
│ └── VsGitToolsPackage_UnitTests.csproj
├── VsGitToolsService.cs
├── extension.vsixmanifest
├── packages.config
└── source.extension.vsixmanifest
└── docs
├── .nojekyll
├── README.md
├── imgs
├── console-gulp-s.png
├── git-console.png
├── git-gv.png
├── main.png
└── vs-diff.png
├── index.html
└── viewer.md
/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 | *.obj
3 | *.exe
4 | *.pdb
5 | *.user
6 | *.aps
7 | *.pch
8 | *.vspscc
9 | *_i.c
10 | *_p.c
11 | *.ncb
12 | *.suo
13 | *.sln.docstates
14 | *.tlb
15 | *.tlh
16 | *.bak
17 | *.cache
18 | *.ilk
19 | *.log
20 | [Bb]in
21 | [Dd]ebug*/
22 | *.lib
23 | *.sbr
24 | obj/
25 | [Rr]elease*/
26 | _ReSharper*/
27 | [Tt]est[Rr]esult*
28 | *.vssscc
29 | $tf*/
30 | packages*/
31 | GitUI/Resources/GitApi2.dll
32 | .vs*/
--------------------------------------------------------------------------------
/.tfignore:
--------------------------------------------------------------------------------
1 | \.git
--------------------------------------------------------------------------------
/DiffClassifier/DiffClassifier-screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/DiffClassifier/DiffClassifier-screenshot.png
--------------------------------------------------------------------------------
/DiffClassifier/DiffClassifierProvider.cs:
--------------------------------------------------------------------------------
1 | //***************************************************************************
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | // This code is licensed under the Visual Studio SDK license terms.
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //***************************************************************************
11 |
12 | // Copyright (c) Microsoft Corporation
13 | // All rights reserved
14 |
15 | namespace DiffClassifier
16 | {
17 | using System.ComponentModel.Composition;
18 | using Microsoft.VisualStudio.Text;
19 | using Microsoft.VisualStudio.Text.Classification;
20 | using Microsoft.VisualStudio.Utilities;
21 |
22 | [Export(typeof(IClassifierProvider))]
23 | [ContentType("diff")]
24 | internal class DiffClassifierProvider : IClassifierProvider
25 | {
26 | [Import]
27 | internal IClassificationTypeRegistryService ClassificationRegistry = null;
28 |
29 | static DiffClassifier diffClassifier;
30 |
31 | public IClassifier GetClassifier(ITextBuffer buffer)
32 | {
33 | if (diffClassifier == null)
34 | diffClassifier = new DiffClassifier(ClassificationRegistry);
35 |
36 | return diffClassifier;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DiffClassifier/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/DiffClassifier/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/DiffClassifier/Properties/FxCopSuppressions.cs:
--------------------------------------------------------------------------------
1 | //***************************************************************************
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | // This code is licensed under the Visual Studio SDK license terms.
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //***************************************************************************
11 |
12 | #if CODE_ANALYSIS_BASELINE
13 | using System.Diagnostics.CodeAnalysis;
14 |
15 | [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "DiffClassifier")]
16 | [module: SuppressMessage("Microsoft.MSInternal", "CA904:DeclareTypesInMicrosoftOrSystemNamespace", Scope = "namespace", Target = "DiffClassifier")]
17 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffAddedDefinition")]
18 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffChangedDefinition")]
19 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffClassificationDefinition")]
20 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffContentTypeDefinition")]
21 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffFileExtensionDefinition")]
22 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffHeaderDefinition")]
23 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffInfolineDefinition")]
24 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffPatchLineDefinition")]
25 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#diffRemovedDefinition")]
26 | [module: SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields", Scope = "member", Target = "DiffClassifier.DiffClassificationDefinitions.#patchFileExtensionDefinition")]
27 | [module: SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", Scope = "type", Target = "DiffClassifier.DiffClassifier")]
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/DiffClassifier/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Diff/Patch File Classifier
6 | A classifier for .diff/.patch files.
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/GitApi/DataServices/Change.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace GitScc.DataServices
7 | {
8 | public class Change
9 | {
10 | public ChangeType ChangeType { get; set; }
11 | public string Name { get; set; }
12 | }
13 |
14 | public enum ChangeType
15 | {
16 | Added,
17 | Deleted,
18 | Modified,
19 | TypeChanged,
20 | Renamed,
21 | Copied,
22 | Unmerged,
23 | Unknown
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/GitApi/DataServices/Commit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace GitScc.DataServices
7 | {
8 | public class Commit
9 | {
10 | public string Id { get; set; }
11 | public IList ParentIds { get; set; }
12 | public IList ChildIds { get; set; }
13 | public string Subject { get; set; }
14 | public string Message { get; set; }
15 | public string TreeId { get; set; }
16 | public string AuthorName { get; set; }
17 | public string AuthorEmail { get; set; }
18 | public DateTime AuthorDate { get; set; }
19 | public string AuthorDateRelative { get; set; }
20 | internal bool deleted { get; set; }
21 |
22 | public override string ToString()
23 | {
24 | return string.Format("[{0}] {1}", ShortId, Subject.Replace("\r", ""));
25 | }
26 |
27 | public string ShortId { get { return Id.Substring(0, 7); } }
}
28 | }
--------------------------------------------------------------------------------
/GitApi/DataServices/GraphLink.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace GitScc.DataServices
7 | {
8 | public class GraphLink
9 | {
10 | public string Id { get; set; }
11 | public int X1 { get; set; }
12 | public int Y1 { get; set; }
13 | public int X2 { get; set; }
14 | public int Y2 { get; set; }
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/GitApi/DataServices/GraphNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace GitScc.DataServices
7 | {
8 | public class GraphNode : Commit
9 | {
10 | public Ref[] Refs { get; set; }
11 | //public string[] Branches { get; set; }
12 | public int X { get; set; }
13 | public int Y { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/GitApi/DataServices/Ref.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace GitScc.DataServices
7 | {
8 | public class Ref
9 | {
10 | public string Id { get; set; }
11 | public string RefName { get; set; }
12 | public string IsHead { get; set; }
13 | public string Name
14 | {
15 | get
16 | {
17 | var name = RefName.Replace("refs/", "");
18 | return name.Substring(name.IndexOf("/") + 1);
19 | }
20 | }
21 | public RefTypes Type
22 | {
23 | get
24 | {
25 | if (RefName == "HEAD") return RefTypes.HEAD;
26 | else if (RefName.StartsWith("refs/heads")) return RefTypes.Branch;
27 | else if (RefName.StartsWith("refs/tags")) return RefTypes.Tag;
28 | else if (RefName.StartsWith("refs/remotes")) return RefTypes.RemoteBranch;
29 | return RefTypes.Unknown;
30 | }
31 | }
32 |
33 | public override string ToString()
34 | {
35 | return Name;
36 | }
37 | }
38 |
39 | public enum RefTypes
40 | {
41 | Unknown,
42 | HEAD,
43 | Branch,
44 | Tag,
45 | RemoteBranch
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/GitApi/DiffHunk.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace GitScc
8 | {
9 | public class DiffHunk
10 | {
11 | public string Heading { get; set; }
12 | public List Lines { get; set; }
13 | public int[] OldBlock { get; set; }
14 | public int[] NewBlock { get; set; }
15 | public int FirstLineIndex { get; set; }
16 | public int LastLineIndex
17 | {
18 | get { return this.FirstLineIndex + this.Lines.Count() - 1; }
19 | }
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/GitApi/GitApi.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {161E81E2-25E5-4134-8D2D-595419B1265B}
7 | Library
8 | Properties
9 | GitScc
10 | GitApi2
11 | v4.5
12 | 512
13 |
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | false
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 | false
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
70 |
--------------------------------------------------------------------------------
/GitApi/GitBashResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace GitScc
7 | {
8 | public class GitBashResult
9 | {
10 | public bool HasError { get; set; }
11 |
12 | public string Error { get; set; }
13 |
14 | public string Output { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GitApi/GitFileStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.ComponentModel;
5 |
6 | namespace GitScc
7 | {
8 | public enum GitFileStatus
9 | {
10 | NotControlled,
11 | New,
12 | Tracked,
13 | Modified,
14 | Staged,
15 | Removed,
16 | Added,
17 | Deleted,
18 | Conflict,
19 | Merged,
20 | Ignored,
21 | Renamed,
22 | Copied
23 | }
24 |
25 | public class GitFile : INotifyPropertyChanged
26 | {
27 | public char X { get; set; }
28 | public char Y { get; set; }
29 |
30 | public GitFileStatus Status { get; set; }
31 | public string FileName { get; set; }
32 | public bool IsStaged {
33 | get
34 | {
35 | return Status == GitFileStatus.Added ||
36 | Status == GitFileStatus.Staged ||
37 | Status == GitFileStatus.Removed ||
38 | Status == GitFileStatus.Renamed;
39 | }
40 | }
41 |
42 | public bool isSelected;
43 | public bool IsSelected
44 | {
45 | get { return isSelected; }
46 | set { isSelected = value; OnPropertyChanged("IsSelected"); }
47 | }
48 |
49 | public event PropertyChangedEventHandler PropertyChanged;
50 |
51 | protected void OnPropertyChanged(string name)
52 | {
53 | PropertyChangedEventHandler handler = PropertyChanged;
54 | if (handler != null)
55 | {
56 | handler(this, new PropertyChangedEventArgs(name));
57 | }
58 | }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/GitApi/GitIntellisenseHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Text.RegularExpressions;
6 | using GitScc;
7 | using GitScc.DataServices;
8 |
9 | namespace GitScc
10 | {
11 | //Inspired by:
12 | //http://www.markembling.info/view/my-ideal-powershell-prompt-with-git-integration
13 | //https://github.com/dahlbyk/posh-git
14 |
15 | public class GitIntellisenseHelper
16 | {
17 | private static IEnumerable GetGitData(GitRepository tracker, string option)
18 | {
19 | switch (option)
20 | {
21 | case "*branches*":
22 | return tracker.RepositoryGraph.Refs
23 | .Where(r => r.Type == RefTypes.Branch)
24 | .Select(r => r.Name);
25 |
26 | case "*tags*":
27 | return tracker.RepositoryGraph.Refs
28 | .Where(r => r.Type == RefTypes.Tag)
29 | .Select(r => r.Name);
30 |
31 | case "*remotes*":
32 | return tracker.Remotes;
33 |
34 | case "*configs*":
35 | return tracker.Configs.Keys;
36 |
37 | case "*commits*":
38 | return tracker.RepositoryGraph.Commits
39 | .OrderByDescending(c => c.AuthorDate)
40 | .Select(r => r.ShortId);
41 |
42 | default:
43 | return new string[] { };
44 | }
45 |
46 | }
47 | public static IEnumerable GetOptions(GitRepository tracker, string command)
48 | {
49 | if (tracker == null) return new string[] { };
50 | var options = Commands.Where(i => Regex.IsMatch(command, i.Key)).Select(i => i.Value).FirstOrDefault();
51 | if (options == null) return new string[] { };
52 |
53 | if (options.Length==1 && options[0].Contains("|")) options = options[0].Split('|');
54 |
55 | var list = new List();
56 | foreach(var option in options)
57 | {
58 | if (option.StartsWith("*"))
59 | {
60 | list.AddRange(GetGitData(tracker, option));
61 | }
62 | else
63 | {
64 | list.Add(option);
65 | }
66 | }
67 | return list;
68 | }
69 |
70 | static Dictionary Commands = new Dictionary{
71 | {"^git$", new string[] {"add", "bisect", "branch", "checkout", "commit", "config", "diff", "fetch", "format-patch", "grep", "init",
72 | "log", "merge", "mv", "pull", "push", "rebase", "remote", "reset", "rm", "show", "status", "stash", "tag"}},
73 |
74 | {"^git bisect$", new string[] {"start|bad|good|skip|reset|help"}},
75 | {"^git rebase$", new string[] {"*branches*"}},
76 | {"^git merge$", new string[] {"*branches*"}},
77 | {"^git rebase -i$", new string[] {"HEAD~"}},
78 |
79 | {"^git remote$", new string[] {"add|rename|rm|set-head|set-branches|set-url|show|prune|update"}},
80 | {"^git stash$", new string[] {"list|save|show|apply|drop|pop|branch|clear|create"}},
81 | //{"^git svn$", new string[] {"fetch|rebase|dcommit|info"}},
82 |
83 | {"^git checkout$", new string[] {"*branches*"}},
84 | {"^git branch -[dDmM]$", new string[] {"*branches*"}},
85 | {"^git tag -[asdfv]$", new string[] {"*tags*"}},
86 | {"^git tag .+$", new string[] {"*commits*"}},
87 |
88 | {"^git pull$", new string[] {"*remotes*"}},
89 | {"^git pull .+$", new string[] {"*branches*"}},
90 | {"^git push$", new string[] {"*remotes*"}},
91 | {"^git push .+$", new string[] {"*branches*"}},
92 |
93 | {"^git reset$", new string[] {"HEAD~|--soft|--mixed|--hard|--merge|--keep"}},
94 | {"^git reset HEAD$", new string[] {"*commits*"}},
95 |
96 | {"^git config$", new string[] {"--global|--system|--local|--get|--add|--unset|--list|-l|--file|*configs*"}},
97 | {"^git config\\s?(?:--global|--system|--local)?$", new string[] {"--get|--add|--unset|--list|*configs*"}},
98 | {"^git config\\s?(?:--global|--system|--local)?\\s?(?:--get|--add|--unset)$", new string[] {"*configs*"}},
99 | };
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/GitApi/GitSccOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.IO;
6 | using System.Xml.Serialization;
7 |
8 | namespace GitScc
9 | {
10 | [Serializable]
11 | public class GitSccOptions
12 | {
13 | private static string configFileName = Path.Combine(
14 | Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
15 | "gitscc.config");
16 |
17 | public string GitBashPath { get; set; }
18 | public string GitExtensionPath { get; set; }
19 | public string DifftoolPath { get; set; }
20 | public string TortoiseGitPath { get; set; }
21 | public bool NotExpandTortoiseGit { get; set; }
22 | public bool NotExpandGitExtensions { get; set; }
23 | public bool UseTGitIconSet { get; set; }
24 | public bool DisableAutoRefresh { get; set; }
25 | public bool DisableAutoLoad { get; set; }
26 | public bool NotUseUTF8FileNames { get; set; }
27 | public bool UseVsDiff { get; set; }
28 |
29 | private static GitSccOptions gitSccOptions;
30 |
31 | public static GitSccOptions Current
32 | {
33 | get
34 | {
35 | if (gitSccOptions == null)
36 | {
37 | gitSccOptions = LoadFromConfig();
38 | }
39 | return gitSccOptions;
40 | }
41 | }
42 |
43 | private GitSccOptions()
44 | {
45 |
46 | }
47 |
48 | public static GitSccOptions LoadFromConfig()
49 | {
50 | GitSccOptions options = null;
51 |
52 |
53 | if (File.Exists(configFileName))
54 | {
55 | try
56 | {
57 | XmlSerializer serializer = new XmlSerializer(typeof(GitSccOptions));
58 | using (TextReader tr = new StreamReader(configFileName))
59 | {
60 | options = (GitSccOptions)serializer.Deserialize(tr);
61 | }
62 | }
63 | catch
64 | {
65 | }
66 | }
67 |
68 | if (options == null) options = new GitSccOptions();
69 |
70 | options.Init();
71 |
72 | return options;
73 | }
74 |
75 | private void Init()
76 | {
77 | if (string.IsNullOrEmpty(GitBashPath))
78 | {
79 | GitBashPath = TryFindFile(new string[]{
80 | @"C:\Program Files\Git\bin\git.exe",
81 | @"C:\Program Files (x86)\Git\bin\git.exe",
82 | });
83 | }
84 | if (string.IsNullOrEmpty(GitExtensionPath))
85 | {
86 | GitExtensionPath = TryFindFile(new string[]{
87 | @"C:\Program Files\GitExtensions\GitExtensions.exe",
88 | @"C:\Program Files (x86)\GitExtensions\GitExtensions.exe",
89 | });
90 | }
91 | if (string.IsNullOrEmpty(TortoiseGitPath))
92 | {
93 | TortoiseGitPath = TryFindFile(new string[]{
94 | @"C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe",
95 | @"C:\Program Files (x86)\TortoiseGit\bin\TortoiseGitProc.exe",
96 | });
97 | }
98 |
99 | if (string.IsNullOrEmpty(DifftoolPath)) DifftoolPath = "diffmerge.exe";
100 |
101 | //bool diffServiceAvailable = Package.GetGlobalService(typeof(SVsDifferenceService)) != null;
102 | //if (!diffServiceAvailable)
103 | // UseVsDiff = false;
104 |
105 | UseVsDiff = true;
106 | }
107 |
108 | public void SaveConfig()
109 | {
110 | try
111 | {
112 | XmlSerializer x = new XmlSerializer(typeof(GitSccOptions));
113 | using (TextWriter tw = new StreamWriter(configFileName))
114 | {
115 | x.Serialize(tw, this);
116 | }
117 | }
118 | catch { }
119 | }
120 |
121 | private string TryFindFile(string[] paths)
122 | {
123 | foreach (var path in paths)
124 | {
125 | if (File.Exists(path)) return path;
126 | }
127 | return null;
128 | }
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/GitApi/Log.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace Gitscc
8 | {
9 | public abstract class Log
10 | {
11 | private static string logFileName = Path.Combine(
12 | Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
13 | "gitscc.log");
14 |
15 | public static void WriteLine(string format, params object[] objects)
16 | {
17 | //#if(DEBUG)
18 | var msg = string.Format(format, objects);
19 | msg = string.Format("{0} {1}\r\n\r\n", DateTime.UtcNow.ToString(), msg);
20 | File.AppendAllText(logFileName, msg);
21 | //#endif
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/GitApi/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("GitApi")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("GitApi")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5d4ce710-e1fa-4b51-aa4e-f53ea8321466")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/GitUI/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/GitUI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 | using System.Reflection;
8 | using System.IO;
9 |
10 | namespace GitUI
11 | {
12 | ///
13 | /// Interaction logic for App.xaml
14 | ///
15 | public partial class App : Application
16 | {
17 | public App()
18 | {
19 | AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
20 | {
21 | String resourceName = "GitUI.Resources." + new AssemblyName(args.Name).Name + ".dll";
22 |
23 | using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
24 | {
25 | if (stream == null) return null;
26 |
27 | Byte[] assemblyData = new Byte[stream.Length];
28 | stream.Read(assemblyData, 0, assemblyData.Length);
29 | return Assembly.Load(assemblyData);
30 | }
31 | };
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/GitUI/HistoryViewCommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Input;
6 |
7 | namespace GitUI
8 | {
9 | public static class HistoryViewCommands
10 | {
11 | public static readonly RoutedUICommand CloseCommitDetails = new RoutedUICommand("CloseCommitDetails", "CloseCommitDetails", typeof(MainWindow));
12 | public static readonly RoutedUICommand OpenCommitDetails = new RoutedUICommand("OpenCommitDetails", "OpenCommitDetails", typeof(MainWindow));
13 | public static readonly RoutedUICommand SelectCommit = new RoutedUICommand("SelectCommit", "SelectCommit", typeof(MainWindow));
14 | public static readonly RoutedUICommand CompareCommits = new RoutedUICommand("CompareCommits", "CompareCommits", typeof(MainWindow));
15 | public static readonly RoutedUICommand ExportGraph = new RoutedUICommand("ExportGraph", "ExportGraph", typeof(MainWindow));
16 | public static readonly RoutedUICommand RefreshGraph = new RoutedUICommand("RefreshGraph", "RefreshGraph", typeof(MainWindow));
17 | public static readonly RoutedUICommand ScrollToCommit = new RoutedUICommand("ScrollToCommit", "ScrollToCommit", typeof(MainWindow));
18 | public static readonly RoutedUICommand GraphLoaded = new RoutedUICommand("GraphLoaded", "GraphLoaded", typeof(MainWindow));
19 | public static readonly RoutedUICommand PendingChanges = new RoutedUICommand("PendingChanges", "PendingChanges", typeof(MainWindow));
20 | public static readonly RoutedUICommand ShowMessage = new RoutedUICommand("ShowMessage", "ShowMessage", typeof(MainWindow));
21 | public static readonly RoutedUICommand OpenRepository = new RoutedUICommand("OpenRepository", "OpenRepository", typeof(MainWindow));
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/GitUI/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("GitUI")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("GitUI")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("2.0.0.0")]
55 | [assembly: AssemblyFileVersion("2.0.0.0")]
56 |
--------------------------------------------------------------------------------
/GitUI/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace GitUI.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GitUI.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/GitUI/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace GitUI.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/GitUI/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/GitUI/Resources/ICSharpCode.AvalonEdit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/GitUI/Resources/ICSharpCode.AvalonEdit.dll
--------------------------------------------------------------------------------
/GitUI/Resources/Loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/GitUI/Resources/Loading.png
--------------------------------------------------------------------------------
/GitUI/Resources/Microsoft.Windows.Shell.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/GitUI/Resources/Microsoft.Windows.Shell.dll
--------------------------------------------------------------------------------
/GitUI/Resources/Patch-Mode.xshd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Index:\s
12 |
13 |
14 | ==
15 |
16 |
17 | ---
18 |
19 |
20 | \+\+\+
21 |
22 |
23 | @@
24 |
25 |
26 | -
27 |
28 |
29 | \+
30 |
31 |
32 | \s
33 |
34 |
35 |
--------------------------------------------------------------------------------
/GitUI/Resources/dragon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/GitUI/Resources/dragon.png
--------------------------------------------------------------------------------
/GitUI/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/GitUI/UI/BottomToolBar.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GitUI/UI/BottomToolBar.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace GitUI.UI
16 | {
17 | ///
18 | /// Interaction logic for BottomToolBar.xaml
19 | ///
20 | public partial class BottomToolBar : UserControl
21 | {
22 | private GitViewModel gitViewModel;
23 | internal GitViewModel GitViewModel
24 | {
25 | set
26 | {
27 | gitViewModel = value;
28 | //this.txtDirectory.Text = gitViewModel.Tacker.GitWorkingDirectory;
29 | }
30 | }
31 | public BottomToolBar()
32 | {
33 | InitializeComponent();
34 | }
35 |
36 | private void btnGo_Click(object sender, RoutedEventArgs e)
37 | {
38 |
39 | }
40 |
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/GitUI/UI/BranchPicker.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/GitUI/UI/BranchPicker.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using GitScc.DataServices;
15 |
16 | namespace GitScc.UI
17 | {
18 | ///
19 | /// Interaction logic for BranchPicker.xaml
20 | ///
21 | public partial class BranchPicker : UserControl
22 | {
23 | private Window window;
24 | //private Repository repository;
25 | private List list;
26 |
27 | public string BranchName { get; set; }
28 | public bool CreateNew { get; set; }
29 |
30 | public BranchPicker(List list)
31 | {
32 | InitializeComponent();
33 | //this.repository = repository;
34 | this.list = list;
35 | }
36 |
37 | internal bool? Show()
38 | {
39 | window = new Window
40 | {
41 | Title = "Switch (checkout) branch",
42 | Content = this,
43 | WindowStartupLocation = WindowStartupLocation.CenterScreen,
44 | ResizeMode = System.Windows.ResizeMode.NoResize,
45 | Width = 350,
46 | Height = 200
47 | };
48 |
49 | comboBranches.ItemsSource = list.Where(r => r.Type == RefTypes.Branch).Select(r => r.Name);
50 | comboBranches.SelectedValue = repository.GetBranch();
51 | return window.ShowDialog();
52 | }
53 |
54 | private void comboBranches_SelectionChanged(object sender, SelectionChangedEventArgs e)
55 | {
56 | radioButton1.IsChecked = true;
57 | btnOK.IsEnabled = true;
58 | }
59 |
60 | private void txtNewBranch_GotFocus(object sender, RoutedEventArgs e)
61 | {
62 | radioButton2.IsChecked = true;
63 | btnOK.IsEnabled = txtNewBranch.Text.Length > 0;
64 | }
65 |
66 | private void txtNewBranch_TextChanged(object sender, TextChangedEventArgs e)
67 | {
68 | btnOK.IsEnabled = txtNewBranch.Text.Length > 0;
69 | }
70 |
71 | private void btnOK_Click(object sender, RoutedEventArgs e)
72 | {
73 | try
74 | {
75 | Git git = new Git(this.repository);
76 |
77 | git.Checkout().SetName(radioButton1.IsChecked == true ?
78 | comboBranches.SelectedValue.ToString() : txtNewBranch.Text)
79 | .SetCreateBranch(radioButton2.IsChecked == true)
80 | .Call();
81 |
82 | window.DialogResult = true;
83 | }
84 | catch (Exception ex)
85 | {
86 | MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
87 | }
88 | }
89 |
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitHead.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
21 |
22 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitHead.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using GitUI;
15 |
16 | namespace GitScc.UI
17 | {
18 | ///
19 | /// Interaction logic for CommitHead.xaml
20 | ///
21 | public partial class CommitHead : UserControl
22 | {
23 | public CommitHead()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void UserControl_Loaded(object sender, RoutedEventArgs e)
29 | {
30 | if (BranchName == "HEAD" || this.txtHead.Text == "*")
31 | {
32 | this.border.Background = this.border.BorderBrush =
33 | this.polygon.Fill = new SolidColorBrush(Color.FromArgb(128, 255, 0, 0));
34 | this.txtName.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
35 | this.txtHead.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
36 | this.menuCheckoutBranch.IsEnabled = this.menuDeleteBranch.IsEnabled =
37 | this.menuRebase.IsEnabled = false;
38 | }
39 | }
40 |
41 | private string BranchName { get { return this.txtName.Text; } }
42 |
43 | private void CheckoutBranch_Click(object sender, RoutedEventArgs e)
44 | {
45 | GitViewModel.Current.CheckoutBranch(BranchName);
46 | }
47 |
48 | private void DeleteBranch_Click(object sender, RoutedEventArgs e)
49 | {
50 | if (MessageBox.Show("Are you sure you want to delete branch: " + BranchName,
51 | "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
52 | {
53 | GitViewModel.Current.DeleteBranch(BranchName);
54 | }
55 | }
56 |
57 | private void Rebase_Click(object sender, RoutedEventArgs e)
58 | {
59 | var branch = GitViewModel.Current.Tracker.CurrentBranch;
60 |
61 | var result = MessageBox.Show("Are you sure you want to rebase current branch: " + branch
62 | + " on top of branch: " + BranchName + "?", "Rebase",
63 | MessageBoxButton.YesNo, MessageBoxImage.Warning);
64 |
65 | if (result == MessageBoxResult.Yes)
66 | {
67 | GitViewModel.Current.Rebase(BranchName);
68 | }
69 | }
70 |
71 | private void Merge_Click(object sender, RoutedEventArgs e)
72 | {
73 | var branch = GitViewModel.Current.Tracker.CurrentBranch;
74 |
75 | var result = MessageBox.Show("Are you sure you want to merge current branch: " + branch
76 | + " with branch: " + BranchName + "?", "Merge",
77 | MessageBoxButton.YesNo, MessageBoxImage.Warning);
78 |
79 | if (result == MessageBoxResult.Yes)
80 | {
81 | GitViewModel.Current.Merge(BranchName);
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitRemote.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitRemote.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace GitScc.UI
16 | {
17 | ///
18 | /// Interaction logic for CommitRemote.xaml
19 | ///
20 | public partial class CommitRemote : UserControl
21 | {
22 | public CommitRemote()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitTag.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GitUI/UI/CommitTag.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using GitUI;
15 |
16 | namespace GitScc.UI
17 | {
18 | ///
19 | /// Interaction logic for CommitTag.xaml
20 | ///
21 | public partial class CommitTag : UserControl
22 | {
23 | public CommitTag()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void DeleteTag_Click(object sender, RoutedEventArgs e)
29 | {
30 | dynamic tag = this.DataContext;
31 |
32 | if (MessageBox.Show("Are you sure you want to delete tag: " + tag.Name,
33 | "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
34 | {
35 | var ret = GitViewModel.Current.DeleteTag(tag.Name);
36 | HistoryViewCommands.ShowMessage.Execute(new { GitBashResult = ret }, this);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/GitUI/UI/GitConsole.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/GitUI/UI/HistoryGraph.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
32 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/GitUI/UI/Loading.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/GitUI/UI/Loading.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 |
15 | namespace GitScc.UI
16 | {
17 | ///
18 | /// Interaction logic for Loading.xaml
19 | ///
20 | public partial class Loading : UserControl
21 | {
22 | public Loading()
23 | {
24 | InitializeComponent();
25 | }
26 |
27 | internal void SetText(string text)
28 | {
29 | this.text1.Text = text;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GitUI/UI/MouseHandlingMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace GitScc.UI
7 | {
8 | ///
9 | /// Defines the current state of the mouse handling logic.
10 | ///
11 | public enum MouseHandlingMode
12 | {
13 | ///
14 | /// Not in any special mode.
15 | ///
16 | None,
17 |
18 | ///
19 | /// The user is left-dragging rectangles with the mouse.
20 | ///
21 | DraggingRectangles,
22 |
23 | ///
24 | /// The user is left-mouse-button-dragging to pan the viewport.
25 | ///
26 | Panning,
27 |
28 | ///
29 | /// The user is holding down shift and left-clicking or right-clicking to zoom in or out.
30 | ///
31 | Zooming,
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/GitUI/ZoomAndPan/AnimationHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Media.Animation;
7 |
8 | namespace ZoomAndPan
9 | {
10 | ///
11 | /// A helper class to simplify animation.
12 | ///
13 | public static class AnimationHelper
14 | {
15 | ///
16 | /// Starts an animation to a particular value on the specified dependency property.
17 | ///
18 | public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds)
19 | {
20 | StartAnimation(animatableElement, dependencyProperty, toValue, animationDurationSeconds, null);
21 | }
22 |
23 | ///
24 | /// Starts an animation to a particular value on the specified dependency property.
25 | /// You can pass in an event handler to call when the animation has completed.
26 | ///
27 | public static void StartAnimation(UIElement animatableElement, DependencyProperty dependencyProperty, double toValue, double animationDurationSeconds, EventHandler completedEvent)
28 | {
29 | double fromValue = (double)animatableElement.GetValue(dependencyProperty);
30 |
31 | DoubleAnimation animation = new DoubleAnimation();
32 | animation.From = fromValue;
33 | animation.To = toValue;
34 | animation.Duration = TimeSpan.FromSeconds(animationDurationSeconds);
35 |
36 | animation.Completed += delegate(object sender, EventArgs e)
37 | {
38 | //
39 | // When the animation has completed bake final value of the animation
40 | // into the property.
41 | //
42 | animatableElement.SetValue(dependencyProperty, animatableElement.GetValue(dependencyProperty));
43 | CancelAnimation(animatableElement, dependencyProperty);
44 |
45 | if (completedEvent != null)
46 | {
47 | completedEvent(sender, e);
48 | }
49 | };
50 |
51 | animation.Freeze();
52 |
53 | animatableElement.BeginAnimation(dependencyProperty, animation);
54 | }
55 |
56 | ///
57 | /// Cancel any animations that are running on the specified dependency property.
58 | ///
59 | public static void CancelAnimation(UIElement animatableElement, DependencyProperty dependencyProperty)
60 | {
61 | animatableElement.BeginAnimation(dependencyProperty, null);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/GitUI/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/GitUI/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/IntegrationTests.testsettings:
--------------------------------------------------------------------------------
1 |
2 |
7 | This test run configuration uses the VS IDE host type in the test run.
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2022 Yiyi Sun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/UnitTests.testsettings:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | This test run configuration is used for running the unit tests
9 |
10 |
--------------------------------------------------------------------------------
/VSIXProject2019/DiffClassifier/DiffClassifierProvider.cs:
--------------------------------------------------------------------------------
1 | //***************************************************************************
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | // This code is licensed under the Visual Studio SDK license terms.
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //***************************************************************************
11 |
12 | // Copyright (c) Microsoft Corporation
13 | // All rights reserved
14 |
15 | namespace DiffClassifier
16 | {
17 | using System.ComponentModel.Composition;
18 | using Microsoft.VisualStudio.Text;
19 | using Microsoft.VisualStudio.Text.Classification;
20 | using Microsoft.VisualStudio.Utilities;
21 |
22 | [Export(typeof(IClassifierProvider))]
23 | [ContentType("diff")]
24 | internal class DiffClassifierProvider : IClassifierProvider
25 | {
26 | [Import]
27 | internal IClassificationTypeRegistryService ClassificationRegistry = null;
28 |
29 | static DiffClassifier diffClassifier;
30 |
31 | public IClassifier GetClassifier(ITextBuffer buffer)
32 | {
33 | if (diffClassifier == null)
34 | diffClassifier = new DiffClassifier(ClassificationRegistry);
35 |
36 | return diffClassifier;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/VSIXProject2019/GitConsole.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/VSIXProject2019/GitSettings.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | Download Git
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Credential Helper
48 |
49 | Merge Tool
50 |
51 |
52 | ** Donate to the project **
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/VSIXProject2019/GitToolCommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace VSIXProject2019
7 | {
8 | class GitToolCommand
9 | {
10 | public CommandScope Scope { get; set; }
11 | public string Name { get; set; }
12 | public string Command { get; set; }
13 |
14 | public GitToolCommand(string name, string Command, CommandScope scope = CommandScope.Project)
15 | {
16 | this.Name = name;
17 | this.Command = Command;
18 | Scope = scope;
19 | }
20 | }
21 |
22 | public enum CommandScope
23 | {
24 | File, Project
25 | }
26 |
27 | static class GitToolCommands
28 | {
29 | internal static List GitTorCommands = new List {
30 | new GitToolCommand("TortoiseGit", "/command:log"),
31 | new GitToolCommand("Branch", "/command:branch"),
32 | new GitToolCommand("Commit", "/command:commit"),
33 | new GitToolCommand("Export", "/command:export"),
34 | new GitToolCommand("Merge", "/command:merge"),
35 | new GitToolCommand("Rebase", "/command:rebase"),
36 | new GitToolCommand("Resolve", "/command:resolve"),
37 | new GitToolCommand("Revert", "/command:revert"),
38 | new GitToolCommand("Show Log", "/command:log", CommandScope.File),
39 | new GitToolCommand("Switch", "/command:switch"),
40 | new GitToolCommand("Sync", "/command:sync"),
41 | new GitToolCommand("Tag", "/command:tag"),
42 | new GitToolCommand("Stash Save", "/command:stashsave"),
43 | new GitToolCommand("Stash Pop", "/command:stashpop"),
44 | new GitToolCommand("Stash List", "/command:reflog /ref:refs/stash"),
45 | };
46 |
47 | internal static List GitExtCommands = new List {
48 | new GitToolCommand("Git Extensions", "browse"),
49 | new GitToolCommand("Add Files", "add"),
50 | new GitToolCommand("Apply Patch", "applypatch"),
51 | new GitToolCommand("Browse", "browse"),
52 | new GitToolCommand("Create Branch", "branch"),
53 | new GitToolCommand("Checkout Branch", "checkout"),
54 | new GitToolCommand("Cherry Pick", "cherry"),
55 | new GitToolCommand("Commit", "commit"),
56 | new GitToolCommand("Edit .gitignore", "gitignore"),
57 | new GitToolCommand("Format Patch", "formatpatch"),
58 | new GitToolCommand("Manage Remotes", "remotes"),
59 | new GitToolCommand("Merge", "merge"),
60 | new GitToolCommand("Pull", "pull"),
61 | new GitToolCommand("Push", "push"),
62 | new GitToolCommand("Rebase", "rebase"),
63 | new GitToolCommand("Stash", "stash"),
64 | new GitToolCommand("Settings", "settings"),
65 | new GitToolCommand("Solve Merge Conflicts", "mergeconflicts"),
66 | };
67 |
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/VSIXProject2019/GitTracker.cs:
--------------------------------------------------------------------------------
1 | using GitScc;
2 | using System;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Timers;
6 |
7 | namespace VSIXProject2019
8 | {
9 | public delegate void ChangedEventHandler(GitTracker tracker);
10 |
11 | public class GitTracker: IDisposable
12 | {
13 | public static bool NoRefresh = false;
14 |
15 | public string Directory { get; }
16 | public GitRepository Repository { get; }
17 |
18 | public event ChangedEventHandler Changed;
19 |
20 | public GitTracker(string directory)
21 | {
22 | this.Directory = directory;
23 | this.Repository = new GitRepository(directory);
24 | WatchFileChanges();
25 | }
26 |
27 | public void Dispose()
28 | {
29 | Debug.WriteLine("GT ==== Dispose ");
30 | if (timer != null ) timer.Stop();
31 | UnWatchFileChanges();
32 | }
33 |
34 | Timer timer;
35 | FileSystemWatcher fileSystemWatcher;
36 | private void WatchFileChanges()
37 | {
38 | UnWatchFileChanges();
39 |
40 | if (!GitSccOptions.Current.DisableAutoRefresh)
41 | {
42 | Debug.WriteLine("GT ==== Monitoring: " + Directory);
43 |
44 | fileSystemWatcher = new FileSystemWatcher(Directory);
45 | fileSystemWatcher.IncludeSubdirectories = true;
46 | fileSystemWatcher.Deleted += new FileSystemEventHandler(fileSystemWatcher_Changed);
47 | fileSystemWatcher.Changed += new FileSystemEventHandler(fileSystemWatcher_Changed);
48 | fileSystemWatcher.EnableRaisingEvents = true;
49 | }
50 | }
51 |
52 | private void UnWatchFileChanges()
53 | {
54 | if (fileSystemWatcher != null)
55 | {
56 | Debug.WriteLine("GT ==== Strop Monitoring: " + Directory);
57 |
58 | fileSystemWatcher.Deleted -= new FileSystemEventHandler(fileSystemWatcher_Changed);
59 | fileSystemWatcher.Changed -= new FileSystemEventHandler(fileSystemWatcher_Changed);
60 | fileSystemWatcher.EnableRaisingEvents = false;
61 | fileSystemWatcher.Dispose();
62 | fileSystemWatcher = null;
63 | }
64 | }
65 |
66 | private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
67 | {
68 | if (!NoRefresh
69 | && !(e.Name.EndsWith(".git") && e.ChangeType == WatcherChangeTypes.Changed)
70 | && !e.Name.EndsWith(".lock")
71 | && !this.Repository.IsIgnored(e.FullPath))
72 | {
73 | Debug.WriteLine("GT ==== File system changed [" + e.ChangeType.ToString() + "]" + e.FullPath);
74 | if (timer != null)
75 | {
76 | timer.Stop();
77 | timer.Dispose();
78 | }
79 | timer = new Timer();
80 | timer.Interval = 500;
81 | timer.Elapsed += Timer_Elapsed;
82 | timer.AutoReset = false;
83 | timer.Start();
84 | }
85 | }
86 |
87 | private void Timer_Elapsed(object sender, ElapsedEventArgs e)
88 | {
89 | timer.Stop();
90 | Debug.WriteLine("GT ==== Timer_Elapsed - Fire Changed Event");
91 | Repository.Refresh();
92 | Changed(this);
93 | }
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/VSIXProject2019/Guids.cs:
--------------------------------------------------------------------------------
1 | // Guids.cs
2 | // MUST match guids.h
3 | using System;
4 |
5 | namespace VSIXProject2019
6 | {
7 | static class GuidList
8 | {
9 | public const string guidVsGitToolsPackagePkgString = "9C86573C-CB62-45D0-9C1A-DAD967BBBDC4";
10 | public const string guidVsGitToolsPackageCmdSetString = "31337E4B-26EB-4201-B411-80950E42165B";
11 | public const string guidToolWindowPersistanceString = "e0487501-8bf2-4e94-8b35-ceb6f0010c44";
12 |
13 | public static readonly Guid guidVsGitToolsPackageCmdSet = new Guid(guidVsGitToolsPackageCmdSetString);
14 | };
15 |
16 | static class PkgCmdIDList
17 | {
18 | public const int cmdidGitToolsWindow = 0x101;
19 |
20 | public const int icmdSccCommandGitBash = 0x102;
21 | public const int icmdSccCommandGitExtension = 0x103;
22 |
23 | public const int icmdSccCommandInit = 0x106;
24 | public const int icmdSccCommandPendingChanges = 0x107;
25 | public const int icmdSccCommandHistory = 0x108;
26 | public const int icmdSccCommandGitTortoise = 0x109;
27 | public const int icmdSccCommandEditIgnore = 0x110;
28 |
29 | public const int icmdPendingChangesCommit = 0x111;
30 | public const int icmdPendingChangesAmend = 0x112;
31 | public const int icmdPendingChangesCommitToBranch = 0x113;
32 |
33 | public const int icmdPendingChangesRefresh = 0x114;
34 | public const int icmdHistoryViewRefresh = 0x115;
35 | public const int icmdPendingChangesSettings = 0x116;
36 | public const int icmdSccCommandAbout = 0x119;
37 |
38 | public const int icmdGitExtCommand1 = 0x811;
39 | public const int icmdGitTorCommand1 = 0x911;
40 |
41 | public const int imnuGitChangesToolWindowToolbarMenu = 0x302;
42 |
43 | };
44 | }
--------------------------------------------------------------------------------
/VSIXProject2019/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("VSIXProject2019")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("VSIXProject2019")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("1.0.0.0")]
34 |
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Compare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Compare.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/GitChangesWindowCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/GitChangesWindowCommand.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/History.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/History.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Icon128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Icon128x128.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Images.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Yiyi Sun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Loading.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Package.ico
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/PendingCheckins.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/PendingCheckins.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Preview.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Refresh.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Settings.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/Switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/Switch.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/UndoCheckout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/UndoCheckout.png
--------------------------------------------------------------------------------
/VSIXProject2019/Resources/git_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/Resources/git_32.png
--------------------------------------------------------------------------------
/VSIXProject2019/art/command.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/art/command.png
--------------------------------------------------------------------------------
/VSIXProject2019/art/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2019/art/main.png
--------------------------------------------------------------------------------
/VSIXProject2019/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Git Tools 2019
6 | This extension provides a git changes window, and menus to launch Git Bash, Git Extenstions and TortoiseGit.
7 | https://github.com/yysun/git-tools
8 | Resources\LICENSE.txt
9 | Resources\Icon128x128.png
10 | Resources\Icon128x128.png
11 | sample, command
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/VSIXProject2022/DiffClassifier/DiffClassifierProvider.cs:
--------------------------------------------------------------------------------
1 | //***************************************************************************
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | // This code is licensed under the Visual Studio SDK license terms.
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //***************************************************************************
11 |
12 | // Copyright (c) Microsoft Corporation
13 | // All rights reserved
14 |
15 | namespace DiffClassifier
16 | {
17 | using System.ComponentModel.Composition;
18 | using Microsoft.VisualStudio.Text;
19 | using Microsoft.VisualStudio.Text.Classification;
20 | using Microsoft.VisualStudio.Utilities;
21 |
22 | [Export(typeof(IClassifierProvider))]
23 | [ContentType("diff")]
24 | internal class DiffClassifierProvider : IClassifierProvider
25 | {
26 | [Import]
27 | internal IClassificationTypeRegistryService ClassificationRegistry = null;
28 |
29 | static DiffClassifier diffClassifier;
30 |
31 | public IClassifier GetClassifier(ITextBuffer buffer)
32 | {
33 | if (diffClassifier == null)
34 | diffClassifier = new DiffClassifier(ClassificationRegistry);
35 |
36 | return diffClassifier;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/VSIXProject2022/GitConsole.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/VSIXProject2022/GitSettings.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | Download Git
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | Credential Helper
48 |
49 | Merge Tool
50 |
51 |
52 | ** Donate to the project **
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/VSIXProject2022/GitToolCommands.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace VSIXProject2022
4 | {
5 | class GitToolCommand
6 | {
7 | public CommandScope Scope { get; set; }
8 | public string Name { get; set; }
9 | public string Command { get; set; }
10 |
11 | public GitToolCommand(string name, string Command, CommandScope scope = CommandScope.Project)
12 | {
13 | this.Name = name;
14 | this.Command = Command;
15 | Scope = scope;
16 | }
17 | }
18 |
19 | public enum CommandScope
20 | {
21 | File, Project
22 | }
23 |
24 | static class GitToolCommands
25 | {
26 | internal static List GitTorCommands = new List {
27 | new GitToolCommand("TortoiseGit", "/command:log"),
28 | new GitToolCommand("Branch", "/command:branch"),
29 | new GitToolCommand("Commit", "/command:commit"),
30 | new GitToolCommand("Export", "/command:export"),
31 | new GitToolCommand("Merge", "/command:merge"),
32 | new GitToolCommand("Rebase", "/command:rebase"),
33 | new GitToolCommand("Resolve", "/command:resolve"),
34 | new GitToolCommand("Revert", "/command:revert"),
35 | new GitToolCommand("Show Log", "/command:log", CommandScope.File),
36 | new GitToolCommand("Switch", "/command:switch"),
37 | new GitToolCommand("Sync", "/command:sync"),
38 | new GitToolCommand("Tag", "/command:tag"),
39 | new GitToolCommand("Stash Save", "/command:stashsave"),
40 | new GitToolCommand("Stash Pop", "/command:stashpop"),
41 | new GitToolCommand("Stash List", "/command:reflog /ref:refs/stash"),
42 | };
43 |
44 | internal static List GitExtCommands = new List {
45 | new GitToolCommand("Git Extensions", "browse"),
46 | new GitToolCommand("Add Files", "add"),
47 | new GitToolCommand("Apply Patch", "applypatch"),
48 | new GitToolCommand("Browse", "browse"),
49 | new GitToolCommand("Create Branch", "branch"),
50 | new GitToolCommand("Checkout Branch", "checkout"),
51 | new GitToolCommand("Cherry Pick", "cherry"),
52 | new GitToolCommand("Commit", "commit"),
53 | new GitToolCommand("Edit .gitignore", "gitignore"),
54 | new GitToolCommand("Format Patch", "formatpatch"),
55 | new GitToolCommand("Manage Remotes", "remotes"),
56 | new GitToolCommand("Merge", "merge"),
57 | new GitToolCommand("Pull", "pull"),
58 | new GitToolCommand("Push", "push"),
59 | new GitToolCommand("Rebase", "rebase"),
60 | new GitToolCommand("Stash", "stash"),
61 | new GitToolCommand("Settings", "settings"),
62 | new GitToolCommand("Solve Merge Conflicts", "mergeconflicts"),
63 | };
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/VSIXProject2022/GitTracker.cs:
--------------------------------------------------------------------------------
1 | using GitScc;
2 | using System;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Timers;
6 | namespace VSIXProject2022
7 | {
8 | public delegate void ChangedEventHandler(GitTracker tracker);
9 |
10 | public class GitTracker : IDisposable
11 | {
12 | public static bool NoRefresh = false;
13 |
14 | public string Directory { get; }
15 | public GitRepository Repository { get; }
16 |
17 | public event ChangedEventHandler Changed;
18 |
19 | public GitTracker(string directory)
20 | {
21 | this.Directory = directory;
22 | this.Repository = new GitRepository(directory);
23 | WatchFileChanges();
24 | }
25 |
26 | public void Dispose()
27 | {
28 | Debug.WriteLine("GT ==== Dispose ");
29 | if (timer != null) timer.Stop();
30 | UnWatchFileChanges();
31 | }
32 |
33 | Timer timer;
34 | FileSystemWatcher fileSystemWatcher;
35 | private void WatchFileChanges()
36 | {
37 | UnWatchFileChanges();
38 |
39 | if (!GitSccOptions.Current.DisableAutoRefresh)
40 | {
41 | Debug.WriteLine("GT ==== Monitoring: " + Directory);
42 |
43 | fileSystemWatcher = new FileSystemWatcher(Directory);
44 | fileSystemWatcher.IncludeSubdirectories = true;
45 | fileSystemWatcher.Deleted += new FileSystemEventHandler(fileSystemWatcher_Changed);
46 | fileSystemWatcher.Changed += new FileSystemEventHandler(fileSystemWatcher_Changed);
47 | fileSystemWatcher.EnableRaisingEvents = true;
48 | }
49 | }
50 |
51 | private void UnWatchFileChanges()
52 | {
53 | if (fileSystemWatcher != null)
54 | {
55 | Debug.WriteLine("GT ==== Strop Monitoring: " + Directory);
56 |
57 | fileSystemWatcher.Deleted -= new FileSystemEventHandler(fileSystemWatcher_Changed);
58 | fileSystemWatcher.Changed -= new FileSystemEventHandler(fileSystemWatcher_Changed);
59 | fileSystemWatcher.EnableRaisingEvents = false;
60 | fileSystemWatcher.Dispose();
61 | fileSystemWatcher = null;
62 | }
63 | }
64 |
65 | private void fileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
66 | {
67 | if (!NoRefresh
68 | && !(e.Name.EndsWith(".git") && e.ChangeType == WatcherChangeTypes.Changed)
69 | && !e.Name.EndsWith(".lock")
70 | && !this.Repository.IsIgnored(e.FullPath))
71 | {
72 | Debug.WriteLine("GT ==== File system changed [" + e.ChangeType.ToString() + "]" + e.FullPath);
73 | if (timer != null)
74 | {
75 | timer.Stop();
76 | timer.Dispose();
77 | }
78 | timer = new Timer();
79 | timer.Interval = 500;
80 | timer.Elapsed += Timer_Elapsed;
81 | timer.AutoReset = false;
82 | timer.Start();
83 | }
84 | }
85 |
86 | private void Timer_Elapsed(object sender, ElapsedEventArgs e)
87 | {
88 | timer.Stop();
89 | Debug.WriteLine("GT ==== Timer_Elapsed - Fire Changed Event");
90 | Repository.Refresh();
91 | Changed(this);
92 | }
93 |
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/VSIXProject2022/Guids.cs:
--------------------------------------------------------------------------------
1 | // Guids.cs
2 | // MUST match guids.h
3 | using System;
4 |
5 | namespace VSIXProject2022
6 | {
7 | static class GuidList
8 | {
9 | public const string guidVsGitToolsPackagePkgString = "9C86573C-CB62-45D0-9C1A-DAD967BBBDC4";
10 | public const string guidVsGitToolsPackageCmdSetString = "31337E4B-26EB-4201-B411-80950E42165B";
11 | public const string guidToolWindowPersistanceString = "e0487501-8bf2-4e94-8b35-ceb6f0010c44";
12 |
13 | public static readonly Guid guidVsGitToolsPackageCmdSet = new Guid(guidVsGitToolsPackageCmdSetString);
14 | };
15 |
16 | static class PkgCmdIDList
17 | {
18 | public const int cmdidGitToolsWindow = 0x101;
19 |
20 | public const int icmdSccCommandGitBash = 0x102;
21 | public const int icmdSccCommandGitExtension = 0x103;
22 |
23 | public const int icmdSccCommandInit = 0x106;
24 | public const int icmdSccCommandPendingChanges = 0x107;
25 | public const int icmdSccCommandHistory = 0x108;
26 | public const int icmdSccCommandGitTortoise = 0x109;
27 | public const int icmdSccCommandEditIgnore = 0x110;
28 |
29 | public const int icmdPendingChangesCommit = 0x111;
30 | public const int icmdPendingChangesAmend = 0x112;
31 | public const int icmdPendingChangesCommitToBranch = 0x113;
32 |
33 | public const int icmdPendingChangesRefresh = 0x114;
34 | public const int icmdHistoryViewRefresh = 0x115;
35 | public const int icmdPendingChangesSettings = 0x116;
36 | public const int icmdSccCommandAbout = 0x119;
37 |
38 | public const int icmdGitExtCommand1 = 0x811;
39 | public const int icmdGitTorCommand1 = 0x911;
40 |
41 | public const int imnuGitChangesToolWindowToolbarMenu = 0x302;
42 |
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/VSIXProject2022/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("VSIXProject2022")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("VSIXProject2022")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.0.0.0")]
33 | [assembly: AssemblyFileVersion("1.0.0.0")]
34 |
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Compare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Compare.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/GitChangesWindowCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/GitChangesWindowCommand.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/History.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/History.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Icon128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Icon128x128.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Images.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Yiyi Sun
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Loading.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Package.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Package.ico
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/PendingCheckins.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/PendingCheckins.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Preview.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Refresh.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Settings.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/Switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/Switch.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/UndoCheckout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/UndoCheckout.png
--------------------------------------------------------------------------------
/VSIXProject2022/Resources/git_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/Resources/git_32.png
--------------------------------------------------------------------------------
/VSIXProject2022/art/command.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/art/command.png
--------------------------------------------------------------------------------
/VSIXProject2022/art/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VSIXProject2022/art/main.png
--------------------------------------------------------------------------------
/VSIXProject2022/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Git Tools 2022
6 | This extension provides a git changes window, and menus to launch Git Bash, Git Extenstions and TortoiseGit.
7 | https://github.com/yysun/git-tools
8 | Resources\LICENSE.txt
9 | Resources\Icon128x128.png
10 | Resources\Icon128x128.png
11 | git
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/VsGitToolsPackage.Tests/DiffToolTest.cs:
--------------------------------------------------------------------------------
1 | using GitScc;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 |
10 | namespace VsGitToolsPackage.Tests
11 | {
12 | [TestClass]
13 | public class DiffToolTest
14 | {
15 | DiffTool tool = new DiffTool();
16 | string[] diffLines = @"diff --get ...
17 | index ...
18 | --- ...
19 | +++ ...
20 | @@ -1,2 +1,2 @@ ...
21 | 1
22 | 2
23 | 3
24 | -1
25 | +1
26 | +2
27 | -2
28 | 4
29 | 5
30 | 6
31 | @@ -10,10 +20,10 @@ ...
32 | a
33 | b
34 | c
35 | -a
36 | +a
37 | +b
38 | -b
39 | d
40 | e
41 | f
42 | ".Replace("\r", "").Split('\n');
43 |
44 | [TestMethod]
45 | public void DiffTool_Should_ParseHunks()
46 | {
47 | var hunks = tool.Parse(diffLines);
48 | Assert.AreEqual(2, hunks.Count());
49 |
50 | Assert.AreEqual(5, hunks[0].FirstLineIndex);
51 | Assert.AreEqual(14, hunks[0].LastLineIndex);
52 | Assert.AreEqual(1, hunks[0].OldBlock[0]);
53 | Assert.AreEqual(2, hunks[0].OldBlock[1]);
54 | Assert.AreEqual(1, hunks[0].NewBlock[0]);
55 | Assert.AreEqual(2, hunks[0].NewBlock[1]);
56 | Assert.AreEqual(16, hunks[1].FirstLineIndex);
57 | Assert.AreEqual(26, hunks[1].LastLineIndex);
58 | Assert.AreEqual(10, hunks[1].OldBlock[0]);
59 | Assert.AreEqual(10, hunks[1].OldBlock[1]);
60 | Assert.AreEqual(20, hunks[1].NewBlock[0]);
61 | Assert.AreEqual(10, hunks[1].NewBlock[1]);
62 | }
63 |
64 | [TestMethod]
65 | public void DiffTool_Should_Find_Hunk()
66 | {
67 | var hunks = tool.GetHunks(diffLines, 9, 9).ToArray();
68 | Assert.AreEqual(1, hunks.Length);
69 | hunks = tool.GetHunks(diffLines, 1, 14).ToArray();
70 | Assert.AreEqual(1, hunks.Length);
71 | hunks = tool.GetHunks(diffLines, 12, 12).ToArray();
72 | Assert.AreEqual(1, hunks.Length);
73 | }
74 |
75 | [TestMethod]
76 | public void DiffTool_Should_Find_Hunks()
77 | {
78 | var hunks = tool.GetHunks(diffLines, 10, 20).ToArray();
79 | Assert.AreEqual(2, hunks.Length);
80 | hunks = tool.GetHunks(diffLines, 1, 100).ToArray();
81 | Assert.AreEqual(2, hunks.Length);
82 | }
83 |
84 | [TestMethod]
85 | public void DiffTool_Should_Not_Find_Hunks()
86 | {
87 | var hunks = tool.GetHunks(diffLines, 1, 1).ToArray();
88 | Assert.AreEqual(0, hunks.Length);
89 | hunks = tool.GetHunks(diffLines, 2, 4).ToArray();
90 | Assert.AreEqual(0, hunks.Length);
91 | hunks = tool.GetHunks(diffLines, 5, 5).ToArray();
92 | Assert.AreEqual(0, hunks.Length);
93 | hunks = tool.GetHunks(diffLines, 5, 7).ToArray();
94 | Assert.AreEqual(0, hunks.Length);
95 | hunks = tool.GetHunks(diffLines, 13, 19).ToArray();
96 | Assert.AreEqual(0, hunks.Length);
97 | hunks = tool.GetHunks(diffLines, 24, 100).ToArray();
98 | Assert.AreEqual(0, hunks.Length);
99 | }
100 |
101 | [TestMethod]
102 | public void DiffTool_Should_Adjust_New_Block()
103 | {
104 | var hunks = tool.GetHunks(diffLines, 20, 20).ToArray();
105 | Assert.AreEqual(1, hunks.Length);
106 | Assert.AreEqual(7, hunks[0].NewBlock[1]);
107 | Assert.AreEqual(8, hunks[0].Lines.Count());
108 | hunks = tool.GetHunks(diffLines, 21, 21).ToArray();
109 | Assert.AreEqual(1, hunks.Length);
110 | Assert.AreEqual(9, hunks[0].NewBlock[1]);
111 | Assert.AreEqual(9, hunks[0].Lines.Count());
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/VsGitToolsPackage.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("VsGitToolsPackage.Tests")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("VsGitToolsPackage.Tests")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("172c3758-97a2-48dd-b622-ed2ca1e58581")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/VsGitToolsPackage.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/DiffClassifier/DiffClassifierProvider.cs:
--------------------------------------------------------------------------------
1 | //***************************************************************************
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | // This code is licensed under the Visual Studio SDK license terms.
5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 | //
10 | //***************************************************************************
11 |
12 | // Copyright (c) Microsoft Corporation
13 | // All rights reserved
14 |
15 | namespace DiffClassifier
16 | {
17 | using System.ComponentModel.Composition;
18 | using Microsoft.VisualStudio.Text;
19 | using Microsoft.VisualStudio.Text.Classification;
20 | using Microsoft.VisualStudio.Utilities;
21 |
22 | [Export(typeof(IClassifierProvider))]
23 | [ContentType("diff")]
24 | internal class DiffClassifierProvider : IClassifierProvider
25 | {
26 | [Import]
27 | internal IClassificationTypeRegistryService ClassificationRegistry = null;
28 |
29 | static DiffClassifier diffClassifier;
30 |
31 | public IClassifier GetClassifier(ITextBuffer buffer)
32 | {
33 | if (diffClassifier == null)
34 | diffClassifier = new DiffClassifier(ClassificationRegistry);
35 |
36 | return diffClassifier;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/GitConsole.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
15 |
16 |
17 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/GitToolCommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace GitScc
7 | {
8 | class GitToolCommand
9 | {
10 | public CommandScope Scope { get; set; }
11 | public string Name { get; set; }
12 | public string Command { get; set; }
13 |
14 | public GitToolCommand(string name, string Command, CommandScope scope = CommandScope.Project)
15 | {
16 | this.Name = name;
17 | this.Command = Command;
18 | Scope = scope;
19 | }
20 | }
21 |
22 | public enum CommandScope
23 | {
24 | File, Project
25 | }
26 |
27 | static class GitToolCommands
28 | {
29 | internal static List GitTorCommands = new List {
30 | new GitToolCommand("TortoiseGit", "/command:log"), // workaround to missing of the first command in menu
31 | new GitToolCommand("Branch", "/command:branch"),
32 | new GitToolCommand("Commit", "/command:commit"),
33 | new GitToolCommand("Export", "/command:export"),
34 | new GitToolCommand("Merge", "/command:merge"),
35 | new GitToolCommand("Rebase", "/command:rebase"),
36 | new GitToolCommand("Resolve", "/command:resolve"),
37 | new GitToolCommand("Revert", "/command:revert"),
38 | new GitToolCommand("Show Log", "/command:log", CommandScope.File),
39 | new GitToolCommand("Switch", "/command:switch"),
40 | new GitToolCommand("Sync", "/command:sync"),
41 | new GitToolCommand("Tag", "/command:tag"),
42 | new GitToolCommand("Stash Save", "/command:stashsave"),
43 | new GitToolCommand("Stash Pop", "/command:stashpop"),
44 | new GitToolCommand("Stash List", "/command:reflog /ref:refs/stash"),
45 | };
46 |
47 | internal static List GitExtCommands = new List {
48 | new GitToolCommand("Git Extensions", "browse"), // workaround to missing of the first command in menu
49 | new GitToolCommand("Add Files", "add"),
50 | new GitToolCommand("Apply Patch", "applypatch"),
51 | new GitToolCommand("Browse", "browse"),
52 | new GitToolCommand("Create Branch", "branch"),
53 | new GitToolCommand("Checkout Branch", "checkout"),
54 | new GitToolCommand("Cherry Pick", "cherry"),
55 | new GitToolCommand("Commit", "commit"),
56 | new GitToolCommand("Edit .gitignore", "gitignore"),
57 | new GitToolCommand("Format Patch", "formatpatch"),
58 | new GitToolCommand("Manage Remotes", "remotes"),
59 | new GitToolCommand("Merge", "merge"),
60 | new GitToolCommand("Pull", "pull"),
61 | new GitToolCommand("Push", "push"),
62 | new GitToolCommand("Rebase", "rebase"),
63 | new GitToolCommand("Stash", "stash"),
64 | new GitToolCommand("Settings", "settings"),
65 | new GitToolCommand("Solve Merge Conflicts", "mergeconflicts"),
66 | };
67 |
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is used by Code Analysis to maintain SuppressMessage
2 | // attributes that are applied to this project. Project-level
3 | // suppressions either have no target or are given a specific target
4 | // and scoped to a namespace, type, member, etc.
5 | //
6 | // To add a suppression to this file, right-click the message in the
7 | // Error List, point to "Suppress Message(s)", and click "In Project
8 | // Suppression File". You do not need to add suppressions to this
9 | // file manually.
10 |
11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")]
12 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/Guids.cs:
--------------------------------------------------------------------------------
1 | // Guids.cs
2 | // MUST match guids.h
3 | using System;
4 |
5 | namespace F1SYS.VsGitToolsPackage
6 | {
7 | static class GuidList
8 | {
9 | public const string guidVsGitToolsPackagePkgString = "54edbb65-f9f1-410f-b936-0ac28cfe4b1c";
10 | public const string guidVsGitToolsPackageCmdSetString = "75db012c-8d8d-4287-89e1-802a537f08eb";
11 | public const string guidToolWindowPersistanceString = "11dffb59-3169-48ac-9676-2916d06a36de";
12 |
13 | public static readonly Guid guidVsGitToolsPackageCmdSet = new Guid(guidVsGitToolsPackageCmdSetString);
14 | };
15 | }
--------------------------------------------------------------------------------
/VsGitToolsPackage/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yysun/git-tools/c65c3ee5fd341fc8caffa93b4da5cfc2e3be0b4b/VsGitToolsPackage/Key.snk
--------------------------------------------------------------------------------
/VsGitToolsPackage/PkgCmdID.cs:
--------------------------------------------------------------------------------
1 | // PkgCmdID.cs
2 | // MUST match PkgCmdID.h
3 | using System;
4 |
5 | namespace F1SYS.VsGitToolsPackage
6 | {
7 | static class PkgCmdIDList
8 | {
9 | public const uint cmdidGitToolsWindow = 0x101;
10 |
11 | public const int icmdSccCommandGitBash = 0x102;
12 | public const int icmdSccCommandGitExtension = 0x103;
13 |
14 | public const int icmdSccCommandInit = 0x106;
15 | public const int icmdSccCommandPendingChanges = 0x107;
16 | public const int icmdSccCommandHistory = 0x108;
17 | public const int icmdSccCommandGitTortoise = 0x109;
18 | public const int icmdSccCommandEditIgnore = 0x110;
19 |
20 | public const int icmdPendingChangesCommit = 0x111;
21 | public const int icmdPendingChangesAmend = 0x112;
22 | public const int icmdPendingChangesCommitToBranch = 0x113;
23 |
24 | public const int icmdPendingChangesRefresh = 0x114;
25 | public const int icmdHistoryViewRefresh = 0x115;
26 | public const int icmdPendingChangesSettings = 0x116;
27 | public const int icmdSccCommandAbout = 0x119;
28 |
29 | public const int icmdGitExtCommand1 = 0x811;
30 | public const int icmdGitTorCommand1 = 0x911;
31 |
32 | public const int imnuGitChangesToolWindowToolbarMenu = 0x302;
33 |
34 | };
35 | }
--------------------------------------------------------------------------------
/VsGitToolsPackage/PlatformUI/HeaderColors.cs:
--------------------------------------------------------------------------------
1 | namespace GitScc.PlatformUI
2 | {
3 | using System.Diagnostics;
4 | using Microsoft.VisualStudio.Shell;
5 |
6 | public static class HeaderColors
7 | {
8 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
9 | public static object SeparatorLineBrushKey
10 | {
11 | get
12 | {
13 | return GetResourceKey("SeparatorLineBrushKey", VsBrushes.CommandBarMenuSeparatorKey);
14 | }
15 | }
16 |
17 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
18 | public static object MouseOverBrushKey
19 | {
20 | get
21 | {
22 | return GetResourceKey("MouseOverBrushKey", VsBrushes.CommandBarMouseOverBackgroundGradientKey);
23 | }
24 | }
25 |
26 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
27 | public static object MouseOverTextBrushKey
28 | {
29 | get
30 | {
31 | return GetResourceKey("MouseOverTextBrushKey", VsBrushes.ButtonTextKey);
32 | }
33 | }
34 |
35 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
36 | public static object MouseDownBrushKey
37 | {
38 | get
39 | {
40 | return GetResourceKey("MouseDownBrushKey", VsBrushes.CommandBarMouseDownBackgroundGradientKey);
41 | }
42 | }
43 |
44 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
45 | public static object MouseDownTextBrushKey
46 | {
47 | get
48 | {
49 | return GetResourceKey("MouseDownTextBrushKey", VsBrushes.ButtonTextKey);
50 | }
51 | }
52 |
53 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
54 | public static object GlyphBrushKey
55 | {
56 | get
57 | {
58 | return GetResourceKey("GlyphBrushKey", VsBrushes.ButtonTextKey);
59 | }
60 | }
61 |
62 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
63 | public static object MouseOverGlyphBrushKey
64 | {
65 | get
66 | {
67 | return GetResourceKey("MouseOverGlyphBrushKey", VsBrushes.ButtonTextKey);
68 | }
69 | }
70 |
71 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
72 | public static object MouseDownGlyphBrushKey
73 | {
74 | get
75 | {
76 | return GetResourceKey("MouseDownGlyphBrushKey", VsBrushes.ButtonTextKey);
77 | }
78 | }
79 |
80 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
81 | public static object DefaultBrushKey
82 | {
83 | get
84 | {
85 | return GetResourceKey("DefaultBrushKey", VsBrushes.CommandBarMenuBackgroundGradientKey);
86 | }
87 | }
88 |
89 | [DebuggerBrowsable(DebuggerBrowsableState.Never)]
90 | public static object DefaultTextBrushKey
91 | {
92 | get
93 | {
94 | return GetResourceKey("DefaultTextBrushKey", VsBrushes.ButtonTextKey);
95 | }
96 | }
97 |
98 | private static object GetResourceKey(string resourceName, object defaultKey)
99 | {
100 | return PlatformColorHelper.GetResourceKey(typeof(HeaderColors), resourceName) ?? defaultKey;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/VsGitToolsPackage/PlatformUI/PlatformColorHelper.cs:
--------------------------------------------------------------------------------
1 | namespace GitScc.PlatformUI
2 | {
3 | using System;
4 | using System.Collections.Concurrent;
5 | using System.Reflection;
6 |
7 | public class PlatformColorHelper
8 | {
9 | private static readonly ConcurrentDictionary _helpers =
10 | new ConcurrentDictionary();
11 |
12 | private readonly ConcurrentDictionary> _propertyAccessors =
13 | new ConcurrentDictionary>();
14 | private readonly Type _platformType;
15 |
16 | private PlatformColorHelper(Type platformType)
17 | {
18 | if (platformType == null)
19 | throw new ArgumentNullException("platformType");
20 |
21 | _platformType = platformType;
22 | }
23 |
24 | public static object GetResourceKey(Type type, string resourceName)
25 | {
26 | PlatformColorHelper helper = _helpers.GetOrAdd(type, LookupPlatformColorHelper);
27 | if (helper == null)
28 | return null;
29 |
30 | return helper.GetResourceKey(resourceName);
31 | }
32 |
33 | private object GetResourceKey(string resourceName)
34 | {
35 | Func