OpenAPI 1.0

com.aquafold.openapi.vcs
Interface AQGit


public interface AQGit

An interface to GIT distributed revision control system.


Method Summary
 void add(Object files)
          Adds file or files to the list of files staged for the next commit.
 void add(String filePattern, boolean update)
          Adds file or files to the list of files staged for the next commit.
 void addRemote(String name, String url)
          Add a remote.
 void applyStash(String ref)
          Apply a stashed commit on top of the current working tree.
 void checkout(String name)
          Checkout a branch
 void cherryPick(Object revision)
          Integrates an individual commit into the current branch.
 String[] clean(Object files, boolean dryRun)
          Remove untracked files from the working tree.
 void clone(String folder, String url, String branch)
          Clones a repository into a new directory.
 void commit(Object files, Object username, Object email, String comment)
          This method commits changes in the specified file or folder.
 void commit(Object username, Object email, String comment)
          This method records changes to the repository.
 void createBranch(String name, String ref)
          Create a local branch.
 void createStash(Object username, Object email, String indexMessage, String workingMessage)
          Stash all current changes and return working tree to a clean state.
 void deleteBranch(String... names)
          Delete one or more branches.
 void deleteTag(String... tags)
          Delete one or more tags.
 void dropStash(int stashRef)
          Delete a stashed commit.
 void fetch()
          Downloads objects and refs from the default remote 'origin'.
 void fetch(String remote)
          Downloads objects and refs from the specified remote repository.
 AQRevision[] getHistory(String filename)
          Returns the file's complete revision history.
 AQRevision[] getHistory(String filename, int count)
          Returns the file's revision history.
 AQRevision getRevision(String filename)
          Returns the file revision.
 byte[] getRevisionContents(String filename, Object revision)
          Returns the binary contents of the specified revision.
 void init(String folder, boolean bare)
          Creates an empty git repository or reinitialize an existing one.
 String[] listBranch()
          Obtain a list of branches
 String[] listRemote()
          List remotes.
 AQRevision[] listStash()
          Return a list of stash commits
 String[] listTag()
          Obtain a list of tags.
 AQRevision[] log(Object start, int count)
          Obtain the log.
 void merge(Object revision)
          Performs a very basic merge operation, which allows only one argument.
 void pull()
          Incorporates changes from a remote repository into the current branch.
 void push()
          Push new branches and data to a remote repository.
 void rebase(Object upstream)
          The Git rebase command.
 void rebaseAbort()
          Abort the rebase process.
 void rebaseContinue()
          Continue the rebase process.
 void rebaseSkip()
          Skip the rebase process.
 void removeRemote(String name)
          Remove a remote.
 void renameBranch(String oldName, String newName)
          Rename a branch
 void reset(String ref, String mode, String filename)
          Undo changes and commits.
 void revert(Object commits)
          Create a commit with the reverse patch to cancel it out.
 void setCredentials(String url, String identity, String password)
          Register a credentials provider.
 void setVerbose(boolean verbose)
          Sets the amount of diagnostic messages sent to the debugger console.
 void setWorkspace(String path)
          Sets workspace folder.
 AQGitStatus status()
          Obtain the Git repo status.
 void tag(Object revision, String name, Object username, Object email, String comment)
          Create a tag.
 void trackRemote(String localBranch, String remoteBranch)
          Track remote branch.
 

Method Detail

setVerbose

void setVerbose(boolean verbose)
Sets the amount of diagnostic messages sent to the debugger console.

Parameters:
verbose - (Default value - true).

setWorkspace

void setWorkspace(String path)
Sets workspace folder.

Parameters:
path - Workspace path.

setCredentials

void setCredentials(String url,
                    String identity,
                    String password)
                    throws Exception
Register a credentials provider. Call this method before clone, fetch, pull and push to connect to remote repositories that require authentication.

For public key authentication, Setting identity to null loads known hosts and private keys from $HOME/.ssh.

Parameters:
url - the url, protocol://host/path/to/repo.git
identity - username or public key file
password - password or passphrase
Throws:
Exception

commit

void commit(Object files,
            Object username,
            Object email,
            String comment)
            throws Exception
This method commits changes in the specified file or folder.

