Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
b37608b7
Commit
b37608b7
authored
Nov 11, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add fetch-remote command
parent
4599d643
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+25
-0
No files found.
lib/gitlab_projects.rb
View file @
b37608b7
...
...
@@ -59,6 +59,7 @@ class GitlabProjects
when
'mv-project'
;
mv_project
when
'import-project'
;
import_project
when
'fork-project'
;
fork_project
when
'fetch-remote'
;
fetch_remote
when
'update-head'
;
update_head
else
$logger
.
warn
"Attempt to execute invalid gitlab-projects command
#{
@command
.
inspect
}
."
...
...
@@ -128,6 +129,30 @@ class GitlabProjects
url
end
def
fetch_remote
@name
=
ARGV
.
shift
# timeout for fetch
timeout
=
(
ARGV
.
shift
||
120
).
to_i
$logger
.
info
"Fetching remote
#{
@name
}
for project
#{
@project_name
}
."
cmd
=
%W(git --git-dir=
#{
full_path
}
fetch
#{
@name
}
--tags)
pid
=
Process
.
spawn
(
*
cmd
)
begin
Timeout
.
timeout
(
timeout
)
do
Process
.
wait
(
pid
)
end
$?
.
exitstatus
.
zero?
rescue
Timeout
::
Error
$logger
.
error
"Fetching remote
#{
@name
}
for project
#{
@project_name
}
failed due to timeout."
Process
.
kill
(
'KILL'
,
pid
)
Process
.
wait
false
end
end
def
remove_origin_in_repo
cmd
=
%W(git --git-dir=
#{
full_path
}
remote rm origin)
pid
=
Process
.
spawn
(
*
cmd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment