ManagedRepository

Base class for a managed repository.

Members

Enums

MergeMode
enum MergeMode

How to merge a branch into another

Functions

checkState
void checkState()

Verify that the state of the working tree matches the one when saveState was last called. Throw an exception otherwise. This and clearState should be called before any git command which destroys working directory changes.

clearState
void clearState()

Delete the saved working tree state, if any.

getBranch
string[2] getBranch(string user, string base, string tip)

Return SHA1 (base, tip) of the given branch (possibly of GitHub fork). Fetches the fork first, unless offline mode is on. (This is a thin wrapper around getRemoteRef.)

getChild
void getChild(string branch, string commit, string child, int mainline)

Find the child of a commit, and, if the commit was a merge, the mainline index of said commit for the child.

getHead
string getHead()

Return the commit the repository HEAD is pointing at. Cache the result.

getMerge
string getMerge(string target, string[2] branch, MergeMode mode)

Returns the hash of the merge between the target and branch commits. Performs the merge if necessary. Caches the result.

getMergeInfo
MergeInfo getMergeInfo(string merge)

Finds and returns the merge parents of the given merge commit. Queries the git repository if necessary. Caches the result.

getPullTip
string getPullTip(int pull)

Return SHA1 of the given pull request #. Fetches the pull request first, unless offline mode is on.

getRef
string getRef(string name)

Returns the SHA1 of the given named ref.

getRemoteRef
string getRemoteRef(string remote, string remoteRef, string localRef)

Return SHA1 of the given remote ref. Fetches the remote first, unless offline mode is on.

getRepo
Git getRepo()

Repository provider

getRevert
string getRevert(string target, string[2] branch, MergeMode mode)

Returns the resulting hash when reverting the branch from the base commit. Performs the revert if necessary. Caches the result. mainline is the 1-based mainline index (as per man git-revert), or 0 if commit is not a merge commit.

getState
RepositoryState getState()

Return the working tree "state". This returns a file list, along with size and modification time.

getUnMerge
string getUnMerge(string head, string[2] branch, MergeMode mode)

Follows the string of merges starting from the given head commit, up till the merge with the given branch. Then, reapplies all merges in order, except for that with the given branch.

log
void log(string line)

Override to add logging.

needClean
void needClean()

Ensure the repository's working copy is clean.

needCommit
void needCommit(string hash)

Ensure that the specified commit is fetched.

needHead
void needHead(string hash)

Ensure the repository's HEAD is as indicated.

performCheckout
void performCheckout(string hash)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset()

Reset internal state.

saveFileState
void saveFileState(string file)

Save the state of just one file. This should be called after automatic edits to repository files during a build. The file parameter should be relative to the directory root, and use forward slashes.

saveState
void saveState()

Save the state of the working tree for versioned files to a .json file, which can later be verified with checkState. This should be called after any git command which mutates the git state.

update
bool update()

Update the remote. Return true if any updates were fetched.

Properties

git
const(Git) git [@property getter]

Git repository we manage.

name
string name [@property getter]

Base name of the repository directory

Variables

clean
bool clean;

True when we know that the repository is currently clean.

offline
bool offline;

Should we fetch the latest stuff?

verify
bool verify;

Verify working tree state to make sure we don't clobber user changes?

Meta