Example #1
0
        private static BlameOptions GetDefault()
        {
            var options = new BlameOptions();

            options.Freeze();
            return(options);
        }
Example #2
0
 public GitReporter(BlameOptions options)
 {
     _gitPath              = options.Git;
     _new                  = options.New;
     _old                  = options.Old;
     _baseCommit           = options.BaseCommit;
     _headCommit           = options.HeadCommit;
     _relativeSolutionPath = options.Solution;
 }
Example #3
0
        public BlameFileBinding(IBlameSource blameSource, BlameViewer blameViewer, BlameOptions blameOptions)
        {
            Verify.Argument.IsNotNull(blameSource, nameof(blameSource));
            Verify.Argument.IsNotNull(blameViewer, nameof(blameViewer));
            Verify.Argument.IsNotNull(blameOptions, nameof(blameOptions));

            BlameSource    = blameSource;
            BlameViewer    = blameViewer;
            _blameOptions  = blameOptions;
            _progressPanel = new FlowProgressPanel();

            Progress = _progressPanel.ProgressMonitor;
        }
Example #4
0
 public BlameHunkCollection Blame(string path, BlameOptions options) =>
 repository.Blame(path, options);
Example #5
0
 public BlameHunkCollection Blame(string path, BlameOptions options)
 {
     return(repositoryInstance.Blame(path, options));
 }
Example #6
0
 public BlameHunkCollection Blame(string path, BlameOptions options = null)
 {
     throw new NotImplementedException();
 }
Example #7
0
        public MainWindow()
        {
            var bo = new BlameOptions();

            _options = GitGooeyOptions.Load();

            AppDomain.CurrentDomain.ProcessExit += (e, s) => {
                _options.Save();
            };

            var args = Environment.GetCommandLineArgs();

            var filename = args[1];

            InitializeComponent();

            filename = Path.IsPathRooted(filename)
                ? filename
                : Path.Combine(Directory.GetCurrentDirectory(), filename);

            var directoryHistory = new List <string>(
                Path.GetDirectoryName(filename)
                .Split(Path.DirectorySeparatorChar));

            string gitDir = null;

            while (directoryHistory.Count > 0)
            {
                var testDir = string.Join(
                    Path.DirectorySeparatorChar + "", directoryHistory);

                if (Directory.GetDirectories(testDir, ".git").Any())
                {
                    gitDir = testDir;
                    break;
                }

                directoryHistory.RemoveAt(directoryHistory.Count - 1);
            }

            if (gitDir == null)
            {
                throw new Exception("File not in git.");
            }

            // +1 to eat the directory char.
            filename = filename.Substring(gitDir.Length + 1);

            Title = $"GitGooey - {filename}";

            _repo    = new Repository(gitDir);
            _history = new GitGooeyHistory(_repo, filename);

            var m = _repo.Blame(filename, bo);

            _blameHunks = m.ToArray();

            var existingChangesetShas = new HashSet <string>();

            foreach (var asd in PatchDisplay
                     .FromBlameHunks(filename, _blameHunks, existingChangesetShas))
            {
                Patches.Add(asd);
            }

            UXPatchDisplay.Document = new FlowDocument(_viewerParagraph);

            DataContext = this;

            if (_options.WindowWidth > 0 && _options.WindowHeight > 0)
            {
                Width  = _options.WindowWidth;
                Height = _options.WindowHeight;
            }
        }
        private static void Run(BlameOptions options)
        {
            var reporter = new GitReporter(options);

            reporter.RunAsync().Wait();
        }