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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
2c796a17
Commit
2c796a17
authored
Mar 21, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache project branches and tags into variables
parent
6cf189f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+16
-0
No files found.
CHANGELOG
View file @
2c796a17
...
@@ -15,6 +15,7 @@ v 7.10.0 (unreleased)
...
@@ -15,6 +15,7 @@ v 7.10.0 (unreleased)
- Improve error message when save profile has error.
- Improve error message when save profile has error.
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
- Add location field to user profile
- Add location field to user profile
- Improve GitLab performance when working with git repositories
v 7.9.0 (unreleased)
v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu)
- Add HipChat integration documentation (Stan Hu)
...
...
app/models/repository.rb
View file @
2c796a17
...
@@ -62,24 +62,28 @@ class Repository
...
@@ -62,24 +62,28 @@ class Repository
def
add_branch
(
branch_name
,
ref
)
def
add_branch
(
branch_name
,
ref
)
cache
.
expire
(
:branch_names
)
cache
.
expire
(
:branch_names
)
@branches
=
nil
gitlab_shell
.
add_branch
(
path_with_namespace
,
branch_name
,
ref
)
gitlab_shell
.
add_branch
(
path_with_namespace
,
branch_name
,
ref
)
end
end
def
add_tag
(
tag_name
,
ref
,
message
=
nil
)
def
add_tag
(
tag_name
,
ref
,
message
=
nil
)
cache
.
expire
(
:tag_names
)
cache
.
expire
(
:tag_names
)
@tags
=
nil
gitlab_shell
.
add_tag
(
path_with_namespace
,
tag_name
,
ref
,
message
)
gitlab_shell
.
add_tag
(
path_with_namespace
,
tag_name
,
ref
,
message
)
end
end
def
rm_branch
(
branch_name
)
def
rm_branch
(
branch_name
)
cache
.
expire
(
:branch_names
)
cache
.
expire
(
:branch_names
)
@branches
=
nil
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
end
end
def
rm_tag
(
tag_name
)
def
rm_tag
(
tag_name
)
cache
.
expire
(
:tag_names
)
cache
.
expire
(
:tag_names
)
@tags
=
nil
gitlab_shell
.
rm_tag
(
path_with_namespace
,
tag_name
)
gitlab_shell
.
rm_tag
(
path_with_namespace
,
tag_name
)
end
end
...
@@ -368,6 +372,18 @@ class Repository
...
@@ -368,6 +372,18 @@ class Repository
end
end
end
end
def
branches
@branches
||=
raw_repository
.
branches
end
def
tags
@tags
||=
raw_repository
.
tags
end
def
root_ref
@root_ref
||=
raw_repository
.
root_ref
end
private
private
def
cache
def
cache
...
...
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