Parameters:
files - A file name, or a javascript array of file names
username - A String or a AQOpaqueObject containing the user name.
email - A String or a AQOpaqueObject containing the user email address.
comment -
Throws:
Exception

commit

void commit(Object username,
            Object email,
            String comment)
            throws Exception
This method records changes to the repository.

Parameters:
username - A String or a AQOpaqueObject containing the user name.
email - A String or a AQOpaqueObject containing the user email address.
comment -
Throws:
Exception

add

void add(Object files)
         throws Exception
Adds file or files to the list of files staged for the next commit.

Parameters:
files - A file name, or a javascript array of file names
Throws:
Exception

add

void add(String filePattern,
         boolean update)
         throws Exception
Adds file or files to the list of files staged for the next commit.

Parameters:
filePattern - File to add content from. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively. Fileglobs (e.g. *.c) are not yet supported.
update - If set to true, the command only matches filepattern against already tracked files in the index rather than the working tree. That means that it will never stage new files, but that it will stage modified new contents of tracked files and that it will remove files from the index if the corresponding files in the working tree have been removed. In contrast to the git command line a filepattern must exist also if update is set to true as there is no concept of a working directory here.
Throws:
Exception

getRevision

AQRevision getRevision(String filename)
                       throws Exception
Returns the file revision.

Parameters:
filename - Workspace file name
Throws:
Exception

getHistory

AQRevision[] getHistory(String filename)
                        throws Exception
Returns the file's complete revision history.

Parameters:
filename - Workspace file name
Throws:
Exception

getHistory

AQRevision[] getHistory(String filename,
                        int count)
                        throws Exception
Returns the file's revision history.

Parameters:
filename - Workspace file name
count - Maximum number of revisions to return
Throws:
Exception

getRevisionContents

byte[] getRevisionContents(String filename,
                           Object revision)
                           throws Exception
Returns the binary contents of the specified revision.

Parameters:
filename - Workspace file name
revision - An AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision()
Throws:
Exception

merge

void merge(Object revision)
           throws Exception
Performs a very basic merge operation, which allows only one argument. Currently, this command supports only fast forward merge.

Parameters:
revision - An AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision() which is merged with the current head
Throws:
Exception

clone

void clone(String folder,
           String url,
           String branch)
           throws Exception
Clones a repository into a new directory.

Parameters:
folder - Destination folder
url - Repository URL, protocol://host/path/to/repo.git
branch - (Optional) branch name. An empty branch name (or null) selects the repository HEAD
Throws:
Exception

fetch

void fetch()
           throws Exception
Downloads objects and refs from the default remote 'origin'.

Throws:
Exception

fetch

void fetch(String remote)
           throws Exception
Downloads objects and refs from the specified remote repository.

Parameters:
remote - the remote to fetch from
Throws:
Exception

pull

void pull()
          throws Exception
Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

Throws:
Exception

init

void init(String folder,
          boolean bare)
          throws Exception
Creates an empty git repository or reinitialize an existing one.

Parameters:
folder -
bare - When true, creates a bare repository.
Throws:
Exception

push

void push()
          throws Exception
Push new branches and data to a remote repository.

Throws:
Exception

reset

void reset(String ref,
           String mode,
           String filename)
           throws Exception
Undo changes and commits.

Parameters:
ref - A reference to a commit. Points to HEAD if null
mode - The mode. One of "SOFT", "MIXED" or "HARD"
filename - Workspace file name. May be null to indicate all files

Note: the mode and filename parameters cannot be combined.

Throws:
Exception

listBranch

String[] listBranch()
                    throws Exception
Obtain a list of branches

Returns:
a list of branches
Throws:
Exception

createBranch

void createBranch(String name,
                  String ref)
                  throws Exception
Create a local branch.

Parameters:
name - the name of the new branch
ref - corresponds to the start-point; if null, HEAD will be used
Throws:
Exception

checkout

void checkout(String name)
              throws Exception
Checkout a branch

Parameters:
name - the branch name
Throws:
Exception

renameBranch

void renameBranch(String oldName,
                  String newName)
                  throws Exception
Rename a branch

Parameters:
oldName - the name of the branch to rename; if not set, the currently checked out branch (if any) will be renamed
newName - the new name
Throws:
Exception

deleteBranch

