model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2015 License: BSD-3-Clause Imports: 1 Imported by: 4

Documentation

Overview

Package model provides data models related to source code repositories.

Index

Constants

This section is empty.

Variables

View Source
var (
	StatusAdded    = "added"
	StatusDeleted  = "deleted"
	StatusModified = "modified"
	StatusRenamed  = "renamed"
	StatusCopied   = "copied"
)

Status of a file touched by a commit.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	// VCSID represents the VCS interanl identification of a commit.
	// In the case of Git, for instance, it is the commit SHA.
	VCSID string `json:"vcs_id"`

	// Message represents the commits message.
	Message string `json:"message"`

	// Author represents the developer that authored the changes made
	// in the commit.
	Author Developer `json:"author"`

	// Committer represents the developer that commited the changes.
	// Most of the time, the committer is also the author.
	Committer Developer `json:"committer"`

	// AuthorDate represents the date when the commit was created.
	AuthorDate time.Time `json:"author_date"`

	// CommitDate represents the date when the commit was committed.
	CommitDate time.Time `json:"commit_date"`

	// DiffDelta represents the changes maed by the commit.
	DiffDelta []DiffDelta `json:"diff_delta,omitempty"`

	// FileChangedCount reprensents how many files have been touched by the
	// commit.
	FileChangedCount int `json:"file_changed_count"`

	// InsertionsCount represents how many new lines have been added.
	InsertionsCount int `json:"insertions_count"`

	// DeletionsCount represents how many lines have been removed.
	DeletionsCount int `json:"deletions_count"`
}

Commit is a representation of a VCS commit.

type Developer

type Developer struct {
	// Name represents the name of a developer.
	Name string `json:"name"`

	// Email is the email of a developer.
	Email string `json:"email"`
}

Developer represents someone linked to a source code repository, be it either as a commiter or commit author (which is not mutually exclusive).

type DiffDelta

type DiffDelta struct {
	// Patch represents the difference between a commit and its parent.
	Patch *string `json:"patch,omitempty"`

	// Status gives information about whether the file has been added, deleted
	// modified, renamed of copied.
	Status *string `json:"status,omitempty"`

	// Binary gives information about whether the file is a binary or not.
	Binary *bool `json:"binary,omitempty"`

	// Similarity is a score that indicates how similar the file is from its
	// state in the previous commit.
	// A similarity score is a value between 0 and 100 indicating how similar
	// the old and new files are. The higher the value, the more similar the
	// files are.
	Similarity *uint `json:"similarity,omitempty"`

	// OldFilePath represents the path to the old file.
	OldFilePath *string `json:"old_file_path,omitempty"`

	// NewFilePath represents the path to the new file.
	NewFilePath *string `json:"new_file_path,omitempty"`
}

DiffDelta represents a delta difference between a commit and its parent.

type Repository

type Repository struct {
	// Name is the name of the repository.
	Name string `json:"name"`

	// VCS is the VCS type of the repository (Git, Mercurial, ...).
	VCS string `json:"vcs"`

	// CloneURL represents the URL from which the repository was cloned.
	CloneURL string `json:"clone_url"`

	// ClonePath is the absolute path to which the repository was cloned
	// on the file system.
	ClonePath string `json:"clone_path"`

	// DefaultBranch is the branch that was active when the repository
	// information were obtained..
	DefaultBranch string `json:"default_branch"`

	// Commits is the list of commits of a repository.
	// Note that only the commit of the default branch are retrieved.
	Commits []Commit `json:"commits"`
}

Repository represents a source code repository.

Jump to

Keyboard shortcuts

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