コード例 #1
0
 public async Task Fetch()
 {
     using (var repositorio = new Repository(Caminho))
     {
         {
             var remote   = repositorio.Network.Remotes["origin"];
             var refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
             var options  = new FetchOptions
             {
                 CredentialsProvider = Configuracoes.ObterCredenciais()
             };
             await Task.Run(() => Commands.Fetch(repositorio, remote.Name, refSpecs, options, ""));
         }
     }
 }
コード例 #2
0
 private static Signature ObterCommiter()
 {
     try
     {
         var appConfig     = ConfigurationManager.AppSettings;
         var nomeCommiter  = appConfig["nomeCommiter"] ?? throw new Exception("É preciso configurar o nome do usuario antes de comitar");
         var emailCommiter = appConfig["emailCommiter"] ?? throw new Exception("É preciso configurar o email do usuario antes de comitar");
         return(new Signature(nomeCommiter, emailCommiter, DateTimeOffset.Now));
     }
     catch (Exception)
     {
         var config = new Configuracoes();
         config.ShowDialog();
         return(ObterCommiter());
     }
 }
コード例 #3
0
            public void Pull()
            {
                var options = new PullOptions
                {
                    FetchOptions = new FetchOptions()
                    {
                        CredentialsProvider = Configuracoes.ObterCredenciais()
                    }
                };

                if (!_branch.IsCurrentRepositoryHead && _branch.IsTracking)
                {
                    Commands.Checkout(_repositorio, _branch);
                }

                Commands.Pull(_repositorio, ObterCommiter(), options);

                Versao          = ObterVersao();
                _versaoOriginal = Versao;
            }
コード例 #4
0
        public async Task Push()
        {
            using (var repo = new Repository(Caminho))
            {
                var options = new PushOptions
                {
                    CredentialsProvider = Configuracoes.ObterCredenciais()
                };

                var branches = from b in repo.Branches
                               where !b.IsRemote && b.TrackedBranch != null
                               select b;

                await Task.Run(() =>
                {
                    foreach (var branch in branches)
                    {
                        repo.Network.Push(branch, options);
                    }
                });
            }
        }
コード例 #5
0
 private async Task CarregarProjetos()
 {
     using (var dlg = new DlgAguarde(this, "Aguarde", "Carregando projetos"))
     {
         try
         {
             _projetos.Clear();
             var projetos = Directory.EnumerateDirectories(@"D:\Projetos");
             var tasks    = (
                 from projeto in projetos
                 let arquivoVersao = Configuracoes.ObterArquivoVersaoDoProjeto(projeto)
                                     where arquivoVersao != null
                                     let arquivoManifesto = Configuracoes.ObterArquivoManifestoDoProjeto(projeto)
                                                            select Task.Run(() => _projetos.Add(new Projeto(projeto, arquivoVersao, arquivoManifesto)))
                 ).ToList();
             await Task.WhenAll(tasks);
         }
         finally
         {
             grid.DataSource = _projetos;
         }
     }
 }
コード例 #6
0
        private void BtnConfig_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var config = new Configuracoes();

            config.Show();
        }