Пример #1
0
 public PullRequestService(IGitClient gitClient, IGitService gitService, IOperatingSystem os, IUsageTracker usageTracker)
 {
     this.gitClient    = gitClient;
     this.gitService   = gitService;
     this.os           = os;
     this.usageTracker = usageTracker;
 }
Пример #2
0
    static PullRequestService CreateTarget(
        IGitClient gitClient                 = null,
        IGitService gitService               = null,
        IVSGitExt gitExt                     = null,
        IApiClientFactory apiClientFactory   = null,
        IGraphQLClientFactory graphqlFactory = null,
        IOperatingSystem os                  = null,
        IUsageTracker usageTracker           = null)
    {
        gitClient        = gitClient ?? Substitute.For <IGitClient>();
        gitService       = gitService ?? Substitute.For <IGitService>();
        gitExt           = gitExt ?? Substitute.For <IVSGitExt>();
        apiClientFactory = apiClientFactory ?? Substitute.For <IApiClientFactory>();
        graphqlFactory   = graphqlFactory ?? Substitute.For <IGraphQLClientFactory>();
        os           = os ?? Substitute.For <IOperatingSystem>();
        usageTracker = usageTracker ?? Substitute.For <IUsageTracker>();

        return(new PullRequestService(
                   gitClient,
                   gitService,
                   gitExt,
                   apiClientFactory,
                   graphqlFactory,
                   os,
                   usageTracker));
    }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Repository"/> class.
        /// </summary>
        /// <param name="gitClient"></param>
        /// <param name="repositoryManager"></param>
        /// <param name="name">The repository name.</param>
        /// <param name="cloneUrl">The repository's clone URL.</param>
        /// <param name="localPath"></param>
        public Repository(IGitClient gitClient, IRepositoryManager repositoryManager, NPath localPath)
        {
            Guard.ArgumentNotNull(repositoryManager, nameof(repositoryManager));

            this.gitClient         = gitClient;
            this.repositoryManager = repositoryManager;
            LocalPath = localPath;
            if (repositoryManager.ActiveBranch.HasValue)
            {
                RepositoryManager_OnActiveBranchChanged(repositoryManager.ActiveBranch?.Name);
            }
            if (repositoryManager.ActiveRemote.HasValue)
            {
                RepositoryManager_OnActiveRemoteChanged(repositoryManager.ActiveRemote);
            }
            SetCloneUrl();

            repositoryManager.OnStatusUpdated           += RepositoryManager_OnStatusUpdated;
            repositoryManager.OnActiveBranchChanged     += RepositoryManager_OnActiveBranchChanged;
            repositoryManager.OnActiveRemoteChanged     += RepositoryManager_OnActiveRemoteChanged;
            repositoryManager.OnLocalBranchListChanged  += RepositoryManager_OnLocalBranchListChanged;
            repositoryManager.OnHeadChanged             += RepositoryManager_OnHeadChanged;
            repositoryManager.OnLocksUpdated            += RepositoryManager_OnLocksUpdated;
            repositoryManager.OnRemoteOrTrackingChanged += SetCloneUrl;
        }
Пример #4
0
 public PullRequestService(IGitClient gitClient, IGitService gitService, IOperatingSystem os, IUsageTracker usageTracker)
 {
     this.gitClient = gitClient;
     this.gitService = gitService;
     this.os = os;
     this.usageTracker = usageTracker;
 }
        public void SetupTest()
        {
            _redirector = new MockRedirector();

            var output = TestData.GetTempPath("Cookiecutter", true);
            var outputProjectFolder = Path.Combine(output, "integration");
            var feedUrl             = new Uri(TestFeedPath);
            var installedPath       = TestInstalledTemplateFolderPath;
            var userConfigFilePath  = TestUserConfigFilePath;

            _gitClient               = GitClientProvider.Create(_redirector, null);
            _gitHubClient            = new GitHubClient();
            _cutterClient            = CookiecutterClientProvider.Create(null, _redirector);
            _telemetry               = new CookiecutterTelemetry(new TelemetryTestService());
            _installedTemplateSource = new LocalTemplateSource(installedPath, _gitClient);
            _gitHubTemplateSource    = new GitHubTemplateSource(_gitHubClient);
            _feedTemplateSource      = new FeedTemplateSource(feedUrl);
            _projectSystemClient     = new MockProjectSystemClient();

            _vm = new CookiecutterViewModel(
                _cutterClient,
                _gitHubClient,
                _gitClient,
                _telemetry,
                _redirector,
                _installedTemplateSource,
                _feedTemplateSource,
                _gitHubTemplateSource,
                ExecuteCommand,
                _projectSystemClient
                );

            _vm.UserConfigFilePath = userConfigFilePath;
            ((CookiecutterClient)_cutterClient).DefaultBasePath = outputProjectFolder;
        }
