repository

package
v0.0.0-...-800eb33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2014 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestRepository

func CreateTestRepository(tmp_path string, repo string, file string, content string, folders ...string) (func(), error)

func GetArchive

func GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)

GetArchive returns the contents for a given file in a given ref for the specified repository

func GetFileContents

func GetFileContents(repo, ref, path string) ([]byte, error)

GetFileContents returns the contents for a given file in a given ref for the specified repository

func GetTree

func GetTree(repo, ref, path string) ([]map[string]string, error)

func GrantAccess

func GrantAccess(rNames, uNames []string) error

GrantAccess gives write permission for users in all specified repositories. If any of the repositories/users do not exists, GrantAccess just skips it.

func Remove

func Remove(name string) error

Remove deletes the repository from the database and removes it's bare Git repository.

func Rename

func Rename(oldName, newName string) error

Rename renames a repository.

func RevokeAccess

func RevokeAccess(rNames, uNames []string) error

RevokeAccess revokes write permission from users in all specified repositories.

Types

type ArchiveFormat

type ArchiveFormat int
const (
	Zip ArchiveFormat = iota
	Tar
	TarGz
)

type ContentRetriever

type ContentRetriever interface {
	GetContents(repo, ref, path string) ([]byte, error)
	GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)
	GetTree(repo, ref, path string) ([]map[string]string, error)
}
var Retriever ContentRetriever

type GitContentRetriever

type GitContentRetriever struct{}

func (*GitContentRetriever) GetArchive

func (*GitContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)

func (*GitContentRetriever) GetContents

func (*GitContentRetriever) GetContents(repo, ref, path string) ([]byte, error)

func (*GitContentRetriever) GetTree

func (*GitContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)

type MockContentRetriever

type MockContentRetriever struct {
	LastFormat     ArchiveFormat
	LastRef        string
	LastPath       string
	ResultContents []byte
	Tree           []map[string]string
	LookPathError  error
	OutputError    error
}

func (*MockContentRetriever) GetArchive

func (r *MockContentRetriever) GetArchive(repo, ref string, format ArchiveFormat) ([]byte, error)

func (*MockContentRetriever) GetContents

func (r *MockContentRetriever) GetContents(repo, ref, path string) ([]byte, error)

func (*MockContentRetriever) GetTree

func (r *MockContentRetriever) GetTree(repo, ref, path string) ([]map[string]string, error)

type Repository

type Repository struct {
	Name     string `bson:"_id"`
	Users    []string
	IsPublic bool
}

Repository represents a Git repository. A Git repository is a record in the database and a directory in the filesystem (the bare repository).

func Get

func Get(name string) (Repository, error)

Get find a repository by name.

func New

func New(name string, users []string, isPublic bool) (*Repository, error)

New creates a representation of a git repository. It creates a Git repository using the "bare-dir" setting and saves repository's meta data in the database.

func (*Repository) MarshalJSON

func (r *Repository) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Repository in json format.

func (*Repository) ReadOnlyURL

func (r *Repository) ReadOnlyURL() string

ReadOnly formats the git url and return it. If no host is configured in gandalf.conf, this method panics.

func (*Repository) ReadWriteURL

func (r *Repository) ReadWriteURL() string

ReadWriteURL formats the git ssh url and return it. If no remote is configured in gandalf.conf, this method panics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL