├── .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 |