Exemplo n.º 1
0
 public PullRequestService(IGitClient gitClient, IGitService gitService, IOperatingSystem os, IUsageTracker usageTracker)
 {
     this.gitClient = gitClient;
     this.gitService = gitService;
     this.os = os;
     this.usageTracker = usageTracker;
 }
 public SourceControlBackupService(
     IAllConfiguration allConfiguration, IVsoRestApiService apiService,
     IFileSystemService fileSystemService, ILogger logger, IGitService gitService)
 {
     _allConfiguration = allConfiguration;
     _apiService = apiService;
     _fileSystemService = fileSystemService;
     _logger = logger;
     _gitService = gitService;
 }
        public SolutionGeneratorService(IGitService gitService, ITemplateRenderer templateRenderer,
            IProjectTypeConverterService projectTypeConverterService, IReferencesService referencesService)
        {
            Argument.IsNotNull(() => gitService);
            Argument.IsNotNull(() => templateRenderer);
            Argument.IsNotNull(() => projectTypeConverterService);
            Argument.IsNotNull(() => referencesService);

            _gitService = gitService;
            _templateRenderer = templateRenderer;
            _projectTypeConverterService = projectTypeConverterService;
            _referencesService = referencesService;
        }
    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;
    }
Exemplo n.º 5
0
 public RepositoriesService(
     IKeyValuesRepository keyValuesRepository,
     IKeyValueHistoryRepository keyValueHistoryRepository,
     IRepositoriesRepository repositoriesRepository,
     IRepositoryDataRepository repositoryDataRepository,
     IRepositoriesUpdateHistoryRepository repositoriesUpdateHistoryRepository,
     ISecretKeyValuesRepository secretKeyValuesRepository,
     IGitService gitService,
     bool useSecrets,
     ILogFactory logFactory)
 {
     _keyValuesRepository                 = keyValuesRepository;
     _keyValueHistoryRepository           = keyValueHistoryRepository;
     _repositoriesRepository              = repositoriesRepository;
     _repositoryDataRepository            = repositoryDataRepository;
     _repositoriesUpdateHistoryRepository = repositoriesUpdateHistoryRepository;
     _secretKeyValuesRepository           = secretKeyValuesRepository;
     _gitService = gitService;
     _useSecrets = useSecrets;
     _log        = logFactory.CreateLog(this);
 }
Exemplo n.º 6
0
        public GiteeNavigationItem(Octicon icon, IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService web)
        {
            _git     = git;
            _shell   = shell;
            _storage = storage;
            _tes     = tes;
            _web     = web;
            var brush = new SolidColorBrush(Color.FromRgb(66, 66, 66));

            brush.Freeze();
            octicon = icon;
            OnThemeChanged();
            VSColorTheme.ThemeChanged += _ =>
            {
                OnThemeChanged();
                Invalidate();
            };
            var gitExt = GlobalServiceProvider.GlobalProvider.GetService <IGitExt>();

            gitExt.PropertyChanged += GitExt_PropertyChanged;
        }
        public PullRequestNavigationItem(
            IGitClientService gitClientService,
            IGitService gitService,
            IEventAggregatorService eventAggregator,
            IUserInformationService userInformationService,
            ICommandsService commandService
            ) : base(null)
        {
            _gitClientService       = gitClientService;
            _gitService             = gitService;
            _eventAggregator        = eventAggregator;
            _userInformationService = userInformationService;
            _commandService         = commandService;
            Text      = Resources.PullRequestNavigationItemTitle;
            Image     = Resources.PullRequest;
            IsVisible = ShouldBeVisible(_userInformationService.ConnectionData);
            var connectionObs = _eventAggregator.GetEvent <ConnectionChangedEvent>();
            var repoObs       = _eventAggregator.GetEvent <ActiveRepositoryChangedEvent>();

            _observable = connectionObs.Select(x => Unit.Default).Merge(repoObs.Select(x => Unit.Default)).Subscribe(_ => ValidateVisibility());
        }
