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
4718847c
Commit
4718847c
authored
Jun 21, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'file_lock_improvements' into 'master'
Address review comments for !440 See merge request !486
parents
8f8101d7
9a686542
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
app/helpers/path_locks_helper.rb
app/helpers/path_locks_helper.rb
+1
-1
app/views/projects/refs/logs_tree.js.haml
app/views/projects/refs/logs_tree.js.haml
+1
-1
lib/gitlab/path_locks_finder.rb
lib/gitlab/path_locks_finder.rb
+5
-5
spec/factories/path_locks.rb
spec/factories/path_locks.rb
+1
-1
No files found.
app/helpers/path_locks_helper.rb
View file @
4718847c
...
@@ -4,6 +4,6 @@ module PathLocksHelper
...
@@ -4,6 +4,6 @@ module PathLocksHelper
end
end
def
license_allows_file_locks?
def
license_allows_file_locks?
::
License
.
current
&&
::
License
.
current
.
add_on?
(
'GitLab_FileLocks'
)
@license_allows_file_locks
||=
(
::
License
.
current
&&
::
License
.
current
.
add_on?
(
'GitLab_FileLocks'
)
)
end
end
end
end
app/views/projects/refs/logs_tree.js.haml
View file @
4718847c
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
-
if
path_lock_info
-
if
path_lock_info
:plain
:plain
var label = $("<span>")
var label = $("<span>")
.attr('title', 'Locked by
#{
escape_javascript
path_lock_info
.
user
.
name
}
')
.attr('title', 'Locked by
#{
escape_javascript
path_lock_info
.
user
.
name
}
')
.attr('data-toggle', 'tooltip')
.attr('data-toggle', 'tooltip')
.addClass('fa fa-lock prepend-left-5');
.addClass('fa fa-lock prepend-left-5');
row.find('td.tree-item-file-name').append(label);
row.find('td.tree-item-file-name').append(label);
...
...
lib/gitlab/path_locks_finder.rb
View file @
4718847c
# The database stores locked paths as following:
# The database stores locked paths as following:
# 'app/models/
project.rb' or 'lib/gitlab
'
# 'app/models/
user.rb' or 'app/models
'
# To determine that '
lib/gitlab/some_class
.rb' is locked we need to generate
# To determine that '
app/models/user
.rb' is locked we need to generate
# tokens for every requested paths and check every token whether it exist in path locks table or not.
# tokens for every requested paths and check every token whether it exist in path locks table or not.
# So for '
lib/gitlab/some_class
.rb' path we would need to search next paths:
# So for '
app/models/user
.rb' path we would need to search next paths:
# '
lib', 'lib/gitlab' and 'lib/gitlab/some_class
.rb'
# '
app', 'app/models' and 'app/models/user
.rb'
# This class also implements a memoization for common paths like '
lib' 'lib/gitlab', 'app
', etc.
# This class also implements a memoization for common paths like '
app' 'app/models', 'vendor
', etc.
class
Gitlab::PathLocksFinder
class
Gitlab::PathLocksFinder
def
initialize
(
project
)
def
initialize
(
project
)
...
...
spec/factories/path_locks.rb
View file @
4718847c
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:path_lock
do
factory
:path_lock
do
project
project
user
{
build
:user
}
user
sequence
(
:path
)
{
|
n
|
"app/model
#{
n
}
"
}
sequence
(
:path
)
{
|
n
|
"app/model
#{
n
}
"
}
end
end
end
end
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