Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem on import a private repository from bitbucket #105

Open
meigallodixital opened this issue Nov 3, 2014 · 2 comments
Open

Problem on import a private repository from bitbucket #105

meigallodixital opened this issue Nov 3, 2014 · 2 comments

Comments

@meigallodixital
Copy link

Mantis 1.2.17, Source Control Integration 0.18, BitBucket Integration 0.18 on a private GIT repository.

Config:
URL https://bitbucket.org/meigallodixital/myapp.com

array(5) {
["bit_basic_login"]=> string(8) "meigallodixital"
["bit_basic_pwd"]=> string(9) "password"
["bit_username"]=> string(8) "meigallodixital"
["bit_reponame"]=> string(9) "myapp.com"
["master_branch"]=> string(7) "master"
}

On import all:

SYSTEM WARNING: 'First parameter must either be an object or the name of an existing class' in '/home/desarrollo/sites/mantis.meigallodixital.com/web/plugins/SourceBitBucket/SourceBitBucket.php' line 255

SYSTEM WARNING: 'First parameter must either be an object or the name of an existing class' in '/home/desarrollo/sites/mantis.meigallodixital.com/web/plugins/SourceBitBucket/SourceBitBucket.php' line 260

Retrieving master ... failed.

@sverhagen
Copy link

This particular problem seems to be caused by the URL being malformed, which is due to the parameters being wrong. I figured this out by putting the following on line 254:

error_log("my URL is: " . $t_url);

I could then see the URL in my php.log. That was helpful for me because it made me understand that it's talking to the Bitbucket API: "https://bitbucket.org/api/2.0/repositories/bit_username/bit_reponame/commits/master".

It turned out that I had used my repository name, instead of the repository slug. The name might by something like "My Repository", in which the case would be "my-repository". If you look at the normal Git "clone" URL, you'd find that it looks something like this: "https://bit_basic_login@bitbucket.org/bit_username/bit_reponame.git". And, of course, your problem may be different than mine. FYI, I end up leaving the URL empty for now.

@sverhagen
Copy link

Another problem that I'm noticing, and this may be not so much a problem in production, but I have been heavily debugging this plugin, is that I'm hitting Bitbucket's rate limits:

Rate limit for this resource has been exceeded

The above message shows up in my PHP log when changing SourceBitBucket.php as follows:

    private function api_json_url( $p_repo, $p_url ) {
            $t_data = $this->url_get( $p_repo, $p_url );
// add this:
error_log($t_data, 0);
            $t_json = json_decode( utf8_encode( $t_data ) );
            return $t_json;
    }

Since the above message isn't JSON, like normal responses, it doesn't get parsed as such, and the script trips over that at the same line 255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants