Exemple #1
0
 public BitBucketIssueTracker(IRepository gitRepository, BitBucketApi bitBucketApi, ILog log, GitReleaseNotesArguments arguments)
 {
     this.gitRepository = gitRepository;
     this.bitBucketApi  = bitBucketApi;
     this.log           = log;
     this.arguments     = arguments;
 }
        public BitBucketIssueTracker(IRepository gitRepository, BitBucketApi bitBucketApi, Context context)
        {
            _gitRepository = gitRepository;
            _bitBucketApi = bitBucketApi;
            _context = context;

            if (!RemotePresentWhichMatches)
            {
                var repo = _context.IssueTracker.Url;
                if (repo == null)
                {
                    Log.WriteLine("Bitbucket repository name must be specified [/Repo .../...]");
                    return;
                }

                var repoParts = repo.Split('/');
                if (repoParts.Length != 2)
                {
                    Log.WriteLine("Bitbucket repository name should be in format Organisation/RepoName");
                    return;
                }

                _accountName = repoParts[0];
                _repoSlug = repoParts[1];
            }
            else
            {
                var remotes = _gitRepository.Network.Remotes.Where(r => r.Url.ToLower().Contains("bitbucket.org"));
                var remoteUrl = remotes.First().Url;
                var split = remoteUrl.Split('/', '.');
                _accountName = split[4];
                _repoSlug = split[5];
            }

            // Assume oauth first
            _oauth = true;
        }
Exemple #3
0
        public BitBucketIssueTracker(IRepository gitRepository, BitBucketApi bitBucketApi, Context context)
        {
            _gitRepository = gitRepository;
            _bitBucketApi  = bitBucketApi;
            _context       = context;

            if (!RemotePresentWhichMatches)
            {
                var repo = _context.IssueTracker.Url;
                if (repo == null)
                {
                    Log.WriteLine("Bitbucket repository name must be specified [/Repo .../...]");
                    return;
                }

                var repoParts = repo.Split('/');
                if (repoParts.Length != 2)
                {
                    Log.WriteLine("Bitbucket repository name should be in format Organisation/RepoName");
                    return;
                }

                _accountName = repoParts[0];
                _repoSlug    = repoParts[1];
            }
            else
            {
                var remotes   = _gitRepository.Network.Remotes.Where(r => r.Url.ToLower().Contains("bitbucket.org"));
                var remoteUrl = remotes.First().Url;
                var split     = remoteUrl.Split('/', '.');
                _accountName = split[4];
                _repoSlug    = split[5];
            }

            // Assume oauth first
            _oauth = true;
        }
Exemple #4
0
 public BitBucketIssueTracker(IRepository gitRepository, BitBucketApi bitBucketApi, Context context)
 {
     this.gitRepository = gitRepository;
     this.bitBucketApi  = bitBucketApi;
     this.context       = context;
 }