|
|
|
@ -89,25 +89,30 @@ public class Git implements AutoCloseable {
|
|
|
|
|
private final boolean closeRepo; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Open repository |
|
|
|
|
* |
|
|
|
|
* @param dir |
|
|
|
|
* the repository to open. May be either the GIT_DIR, or the |
|
|
|
|
* working tree directory that contains {@code .git}. |
|
|
|
|
* @return a {@link Git} object for the existing git repository |
|
|
|
|
* @throws IOException |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.Git} object for the existing git |
|
|
|
|
* repository |
|
|
|
|
* @throws java.io.IOException |
|
|
|
|
*/ |
|
|
|
|
public static Git open(File dir) throws IOException { |
|
|
|
|
return open(dir, FS.DETECTED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Open repository |
|
|
|
|
* |
|
|
|
|
* @param dir |
|
|
|
|
* the repository to open. May be either the GIT_DIR, or the |
|
|
|
|
* working tree directory that contains {@code .git}. |
|
|
|
|
* @param fs |
|
|
|
|
* filesystem abstraction to use when accessing the repository. |
|
|
|
|
* @return a {@link Git} object for the existing git repository. Closing this |
|
|
|
|
* instance will close the repo. |
|
|
|
|
* @throws IOException |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.Git} object for the existing git |
|
|
|
|
* repository. Closing this instance will close the repo. |
|
|
|
|
* @throws java.io.IOException |
|
|
|
|
*/ |
|
|
|
|
public static Git open(File dir, FS fs) throws IOException { |
|
|
|
|
RepositoryCache.FileKey key; |
|
|
|
@ -119,31 +124,36 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Wrap repository |
|
|
|
|
* |
|
|
|
|
* @param repo |
|
|
|
|
* the git repository this class is interacting with; |
|
|
|
|
* {@code null} is not allowed. |
|
|
|
|
* @return a {@link Git} object for the existing git repository. The caller is |
|
|
|
|
* responsible for closing the repository; {@link #close()} on this |
|
|
|
|
* instance does not close the repo. |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.Git} object for the existing git |
|
|
|
|
* repository. The caller is responsible for closing the repository; |
|
|
|
|
* {@link #close()} on this instance does not close the repo. |
|
|
|
|
*/ |
|
|
|
|
public static Git wrap(Repository repo) { |
|
|
|
|
return new Git(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Frees resources associated with this instance. |
|
|
|
|
* {@inheritDoc} |
|
|
|
|
* <p> |
|
|
|
|
* Free resources associated with this instance. |
|
|
|
|
* <p> |
|
|
|
|
* If the repository was opened by a static factory method in this class, then |
|
|
|
|
* this method calls {@link Repository#close()} on the underlying repository |
|
|
|
|
* instance. (Whether this actually releases underlying resources, such as |
|
|
|
|
* file handles, may vary; see {@link Repository} for more details.) |
|
|
|
|
* If the repository was opened by a static factory method in this class, |
|
|
|
|
* then this method calls {@link Repository#close()} on the underlying |
|
|
|
|
* repository instance. (Whether this actually releases underlying |
|
|
|
|
* resources, such as file handles, may vary; see {@link Repository} for |
|
|
|
|
* more details.) |
|
|
|
|
* <p> |
|
|
|
|
* If the repository was created by a caller and passed into {@link |
|
|
|
|
* #Git(Repository)} or a static factory method in this class, then this |
|
|
|
|
* method does not call close on the underlying repository. |
|
|
|
|
* If the repository was created by a caller and passed into |
|
|
|
|
* {@link #Git(Repository)} or a static factory method in this class, then |
|
|
|
|
* this method does not call close on the underlying repository. |
|
|
|
|
* <p> |
|
|
|
|
* In all cases, after calling this method you should not use this {@link Git} |
|
|
|
|
* instance anymore. |
|
|
|
|
* In all cases, after calling this method you should not use this |
|
|
|
|
* {@link Git} instance anymore. |
|
|
|
|
* |
|
|
|
|
* @since 3.2 |
|
|
|
|
*/ |
|
|
|
@ -154,23 +164,23 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code clone} command |
|
|
|
|
* Return a command object to execute a {@code clone} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-clone.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-clone.html" |
|
|
|
|
* >Git documentation about clone</a> |
|
|
|
|
* @return a {@link CloneCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code clone} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CloneCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code clone} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public static CloneCommand cloneRepository() { |
|
|
|
|
return new CloneCommand(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to list remote branches/tags without a local |
|
|
|
|
* repository. |
|
|
|
|
* Return a command to list remote branches/tags without a local repository. |
|
|
|
|
* |
|
|
|
|
* @return a {@link LsRemoteCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.LsRemoteCommand} |
|
|
|
|
* @since 3.1 |
|
|
|
|
*/ |
|
|
|
|
public static LsRemoteCommand lsRemoteRepository() { |
|
|
|
@ -178,24 +188,25 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code init} command |
|
|
|
|
* Return a command object to execute a {@code init} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-init.html" |
|
|
|
|
* >Git documentation about init</a> |
|
|
|
|
* @return a {@link InitCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code init} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-init.html" >Git |
|
|
|
|
* documentation about init</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.InitCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code init} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public static InitCommand init() { |
|
|
|
|
return new InitCommand(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Constructs a new {@link Git} object which can interact with the specified |
|
|
|
|
* git repository. |
|
|
|
|
* Construct a new {@link org.eclipse.jgit.api.Git} object which can |
|
|
|
|
* interact with the specified git repository. |
|
|
|
|
* <p> |
|
|
|
|
* All command classes returned by methods of this class will always interact |
|
|
|
|
* with this git repository. |
|
|
|
|
* All command classes returned by methods of this class will always |
|
|
|
|
* interact with this git repository. |
|
|
|
|
* <p> |
|
|
|
|
* The caller is responsible for closing the repository; {@link #close()} on |
|
|
|
|
* this instance does not close the repo. |
|
|
|
@ -216,75 +227,78 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Commit} command |
|
|
|
|
* Return a command object to execute a {@code Commit} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-commit.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html" |
|
|
|
|
* >Git documentation about Commit</a> |
|
|
|
|
* @return a {@link CommitCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code Commit} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CommitCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Commit} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public CommitCommand commit() { |
|
|
|
|
return new CommitCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Log} command |
|
|
|
|
* Return a command object to execute a {@code Log} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-log.html" |
|
|
|
|
* >Git documentation about Log</a> |
|
|
|
|
* @return a {@link LogCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code Log} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-log.html" >Git |
|
|
|
|
* documentation about Log</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.LogCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Log} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public LogCommand log() { |
|
|
|
|
return new LogCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Merge} command |
|
|
|
|
* Return a command object to execute a {@code Merge} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-merge.html" |
|
|
|
|
* >Git documentation about Merge</a> |
|
|
|
|
* @return a {@link MergeCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code Merge} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.MergeCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Merge} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public MergeCommand merge() { |
|
|
|
|
return new MergeCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Pull} command |
|
|
|
|
* Return a command object to execute a {@code Pull} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link PullCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.PullCommand} |
|
|
|
|
*/ |
|
|
|
|
public PullCommand pull() { |
|
|
|
|
return new PullCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to create branches |
|
|
|
|
* Return a command object used to create branches |
|
|
|
|
* |
|
|
|
|
* @return a {@link CreateBranchCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CreateBranchCommand} |
|
|
|
|
*/ |
|
|
|
|
public CreateBranchCommand branchCreate() { |
|
|
|
|
return new CreateBranchCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to delete branches |
|
|
|
|
* Return a command object used to delete branches |
|
|
|
|
* |
|
|
|
|
* @return a {@link DeleteBranchCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.DeleteBranchCommand} |
|
|
|
|
*/ |
|
|
|
|
public DeleteBranchCommand branchDelete() { |
|
|
|
|
return new DeleteBranchCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to list branches |
|
|
|
|
* Return a command object used to list branches |
|
|
|
|
* |
|
|
|
|
* @return a {@link ListBranchCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ListBranchCommand} |
|
|
|
|
*/ |
|
|
|
|
public ListBranchCommand branchList() { |
|
|
|
|
return new ListBranchCommand(repo); |
|
|
|
@ -292,170 +306,180 @@ public class Git implements AutoCloseable {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* Returns a command object used to list tags |
|
|
|
|
* Return a command object used to list tags |
|
|
|
|
* |
|
|
|
|
* @return a {@link ListTagCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ListTagCommand} |
|
|
|
|
*/ |
|
|
|
|
public ListTagCommand tagList() { |
|
|
|
|
return new ListTagCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to rename branches |
|
|
|
|
* Return a command object used to rename branches |
|
|
|
|
* |
|
|
|
|
* @return a {@link RenameBranchCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RenameBranchCommand} |
|
|
|
|
*/ |
|
|
|
|
public RenameBranchCommand branchRename() { |
|
|
|
|
return new RenameBranchCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Add} command |
|
|
|
|
* Return a command object to execute a {@code Add} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-add.html" |
|
|
|
|
* >Git documentation about Add</a> |
|
|
|
|
* @return a {@link AddCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code Add} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-add.html" >Git |
|
|
|
|
* documentation about Add</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.AddCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Add} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public AddCommand add() { |
|
|
|
|
return new AddCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Tag} command |
|
|
|
|
* Return a command object to execute a {@code Tag} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-tag.html" |
|
|
|
|
* >Git documentation about Tag</a> |
|
|
|
|
* @return a {@link TagCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code Tag} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-tag.html" >Git |
|
|
|
|
* documentation about Tag</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.TagCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Tag} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public TagCommand tag() { |
|
|
|
|
return new TagCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Fetch} command |
|
|
|
|
* Return a command object to execute a {@code Fetch} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html" |
|
|
|
|
* >Git documentation about Fetch</a> |
|
|
|
|
* @return a {@link FetchCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code Fetch} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.FetchCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Fetch} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public FetchCommand fetch() { |
|
|
|
|
return new FetchCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Push} command |
|
|
|
|
* Return a command object to execute a {@code Push} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-push.html" |
|
|
|
|
* >Git documentation about Push</a> |
|
|
|
|
* @return a {@link PushCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code Push} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-push.html" >Git |
|
|
|
|
* documentation about Push</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.PushCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code Push} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public PushCommand push() { |
|
|
|
|
return new PushCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code cherry-pick} command |
|
|
|
|
* Return a command object to execute a {@code cherry-pick} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-cherry-pick.html" |
|
|
|
|
* >Git documentation about cherry-pick</a> |
|
|
|
|
* @return a {@link CherryPickCommand} used to collect all optional |
|
|
|
|
* parameters and to finally execute the {@code cherry-pick} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CherryPickCommand} used to collect |
|
|
|
|
* all optional parameters and to finally execute the |
|
|
|
|
* {@code cherry-pick} command |
|
|
|
|
*/ |
|
|
|
|
public CherryPickCommand cherryPick() { |
|
|
|
|
return new CherryPickCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code revert} command |
|
|
|
|
* Return a command object to execute a {@code revert} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-revert.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-revert.html" |
|
|
|
|
* >Git documentation about reverting changes</a> |
|
|
|
|
* @return a {@link RevertCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code cherry-pick} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RevertCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the |
|
|
|
|
* {@code cherry-pick} command |
|
|
|
|
*/ |
|
|
|
|
public RevertCommand revert() { |
|
|
|
|
return new RevertCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code Rebase} command |
|
|
|
|
* Return a command object to execute a {@code Rebase} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html" |
|
|
|
|
* >Git documentation about rebase</a> |
|
|
|
|
* @return a {@link RebaseCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code rebase} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RebaseCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code rebase} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public RebaseCommand rebase() { |
|
|
|
|
return new RebaseCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code rm} command |
|
|
|
|
* Return a command object to execute a {@code rm} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-rm.html" |
|
|
|
|
* >Git documentation about rm</a> |
|
|
|
|
* @return a {@link RmCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code rm} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-rm.html" >Git |
|
|
|
|
* documentation about rm</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RmCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code rm} command |
|
|
|
|
*/ |
|
|
|
|
public RmCommand rm() { |
|
|
|
|
return new RmCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code checkout} command |
|
|
|
|
* Return a command object to execute a {@code checkout} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html" |
|
|
|
|
* >Git documentation about checkout</a> |
|
|
|
|
* @return a {@link CheckoutCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code checkout} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CheckoutCommand} used to collect |
|
|
|
|
* all optional parameters and to finally execute the |
|
|
|
|
* {@code checkout} command |
|
|
|
|
*/ |
|
|
|
|
public CheckoutCommand checkout() { |
|
|
|
|
return new CheckoutCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code reset} command |
|
|
|
|
* Return a command object to execute a {@code reset} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-reset.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-reset.html" |
|
|
|
|
* >Git documentation about reset</a> |
|
|
|
|
* @return a {@link ResetCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code reset} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ResetCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code reset} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public ResetCommand reset() { |
|
|
|
|
return new ResetCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code status} command |
|
|
|
|
* Return a command object to execute a {@code status} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-status.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-status.html" |
|
|
|
|
* >Git documentation about status</a> |
|
|
|
|
* @return a {@link StatusCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code status} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.StatusCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code status} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public StatusCommand status() { |
|
|
|
|
return new StatusCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to create an archive from a tree |
|
|
|
|
* Return a command to create an archive from a tree |
|
|
|
|
* |
|
|
|
|
* @return a {@link ArchiveCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ArchiveCommand} |
|
|
|
|
* @since 3.1 |
|
|
|
|
*/ |
|
|
|
|
public ArchiveCommand archive() { |
|
|
|
@ -463,179 +487,185 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to add notes to an object |
|
|
|
|
* Return a command to add notes to an object |
|
|
|
|
* |
|
|
|
|
* @return a {@link AddNoteCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.AddNoteCommand} |
|
|
|
|
*/ |
|
|
|
|
public AddNoteCommand notesAdd() { |
|
|
|
|
return new AddNoteCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to remove notes on an object |
|
|
|
|
* Return a command to remove notes on an object |
|
|
|
|
* |
|
|
|
|
* @return a {@link RemoveNoteCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RemoveNoteCommand} |
|
|
|
|
*/ |
|
|
|
|
public RemoveNoteCommand notesRemove() { |
|
|
|
|
return new RemoveNoteCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to list all notes |
|
|
|
|
* Return a command to list all notes |
|
|
|
|
* |
|
|
|
|
* @return a {@link ListNotesCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ListNotesCommand} |
|
|
|
|
*/ |
|
|
|
|
public ListNotesCommand notesList() { |
|
|
|
|
return new ListNotesCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command to show notes on an object |
|
|
|
|
* Return a command to show notes on an object |
|
|
|
|
* |
|
|
|
|
* @return a {@link ShowNoteCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ShowNoteCommand} |
|
|
|
|
*/ |
|
|
|
|
public ShowNoteCommand notesShow() { |
|
|
|
|
return new ShowNoteCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code ls-remote} command |
|
|
|
|
* Return a command object to execute a {@code ls-remote} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html" |
|
|
|
|
* >Git documentation about ls-remote</a> |
|
|
|
|
* @return a {@link LsRemoteCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code status} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.LsRemoteCommand} used to collect |
|
|
|
|
* all optional parameters and to finally execute the {@code status} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public LsRemoteCommand lsRemote() { |
|
|
|
|
return new LsRemoteCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code clean} command |
|
|
|
|
* Return a command object to execute a {@code clean} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-clean.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-clean.html" |
|
|
|
|
* >Git documentation about Clean</a> |
|
|
|
|
* @return a {@link CleanCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code clean} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.CleanCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code clean} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public CleanCommand clean() { |
|
|
|
|
return new CleanCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code blame} command |
|
|
|
|
* Return a command object to execute a {@code blame} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-blame.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-blame.html" |
|
|
|
|
* >Git documentation about Blame</a> |
|
|
|
|
* @return a {@link BlameCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code blame} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.BlameCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code blame} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public BlameCommand blame() { |
|
|
|
|
return new BlameCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code reflog} command |
|
|
|
|
* Return a command object to execute a {@code reflog} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-reflog.html" |
|
|
|
|
* >Git documentation about reflog</a> |
|
|
|
|
* @return a {@link ReflogCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code reflog} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ReflogCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code reflog} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public ReflogCommand reflog() { |
|
|
|
|
return new ReflogCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code diff} command |
|
|
|
|
* Return a command object to execute a {@code diff} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-diff.html" |
|
|
|
|
* >Git documentation about diff</a> |
|
|
|
|
* @return a {@link DiffCommand} used to collect all optional parameters and |
|
|
|
|
* to finally execute the {@code diff} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html" >Git |
|
|
|
|
* documentation about diff</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.DiffCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code diff} |
|
|
|
|
* command |
|
|
|
|
*/ |
|
|
|
|
public DiffCommand diff() { |
|
|
|
|
return new DiffCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to delete tags |
|
|
|
|
* Return a command object used to delete tags |
|
|
|
|
* |
|
|
|
|
* @return a {@link DeleteTagCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.DeleteTagCommand} |
|
|
|
|
*/ |
|
|
|
|
public DeleteTagCommand tagDelete() { |
|
|
|
|
return new DeleteTagCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code submodule add} command |
|
|
|
|
* Return a command object to execute a {@code submodule add} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link SubmoduleAddCommand} used to add a new submodule to a |
|
|
|
|
* parent repository |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.SubmoduleAddCommand} used to add a |
|
|
|
|
* new submodule to a parent repository |
|
|
|
|
*/ |
|
|
|
|
public SubmoduleAddCommand submoduleAdd() { |
|
|
|
|
return new SubmoduleAddCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code submodule init} command |
|
|
|
|
* Return a command object to execute a {@code submodule init} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link SubmoduleInitCommand} used to initialize the |
|
|
|
|
* repository's config with settings from the .gitmodules file in |
|
|
|
|
* the working tree |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.SubmoduleInitCommand} used to |
|
|
|
|
* initialize the repository's config with settings from the |
|
|
|
|
* .gitmodules file in the working tree |
|
|
|
|
*/ |
|
|
|
|
public SubmoduleInitCommand submoduleInit() { |
|
|
|
|
return new SubmoduleInitCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code submodule status} command |
|
|
|
|
* Return a command object to execute a {@code submodule status} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link SubmoduleStatusCommand} used to report the status of a |
|
|
|
|
* repository's configured submodules |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.SubmoduleStatusCommand} used to |
|
|
|
|
* report the status of a repository's configured submodules |
|
|
|
|
*/ |
|
|
|
|
public SubmoduleStatusCommand submoduleStatus() { |
|
|
|
|
return new SubmoduleStatusCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code submodule sync} command |
|
|
|
|
* Return a command object to execute a {@code submodule sync} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link SubmoduleSyncCommand} used to update the URL of a |
|
|
|
|
* submodule from the parent repository's .gitmodules file |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.SubmoduleSyncCommand} used to |
|
|
|
|
* update the URL of a submodule from the parent repository's |
|
|
|
|
* .gitmodules file |
|
|
|
|
*/ |
|
|
|
|
public SubmoduleSyncCommand submoduleSync() { |
|
|
|
|
return new SubmoduleSyncCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code submodule update} command |
|
|
|
|
* Return a command object to execute a {@code submodule update} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link SubmoduleUpdateCommand} used to update the submodules in |
|
|
|
|
* a repository to the configured revision |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.SubmoduleUpdateCommand} used to |
|
|
|
|
* update the submodules in a repository to the configured revision |
|
|
|
|
*/ |
|
|
|
|
public SubmoduleUpdateCommand submoduleUpdate() { |
|
|
|
|
return new SubmoduleUpdateCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to list stashed commits |
|
|
|
|
* Return a command object used to list stashed commits |
|
|
|
|
* |
|
|
|
|
* @return a {@link StashListCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.StashListCommand} |
|
|
|
|
*/ |
|
|
|
|
public StashListCommand stashList() { |
|
|
|
|
return new StashListCommand(repo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to create a stashed commit |
|
|
|
|
* Return a command object used to create a stashed commit |
|
|
|
|
* |
|
|
|
|
* @return a {@link StashCreateCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.StashCreateCommand} |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
|
public StashCreateCommand stashCreate() { |
|
|
|
@ -643,9 +673,9 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to apply a stashed commit |
|
|
|
|
* Returs a command object used to apply a stashed commit |
|
|
|
|
* |
|
|
|
|
* @return a {@link StashApplyCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.StashApplyCommand} |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
|
public StashApplyCommand stashApply() { |
|
|
|
@ -653,9 +683,9 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object used to drop a stashed commit |
|
|
|
|
* Return a command object used to drop a stashed commit |
|
|
|
|
* |
|
|
|
|
* @return a {@link StashDropCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.StashDropCommand} |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
|
public StashDropCommand stashDrop() { |
|
|
|
@ -663,14 +693,14 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code apply} command |
|
|
|
|
* Return a command object to execute a {@code apply} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-apply.html" |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-apply.html" |
|
|
|
|
* >Git documentation about apply</a> |
|
|
|
|
* |
|
|
|
|
* @return a {@link ApplyCommand} used to collect all optional parameters |
|
|
|
|
* and to finally execute the {@code apply} command |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.ApplyCommand} used to collect all |
|
|
|
|
* optional parameters and to finally execute the {@code apply} |
|
|
|
|
* command |
|
|
|
|
* @since 2.0 |
|
|
|
|
*/ |
|
|
|
|
public ApplyCommand apply() { |
|
|
|
@ -678,14 +708,14 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to execute a {@code gc} command |
|
|
|
|
* |
|
|
|
|
* @see <a |
|
|
|
|
* href="http://www.kernel.org/pub/software/scm/git/docs/git-gc.html" |
|
|
|
|
* >Git documentation about gc</a> |
|
|
|
|
* Return a command object to execute a {@code gc} command |
|
|
|
|
* |
|
|
|
|
* @return a {@link GarbageCollectCommand} used to collect all optional |
|
|
|
|
* parameters and to finally execute the {@code gc} command |
|
|
|
|
* @see <a href= |
|
|
|
|
* "http://www.kernel.org/pub/software/scm/git/docs/git-gc.html" >Git |
|
|
|
|
* documentation about gc</a> |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.GarbageCollectCommand} used to |
|
|
|
|
* collect all optional parameters and to finally execute the |
|
|
|
|
* {@code gc} command |
|
|
|
|
* @since 2.2 |
|
|
|
|
*/ |
|
|
|
|
public GarbageCollectCommand gc() { |
|
|
|
@ -693,9 +723,9 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to find human-readable names of revisions. |
|
|
|
|
* Return a command object to find human-readable names of revisions. |
|
|
|
|
* |
|
|
|
|
* @return a {@link NameRevCommand}. |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.NameRevCommand}. |
|
|
|
|
* @since 3.0 |
|
|
|
|
*/ |
|
|
|
|
public NameRevCommand nameRev() { |
|
|
|
@ -703,10 +733,10 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Returns a command object to come up with a short name that describes a |
|
|
|
|
* Return a command object to come up with a short name that describes a |
|
|
|
|
* commit in terms of the nearest git tag. |
|
|
|
|
* |
|
|
|
|
* @return a {@link DescribeCommand}. |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.DescribeCommand}. |
|
|
|
|
* @since 3.2 |
|
|
|
|
*/ |
|
|
|
|
public DescribeCommand describe() { |
|
|
|
@ -716,7 +746,7 @@ public class Git implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* Return a command used to list the available remotes. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RemoteListCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RemoteListCommand} |
|
|
|
|
* @since 4.2 |
|
|
|
|
*/ |
|
|
|
|
public RemoteListCommand remoteList() { |
|
|
|
@ -726,7 +756,7 @@ public class Git implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* Return a command used to add a new remote. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RemoteAddCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RemoteAddCommand} |
|
|
|
|
* @since 4.2 |
|
|
|
|
*/ |
|
|
|
|
public RemoteAddCommand remoteAdd() { |
|
|
|
@ -736,7 +766,7 @@ public class Git implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* Return a command used to remove an existing remote. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RemoteRemoveCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RemoteRemoveCommand} |
|
|
|
|
* @since 4.2 |
|
|
|
|
*/ |
|
|
|
|
public RemoteRemoveCommand remoteRemove() { |
|
|
|
@ -746,7 +776,7 @@ public class Git implements AutoCloseable {
|
|
|
|
|
/** |
|
|
|
|
* Return a command used to change the URL of an existing remote. |
|
|
|
|
* |
|
|
|
|
* @return a {@link RemoteSetUrlCommand} |
|
|
|
|
* @return a {@link org.eclipse.jgit.api.RemoteSetUrlCommand} |
|
|
|
|
* @since 4.2 |
|
|
|
|
*/ |
|
|
|
|
public RemoteSetUrlCommand remoteSetUrl() { |
|
|
|
@ -754,6 +784,8 @@ public class Git implements AutoCloseable {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get repository |
|
|
|
|
* |
|
|
|
|
* @return the git repository this class is interacting with; see |
|
|
|
|
* {@link #close()} for notes on closing this repository. |
|
|
|
|
*/ |
|
|
|
@ -761,6 +793,7 @@ public class Git implements AutoCloseable {
|
|
|
|
|
return repo; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** {@inheritDoc} */ |
|
|
|
|
@Override |
|
|
|
|
public String toString() { |
|
|
|
|
return "Git[" + repo + "]"; //$NON-NLS-1$//$NON-NLS-2$
|
|
|
|
|