예제 #1
0
        private string GetHelp(StatusCharacterMap statusCharacterMap)
        {
            return($@"
RepoZ is showing all git repositories found on local drives. Each repository is listed with a status string which could look like this:

    current_branch  [i]   +1   ~2   -3   |   +4   ~5   -6 


current_branch
The current branch or the SHA of a detached HEAD.

[i] Represents the branch status in relation to its remote (tracked origin) branch.

[i] =  {statusCharacterMap.IdenticalSign}
The local branch is at the same commit level as the remote branch.

[i] =  {statusCharacterMap.ArrowUpSign}<num>
The local branch is ahead of the remote branch by the specified number of commits; a 'git push' is required to update the remote branch.

[i] =  {statusCharacterMap.ArrowDownSign}<num>
The local branch is behind the remote branch by the specified number of commits; a 'git pull' is required to update the local branch.

[i] =  {statusCharacterMap.NoUpstreamSign}
The local branch has no upstream branch. 'git push' needs to be called with '--set-upstream' to push changes to a remote branch.

The following numbers represent added (+1), modified (~2) and removed files (-3) from the index.
The numbers after the pipe sign represent added (+4), modified (~5) and removed files (-6) on the working directory.

Please note:
This information reflects the state of the remote tracked branch after the last git fetch/pull of the remote.
Note that the status might be shorter if possible to improve readablility.

");
        }
예제 #2
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider)
        {
            InitializeComponent();

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider = repositoryActionProvider;

            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            txtHelp.Text = GetHelp(statusCharacterMap);

            PlaceFormToLowerRight();
        }
예제 #3
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider,
                          IRepositoryIgnoreStore repositoryIgnoreStore,
                          IAppSettingsService appSettingsService)
        {
            InitializeComponent();

            DataContext = new MainWindowPageModel(appSettingsService);
            SettingsMenu.DataContext = DataContext;             // this is out of the visual tree

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider   = repositoryActionProvider ?? throw new ArgumentNullException(nameof(repositoryActionProvider));
            _repositoryIgnoreStore      = repositoryIgnoreStore ?? throw new ArgumentNullException(nameof(repositoryIgnoreStore));
            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            txtHelp.Text = GetHelp(statusCharacterMap);

            PlaceFormToLowerRight();
        }
예제 #4
0
 private string GetHelp(StatusCharacterMap statusCharacterMap)
 {
     return(_translationService.Translate("Help Detail",
                                          statusCharacterMap.IdenticalSign,
                                          statusCharacterMap.StashSign,
                                          statusCharacterMap.IdenticalSign,
                                          statusCharacterMap.ArrowUpSign,
                                          statusCharacterMap.ArrowDownSign,
                                          statusCharacterMap.NoUpstreamSign,
                                          statusCharacterMap.StashSign));
 }
예제 #5
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider,
                          IRepositoryIgnoreStore repositoryIgnoreStore,
                          IAppSettingsService appSettingsService,
                          ITranslationService translationService)
        {
            _translationService = translationService;

            InitializeComponent();

            AcrylicWindow.SetAcrylicWindowStyle(this, AcrylicWindowStyle.None);

            DataContext = new MainWindowPageModel(appSettingsService);
            SettingsMenu.DataContext = DataContext;             // this is out of the visual tree

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider   = repositoryActionProvider ?? throw new ArgumentNullException(nameof(repositoryActionProvider));
            _repositoryIgnoreStore      = repositoryIgnoreStore ?? throw new ArgumentNullException(nameof(repositoryIgnoreStore));
            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            var appName = System.Reflection.Assembly.GetEntryAssembly().GetName();

            txtHelpCaption.Text = appName.Name + " " + appName.Version.ToString(2);
            txtHelp.Text        = GetHelp(statusCharacterMap);

            PlaceFormByTaskbarLocation();
        }
예제 #6
0
        public RepositoriesView(IEnumerable <RepoZ.Ipc.Repository> repositories)
        {
            var repositoryCount = repositories.Count();

            _repositoryViews = new RepositoryView[repositoryCount];

            _map = new StatusCharacterMap();

            var maxRepoNameLength    = Math.Min(MAX_REPO_NAME_LENGTH, repositories.Max(r => r.Name?.Length ?? 0));
            var maxIndexStringLength = repositoryCount.ToString().Length;
            var writeIndex           = repositoryCount > 1;

            for (int i = 0; i < repositoryCount; i++)
            {
                var userIndex  = i + 1;                // the index visible to the user are 1-based, not 0-based;
                var repository = repositories.ElementAt(i);

                string repoName = (repository.Name.Length > MAX_REPO_NAME_LENGTH)
                                        ? repository.Name.Substring(0, MAX_REPO_NAME_LENGTH) + _map.EllipsesSign
                                        : repository.Name;

                var index = "";
                if (writeIndex)
                {
                    index = $"[{userIndex.ToString().PadLeft(maxIndexStringLength)}]  ";
                }

                var name   = repoName.PadRight(maxRepoNameLength + 3);
                var branch = repository.BranchWithStatus;

                var displayText = index + Clean(name) + Clean(branch);

                _repositoryViews[i] = new RepositoryView(repository)
                {
                    DisplayText = displayText
                };
            }
        }
예제 #7
0
 public void Setup()
 {
     _repo = new RepositoryBuilder().BuildFullFeatured();
     _view = new RepositoryView(_repo);
     _statusCharacterMap = new StatusCharacterMap();
 }
예제 #8
0
 public void Setup()
 {
     _builder      = new RepositoryBuilder();
     _characterMap = new StatusCharacterMap();
     _compressor   = new StatusCompressor(_characterMap);
 }