Commit Graph

85 Commits

Author SHA1 Message Date
Rémy Coutable a5850041d3
Minor improvements after latest review
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 12:45:15 +02:00
Rémy Coutable 7833d3fb29
Improve & simplify GitHub's representation classes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 11:05:45 +02:00
Rémy Coutable a55e150177 Set `label_ids` and `assignee_ids` after the initial `save!`.
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:26 +02:00
Rémy Coutable f96b4f4141 Fetch the remote if a PR has been created/updated after the last fetch
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:26 +02:00
Rémy Coutable 37cdde195f Ensure Github::Import#execute returns false if any errors occured
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:26 +02:00
Rémy Coutable be35346bc7 Set `ref_fetched` to `true` in Github::Import#fetch_pull_requests
Since we fetch all the refs we need at the beginning of the import
process, we can safely set this attribute.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:26 +02:00
Rémy Coutable 43b75b3808 Don't even check if the branch exists locally as we only use its name in GH import
The benefit is that we don't even have to create temp source/target
branches.

Also, when the source branch of the imported MR is from a fork, name it
"user:branch" to mimic how we display it for MR when forks actually
exists.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:25 +02:00
Rémy Coutable f8184cec85 Don't check for commit existence in Github::Representation::Branch#exists?
We don't need to check if the existing branch contains a specific SHA
since we only use the branch's name, the SHA is taken from the pull
request raw `sha` data.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:25 +02:00
Rémy Coutable 324f672eef Keep only the changes that are known to work well
Also, improved a bit the method names in
Github::Representation::PullRequest.