Exemplo n.º 8
0
        public InlineCommentTagger(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            ITextView view,
            ITextBuffer buffer,
            IPullRequestSessionManager sessionManager,
            IInlineCommentPeekService peekService)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(diffService, nameof(diffService));
            Guard.ArgumentNotNull(buffer, nameof(buffer));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(peekService, nameof(peekService));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.buffer         = buffer;
            this.view           = view;
            this.sessionManager = sessionManager;
            this.peekService    = peekService;

            trackingPoints = new Dictionary <IInlineCommentThreadModel, ITrackingPoint>();

            if (view.Options.GetOptionValue("Tabs/ConvertTabsToSpaces", false))
            {
                tabsToSpaces = view.Options.GetOptionValue <int?>("Tabs/TabSize", null);
            }

            signalRebuild = new Subject <ITextSnapshot>();
            signalRebuild.Throttle(TimeSpan.FromMilliseconds(500))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => Rebuild(x).Forget());

            this.buffer.Changed += Buffer_Changed;
        }
    static PullRequestService CreateTarget(
        IGitClient gitClient   = null,
        IGitService gitService = null,
        IVSGitExt gitExt       = 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>();
        graphqlFactory = graphqlFactory ?? Substitute.For <IGraphQLClientFactory>();
        os             = os ?? Substitute.For <IOperatingSystem>();
        usageTracker   = usageTracker ?? Substitute.For <IUsageTracker>();

        return(new PullRequestService(
                   gitClient,
                   gitService,
                   gitExt,
                   graphqlFactory,
                   os,
                   usageTracker));
    }
Exemplo n.º 10
0
        public InlineCommentTagger(
            IGitService gitService,
            IGitClient gitClient,
            IDiffService diffService,
            ITextView view,
            ITextBuffer buffer,
            IPullRequestSessionManager sessionManager,
            IInlineCommentPeekService peekService)
        {
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(gitClient, nameof(gitClient));
            Guard.ArgumentNotNull(diffService, nameof(diffService));
            Guard.ArgumentNotNull(buffer, nameof(buffer));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(peekService, nameof(peekService));

            this.gitService     = gitService;
            this.gitClient      = gitClient;
            this.diffService    = diffService;
            this.buffer         = buffer;
            this.view           = view;
            this.sessionManager = sessionManager;
            this.peekService    = peekService;
        }
        public PublishSectionViewModel(IMessenger messenger, IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IViewFactory viewFactory, IWebService web)
        {
            messenger.Register("OnLogined", OnLogined);
            messenger.Register("OnSignOuted", OnSignOuted);

            _messenger   = messenger;
            _git         = git;
            _shell       = shell;
            _storage     = storage;
            _tes         = tes;
            _viewFactory = viewFactory;
            _web         = web;

            Name        = Strings.Name;
            Provider    = Strings.Provider;
            Description = Strings.Description;

            _loginCommand      = new DelegateCommand(OnLogin);
            _signUpCommand     = new DelegateCommand(OnSignUp);
            _getStartedCommand = new DelegateCommand(OnGetStarted);
            _publishCommand    = new DelegateCommand(OnPublish, CanPublish);

            LoadResources();
        }
Exemplo n.º 12
0
        public VSGitExt(IServiceProvider serviceProvider, IVSUIContextFactory factory, IGitService gitService,
                        JoinableTaskContext joinableTaskContext)
        {
            JoinableTaskCollection             = joinableTaskContext.CreateCollection();
            JoinableTaskCollection.DisplayName = nameof(VSGitExt);
            JoinableTaskFactory = joinableTaskContext.CreateFactory(JoinableTaskCollection);

            this.serviceProvider = serviceProvider;
            this.gitService      = gitService;

            // Start with empty array until we have a chance to initialize.
            ActiveRepositories = Array.Empty <LocalRepositoryModel>();

            // The IGitExt service isn't available when a TFS based solution is opened directly.
            // It will become available when moving to a Git based solution (and cause a UIContext event to fire).
            // NOTE: I tried using the RepositoryOpen context, but it didn't work consistently.
            var context = factory.GetUIContext(new Guid(Guids.GitSccProviderId));

            context.WhenActivated(() =>
            {
                log.Debug("WhenActivated");
                JoinableTaskFactory.RunAsync(InitializeAsync).Task.Forget(log);
            });
        }
 public VSGitExt16(IServiceProvider serviceProvider, IGitService gitService) : base(serviceProvider, gitService)
 {
 }
