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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-03-27 17:43:03 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-04-03 21:50:22 +0300
commit336ba94a7bbdd52f07d0f1c7f7bced20c37ad307 (patch)
tree881862060ce559f579ac8d5b31f1b81844678eea /lib/gitlab/shell.rb
parent97c49b8426c62b5b398ed9a2bf863d859a4b7e55 (diff)
Fetch GitHub project as a mirror to get all refs at once
Diffstat (limited to 'lib/gitlab/shell.rb')
-rw-r--r--lib/gitlab/shell.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb
index da8d8ddb8ed..94073d816e5 100644
--- a/lib/gitlab/shell.rb
+++ b/lib/gitlab/shell.rb
@@ -88,6 +88,25 @@ module Gitlab
true
end
+ # Fetch remote for repository
+ #
+ # name - project path with namespace
+ # remote - remote name
+ # forced - should we use --force flag?
+ #
+ # Ex.
+ # fetch_remote("gitlab/gitlab-ci", "upstream")
+ #
+ def fetch_remote(storage, name, remote, forced: false, no_tags: false)
+ args = [gitlab_shell_projects_path, 'fetch-remote', storage, "#{name}.git", remote, '2100']
+ args << '--force' if forced
+ args << '--no-tags' if no_tags
+
+ output, status = Popen.popen(args)
+ raise Error, output unless status.zero?
+ true
+ end
+
# Move repository
# storage - project's storage path
# path - project path with namespace