Пример #6
0
        public BlogService(
            ILogger <BlogService> logger,
            IOptions <AppConfig> appConfig,
            IGitClient gitClient,
            IMemoryCacheClient memoryCacheClient,
            IEmailClient emailClient)
        {
            _logger            = logger;
            _appConfig         = appConfig.Value;
            _gitClient         = gitClient;
            _emailClient       = emailClient;
            _memoryCacheClient = memoryCacheClient;

            _tagParser      = new BlogTagParser();
            _postParser     = new BlogPostParser(_appConfig);
            _categoryParser = new BlogCategoryParser();
            _gitConfig      = new GitConfig
            {
                GitHubRepositoryName   = _appConfig.AssetGitHubRepoName,
                GitHubRepositoryBranch = _appConfig.AssetGitHubRepoBranch,
                GitHubRepositoryOwner  = _appConfig.AssetGitHubRepoOwner,
                GitHubAccessToken      = _appConfig.AssetGitHubRepoApiToken,
                GitCloneToDir          = _appConfig.AssetRepoLocalDir,
                GitCommitEmail         = _appConfig.AssetGitCommitEmail,
                GitCommitUser          = _appConfig.AssetGitCommitUser
            };
        }
Пример #7
0
 public RepositoryForkService(IGitClient gitClient, IVSGitServices vsGitServices, IVSGitExt vsGitExt, IUsageTracker usageTracker)
 {
     this.gitClient     = gitClient;
     this.vsGitServices = vsGitServices;
     this.vsGitExt      = vsGitExt;
     this.usageTracker  = usageTracker;
 }
Пример #8
0
        public GitHelper(IConfig config, IGitClient gitClient)
        {
            if (config == null) { throw new ArgumentNullException("config"); }
            if (gitClient == null) { throw new ArgumentNullException("gitClient"); }

            _config = config;
            _gitClient = gitClient;
        }
 public VstsArtifactsHelper(IBuildClient buildClient, IReleaseClient releaseClient, IGitClient gitClient, Guid projectId, string repoName)
 {
     this.buildClient   = buildClient;
     this.releaseClient = releaseClient;
     this.gitClient     = gitClient;
     this.projectId     = projectId;
     this.repoName      = repoName;
 }
Пример #10
0
 public void Initialize(IGitClient client)
 {
     Guard.ArgumentNotNull(client, nameof(client));
     gitClient = client;
     if (needsRefresh)
     {
         cacheContainer.GitUserCache.InvalidateData();
     }
 }
Пример #11
0
        public void Initialize(IGitClient client)
        {
            Guard.ArgumentNotNull(client, nameof(client));

            Logger.Trace("Initialize");

            gitClient = client;
            cacheContainer.GitUserCache.ValidateData();
        }
Пример #12
0
        public void Initialize(IGitClient client)
        {
            Guard.ArgumentNotNull(client, nameof(client));

            Logger.Trace("Initialize");

            gitClient = client;
            UpdateUserAndEmail();
        }
Пример #13
0
 public void Initialize(IGitClient client)
 {
     Guard.ArgumentNotNull(client, nameof(client));
     gitClient = client;
     if (needsRefresh)
     {
         needsRefresh = false;
         GitUserCacheOnCacheInvalidated();
     }
 }
