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
Kazuhiko Shiozaki
gitlab-ce
Commits
ca9098d8
Commit
ca9098d8
authored
Mar 07, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove last commit widget, added repo size and owner info on project home page
parent
e90277f9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
17 deletions
+37
-17
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+0
-1
app/models/repository.rb
app/models/repository.rb
+19
-0
app/services/git_push_service.rb
app/services/git_push_service.rb
+1
-0
app/views/projects/_last_commit.html.haml
app/views/projects/_last_commit.html.haml
+0
-11
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+17
-5
No files found.
app/controllers/projects_controller.rb
View file @
ca9098d8
...
@@ -59,7 +59,6 @@ class ProjectsController < ProjectResourceController
...
@@ -59,7 +59,6 @@ class ProjectsController < ProjectResourceController
format
.
html
do
format
.
html
do
if
@project
.
repository
&&
!
@project
.
repository
.
empty?
if
@project
.
repository
&&
!
@project
.
repository
.
empty?
@last_push
=
current_user
.
recent_push
(
@project
.
id
)
@last_push
=
current_user
.
recent_push
(
@project
.
id
)
@last_commit
=
CommitDecorator
.
decorate
(
@project
.
repository
.
commit
)
render
:show
render
:show
else
else
render
"projects/empty"
render
"projects/empty"
...
...
app/models/repository.rb
View file @
ca9098d8
class
Repository
class
Repository
include
Gitlab
::
Popen
# Repository directory name with namespace direcotry
# Repository directory name with namespace direcotry
# Examples:
# Examples:
# gitlab/gitolite
# gitlab/gitolite
...
@@ -147,4 +149,21 @@ class Repository
...
@@ -147,4 +149,21 @@ class Repository
file_path
file_path
end
end
# Return repo size in megabytes
# Cached in redis
def
size
Rails
.
cache
.
fetch
(
cache_key
(
:size
))
do
size
=
popen
(
'du -s'
,
path_to_repo
).
first
.
strip
.
to_i
(
size
.
to_f
/
1024
).
round
(
2
)
end
end
def
expire_cache
Rails
.
cache
.
delete
(
cache_key
(
:size
))
end
def
cache_key
(
type
)
"
#{
type
}
:
#{
path_with_namespace
}
"
end
end
end
app/services/git_push_service.rb
View file @
ca9098d8
...
@@ -23,6 +23,7 @@ class GitPushService
...
@@ -23,6 +23,7 @@ class GitPushService
project
.
ensure_satellite_exists
project
.
ensure_satellite_exists
project
.
discover_default_branch
project
.
discover_default_branch
project
.
repository
.
expire_cache
if
push_to_branch?
(
ref
,
oldrev
)
if
push_to_branch?
(
ref
,
oldrev
)
project
.
update_merge_requests
(
oldrev
,
newrev
,
ref
,
@user
)
project
.
update_merge_requests
(
oldrev
,
newrev
,
ref
,
@user
)
...
...
app/views/projects/_last_commit.html.haml
deleted
100644 → 0
View file @
e90277f9
.commit
%p
%time
.committed_ago
{
datetime:
commit
.
committed_date
,
title:
commit
.
committed_date
.
stamp
(
"Aug 21, 2011 9:23pm"
)
}
=
time_ago_in_words
(
commit
.
committed_date
)
ago
=
commit
.
author_link
avatar:
true
,
size:
16
%p
=
link_to
commit
.
short_id
(
8
),
project_commit_path
(
@project
,
commit
),
class:
"commit_short_id"
=
link_to_gfm
truncate
(
commit
.
title
,
length:
30
),
project_commit_path
(
@project
,
commit
.
id
),
class:
"row_title"
app/views/projects/show.html.haml
View file @
ca9098d8
...
@@ -3,19 +3,31 @@
...
@@ -3,19 +3,31 @@
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
.row
.row
.span
8
.span
9
.content_list
=
render
@events
.content_list
=
render
@events
.loading.hide
.loading.hide
.span
4
.span
3
.ui-box.white
.ui-box.white
.padded
.padded
%h3
.page_title
%h3
.page_title
=
@project
.
name
=
@project
.
name
%hr
-
if
@project
.
description
.
present?
-
if
@project
.
description
.
present?
%p
.light
=
@project
.
description
%p
.light
=
@project
.
description
%h5
Last commit:
%hr
=
render
'last_commit'
,
commit:
@last_commit
%p
Access level:
-
if
@project
.
public
%span
.cblue
%i
.icon-share
Public
-
else
%span
.cgreen
%i
.icon-lock
Private
%p
Repo Size:
#{
@project
.
repository
.
size
}
MB
%p
Created at:
#{
@project
.
created_at
.
stamp
(
'Aug 22, 2013'
)
}
%p
Owner:
#{
link_to
@project
.
owner_name
,
@project
.
owner
}
:javascript
:javascript
$
(
function
(){
Pager
.
init
(
20
);
});
$
(
function
(){
Pager
.
init
(
20
);
});
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