public RepositoryManager(IGitConfig gitConfig, IRepositoryWatcher repositoryWatcher, IGitClient gitClient, IRepositoryPathConfiguration repositoryPaths) { this.repositoryPaths = repositoryPaths; this.gitClient = gitClient; this.watcher = repositoryWatcher; this.config = gitConfig; SetupWatcher(); }
public static void AttachListener(this IRepositoryWatcherListener listener, IRepositoryWatcher repositoryWatcher, RepositoryWatcherAutoResetEvent autoResetEvent = null, bool trace = false) { var logger = trace ? LogHelper.GetLogger <IRepositoryWatcherListener>() : null; repositoryWatcher.HeadChanged += () => { logger?.Trace("HeadChanged"); listener.HeadChanged(); autoResetEvent?.HeadChanged.Set(); }; repositoryWatcher.IndexChanged += () => { logger?.Trace("IndexChanged"); listener.IndexChanged(); autoResetEvent?.IndexChanged.Set(); }; repositoryWatcher.ConfigChanged += () => { logger?.Trace("ConfigChanged"); listener.ConfigChanged(); autoResetEvent?.ConfigChanged.Set(); }; repositoryWatcher.RepositoryCommitted += () => { logger?.Trace("ConfigChanged"); listener.RepositoryCommitted(); autoResetEvent?.RepositoryCommitted.Set(); }; repositoryWatcher.RepositoryChanged += () => { logger?.Trace("RepositoryChanged"); listener.RepositoryChanged(); autoResetEvent?.RepositoryChanged.Set(); }; repositoryWatcher.LocalBranchesChanged += () => { logger?.Trace("LocalBranchesChanged"); listener.LocalBranchesChanged(); autoResetEvent?.LocalBranchesChanged.Set(); }; repositoryWatcher.RemoteBranchesChanged += () => { logger?.Trace("RemoteBranchesChanged"); listener.RemoteBranchesChanged(); autoResetEvent?.RemoteBranchesChanged.Set(); }; }
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(); }
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); }
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(); }
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; }
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; }
public static void AttachListener(this IRepositoryWatcherListener listener, IRepositoryWatcher repositoryWatcher, RepositoryWatcherAutoResetEvent autoResetEvent = null, bool trace = false) { var logger = trace ? Logging.GetLogger <IRepositoryWatcherListener>() : null; repositoryWatcher.HeadChanged += () => { logger?.Trace("HeadChanged"); listener.HeadChanged(); autoResetEvent?.HeadChanged.Set(); }; repositoryWatcher.ConfigChanged += () => { logger?.Trace("ConfigChanged"); listener.ConfigChanged(); autoResetEvent?.ConfigChanged.Set(); }; repositoryWatcher.IndexChanged += () => { logger?.Trace("IndexChanged"); listener.IndexChanged(); autoResetEvent?.IndexChanged.Set(); }; repositoryWatcher.LocalBranchChanged += s => { logger?.Trace("LocalBranchChanged: {0}", s); listener.LocalBranchChanged(s); autoResetEvent?.LocalBranchChanged.Set(); }; repositoryWatcher.LocalBranchCreated += s => { logger?.Trace("LocalBranchCreated: {0}", s); listener.LocalBranchCreated(s); autoResetEvent?.LocalBranchCreated.Set(); }; repositoryWatcher.LocalBranchDeleted += s => { logger?.Trace("LocalBranchDeleted: {0}", s); listener.LocalBranchDeleted(s); autoResetEvent?.LocalBranchDeleted.Set(); }; repositoryWatcher.RemoteBranchCreated += (s, s1) => { logger?.Trace("RemoteBranchCreated: {0} {1}", s, s1); listener.RemoteBranchCreated(s, s1); autoResetEvent?.RemoteBranchCreated.Set(); }; repositoryWatcher.RemoteBranchDeleted += (s, s1) => { logger?.Trace("RemoteBranchDeleted: {0} {1}", s, s1); listener.RemoteBranchDeleted(s, s1); autoResetEvent?.RemoteBranchDeleted.Set(); }; repositoryWatcher.RepositoryChanged += () => { logger?.Trace("RepositoryChanged"); listener.RepositoryChanged(); autoResetEvent?.RepositoryChanged.Set(); }; }