diff options
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/models/repo.go b/models/repo.go index 1e899c182b..8139d22abf 100644 --- a/models/repo.go +++ b/models/repo.go @@ -204,6 +204,22 @@ type Mirror struct { NextUpdate time.Time } +func GetMirror(repoId int64) (*Mirror, error) { + m := &Mirror{RepoId: repoId} + has, err := x.Get(m) + if err != nil { + return nil, err + } else if !has { + return nil, ErrMirrorNotExist + } + return m, nil +} + +func UpdateMirror(m *Mirror) error { + _, err := x.Id(m.Id).Update(m) + return err +} + // MirrorRepository creates a mirror repository from source. func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error { _, stderr, err := process.ExecTimeout(10*time.Minute, @@ -226,22 +242,6 @@ func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) er return nil } -func GetMirror(repoId int64) (*Mirror, error) { - m := &Mirror{RepoId: repoId} - has, err := x.Get(m) - if err != nil { - return nil, err - } else if !has { - return nil, ErrMirrorNotExist - } - return m, nil -} - -func UpdateMirror(m *Mirror) error { - _, err := x.Id(m.Id).Update(m) - return err -} - // MirrorUpdate checks and updates mirror repositories. func MirrorUpdate() { if err := x.Iterate(new(Mirror), func(idx int, bean interface{}) error { |