Skip to content

Commit afa37b6

Browse files
committed
Add UI and update src-d/go-git dependency
1 parent dd732dd commit afa37b6

File tree

29 files changed

+641
-200
lines changed

29 files changed

+641
-200
lines changed

Gopkg.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

options/locale/locale_en-US.ini

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,24 @@ activity.title.releases_1 = %d Release
10051005
activity.title.releases_n = %d Releases
10061006
activity.title.releases_published_by = %s published by %s
10071007
activity.published_release_label = Published
1008+
activity.no_git_activity = There has been any commit activity in this period.
1009+
activity.git_stats_exclude_merges = Excluding merges,
1010+
activity.git_stats_author_1 = %d author
1011+
activity.git_stats_author_n = %d authors
1012+
activity.git_stats_pushed = has pushed
1013+
activity.git_stats_commit_1 = %d commit
1014+
activity.git_stats_commit_n = %d commits
1015+
activity.git_stats_push_to_branch = to %s and
1016+
activity.git_stats_push_to_all_branches = to all branches.
1017+
activity.git_stats_on_default_branch = On %s,
1018+
activity.git_stats_file_1 = %d file
1019+
activity.git_stats_file_n = %d files
1020+
activity.git_stats_files_changed = have changed and there have been
1021+
activity.git_stats_addition_1 = %d addition
1022+
activity.git_stats_addition_n = %d additions
1023+
activity.git_stats_and_deletions = and
1024+
activity.git_stats_deletion_1 = %d deletion
1025+
activity.git_stats_deletion_n = %d deletions
10081026
10091027
search = Search
10101028
search.search_repo = Search repository

routers/repo/activity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Activity(ctx *context.Context) {
4444
ctx.Data["PeriodText"] = ctx.Tr("repo.activity.period." + ctx.Data["Period"].(string))
4545

4646
var err error
47-
if ctx.Data["Activity"], err = models.GetActivityStats(ctx.Repo.Repository.ID, timeFrom,
47+
if ctx.Data["Activity"], err = models.GetActivityStats(ctx.Repo.Repository, timeFrom,
4848
ctx.Repo.CanRead(models.UnitTypeReleases),
4949
ctx.Repo.CanRead(models.UnitTypeIssues),
5050
ctx.Repo.CanRead(models.UnitTypePullRequests),

templates/repo/activity.tmpl

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,32 @@
8181
</div>
8282
{{end}}
8383

84-
<span>
85-
Excluding merges, <strong>{{.Activity.Code.AuthorCount}} authors</strong>
86-
has pushed <strong>{{.Activity.Code.CommitCount}} commits</strong> to {{.Repository.DefaultBranch}}
87-
and <strong>{{.Activity.Code.CommitCountInAllBranches}} commits</strong> to all branches.
88-
On {{.Repository.DefaultBranch}}, <strong>{{.Activity.Code.ChangedFiles}} files</strong> have changed
89-
and there have been <strong>{{.Activity.Code.Additions}} additions</strong>
90-
and <strong>{{.Activity.Code.Deletions}} deletions</strong>.
91-
</span>
84+
{{if .Permission.CanRead $.UnitTypeCode}}
85+
{{if eq .Activity.Code.CommitCountInAllBranches 0}}
86+
<div class="ui center aligned segment">
87+
<h4 class="ui header">{{.i18n.Tr "repo.activity.no_git_activity" }}</h4>
88+
</div>
89+
{{end}}
90+
{{if gt .Activity.Code.CommitCountInAllBranches 0}}
91+
<div class="ui attached segment horizontal segments">
92+
<div class="ui attached segment text">
93+
{{.i18n.Tr "repo.activity.git_stats_exclude_merges" }}
94+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.AuthorCount "repo.activity.git_stats_author_1" "repo.activity.git_stats_author_n") .Activity.Code.AuthorCount }}</strong>
95+
{{.i18n.Tr "repo.activity.git_stats_pushed" }}
96+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.CommitCount "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n") .Activity.Code.CommitCount }}</strong>
97+
{{.i18n.Tr "repo.activity.git_stats_push_to_branch" .Repository.DefaultBranch }}
98+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.CommitCountInAllBranches "repo.activity.git_stats_commit_1" "repo.activity.git_stats_commit_n") .Activity.Code.CommitCountInAllBranches }}</strong>
99+
{{.i18n.Tr "repo.activity.git_stats_push_to_all_branches" }}
100+
{{.i18n.Tr "repo.activity.git_stats_on_default_branch" .Repository.DefaultBranch }}
101+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.ChangedFiles "repo.activity.git_stats_file_1" "repo.activity.git_stats_file_n") .Activity.Code.ChangedFiles }}</strong>
102+
{{.i18n.Tr "repo.activity.git_stats_files_changed" }}
103+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.Additions "repo.activity.git_stats_addition_1" "repo.activity.git_stats_addition_n") .Activity.Code.Additions }}</strong>
104+
{{.i18n.Tr "repo.activity.git_stats_and_deletions" }}
105+
<strong>{{.i18n.Tr (TrN .i18n.Lang .Activity.Code.Deletions "repo.activity.git_stats_deletion_1" "repo.activity.git_stats_deletion_n") .Activity.Code.Deletions }}</strong>.
106+
</div>
107+
</div>
108+
{{end}}
109+
{{end}}
92110

93111
{{if gt .Activity.PublishedReleaseCount 0}}
94112
<h4 class="ui horizontal divider header" id="published-releases">

vendor/gopkg.in/src-d/go-git.v4/config/config.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/internal/url/url.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/options.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/common.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/fsobject.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/packfile.go

Lines changed: 29 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/parser.go

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/scanner.go

Lines changed: 42 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)