Exemple #1
0
        public RepositoryManager(IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.repositoryPaths = repositoryPaths;
            this.gitClient       = gitClient;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            SetupWatcher();
        }
Exemple #2
0
        public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.repositoryPaths = repositoryPaths;
            this.platform        = platform;
            this.taskManager     = taskManager;
            this.gitClient       = gitClient;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            SetupWatcher();
        }
Exemple #3
0
        public RepositoryManager(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker, IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths, CancellationToken cancellationToken)
        {
            this.repositoryPaths   = repositoryPaths;
            this.platform          = platform;
            this.taskManager       = taskManager;
            this.usageTracker      = usageTracker;
            this.cancellationToken = cancellationToken;
            this.gitClient         = gitClient;

            config = gitConfig;

            watcher = repositoryWatcher;

            watcher.HeadChanged         += HeadChanged;
            watcher.IndexChanged        += OnIndexChanged;
            watcher.ConfigChanged       += OnConfigChanged;
            watcher.LocalBranchChanged  += OnLocalBranchChanged;
            watcher.LocalBranchCreated  += OnLocalBranchCreated;
            watcher.LocalBranchDeleted  += OnLocalBranchDeleted;
            watcher.RepositoryChanged   += OnRepositoryUpdated;
            watcher.RemoteBranchCreated += OnRemoteBranchCreated;
            watcher.RemoteBranchDeleted += OnRemoteBranchDeleted;

            const int debounceTimeout = 0;

            repositoryUpdateCallback = debounceTimeout == 0 ?
                                       OnRepositoryUpdatedHandler
                : TaskExtensions.Debounce(OnRepositoryUpdatedHandler, debounceTimeout);

            var remote = config.GetRemote("origin");

            if (!remote.HasValue)
            {
                remote = config.GetRemotes()
                         .Where(x => HostAddress.Create(new UriString(x.Url).ToRepositoryUri()).IsGitHubDotCom())
                         .FirstOrDefault();
            }
            UriString cloneUrl = "";

            if (remote.Value.Url != null)
            {
                cloneUrl = new UriString(remote.Value.Url).ToRepositoryUrl();
            }

            repository = new Repository(gitClient, this, repositoryPaths.RepositoryPath.FileName, cloneUrl,
                                        repositoryPaths.RepositoryPath);
        }
Exemple #4
0
        public RepositoryManager(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker, IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths, CancellationToken cancellationToken)
        {
            this.repositoryPaths   = repositoryPaths;
            this.platform          = platform;
            this.taskManager       = taskManager;
            this.usageTracker      = usageTracker;
            this.cancellationToken = cancellationToken;
            this.gitClient         = gitClient;
            this.watcher           = repositoryWatcher;
            this.config            = gitConfig;

            SetupWatcher();
        }
Exemple #5
0
        public RepositoryManager(IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IProcessManager processManager,
                                 IFileSystem fileSystem,
                                 CancellationToken token,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.repositoryPaths = repositoryPaths;
            this.fileSystem      = fileSystem;
            this.token           = token;
            this.gitClient       = gitClient;
            this.processManager  = processManager;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            SetupWatcher();
        }
        public RepositoryManager(IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher,
                                 IGitClient gitClient,
                                 CancellationToken token,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.repositoryPaths = repositoryPaths;
            this.token           = token;
            this.gitClient       = gitClient;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            watcher.HeadChanged           += WatcherOnHeadChanged;
            watcher.IndexChanged          += WatcherOnIndexChanged;
            watcher.ConfigChanged         += WatcherOnConfigChanged;
            watcher.RepositoryCommitted   += WatcherOnRepositoryCommitted;
            watcher.RepositoryChanged     += WatcherOnRepositoryChanged;
            watcher.LocalBranchesChanged  += WatcherOnLocalBranchesChanged;
            watcher.RemoteBranchesChanged += WatcherOnRemoteBranchesChanged;
        }
Exemple #7
0
        public RepositoryManager(ITaskManager taskManager,
                                 IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher,
                                 IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.taskManager = taskManager;
            cts = CancellationTokenSource.CreateLinkedTokenSource(taskManager.Token);
            this.repositoryPaths = repositoryPaths;
            this.gitClient       = gitClient;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            watcher.HeadChanged           += WatcherOnHeadChanged;
            watcher.IndexChanged          += WatcherOnIndexChanged;
            watcher.ConfigChanged         += WatcherOnConfigChanged;
            watcher.RepositoryCommitted   += WatcherOnRepositoryCommitted;
            watcher.RepositoryChanged     += WatcherOnRepositoryChanged;
            watcher.LocalBranchesChanged  += WatcherOnLocalBranchesChanged;
            watcher.RemoteBranchesChanged += WatcherOnRemoteBranchesChanged;
        }