void deleteBranch(String... names)
                  throws Exception
Delete one or more branches.

Parameters:
names - the names of the branches to delete; if not set, this will do nothing; invalid branch names will simply be ignored
Throws:
Exception

listTag

String[] listTag()
                 throws Exception
Obtain a list of tags.

Throws:
Exception

tag

void tag(Object revision,
         String name,
         Object username,
         Object email,
         String comment)
         throws Exception
Create a tag.

Parameters:
revision - An AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision()
name - the tag name
username - A String or a AQOpaqueObject containing the user name.
email - A String or a AQOpaqueObject containing the user email address.
comment - the tag message
Throws:
Exception

deleteTag

void deleteTag(String... tags)
               throws Exception
Delete one or more tags.

Parameters:
tags - tags to be deleted
Throws:
Exception

rebase

void rebase(Object upstream)
            throws Exception
The Git rebase command. The current branch is reset to .

Parameters:
upstream - A branch name, an AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision()

If the operation fails (i.e. due to a merge conflict), a RuntimeException will be thrown.

Throws:
Exception

rebaseContinue

void rebaseContinue()
                    throws Exception
Continue the rebase process.

Throws:
Exception

rebaseSkip

void rebaseSkip()
                throws Exception
Skip the rebase process.

Throws:
Exception

rebaseAbort

void rebaseAbort()
                 throws Exception
Abort the rebase process.

Throws:
Exception

listRemote

String[] listRemote()
                    throws Exception
List remotes.

Throws:
Exception

addRemote

void addRemote(String name,
               String url)
               throws Exception
Add a remote.

Parameters:
name - the remote name
url - the remote url, protocol://host/path/to/repo.git
Throws:
Exception

removeRemote

void removeRemote(String name)
                  throws Exception
Remove a remote.

Throws:
Exception

trackRemote

void trackRemote(String localBranch,
                 String remoteBranch)
                 throws Exception
Track remote branch.

Parameters:
localBranch - the local branch
remoteBranch - the remote branch. Use null to remove remote branch tracking from local branch
Throws:
Exception

cherryPick

void cherryPick(Object revision)
                throws Exception
Integrates an individual commit into the current branch.

Parameters:
revision - An AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision()

If the operation fails (i.e. due to a merge conflict), a RuntimeException will be thrown.

Throws:
Exception

listStash

AQRevision[] listStash()
                       throws Exception
Return a list of stash commits

Throws:
Exception

createStash

void createStash(Object username,
                 Object email,
                 String indexMessage,
                 String workingMessage)
                 throws Exception
Stash all current changes and return working tree to a clean state. Changes can be either in staging area or working copy.

Parameters:
username - A String or a AQOpaqueObject containing the user name.
email - A String or a AQOpaqueObject containing the user email address.
indexMessage - the message used when committing index changes
workingMessage - the message used when committing working directory changes
Throws:
Exception

applyStash

void applyStash(String ref)
                throws Exception
Apply a stashed commit on top of the current working tree.

Parameters:
ref - the reference (stash@{x}) to update with the stashed commit id. Use null for all stashes
Throws:
Exception

dropStash

void dropStash(int stashRef)
               throws Exception
Delete a stashed commit.

Parameters:
stashRef - Set the stash reference to drop (0-based)
Throws:
Exception

log

AQRevision[] log(Object start,
                 int count)
                 throws Exception
Obtain the log.

Parameters:
start - a commit to start graph traversal from. Use null for HEAD
count - the number of commits to obtain. Use -1 for all
Throws:
Exception

status

AQGitStatus status()
                   throws Exception
Obtain the Git repo status.

Throws:
Exception

revert

void revert(Object commits)
            throws Exception
Create a commit with the reverse patch to cancel it out.

Parameters:
commits - an AQRevision object or a SHA-1 hash of a commit, obtained via AQRevision.getRevision(), or a list of such objects.
Throws:
Exception

clean

String[] clean(Object files,
               boolean dryRun)
               throws Exception
Remove untracked files from the working tree.

Parameters:
files - a file name, or a javascript array of file names, or null for all untracked files
dryRun - if it is set, the files in question will not actually be deleted
Returns:
a set of strings representing each file cleaned.
Throws:
Exception

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.