Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7304a594
Commit
7304a594
authored
Mar 17, 2020
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate remaining Gitlab::Shell methods
parent
6196fcf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+20
-2
No files found.
lib/gitlab/shell.rb
View file @
7304a594
# frozen_string_literal: true
# frozen_string_literal: true
# Gitaly note: SSH key operations are not part of Gitaly so will never be migrated.
require
'securerandom'
require
'securerandom'
module
Gitlab
module
Gitlab
# This class is an artifact of a time when common repository operations were
# performed by calling out to scripts in the gitlab-shell project. Now, these
# operations are all performed by Gitaly, and are mostly accessible through
# the Repository class. Prefer using a Repository to functionality here.
#
# Legacy code relating to namespaces still relies on Gitlab::Shell; it can be
# converted to a module once https://gitlab.com/groups/gitlab-org/-/epics/2320
# is completed. https://gitlab.com/gitlab-org/gitlab/-/issues/25095 tracks it.
class
Shell
class
Shell
Error
=
Class
.
new
(
StandardError
)
Error
=
Class
.
new
(
StandardError
)
...
@@ -86,6 +92,8 @@ module Gitlab
...
@@ -86,6 +92,8 @@ module Gitlab
# @param [String] disk_path current project path on disk
# @param [String] disk_path current project path on disk
# @param [String] new_disk_path new project path on disk
# @param [String] new_disk_path new project path on disk
# @return [Boolean] whether repository could be moved/renamed on disk
# @return [Boolean] whether repository could be moved/renamed on disk
#
# @deprecated
def
mv_repository
(
storage
,
disk_path
,
new_disk_path
)
def
mv_repository
(
storage
,
disk_path
,
new_disk_path
)
return
false
if
disk_path
.
empty?
||
new_disk_path
.
empty?
return
false
if
disk_path
.
empty?
||
new_disk_path
.
empty?
...
@@ -107,6 +115,8 @@ module Gitlab
...
@@ -107,6 +115,8 @@ module Gitlab
#
#
# @param [String] storage project's storage path
# @param [String] storage project's storage path
# @param [String] disk_path current project path on disk
# @param [String] disk_path current project path on disk
#
# @deprecated
def
remove_repository
(
storage
,
disk_path
)
def
remove_repository
(
storage
,
disk_path
)
return
false
if
disk_path
.
empty?
return
false
if
disk_path
.
empty?
...
@@ -127,6 +137,8 @@ module Gitlab
...
@@ -127,6 +137,8 @@ module Gitlab
#
#
# @param [String] storage project's storage path
# @param [String] storage project's storage path
# @param [String] name namespace name
# @param [String] name namespace name
#
# @deprecated
def
add_namespace
(
storage
,
name
)
def
add_namespace
(
storage
,
name
)
Gitlab
::
GitalyClient
.
allow_n_plus_1_calls
do
Gitlab
::
GitalyClient
.
allow_n_plus_1_calls
do
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
add
(
name
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
add
(
name
)
...
@@ -143,6 +155,8 @@ module Gitlab
...
@@ -143,6 +155,8 @@ module Gitlab
#
#
# @param [String] storage project's storage path
# @param [String] storage project's storage path
# @param [String] name namespace name
# @param [String] name namespace name
#
# @deprecated
def
rm_namespace
(
storage
,
name
)
def
rm_namespace
(
storage
,
name
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
remove
(
name
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
remove
(
name
)
rescue
GRPC
::
InvalidArgument
=>
e
rescue
GRPC
::
InvalidArgument
=>
e
...
@@ -158,6 +172,8 @@ module Gitlab
...
@@ -158,6 +172,8 @@ module Gitlab
# @param [String] storage project's storage path
# @param [String] storage project's storage path
# @param [String] old_name current namespace name
# @param [String] old_name current namespace name
# @param [String] new_name new namespace name
# @param [String] new_name new namespace name
#
# @deprecated
def
mv_namespace
(
storage
,
old_name
,
new_name
)
def
mv_namespace
(
storage
,
old_name
,
new_name
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
rename
(
old_name
,
new_name
)
Gitlab
::
GitalyClient
::
NamespaceService
.
new
(
storage
).
rename
(
old_name
,
new_name
)
rescue
GRPC
::
InvalidArgument
=>
e
rescue
GRPC
::
InvalidArgument
=>
e
...
@@ -174,6 +190,8 @@ module Gitlab
...
@@ -174,6 +190,8 @@ module Gitlab
# @return [Boolean] whether repository exists or not
# @return [Boolean] whether repository exists or not
# @param [String] storage project's storage path
# @param [String] storage project's storage path
# @param [Object] dir_name repository dir name
# @param [Object] dir_name repository dir name
#
# @deprecated
def
repository_exists?
(
storage
,
dir_name
)
def
repository_exists?
(
storage
,
dir_name
)
Gitlab
::
Git
::
Repository
.
new
(
storage
,
dir_name
,
nil
,
nil
).
exists?
Gitlab
::
Git
::
Repository
.
new
(
storage
,
dir_name
,
nil
,
nil
).
exists?
rescue
GRPC
::
Internal
rescue
GRPC
::
Internal
...
...
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