Exemplo n.º 14
0
 public HomeController(IGitService service)
 {
     this.service = service;
 }
        public PullRequestCreationViewModel(
            IModelServiceFactory modelServiceFactory,
            IPullRequestService service,
            INotificationService notifications,
            IMessageDraftStore draftStore,
            IGitService gitService,
            IScheduler timerScheduler)
        {
            Guard.ArgumentNotNull(modelServiceFactory, nameof(modelServiceFactory));
            Guard.ArgumentNotNull(service, nameof(service));
            Guard.ArgumentNotNull(notifications, nameof(notifications));
            Guard.ArgumentNotNull(draftStore, nameof(draftStore));
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(timerScheduler, nameof(timerScheduler));

            this.service             = service;
            this.modelServiceFactory = modelServiceFactory;
            this.draftStore          = draftStore;
            this.gitService          = gitService;
            this.timerScheduler      = timerScheduler;

            this.WhenAnyValue(x => x.Branches)
            .WhereNotNull()
            .Where(_ => TargetBranch != null)
            .Subscribe(x =>
            {
                if (!x.Any(t => t.Equals(TargetBranch)))
                {
                    TargetBranch = GitHubRepository.IsFork ? GitHubRepository.Parent.DefaultBranch : GitHubRepository.DefaultBranch;
                }
            });

            SetupValidators();

            var whenAnyValidationResultChanges = this.WhenAny(
                x => x.TitleValidator.ValidationResult,
                x => x.BranchValidator.ValidationResult,
                x => x.IsBusy,
                (x, y, z) => (x.Value?.IsValid ?? false) && (y.Value?.IsValid ?? false) && !z.Value);

            this.WhenAny(x => x.BranchValidator.ValidationResult, x => x.GetValue())
            .WhereNotNull()
            .Where(x => !x.IsValid && x.DisplayValidationError)
            .Subscribe(x => notifications.ShowError(BranchValidator.ValidationResult.Message));

            CreatePullRequest = ReactiveCommand.CreateFromObservable(
                () => service
                .CreatePullRequest(modelService, activeLocalRepo, TargetBranch.Repository, SourceBranch, TargetBranch, PRTitle, Description ?? String.Empty)
                .Catch <IPullRequestModel, Exception>(ex =>
            {
                log.Error(ex, "Error creating pull request");

                //TODO:Will need a uniform solution to HTTP exception message handling
                var apiException = ex as ApiValidationException;
                var error        = apiException?.ApiError?.Errors?.FirstOrDefault();
                notifications.ShowError(error?.Message ?? ex.Message);
                return(Observable.Empty <IPullRequestModel>());
            }),
                whenAnyValidationResultChanges);
            CreatePullRequest.Subscribe(pr =>
            {
                notifications.ShowMessage(String.Format(CultureInfo.CurrentCulture, Resources.PRCreatedUpstream, SourceBranch.DisplayName, TargetBranch.Repository.Owner + "/" + TargetBranch.Repository.Name + "#" + pr.Number,
                                                        TargetBranch.Repository.CloneUrl.ToRepositoryUrl().Append("pull/" + pr.Number)));
                NavigateTo("/pulls?refresh=true");
                Cancel.Execute();
                draftStore.DeleteDraft(GetDraftKey(), string.Empty).Forget();
                Close();
            });

            Cancel = ReactiveCommand.Create(() => { });
            Cancel.Subscribe(_ =>
            {
                Close();
                draftStore.DeleteDraft(GetDraftKey(), string.Empty).Forget();
            });

            isExecuting = CreatePullRequest.IsExecuting.ToProperty(this, x => x.IsExecuting);

            this.WhenAnyValue(x => x.Initialized, x => x.GitHubRepository, x => x.IsExecuting)
            .Select(x => !(x.Item1 && x.Item2 != null && !x.Item3))
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x => IsBusy = x);
        }
Exemplo n.º 16
0
 public PreCommand(IGitService gitService)
     : base(gitService)
 {
 }
Exemplo n.º 17
0
 public CreateModel(IRepositoryService service, IGitService gitService)
 {
     this.service    = service;
     this.gitService = gitService;
 }
 public GenerateTagsReadmeCommand(IGitService gitService) : base()
 {
     this.gitService = gitService ?? throw new ArgumentNullException(nameof(gitService));
 }
