public void Execute() { GVFSEnlistment enlistment = this.CreateEnlistment(this.EnlistmentRootPathParameter); EventLevel verbosity; Keywords keywords; this.ParseEnumArgs(out verbosity, out keywords); JsonTracer tracer = this.CreateTracer(enlistment, verbosity, keywords); CacheServerInfo cacheServer = CacheServerResolver.GetCacheServerFromConfig(enlistment); tracer.WriteStartEvent( enlistment.EnlistmentRoot, enlistment.RepoUrl, cacheServer.Url, new EventMetadata { { "IsElevated", GVFSPlatform.Instance.IsElevated() }, { nameof(this.EnlistmentRootPathParameter), this.EnlistmentRootPathParameter }, { nameof(this.StartedByService), this.StartedByService }, }); AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { this.UnhandledGVFSExceptionHandler(tracer, sender, e); }; string error; RetryConfig retryConfig; if (!RetryConfig.TryLoadFromGitConfig(tracer, enlistment, out retryConfig, out error)) { this.ReportErrorAndExit(tracer, "Failed to determine GVFS timeout and max retries: " + error); } GitStatusCacheConfig gitStatusCacheConfig; if (!GitStatusCacheConfig.TryLoadFromGitConfig(tracer, enlistment, out gitStatusCacheConfig, out error)) { tracer.RelatedWarning("Failed to determine GVFS status cache backoff time: " + error); gitStatusCacheConfig = GitStatusCacheConfig.DefaultConfig; } InProcessMount mountHelper = new InProcessMount(tracer, enlistment, cacheServer, retryConfig, gitStatusCacheConfig, this.ShowDebugWindow); try { mountHelper.Mount(verbosity, keywords); } catch (Exception ex) { this.ReportErrorAndExit(tracer, "Failed to mount: {0}", ex.Message); } }
public InProcessMount(ITracer tracer, GVFSEnlistment enlistment, CacheServerInfo cacheServer, RetryConfig retryConfig, GitStatusCacheConfig gitStatusCacheConfig, bool showDebugWindow) { this.tracer = tracer; this.retryConfig = retryConfig; this.gitStatusCacheConfig = gitStatusCacheConfig; this.cacheServer = cacheServer; this.enlistment = enlistment; this.showDebugWindow = showDebugWindow; this.unmountEvent = new ManualResetEvent(false); }
public void Execute() { if (this.StartedByVerb) { // If this process was started by a verb it means that StartBackgroundVFS4GProcess was used // and we should be running in the background. PrepareProcessToRunInBackground will perform // any platform specific preparation required to run as a background process. GSDPlatform.Instance.PrepareProcessToRunInBackground(); } GSDEnlistment enlistment = this.CreateEnlistment(this.EnlistmentRootPathParameter); EventLevel verbosity; Keywords keywords; this.ParseEnumArgs(out verbosity, out keywords); JsonTracer tracer = this.CreateTracer(enlistment, verbosity, keywords); CacheServerInfo cacheServer = CacheServerResolver.GetCacheServerFromConfig(enlistment); tracer.WriteStartEvent( enlistment.EnlistmentRoot, enlistment.RepoUrl, cacheServer.Url, new EventMetadata { { "IsElevated", GSDPlatform.Instance.IsElevated() }, { nameof(this.EnlistmentRootPathParameter), this.EnlistmentRootPathParameter }, { nameof(this.StartedByService), this.StartedByService }, { nameof(this.StartedByVerb), this.StartedByVerb }, }); AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { this.UnhandledGSDExceptionHandler(tracer, sender, e); }; string error; RetryConfig retryConfig; if (!RetryConfig.TryLoadFromGitConfig(tracer, enlistment, out retryConfig, out error)) { this.ReportErrorAndExit(tracer, "Failed to determine GSD timeout and max retries: " + error); } GitStatusCacheConfig gitStatusCacheConfig; if (!GitStatusCacheConfig.TryLoadFromGitConfig(tracer, enlistment, out gitStatusCacheConfig, out error)) { tracer.RelatedWarning("Failed to determine GSD status cache backoff time: " + error); gitStatusCacheConfig = GitStatusCacheConfig.DefaultConfig; } InProcessMount mountHelper = new InProcessMount(tracer, enlistment, cacheServer, retryConfig, gitStatusCacheConfig, this.ShowDebugWindow); try { mountHelper.Mount(verbosity, keywords); } catch (Exception ex) { this.ReportErrorAndExit(tracer, "Failed to mount: {0}", ex.Message); } }