Пример #14
0
        public RepositoryManager(IGitConfig gitConfig,
                                 IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
                                 IRepositoryPathConfiguration repositoryPaths)
        {
            this.repositoryPaths = repositoryPaths;
            this.gitClient       = gitClient;
            this.watcher         = repositoryWatcher;
            this.config          = gitConfig;

            SetupWatcher();
        }
        public PullRequestSessionService(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService)
        {
            this.gitService  = gitService;
            this.gitClient   = gitClient;
            this.diffService = diffService;

            mergeBaseCache = new Dictionary <Tuple <string, string>, string>();
        }
Пример #16
0
 public UsageTracker(ITaskManager taskManager, IGitClient gitClient, IProcessManager processManager,
                     ISettings userSettings,
                     IEnvironment environment, string instanceId)
     : base(userSettings,
            new UsageLoader(environment.UserCachePath.Combine(Constants.UsageFile)),
            environment.UnityVersion, instanceId)
 {
     TaskManager    = taskManager;
     Environment    = environment;
     GitClient      = gitClient;
     ProcessManager = processManager;
 }
Пример #17
0
        public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager taskManager, IUsageTracker usageTracker,
                                                       IGitClient gitClient, NPath repositoryRoot)
        {
            var    repositoryPathConfiguration = new RepositoryPathConfiguration(repositoryRoot);
            string filePath  = repositoryPathConfiguration.DotGitConfig;
            var    gitConfig = new GitConfig(filePath);

            var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token);

            return(new RepositoryManager(platform, taskManager, usageTracker, gitConfig, repositoryWatcher,
                                         gitClient, repositoryPathConfiguration, taskManager.Token));
        }
Пример #18
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();
        }
        protected void InitializePlatform(NPath repoPath, NPath?environmentPath, bool enableEnvironmentTrace, bool setupGit = true)
        {
            InitializeTaskManager();
            InitializeEnvironment(repoPath, environmentPath, enableEnvironmentTrace);

            Platform       = new Platform(Environment);
            ProcessManager = new ProcessManager(Environment, GitEnvironment, TaskManager.Token);

            Platform.Initialize(ProcessManager, TaskManager);

            if (setupGit)
            {
                var autoResetEvent = new AutoResetEvent(false);

                var applicationDataPath = Environment.GetSpecialFolder(System.Environment.SpecialFolder.LocalApplicationData).ToNPath();
                var installDetails      = new GitInstallDetails(applicationDataPath, true);

                var zipArchivesPath   = TestBasePath.Combine("ZipArchives").CreateDirectory();
                var gitArchivePath    = AssemblyResources.ToFile(ResourceType.Platform, "git.zip", zipArchivesPath, Environment);
                var gitLfsArchivePath = AssemblyResources.ToFile(ResourceType.Platform, "git-lfs.zip", zipArchivesPath, Environment);

                var gitInstaller = new GitInstaller(Environment, TaskManager.Token, installDetails, gitArchivePath, gitLfsArchivePath);

                NPath?    result = null;
                Exception ex     = null;

                gitInstaller.SetupGitIfNeeded(new ActionTask <NPath>(TaskManager.Token, (b, path) => {
                    result = path;
                    autoResetEvent.Set();
                }),
                                              new ActionTask(TaskManager.Token, (b, exception) => {
                    ex = exception;
                    autoResetEvent.Set();
                }));

                autoResetEvent.WaitOne();

                if (result == null)
                {
                    if (ex != null)
                    {
                        throw ex;
                    }

                    throw new Exception("Did not install git");
                }

                Environment.GitExecutablePath = result.Value;
                GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);
            }
        }
Пример #20
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);
        }
Пример #21
0
        public CookiecutterViewModel(ICookiecutterClient cutter, IGitHubClient githubClient, IGitClient gitClient, Redirector outputWindow, ITemplateSource installedTemplateSource, ITemplateSource feedTemplateSource, ITemplateSource gitHubTemplateSource, Action<string> openFolder) {
            _cutterClient = cutter;
            _githubClient = githubClient;
            _gitClient = gitClient;
            _outputWindow = outputWindow;
            _recommendedSource = feedTemplateSource;
            _installedSource = installedTemplateSource;
            _githubSource = gitHubTemplateSource;
            _openFolder = openFolder;

            Installed = new CategorizedViewModel(Strings.TemplateCategoryInstalled);
            Recommended = new CategorizedViewModel(Strings.TemplateCategoryRecommended);
            GitHub = new CategorizedViewModel(Strings.TemplateCategoryGitHub);
            Custom = new CategorizedViewModel(Strings.TemplateCategoryCustom);
        }
