mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-16 00:03:31 -04:00
Compare commits
7 Commits
b9baed2c74
...
54c28fddd8
Author | SHA1 | Date | |
---|---|---|---|
|
54c28fddd8 | ||
|
b1089bdafe | ||
|
6ed4626ed5 | ||
|
ab388deb0e | ||
|
ab0e588217 | ||
|
edd93fcfbc | ||
|
9a65d011f6 |
@ -102,8 +102,11 @@ MODE = file, file-error
|
||||
|
||||
; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it
|
||||
; [log.file]
|
||||
; by default, the MODE (actually it's the output writer of this logger) is taken from the section name, so we don't need to set it either
|
||||
; MODE = file
|
||||
|
||||
[log.file-error]
|
||||
MODE = file
|
||||
LEVEL = Error
|
||||
FILE_NAME = file-error.log
|
||||
```
|
||||
|
@ -40,7 +40,7 @@ apk add gitea
|
||||
|
||||
## Arch Linux
|
||||
|
||||
The rolling release distribution has [Gitea](https://www.archlinux.org/packages/community/x86_64/gitea/) in their official community repository and package updates are provided with new Gitea releases.
|
||||
The rolling release distribution has [Gitea](https://www.archlinux.org/packages/extra/x86_64/gitea/) in their official extra repository and package updates are provided with new Gitea releases.
|
||||
|
||||
```sh
|
||||
pacman -S gitea
|
||||
|
@ -395,9 +395,9 @@ func FindRecentlyPushedNewBranches(ctx context.Context, repoID, userID int64, ex
|
||||
Where("pusher_id=? AND is_deleted=?", userID, false).
|
||||
And("name <> ?", excludeBranchName).
|
||||
And("repo_id = ?", repoID).
|
||||
And("updated_unix >= ?", time.Now().Add(-time.Hour*6).Unix()).
|
||||
And("commit_time >= ?", time.Now().Add(-time.Hour*6).Unix()).
|
||||
NotIn("name", subQuery).
|
||||
OrderBy("branch.updated_unix DESC").
|
||||
OrderBy("branch.commit_time DESC").
|
||||
Limit(2).
|
||||
Find(&branches)
|
||||
return branches, err
|
||||
|
@ -85,6 +85,12 @@ func UpdatePushMirror(ctx context.Context, m *PushMirror) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// UpdatePushMirrorInterval updates the push-mirror
|
||||
func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error {
|
||||
_, err := db.GetEngine(ctx).ID(m.ID).Cols("interval").Update(m)
|
||||
return err
|
||||
}
|
||||
|
||||
func DeletePushMirrors(ctx context.Context, opts PushMirrorOptions) error {
|
||||
if opts.RepoID > 0 {
|
||||
_, err := db.GetEngine(ctx).Where(opts.toConds()).Delete(&PushMirror{})
|
||||
|
@ -165,7 +165,7 @@ func loadLogModeByName(rootCfg ConfigProvider, loggerName, modeName string) (wri
|
||||
writerMode.WriterOption = writerOption
|
||||
default:
|
||||
if !log.HasEventWriter(writerType) {
|
||||
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s", writerType)
|
||||
return "", "", writerMode, fmt.Errorf("invalid log writer type (mode): %s, maybe it needs something like 'MODE=file' in [log.%s] section", writerType, modeName)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1966,6 +1966,8 @@ settings.mirror_settings.last_update = Last update
|
||||
settings.mirror_settings.push_mirror.none = No push mirrors configured
|
||||
settings.mirror_settings.push_mirror.remote_url = Git Remote Repository URL
|
||||
settings.mirror_settings.push_mirror.add = Add Push Mirror
|
||||
settings.mirror_settings.push_mirror.edit_sync_time = Edit mirror sync interval
|
||||
|
||||
settings.sync_mirror = Synchronize Now
|
||||
settings.mirror_sync_in_progress = Mirror synchronization is in progress. Check back in a minute.
|
||||
settings.site = Website
|
||||
|
@ -299,6 +299,43 @@ func SettingsPost(ctx *context.Context) {
|
||||
ctx.Flash.Info(ctx.Tr("repo.settings.mirror_sync_in_progress"))
|
||||
ctx.Redirect(repo.Link() + "/settings")
|
||||
|
||||
case "push-mirror-update":
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.NotFound("", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// This section doesn't require repo_name/RepoName to be set in the form, don't show it
|
||||
// as an error on the UI for this action
|
||||
ctx.Data["Err_RepoName"] = nil
|
||||
|
||||
interval, err := time.ParseDuration(form.PushMirrorInterval)
|
||||
if err != nil || (interval != 0 && interval < setting.Mirror.MinInterval) {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.mirror_interval_invalid"), tplSettingsOptions, &forms.RepoSettingForm{})
|
||||
return
|
||||
}
|
||||
|
||||
id, err := strconv.ParseInt(form.PushMirrorID, 10, 64)
|
||||
if err != nil {
|
||||
ctx.ServerError("UpdatePushMirrorIntervalPushMirrorID", err)
|
||||
return
|
||||
}
|
||||
m := &repo_model.PushMirror{
|
||||
ID: id,
|
||||
Interval: interval,
|
||||
}
|
||||
if err := repo_model.UpdatePushMirrorInterval(ctx, m); err != nil {
|
||||
ctx.ServerError("UpdatePushMirrorInterval", err)
|
||||
return
|
||||
}
|
||||
// Background why we are adding it to Queue
|
||||
// If we observed its implementation in the context of `push-mirror-sync` where it
|
||||
// is evident that pushing to the queue is necessary for updates.
|
||||
// So, there are updates within the given interval, it is necessary to update the queue accordingly.
|
||||
mirror_module.AddPushMirrorToQueue(m.ID)
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))
|
||||
ctx.Redirect(repo.Link() + "/settings")
|
||||
|
||||
case "push-mirror-remove":
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.NotFound("", nil)
|
||||
|
@ -999,10 +999,18 @@ func renderCode(ctx *context.Context) {
|
||||
ctx.ServerError("GetBaseRepo", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRecentlyPushedBranches", err)
|
||||
return
|
||||
|
||||
showRecentlyPushedNewBranches := true
|
||||
if ctx.Repo.Repository.IsMirror ||
|
||||
!ctx.Repo.Repository.UnitEnabled(ctx, unit_model.TypePullRequests) {
|
||||
showRecentlyPushedNewBranches = false
|
||||
}
|
||||
if showRecentlyPushedNewBranches {
|
||||
ctx.Data["RecentlyPushedNewBranches"], err = git_model.FindRecentlyPushedNewBranches(ctx, ctx.Repo.Repository.ID, ctx.Doer.ID, ctx.Repo.Repository.DefaultBranch)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetRecentlyPushedBranches", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{if .CanWriteProjects}}
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
|
||||
<div class="gt-text-right">
|
||||
<a class="ui small green button" href="{{$.Link}}/new">{{.locale.Tr "repo.projects.new"}}</a>
|
||||
</div>
|
||||
@ -72,7 +72,7 @@
|
||||
{{template "base/paginate" .}}
|
||||
</div>
|
||||
|
||||
{{if $.CanWriteProjects}}
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
|
||||
<div class="ui g-modal-confirm delete modal">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{{range .RecentlyPushedNewBranches}}
|
||||
<div class="ui positive message gt-df gt-ac">
|
||||
<div class="gt-f1">
|
||||
{{$timeSince := TimeSince .UpdatedUnix.AsTime $.locale}}
|
||||
{{$timeSince := TimeSince .CommitTime.AsTime $.locale}}
|
||||
{{$.locale.Tr "repo.pulls.recently_pushed_new_branches" (PathEscapeSegments .Name) $timeSince | Safe}}
|
||||
</div>
|
||||
<a aria-role="button" class="ui compact positive button gt-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo (PathEscapeSegments .Name)}}">
|
||||
|
@ -374,7 +374,7 @@
|
||||
<div class="gt-df gt-sb gt-ac">
|
||||
<div class="due-date {{if .Issue.IsOverdue}}text red{{end}}" {{if .Issue.IsOverdue}}data-tooltip-content="{{.locale.Tr "repo.issues.due_date_overdue"}}"{{end}}>
|
||||
{{svg "octicon-calendar" 16 "gt-mr-3"}}
|
||||
{{DateTime "long" .Issue.DeadlineUnix}}
|
||||
{{DateTime "long" .Issue.DeadlineUnix.FormatDate}}
|
||||
</div>
|
||||
<div>
|
||||
{{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}}
|
||||
|
@ -2,92 +2,7 @@
|
||||
<div role="main" aria-label="{{.Title}}" class="page-content repository projects milestones">
|
||||
{{template "repo/header" .}}
|
||||
<div class="ui container">
|
||||
<div class="navbar projects-header">
|
||||
<div>
|
||||
<div class="small-menu-items ui compact tiny menu">
|
||||
<a class="item{{if not .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/projects?state=open">
|
||||
{{svg "octicon-project" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .OpenCount}} {{.locale.Tr "repo.issues.open_title"}}
|
||||
</a>
|
||||
<a class="item{{if .IsShowClosed}} active{{end}}" href="{{.RepoLink}}/projects?state=closed">
|
||||
{{svg "octicon-check" 16 "gt-mr-3"}}
|
||||
{{.locale.PrettyNumber .ClosedCount}} {{.locale.Tr "repo.issues.closed_title"}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="projects-toolbar">
|
||||
<!-- Sort -->
|
||||
<div class="ui small dropdown type jump item">
|
||||
<span class="text">
|
||||
{{.locale.Tr "repo.issues.filter_sort"}}
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
</span>
|
||||
<div class="menu">
|
||||
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&sort=oldest&state={{$.State}}">{{.locale.Tr "repo.issues.filter_sort.oldest"}}</a>
|
||||
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&sort=recentupdate&state={{$.State}}">{{.locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
|
||||
<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="{{$.Link}}?q={{$.Keyword}}&sort=leastupdate&state={{$.State}}">{{.locale.Tr "repo.issues.filter_sort.leastupdate"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
{{if and .CanWriteProjects (not .Repository.IsArchived)}}
|
||||
<a class="ui small green button gt-ml-4" href="{{$.Link}}/new">{{.locale.Tr "repo.projects.new"}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/alert" .}}
|
||||
|
||||
<div class="milestone-list">
|
||||
{{range .Projects}}
|
||||
<li class="milestone-card">
|
||||
<h3 class="flex-text-block gt-m-0">
|
||||
{{svg .IconName 16}}
|
||||
<a class="muted" href="{{.Link}}">{{.Title}}</a>
|
||||
</h3>
|
||||
<div class="milestone-toolbar">
|
||||
<div class="group">
|
||||
<div class="flex-text-block">
|
||||
{{svg "octicon-issue-opened" 14}}
|
||||
{{$.locale.PrettyNumber .NumOpenIssues}} {{$.locale.Tr "repo.issues.open_title"}}
|
||||
</div>
|
||||
<div class="flex-text-block">
|
||||
{{svg "octicon-check" 14}}
|
||||
{{$.locale.PrettyNumber .NumClosedIssues}} {{$.locale.Tr "repo.issues.closed_title"}}
|
||||
</div>
|
||||
</div>
|
||||
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
|
||||
<div class="group">
|
||||
<a class="flex-text-inline" href="{{.Link}}/edit">{{svg "octicon-pencil" 14}}{{$.locale.Tr "repo.issues.label_edit"}}</a>
|
||||
{{if .IsClosed}}
|
||||
<a class="link-action flex-text-inline" href data-url="{{.Link}}/open">{{svg "octicon-check" 14}}{{$.locale.Tr "repo.projects.open"}}</a>
|
||||
{{else}}
|
||||
<a class="link-action flex-text-inline" href data-url="{{.Link}}/close">{{svg "octicon-skip" 14}}{{$.locale.Tr "repo.projects.close"}}</a>
|
||||
{{end}}
|
||||
<a class="delete-button flex-text-inline" href="#" data-url="{{.Link}}/delete">{{svg "octicon-trash" 14}}{{$.locale.Tr "repo.issues.label_delete"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{if .Description}}
|
||||
<div class="content">
|
||||
{{.RenderedContent|Str2html}}
|
||||
</div>
|
||||
{{end}}
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
{{template "base/paginate" .}}
|
||||
</div>
|
||||
{{template "projects/list" .}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .CanWriteProjects}}
|
||||
<div class="ui g-modal-confirm delete modal">
|
||||
<div class="header">
|
||||
{{svg "octicon-trash"}}
|
||||
{{.locale.Tr "repo.projects.deletion"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{{.locale.Tr "repo.projects.deletion_desc"}}</p>
|
||||
</div>
|
||||
{{template "base/modal_actions_confirm" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{template "base/footer" .}}
|
||||
|
@ -203,17 +203,27 @@
|
||||
<td>{{$.locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
|
||||
<td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{$.locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{$.locale.Tr "error"}}</div>{{end}}</td>
|
||||
<td class="right aligned">
|
||||
<form method="post" class="gt-dib">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="action" value="push-mirror-remove">
|
||||
<input type="hidden" name="push_mirror_id" value="{{.ID}}">
|
||||
<button class="ui basic red tiny button inline text-thin">{{$.locale.Tr "remove"}}</button>
|
||||
</form>
|
||||
<button
|
||||
class="ui tiny button show-modal"
|
||||
data-modal="#push-mirror-edit-modal"
|
||||
data-tooltip-content="{{$.locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}"
|
||||
data-modal-push-mirror-edit-id="{{.ID}}"
|
||||
data-modal-push-mirror-edit-interval="{{.Interval}}"
|
||||
data-modal-push-mirror-edit-address="{{$address.Address}}"
|
||||
>
|
||||
{{svg "octicon-pencil" 14}}
|
||||
</button>
|
||||
<form method="post" class="gt-dib">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="action" value="push-mirror-sync">
|
||||
<input type="hidden" name="push_mirror_id" value="{{.ID}}">
|
||||
<button class="ui primary tiny button inline text-thin">{{$.locale.Tr "repo.settings.sync_mirror"}}</button>
|
||||
<button class="ui primary tiny button" data-tooltip-content="{{$.locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button>
|
||||
</form>
|
||||
<form method="post" class="gt-dib">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<input type="hidden" name="action" value="push-mirror-remove">
|
||||
<input type="hidden" name="push_mirror_id" value="{{.ID}}">
|
||||
<button class="ui basic red tiny button" data-tooltip-content="{{$.locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@ -980,3 +990,5 @@
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{template "repo/settings/push_mirror_sync_modal" .}}
|
||||
|
32
templates/repo/settings/push_mirror_sync_modal.tmpl
Normal file
32
templates/repo/settings/push_mirror_sync_modal.tmpl
Normal file
@ -0,0 +1,32 @@
|
||||
<div class="ui small modal" id="push-mirror-edit-modal">
|
||||
<div class="header">
|
||||
{{$.locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}
|
||||
</div>
|
||||
<div class="content">
|
||||
<form class="ui form ignore-dirty" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<input type="hidden" name="action" value="push-mirror-update">
|
||||
<input type="hidden" name="push_mirror_id" id="push-mirror-edit-id">
|
||||
<div class="field">
|
||||
<label for="name">{{$.locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</label>
|
||||
<div class="ui small input">
|
||||
<input id="push-mirror-edit-address" readonly>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label for="push-mirror-edit-interval">{{.locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
|
||||
<input id="push-mirror-edit-interval" name="push_mirror_interval" autofocus>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="ui small basic cancel button">
|
||||
{{svg "octicon-x"}}
|
||||
{{.locale.Tr "cancel"}}
|
||||
</button>
|
||||
<button class="ui primary small approve button">
|
||||
{{svg "fontawesome-save"}}
|
||||
{{.locale.Tr "save"}}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -12,6 +12,7 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
packages_model "code.gitea.io/gitea/models/packages"
|
||||
@ -43,6 +44,9 @@ func InitTest(requireGitea bool) {
|
||||
exitf("Environment variable $GITEA_ROOT not set")
|
||||
}
|
||||
|
||||
// Speedup tests that rely on the event source ticker.
|
||||
setting.UI.Notification.EventSourceUpdateTime = time.Second
|
||||
|
||||
setting.IsInTesting = true
|
||||
setting.AppWorkPath = giteaRoot
|
||||
setting.CustomPath = filepath.Join(setting.AppWorkPath, "custom")
|
||||
|
@ -87,18 +87,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.projects-header {
|
||||
margin-bottom: 1rem;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.projects-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.repository .issue-content-right .menu {
|
||||
overflow-x: auto;
|
||||
max-height: 500px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user