vcswrapper-0.1.1: Wrapper for source code management systems

Safe HaskellNone
LanguageHaskell98

VCSWrapper.Svn

Description

Provides high level SVN functions like commit, checkout, update and others.

All functions of this module run in the Ctx monad, common to all VCS. On unexpected behavior, these functions will throw a VCSException. All functions will be executed with options --non-interactive and --no-auth-cache set.

Synopsis

Documentation

add Source

Arguments

:: [FilePath]

files to add

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit.. Executes svn add.

checkout Source

Arguments

:: [(Text, Maybe Text)]

list of (url, Maybe revision). List must not be empty, however revision need not to be set

-> Maybe Text

optional path

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Checkout out a working copy from a repository. Executes svn checkout.

commit Source

Arguments

:: [FilePath]

files to commit. List may be empty - if not only specified files will be commited

-> Text

message, can be empty

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Send changes from your working copy to the repository. Executes svn commit.

lock Source

Arguments

:: [FilePath]

Files to lock, must not be empty

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Lock working copy paths or URLs in the repository, so that no other user can commit changes to them. Executes svn lock.

mergeHeadToRevision Source

Arguments

:: Integer

revision, e.g. 3

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Reverts working copy to given revision. Executes svn merge -rHEAD:$revision ..

resolved Source

Arguments

:: [FilePath]

files or directories to mark resolved

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Remove conflicted state on working copy files or directories. Executes svn resolved.

simpleLog :: Ctx [LogEntry] Source

Get the log messages for the current working copy. Executes svn log.

unlock Source

Arguments

:: [FilePath]

Files to unlock, must not be empty

-> Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Unlock working copy paths or URLs. Executes svn unlock.

update Source

Arguments

:: Maybe Text

optional password

-> [Text]

options

-> Ctx () 

Bring changes from the repository into the working copy. Executes svn update.

status :: Ctx [Status] Source

Get the status of working copy files and directories. Executes svn status.

getFilesInConflict Source

Arguments

:: FilePath

FilePath to file of conflict.

-> Ctx [FilePath] 

Returns all files of a conflict indicated by its associated filename. E.g. for file "Types.hs" this might be "Types.hs", "Types.hs.r1", "Types.hs.r2" and "Types.hs.mine"

runVcs Source

Arguments

:: Config

Config for a VCS

-> Ctx t

An operation running in Ctx

-> IO t 

Run a VCS Ctx from a Config and returns the result

data VCSType Source

Available VCS types implemented in this package.

Constructors

SVN 
GIT 
Mercurial 

type IsLocked = Bool Source

True, if this file is locked by the VCS.

data LogEntry Source

Represents a log entry in the history managed by the VCS.

Constructors

LogEntry 

Fields

mbBranch :: Maybe Text

Maybe Branchname

commitID :: Text

Commit identifier

author :: Text

Author of this commit.

email :: Text

Email address of the author.

date :: Text

Date this log entry was created.

subject :: Text

Short commit message.

body :: Text

Long body of the commit message.

Instances

newtype Ctx a Source

Context for all VCS commands.

E.g. to create a new Git repository use something like this:

import VCSWrapper.Git
myInitRepoFn = do
    let config = makeConfig "path/to/repo" Nothing Nothing
    runVcs config $ initDB False

Constructors

Ctx (ReaderT Config IO a) 

data Config Source

Configuration of the Ctx the VCS commands will be executed in.

Constructors

Config 

Fields

configCwd :: Maybe FilePath

Path to the main directory of the repository. E.g. for Git: the directory of the repository containing the .git config directory.

configPath :: Maybe FilePath

Path to the vcs executable. If Nothing, the PATH environment variable will be search for a matching executable.

configAuthor :: Maybe Author

Author to be used for different VCS actions. If Nothing, the default for the selected repository will be used.

configEnvironment :: [(Text, Text)]

List of environment variables mappings passed to the underlying VCS executable.

data Author Source

Author to be passed to VCS commands where applicable.

Constructors

Author 

Fields

authorName :: Text

Name of the author.

authorEmail :: Maybe Text

Email address of the author.

Instances

data VCSException Source

This Exception-type will be thrown if a VCS command fails unexpectedly.

Constructors

VCSException Int Text Text FilePath [Text]

Exit code -> stdout -> errout -> configCwd of the Config -> List containing the executed command and its options

data Status Source

Status of a file managed by the respective VCS.

Instances

data Modification Source

Flags to describe the state of a file.

Constructors

None

File hasn't been modified.

Added

File has been selected to be managed by the respective VCS.

Conflicting

File is in conflicting state. Manually resolving the conflict may be necessary.

Deleted

File has been deleted.

Modified

File has been modified since last commit.

Replaced

File has been replaced by a different file.

Untracked

File is currently not known by the VCS.

Unknown

State of file is unknown.

Ignored

File is ignored by VCS.

Missing

File is missing.

makeConfig Source

Arguments

:: Maybe FilePath

Path to the main directory of the repository. E.g. for Git: the directory of the repository containing the .git config directory.

-> Maybe FilePath

Path to the vcs executable. If Nothing, the PATH environment variable will be search for a matching executable.

-> Maybe Author

Author to be used for different VCS actions. If Nothing, the default for the selected repository will be used.

-> Config 

Creates a new Config.

makeConfigWithEnvironment Source

Arguments

:: Maybe FilePath

Path to the main directory of the repository. E.g. for Git: the directory of the repository containing the .git config directory.

-> Maybe FilePath

Path to the vcs executable. If Nothing, the PATH environment variable will be search for a matching executable.

-> Maybe Author

Author to be used for different VCS actions. If Nothing, the default for the selected repository will be used.

-> [(Text, Text)]

List of environment variables mappings passed to the underlying VCS executable.

-> Config 

Creates a new Config with a list of environment variables.

filePath :: Status -> FilePath Source

Retrieve the FilePath of any VCS Status.

isLocked :: Status -> IsLocked Source

Retrieve the IsLocked of any VCS Status. For Git, this returns always False.