Пример #22
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();
        }
Пример #23
0
 public PullRequestService(
     IGitClient gitClient,
     IGitService gitService,
     IVSGitExt gitExt,
     IGraphQLClientFactory graphqlFactory,
     IOperatingSystem os,
     IUsageTracker usageTracker)
 {
     this.gitClient      = gitClient;
     this.gitService     = gitService;
     this.gitExt         = gitExt;
     this.graphqlFactory = graphqlFactory;
     this.os             = os;
     this.usageTracker   = usageTracker;
 }
        public InlineCommentTaggerProvider(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            IPullRequestSessionManager sessionManager)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.sessionManager = sessionManager;
        }
        public PullRequestSessionService(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            IApiClientFactory apiClientFactory,
            IUsageTracker usageTracker)
        {
            this.gitService       = gitService;
            this.gitClient        = gitClient;
            this.diffService      = diffService;
            this.apiClientFactory = apiClientFactory;
            this.usageTracker     = usageTracker;

            mergeBaseCache = new Dictionary <Tuple <string, string>, string>();
        }
Пример #26
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();
        }
        private static async Task <NPath> LookForGitInstallationPath(IGitClient gitClient, ISettings systemSettings)
        {
            NPath cachedGitInstallPath = null;
            var   path = systemSettings.Get(Constants.GitInstallPathKey);

            if (!String.IsNullOrEmpty(path))
            {
                cachedGitInstallPath = path.ToNPath();
            }

            // Root paths
            if (cachedGitInstallPath != null && cachedGitInstallPath.DirectoryExists())
            {
                return(cachedGitInstallPath);
            }
            return(await gitClient.FindGitInstallation());
        }
    static LibGit2Sharp.IRepository SetupLocalRepoMock(IGitClient gitClient, IGitService gitService, string remote, string head, bool isTracking)
    {
        var l2remote = Substitute.For<LibGit2Sharp.Remote>();
        l2remote.Name.Returns(remote);
        gitClient.GetHttpRemote(Args.LibGit2Repo, Args.String).Returns(Task.FromResult(l2remote));

        var l2repo = Substitute.For<LibGit2Sharp.IRepository>();
        var l2branchcol = Substitute.For<LibGit2Sharp.BranchCollection>();
        var l2branch = Substitute.For<LibGit2Sharp.Branch>();
        l2branch.FriendlyName.Returns(head);
        l2branch.IsTracking.Returns(isTracking);
        l2branchcol[Args.String].Returns(l2branch);
        l2repo.Branches.Returns(l2branchcol);
        l2repo.Head.Returns(l2branch);
        gitService.GetRepository(Args.String).Returns(l2repo);
        return l2repo;
    }