Last but not least, ensure temp branch names doesn't contain a `/` as
this would create the ref in a subfolder in `refs/heads` (e.g.
`refs/heads/gh-123/456/rymai/foo`), and would leave empty directories
upon branch deletion (e.g. `refs/heads/gh-123/456/rymai/`.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-10-05 10:48:25 +02:00
James Lopez 149adcd120 Fetch and map refs/pull to refs/merge-requests in the GH import
update MR diff
2017-10-05 10:48:25 +02:00
Lin Jen-Shin (godfat) 8bac6e41ef Fix notes type created from import 2017-09-29 11:18:58 +00:00
Rémy Coutable 62120acf1d Add a spec for Github::Client and revert an `if !` to `unless`
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-09-26 19:17:00 +02:00
Rémy Coutable e484a06472 Retrieve PR comments only when we know there are any
The Pull Request resource doesn't include the `comments` field, while
the Issue resource does. And since we're looping through all issues
anyway, we can freely check if the issue is a PR and has comments and in
this case only fetch comments for it.

That means if you have 1000 PRs but only 200 with comments, you will do
200 API requests instead of 1000. :notbad:

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-09-26 19:17:00 +02:00
Rémy Coutable 60053c1201 Fetch 100 results when calling the GitHub API in Github::Import
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-09-26 19:17:00 +02:00
Ahmad Sherif 41ef94e777 Migrate creating/deleting a branch to Gitaly 2017-09-06 17:25:17 +02:00
Maxim Rydkin d807d3810f Decrease ABC threshold to 55.25 2017-08-31 10:58:05 +00:00
Bob Van Landuyt f76d8c902a Fix error when importing a GitHub-wiki repository
This would occur when Wiki's are enabled on GitHub, but there is no
wiki repository
2017-08-23 13:36:38 +02:00
Douglas Barbosa Alexandre e198eea90f Change `project.path_with_namespace` to `project.disk_path` 2017-08-07 14:18:05 -03:00
Douglas Barbosa Alexandre 0e191b4ccd Allow users to disable SSL verification if not connecting to github.com 2017-08-07 14:11:38 -03:00
Douglas Barbosa Alexandre 68f568d9dc Fix small typo on Github::Import#fetch_releases 2017-08-07 13:53:08 -03:00
Douglas Barbosa Alexandre ee3d8e9340 Import GitHub releases 2017-08-07 13:52:28 -03:00
Douglas Barbosa Alexandre d20a9132bd Fix Github::Import cache for user ids 2017-08-07 13:06:13 -03:00
Douglas Barbosa Alexandre cb08cb2218 Extrac common timeout to a constant on Github::Client 2017-08-07 13:06:13 -03:00
Douglas Barbosa Alexandre 6f642e3f7b Fix small typoe on Github::Client#root_endpoint 2017-08-07 13:06:13 -03:00
Douglas Barbosa Alexandre 8021a7244d Expire content cache when repository fetch fails 2017-08-07 13:06:13 -03:00
Douglas Barbosa Alexandre 4caa429374 Set the GitHub API token on options hash 2017-08-07 13:06:13 -03:00
Douglas Barbosa Alexandre a7363d4a54 Move GitHub root endpoint methods to Github::Client 2017-08-07 13:06:12 -03:00
Douglas Barbosa Alexandre 51186e72c5 Use a custom root endpoint if defined on GH ominiauth provider settings 2017-08-07 13:06:12 -03:00
Douglas Barbosa Alexandre 81995317f9 Use project.import_url to fetch repositories from Github 2017-08-07 13:06:12 -03:00
Gabriel Mazetto abb878326c Rename many path_with_namespace -> full_path 2017-08-01 07:26:58 +02:00
Douglas Barbosa Alexandre be108ae6f0 Add a comment explaining how the branch clean up happens 2017-06-21 11:42:08 -03:00
Douglas Barbosa Alexandre 7c85d6af96 Fix Github::Representation::PullRequest#source_branch_exists? 2017-06-21 11:42:08 -03:00
Douglas Barbosa Alexandre 0e298c55ad Fix GitHub importer performance on branch existence check 2017-06-21 11:42:08 -03:00
Douglas Barbosa Alexandre 7958223c57 Github - Fix token interpolation when cloning wiki repository 2017-06-12 16:37:18 -03:00
Douglas Barbosa Alexandre e901d1209e Reset create callbacks for Issues/MRs while importing GitHub projects 2017-05-11 17:30:56 -03:00
Douglas Barbosa Alexandre c5e4e676e3 Fix token interpolation when setting the Github remote 2017-05-11 17:29:42 -03:00
Valery Sizov 34be1835af [Multiple issue assignee] Fix a number of specs 2017-05-05 15:30:19 +03:00
Douglas Barbosa Alexandre 1d0a0b9ae7 Fix a failing Rubocop rule on master 2017-04-26 14:35:34 -03:00
Douglas Barbosa Alexandre d082b78998 Add basic progress output to GitHub import 2017-04-25 23:47:49 -03:00
Douglas Barbosa Alexandre 70d15ae1d9 Fix Rubocop offenses 2017-04-25 17:08:32 -03:00
Douglas Barbosa Alexandre 44954c507e Fix import of notes on Pull Request diff 2017-04-25 17:05:40 -03:00
Douglas Barbosa Alexandre 39ab842bc2 Create project repository only when it not exists 2017-04-25 15:58:17 -03:00
Douglas Barbosa Alexandre 000a723d84 Fix small typo on GitHub::Import 2017-04-25 15:57:50 -03:00
Douglas Barbosa Alexandre 2f934ce22f Remove the Github::Error base class 2017-04-25 13:30:30 -03:00
Douglas Barbosa Alexandre 7df974c433 Add blank line before the raise method on Github::Collection 2017-04-25 13:30:08 -03:00
Douglas Barbosa Alexandre aeb1684c52 Fix small typo 2017-04-24 23:41:46 -03:00
Douglas Barbosa Alexandre dd1157c80b Use Class.new(SuperClass) to define an empty custom error class 2017-04-24 23:41:36 -03:00
Douglas Barbosa Alexandre 30794972f4 Set timeout options to the Github::Client 2017-04-24 21:21:58 -03:00
Douglas Barbosa Alexandre 5d106f2597 Use the base initiliazer for representations 2017-04-24 21:13:51 -03:00
Douglas Barbosa Alexandre 05255631ae Cache labels at the same time we fetch them from the GH API 2017-04-24 21:03:42 -03:00