Exemplo n.º 19
0
 public BuildCommand(IDockerService dockerService, ILoggerService loggerService, IGitService gitService)
 {
     _imageDigestCache = new ImageDigestCache(dockerService);
     _dockerService    = new DockerServiceCache(dockerService ?? throw new ArgumentNullException(nameof(dockerService)));
     _loggerService    = loggerService ?? throw new ArgumentNullException(nameof(loggerService));
     _gitService       = gitService ?? throw new ArgumentNullException(nameof(gitService));
 }
Exemplo n.º 20
0
 public VersionCommandBase(IGitService gitService)
 {
     _store      = new ProjectStore();
     _gitService = gitService ?? throw new ArgumentNullException(nameof(gitService));
 }
Exemplo n.º 21
0
 public HomeController(IQueueService qSvc, IGitService gSvc, ITableService tableSvc)
 {
     this.qSvc     = qSvc;
     this.gSvc     = gSvc;
     this.tableSvc = tableSvc;
 }
Exemplo n.º 22
0
 public RemoteRepositoryFactory(IGitService gitService)
 {
     this.gitService = gitService;
 }
Exemplo n.º 23
0
 public LocalizationAnalizer(IGitService gitService, IHtmlParser htmlParser, IResourceParser resourceParser)
 {
     _gitService     = gitService;
     _htmlParser     = htmlParser;
     _resourceParser = resourceParser;
 }
Exemplo n.º 24
0
 public ReceivePackParser(IGitService gitService, IHookReceivePack receivePackHandler, GitServiceResultParser resultParser)
 {
     this.gitService = gitService;
     this.receivePackHandler = receivePackHandler;
     this.resultParser = resultParser;
 }
 public LocalizationAnalizer(ITextElementCshtmlParser cshtmlParser, ITextElementVueParser vueParser, IResoucesParser resoucesParser, IGitService gitService)
 {
     _cshtmlParser   = cshtmlParser;
     _vueParser      = vueParser;
     _resoucesParser = resoucesParser;
     _gitService     = gitService;
 }
Exemplo n.º 26
0
 public PublishImageInfoCommand(IGitService gitService, ILoggerService loggerService)
 {
     _gitService    = gitService ?? throw new ArgumentNullException(nameof(gitService));
     _loggerService = loggerService ?? throw new ArgumentNullException(nameof(loggerService));
 }
Exemplo n.º 27
0
 public SiteService(IGitService gitService, IDotNetPublishService publishService, ISiteManagementService siteManagementService)
 {
     this.gitService            = gitService ?? throw new ArgumentNullException(nameof(gitService));
     this.publishService        = publishService ?? throw new ArgumentNullException(nameof(publishService));
     this.siteManagementService = siteManagementService ?? throw new ArgumentNullException(nameof(siteManagementService));
 }
 public DurableGitServiceResult(IGitService gitService, IRecoveryFilePathBuilder resultFilePathBuilder)
 {
     this.gitService = gitService;
     this.resultFilePathBuilder = resultFilePathBuilder;
 }
Exemplo n.º 29
0
 public VSGitExt(IServiceProvider serviceProvider, IGitService gitService)
     : this(serviceProvider, new VSUIContextFactory(), gitService, ThreadHelper.JoinableTaskContext)
 {
 }
 public SourceControlBackupService(IAllConfiguration allConfiguration, IVsoRestApiService apiService, IFileSystemService fileSystemService, ILogger logger, IGitService gitService)
 {
     _allConfiguration  = allConfiguration;
     _apiService        = apiService;
     _fileSystemService = fileSystemService;
     _logger            = logger;
     _gitService        = gitService;
 }
Exemplo n.º 31
0
 public GenerateReadmesCommand(IEnvironmentService environmentService, IGitService gitService) : base(environmentService)
 {
     _gitService = gitService ?? throw new ArgumentNullException(nameof(gitService));
 }
Exemplo n.º 32
0
 public GitHubContextService(IGitHubServiceProvider serviceProvider, IGitService gitService)
 {
     this.serviceProvider = serviceProvider;
     this.gitService      = gitService;
     textManager          = new Lazy <IVsTextManager2>(() => serviceProvider.GetService <SVsTextManager, IVsTextManager2>());
 }
Exemplo n.º 33
0
 public SetCommand(IGitService gitService)
     : base(gitService)
 {
 }