Пример #29
0
        public CookiecutterContainerPage(IServiceProvider provider, Redirector outputWindow, ICookiecutterTelemetry telemetry, IGitClient gitClient, Uri feedUrl, Action<string> openFolder, IProjectSystemClient projectSystemClient, Action updateCommandUI) {
            _updateCommandUI = updateCommandUI;

            _checkForUpdatesTimer = new DispatcherTimer();
            _checkForUpdatesTimer.Tick += new EventHandler(CheckForUpdateTimer_Tick);

            var gitHubClient = new GitHubClient();
            ViewModel = new CookiecutterViewModel(
                CookiecutterClientProvider.Create(provider, outputWindow),
                gitHubClient,
                gitClient,
                telemetry,
                outputWindow,
                new LocalTemplateSource(CookiecutterViewModel.DefaultInstalledFolderPath, gitClient),
                new FeedTemplateSource(feedUrl),
                new GitHubTemplateSource(gitHubClient),
                openFolder,
                projectSystemClient
            );

            ViewModel.UserConfigFilePath = CookiecutterViewModel.GetUserConfigPath();
            ViewModel.OutputFolderPath = string.Empty; // leaving this empty for now, initialize on context creation
            ViewModel.ContextLoaded += ViewModel_ContextLoaded;
            ViewModel.HomeClicked += ViewModel_HomeClicked;

            _searchPage = new CookiecutterSearchPage { DataContext = ViewModel };
            _optionsPage = new CookiecutterOptionsPage { DataContext = ViewModel };

            var pages = new List<Page>();
            pages.Add(_searchPage);
            pages.Add(_optionsPage);

            _pageSequence = new CollectionViewSource {
                Source = new ObservableCollection<Page>(pages)
            };
            PageCount = _pageSequence.View.OfType<object>().Count();

            PageSequence = _pageSequence.View;
            PageSequence.MoveCurrentToFirst();

            DataContext = this;

            InitializeComponent();

            _searchPage.SelectedTemplateChanged += SearchPage_SelectedTemplateChanged;
        }
    static PullRequestService CreateTarget(
        IGitClient gitClient       = null,
        IGitService gitService     = null,
        IOperatingSystem os        = null,
        IUsageTracker usageTracker = null)
    {
        gitClient    = gitClient ?? Substitute.For <IGitClient>();
        gitService   = gitService ?? Substitute.For <IGitService>();
        os           = os ?? Substitute.For <IOperatingSystem>();
        usageTracker = usageTracker ?? Substitute.For <IUsageTracker>();

        return(new PullRequestService(
                   gitClient,
                   gitService,
                   os,
                   usageTracker));
    }
Пример #31
0
        public CookiecutterViewModel(ICookiecutterClient cutter, IGitHubClient githubClient, IGitClient gitClient, ICookiecutterTelemetry telemetry, Redirector outputWindow, ILocalTemplateSource installedTemplateSource, ITemplateSource feedTemplateSource, ITemplateSource gitHubTemplateSource, Action <string, string> executeCommand, IProjectSystemClient projectSystemClient)
        {
            _cutterClient        = cutter;
            _githubClient        = githubClient;
            _gitClient           = gitClient;
            _telemetry           = telemetry;
            _outputWindow        = outputWindow;
            _recommendedSource   = feedTemplateSource;
            _installedSource     = installedTemplateSource;
            _githubSource        = gitHubTemplateSource;
            _executeCommand      = executeCommand;
            _projectSystemClient = projectSystemClient;

            Installed   = new CategorizedViewModel(Strings.TemplateCategoryInstalled);
            Recommended = new CategorizedViewModel(Strings.TemplateCategoryRecommended);
            GitHub      = new CategorizedViewModel(Strings.TemplateCategoryGitHub);
            Custom      = new CategorizedViewModel(Strings.TemplateCategoryCustom);
        }
    static LibGit2Sharp.IRepository SetupLocalRepoMock(IGitClient gitClient, IGitService gitService, string remote, string head, bool isTracking)
    {
        var l2remote = Substitute.For <LibGit2Sharp.Remote>();

        l2remote.Name.Returns(remote);
        gitClient.GetHttpRemote(Args.LibGit2Repo, Args.String).Returns(Task.FromResult(l2remote));

        var l2repo      = Substitute.For <LibGit2Sharp.IRepository>();
        var l2branchcol = Substitute.For <LibGit2Sharp.BranchCollection>();
        var l2branch    = Substitute.For <LibGit2Sharp.Branch>();

        l2branch.FriendlyName.Returns(head);
        l2branch.IsTracking.Returns(isTracking);
        l2branchcol[Args.String].Returns(l2branch);
        l2repo.Branches.Returns(l2branchcol);
        l2repo.Head.Returns(l2branch);
        gitService.GetRepository(Args.String).Returns(l2repo);
        return(l2repo);
    }
