Add push to remote mirror repository #15157
Labels
No Label
backport/done
backport/v1.0
backport/v1.1
backport/v1.10
backport/v1.11
backport/v1.12
backport/v1.13
backport/v1.14
backport/v1.15
backport/v1.2
backport/v1.3
backport/v1.4
backport/v1.5
backport/v1.6
backport/v1.7
backport/v1.8
backport/v1.9
bounty
changelog
dependencies
frontport/done
frontport/main
good first issue
Hacktoberfest
hacktoberfest-accepted
in progress
kind/api
kind/breaking
kind/bug
kind/build
kind/deployment
kind/deprecated
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/misc
kind/moderation
kind/package
kind/proposal
kind/question
kind/refactor
kind/regression
kind/security
kind/summary
kind/testing
kind/translation
kind/ui
kind/upstream-related
kind/usability
kind/ux
lgtm/done
lgtm/need 1
lgtm/need 2
performance/bigrepo
performance/cpu
performance/memory
performance/speed
priority/critical
priority/low
priority/maybe
priority/medium
proposal/rejected
reviewed/confirmed
reviewed/duplicate
reviewed/fixed
reviewed/invalid
reviewed/not-a-bug
reviewed/wontfix
skip-changelog
stale
status/blocked
status/needs-feedback
status/wip
theme/2fa
theme/authentication
theme/avatar
theme/backup-restore
theme/docker
theme/federation
theme/issues
theme/kanban
theme/markdown
theme/migration
theme/mobile
theme/pr
theme/signing
theme/sqlite
theme/timetracker
theme/webhook
theme/wiki
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: lunny/gitea#15157
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature-push-mirror"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the ability to push-mirror a repository to a remote destination.
ToDo:
close #3480
maybe #2280
2021
Even if the code in the file was just moved from the other file?
A
created
column will help us sometimes.Tested this locally and it's looking really good! Are you still adding more tests? Asking because the checkbox is unchecked in the description.
Some initial findings:
Probably also a link to the docs - I can work on this
4. We should add some information about Auth to the right of the field - ex. password should probably be an OAuth token (this is actually required for 2FA logins).
5. Can we hide the "Direction" and "Last update" columns if there are no Mirrors?
6. Errors might be more consistent formatted as a message (this isn't a big deal though):
7. We should add the option to initialize a push mirror in the "New Repository" form. This can be a separate PR.
if we have Interval do we need NextUpdateUnix ?
I'm still not sure why we should store NextUpdateUnix in database. Since it can be calculated from LastUpdateUnix & Interval ?
Was just the same interface as the pull mirror. I removed the field and it should be removed in the pull mirror table too in another PR.
@ -0,0 +16,4 @@
var (
// ErrPushMirrorNotExist mirror does not exist error
ErrPushMirrorNotExist = errors.New("PushMirror does not exist")
NOTE: other error types for models package are declared in models/error.go ... throu I don't know if we should declare them in there used files instead ...
this is just a smal code inconsistency
@ -0,0 +33,4 @@
}
// AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (m *PushMirror) AfterLoad(session *xorm.Session) {
I'm not a fan of load it each time intransparent, we should create a "LoadRepo" func for PushMirror struct
And exec it where needed, this way we can also pass the error upwards and not just drop it into the logs
@ -0,0 +16,4 @@
var (
// ErrPushMirrorNotExist mirror does not exist error
ErrPushMirrorNotExist = errors.New("PushMirror does not exist")
I would vote for a location near/in the used file and not a god-file with all errors. Anyway in this case it's not a new error "type". If you search for
= errors.New
in the code they appear all in the file which uses them.@ -0,0 +33,4 @@
}
// AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (m *PushMirror) AfterLoad(session *xorm.Session) {
That was copied from the pull mirror. While I agree with your intention there is a fine line between being intransparent and cluttering the code every time the object is used. For the mirror structs for example the load of the repository is needed all the time. Maybe it would be useful if
AfterLoad
could return an error which would be propagated to the caller ofGet
,Find
andIterate
.@ -0,0 +33,4 @@
}
// AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (m *PushMirror) AfterLoad(session *xorm.Session) {
hmm an xorm feature request ...
and it looks like the "pull mirror" code need some tuning ...
I think you should use xorm.Builder so xorm take care of different sql dialects
LastError should use
xorm:"text"
default it's
varchar(255)
.