Exemplo n.º 34
0
 public IssuesNavigationItem(IGitService git, IShellService shell, IStorage storage, ITeamExplorerServices tes, IWebService ws)
     : base(Octicon.issue_opened, git, shell, storage, tes, ws)
 {
     _tes = tes;
     Text = Strings.Items_Issues;
 }
Exemplo n.º 35
0
        public PullRequestDetailViewModel(
            IPullRequestService pullRequestsService,
            IPullRequestSessionManager sessionManager,
            IModelServiceFactory modelServiceFactory,
            IUsageTracker usageTracker,
            ITeamExplorerContext teamExplorerContext,
            IPullRequestFilesViewModel files,
            ISyncSubmodulesCommand syncSubmodulesCommand,
            IViewViewModelFactory viewViewModelFactory,
            IGitService gitService,
            IOpenIssueishDocumentCommand openDocumentCommand,
            [Import(AllowDefault = true)] JoinableTaskContext joinableTaskContext)
        {
            Guard.ArgumentNotNull(pullRequestsService, nameof(pullRequestsService));
            Guard.ArgumentNotNull(sessionManager, nameof(sessionManager));
            Guard.ArgumentNotNull(modelServiceFactory, nameof(modelServiceFactory));
            Guard.ArgumentNotNull(usageTracker, nameof(usageTracker));
            Guard.ArgumentNotNull(teamExplorerContext, nameof(teamExplorerContext));
            Guard.ArgumentNotNull(syncSubmodulesCommand, nameof(syncSubmodulesCommand));
            Guard.ArgumentNotNull(viewViewModelFactory, nameof(viewViewModelFactory));
            Guard.ArgumentNotNull(gitService, nameof(gitService));
            Guard.ArgumentNotNull(openDocumentCommand, nameof(openDocumentCommand));

            this.pullRequestsService   = pullRequestsService;
            this.sessionManager        = sessionManager;
            this.modelServiceFactory   = modelServiceFactory;
            this.usageTracker          = usageTracker;
            this.teamExplorerContext   = teamExplorerContext;
            this.syncSubmodulesCommand = syncSubmodulesCommand;
            this.viewViewModelFactory  = viewViewModelFactory;
            this.gitService            = gitService;
            this.openDocumentCommand   = openDocumentCommand;
            JoinableTaskContext        = joinableTaskContext ?? ThreadHelper.JoinableTaskContext;

            Files = files;

            Checkout = ReactiveCommand.CreateFromObservable(
                DoCheckout,
                this.WhenAnyValue(x => x.CheckoutState)
                .Cast <CheckoutCommandState>()
                .Select(x => x != null && x.IsEnabled));
            Checkout.IsExecuting.Subscribe(x => isInCheckout = x);
            SubscribeOperationError(Checkout);

            Pull = ReactiveCommand.CreateFromObservable(
                DoPull,
                this.WhenAnyValue(x => x.UpdateState)
                .Cast <UpdateCommandState>()
                .Select(x => x != null && x.PullEnabled));
            SubscribeOperationError(Pull);

            Push = ReactiveCommand.CreateFromObservable(
                DoPush,
                this.WhenAnyValue(x => x.UpdateState)
                .Cast <UpdateCommandState>()
                .Select(x => x != null && x.PushEnabled));
            SubscribeOperationError(Push);

            SyncSubmodules = ReactiveCommand.CreateFromTask(
                DoSyncSubmodules,
                this.WhenAnyValue(x => x.UpdateState)
                .Cast <UpdateCommandState>()
                .Select(x => x != null && x.SyncSubmodulesEnabled));
            SyncSubmodules.Subscribe(_ => Refresh().ToObservable());
            SubscribeOperationError(SyncSubmodules);

            OpenConversation = ReactiveCommand.Create(DoOpenConversation);

            OpenOnGitHub = ReactiveCommand.Create(DoOpenDetailsUrl);

            ShowReview = ReactiveCommand.Create <IPullRequestReviewSummaryViewModel>(DoShowReview);

            ShowAnnotations = ReactiveCommand.Create <IPullRequestCheckViewModel>(DoShowAnnotations);
        }
 public CloneSolutionTemplateCommand(IGitService gitService, IGetTemplateByIdQuery getTemplateByIdQuery)
 {
     _gitService           = gitService;
     _getTemplateByIdQuery = getTemplateByIdQuery;
 }