Пример #33
0
 public ProjectGenerator(IProjectDirectoryProvider projectDirectoryProvider,
                         IDirectoryManipulator directoryManipulator,
                         IFileManipulator fileManipulator,
                         ISolutionTemplateProvider solutionTemplateProvider,
                         IGitClient gitClient,
                         IGitApiClient gitApiClient,
                         ILogger logger,
                         string projectType
                         )
 {
     _directoryManipulator     = directoryManipulator;
     _fileManipulator          = fileManipulator;
     _solutionTemplateProvider = solutionTemplateProvider;
     _gitClient         = gitClient;
     _gitApiClient      = gitApiClient;
     _logger            = logger;
     _projectType       = projectType;
     _solutionDirectory = projectDirectoryProvider.SolutionDirectory;
 }
Пример #34
0
        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;
        }
Пример #35
0
 public RepositoriosController(IGitClient gitClient)
 {
     this.gitClient = gitClient;
 }
Пример #36
0
        public void SetupTest() {
            _redirector = new MockRedirector();

            var output = TestData.GetTempPath("Cookiecutter", true);
            var outputProjectFolder = Path.Combine(output, "integration");
            var feedUrl = new Uri(TestFeedPath);
            var installedPath = TestInstalledTemplateFolderPath;
            var userConfigFilePath = TestUserConfigFilePath;

            _gitClient = GitClientProvider.Create(_redirector, null);
            _gitHubClient = new GitHubClient();
            _cutterClient = CookiecutterClientProvider.Create(null, _redirector);
            _telemetry = new CookiecutterTelemetry(new TelemetryTestService());
            _installedTemplateSource = new LocalTemplateSource(installedPath, _gitClient);
            _gitHubTemplateSource = new GitHubTemplateSource(_gitHubClient);
            _feedTemplateSource = new FeedTemplateSource(feedUrl);
            _projectSystemClient = new MockProjectSystemClient();

            _vm = new CookiecutterViewModel(
                _cutterClient,
                _gitHubClient,
                _gitClient,
                _telemetry,
                _redirector,
                _installedTemplateSource,
                _feedTemplateSource,
                _gitHubTemplateSource,
                OpenFolder,
                _projectSystemClient
            );

            _vm.UserConfigFilePath = userConfigFilePath;
            ((CookiecutterClient)_cutterClient).DefaultBasePath = outputProjectFolder;
        }
Пример #37
0
 public GitData(IGitClient git)
 {
     this.git = git;
 }
Пример #38
0
        public CookiecutterViewModel(ICookiecutterClient cutter, IGitHubClient githubClient, IGitClient gitClient, ICookiecutterTelemetry telemetry, Redirector outputWindow, ILocalTemplateSource installedTemplateSource, ITemplateSource feedTemplateSource, ITemplateSource gitHubTemplateSource, Action<string> openFolder, IProjectSystemClient projectSystemClient) {
            _cutterClient = cutter;
            _githubClient = githubClient;
            _gitClient = gitClient;
            _telemetry = telemetry;
            _outputWindow = outputWindow;
            _recommendedSource = feedTemplateSource;
            _installedSource = installedTemplateSource;
            _githubSource = gitHubTemplateSource;
            _openFolder = openFolder;
            _projectSystemClient = projectSystemClient;

            Installed = new CategorizedViewModel(Strings.TemplateCategoryInstalled);
            Recommended = new CategorizedViewModel(Strings.TemplateCategoryRecommended);
            GitHub = new CategorizedViewModel(Strings.TemplateCategoryGitHub);
            Custom = new CategorizedViewModel(Strings.TemplateCategoryCustom);
        }
Пример #39
0
 public void SetUp()
 {
     gitStub = MockRepository.GenerateStub<IGitClient>();
     gitData = new GitData(gitStub);
 }
Пример #40
0
 public LocalTemplateSource(string installedFolderPath, IGitClient gitClient) {
     _installedFolderPath = installedFolderPath;
     _gitClient = gitClient;
 }
 public RepositoryPublishService(IGitClient gitClient, IVSServices services)
 {
     this.gitClient = gitClient;
     this.activeRepository = services.GetActiveRepo();
 }
 public RepositoryPublishService(IGitClient gitClient, IVSGitServices vsGitServices)
 {
     this.gitClient = gitClient;
     this.vsGitServices = vsGitServices;
 }