Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-03-07 12:36:42 +0300
committerGabriel Mazetto <brodock@gmail.com>2017-03-10 23:08:21 +0300
commit9b53cb6c88f406c947df24debcba0f87c66cbfcf (patch)
tree8874710fb35b8830d500bd68e408d7b05faf34ad /lib/gitlab/github_import
parentc4ba6ea684052ff555e8683c23be5b25bf5abd11 (diff)
Fix GitHub Import for open PRs from a fork
Diffstat (limited to 'lib/gitlab/github_import')
-rw-r--r--lib/gitlab/github_import/importer.rb2
-rw-r--r--lib/gitlab/github_import/pull_request_formatter.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index dc73cad93a5..055a07781a5 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -148,7 +148,7 @@ module Gitlab
rescue => e
errors << { type: :pull_request, url: Gitlab::UrlSanitizer.sanitize(gh_pull_request.url), errors: e.message }
ensure
- clean_up_restored_branches(gh_pull_request)
+ clean_up_restored_branches(gh_pull_request) unless gh_pull_request.opened?
end
end
end
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb
index 28812fd0cb9..0a31e3888bd 100644
--- a/lib/gitlab/github_import/pull_request_formatter.rb
+++ b/lib/gitlab/github_import/pull_request_formatter.rb
@@ -60,6 +60,18 @@ module Gitlab
source_branch.repo.id != target_branch.repo.id
end
+ def opened?
+ state == 'opened'
+ end
+
+ def closed?
+ state == 'closed'
+ end
+
+ def merged?
+ state == 'merged'
+ end
+
private
def state