Exemple #1
0
        public void Checkout(string identifier)
        {
            if (identifier == null)
            {
                throw new ArgumentNullException(CommonExtensions.GetParameterName <string>(() => identifier));
            }

            using (var repository = new LibGit2Sharp.Repository(_localRepositoryPath))
            {
                var branchName = "origin/" + identifier;
                var branch     = repository.Branches.FirstOrDefault(b => b.FriendlyName == branchName);
                if (branch != null)
                {
                    CheckoutedBranch = Commands.Checkout(repository, branch);
                }
            }
        }
Exemple #2
0
        public GitRepositoryAccess(Uri localRepositoryPath, CloneOptions cloneOptions = null)
        {
            if (cloneOptions == null)
            {
                _cloneOptions = new CloneOptions();
                _cloneOptions.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials
                {
                    //TODO get this options from default configuration file
                    Username = "******",
                    Password = "******"
                };
            }

            if (localRepositoryPath == null)
            {
                throw new ArgumentNullException(CommonExtensions.GetParameterName <Uri>(() => localRepositoryPath));
            }

            _localRepositoryPath = localRepositoryPath.AbsolutePath;
        }