diff options
author | Yuxuan 'fishy' Wang <fishywang@google.com> | 2014-04-18 08:23:20 -0700 |
---|---|---|
committer | Shawn Pearce <sop@google.com> | 2014-04-25 13:42:35 -0400 |
commit | dc4c673902a0847b270faf1771595d7c189a1943 (patch) | |
tree | 2755939eee7dde9bd6e9a6abc10ebdbb17bf7aff | |
parent | 51cccc9dae3191567a2972a7ebe692b1629808c1 (diff) | |
download | jgit-dc4c673902a0847b270faf1771595d7c189a1943.tar.gz jgit-dc4c673902a0847b270faf1771595d7c189a1943.zip |
Commit changes generated during repo command
Change-Id: Ia4df9808294d2069dcc5973bcb69b4499c7dcacd
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
3 files changed, 16 insertions, 5 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/gitrepo/internal/RepoText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/gitrepo/internal/RepoText.properties index 64d754de80..29aa51ccd8 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/gitrepo/internal/RepoText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/gitrepo/internal/RepoText.properties @@ -2,3 +2,4 @@ copyFileFailed=Error occurred during execution of copyfile rule. errorNoDefault=Error: no default remote in file {0}. errorParsingManifestFile=Error occurred during parsing manifest file {0}. invalidManifest=Invalid manifest. +repoCommitMessage=Added repo manifest. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index a05dc11da5..475fbacaff 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -58,6 +58,7 @@ import java.util.Map; import java.util.Set; import org.eclipse.jgit.api.AddCommand; +import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.GitCommand; import org.eclipse.jgit.api.SubmoduleAddCommand; import org.eclipse.jgit.api.errors.GitAPIException; @@ -65,6 +66,7 @@ import org.eclipse.jgit.gitrepo.internal.RepoText; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.ProgressMonitor; import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.revwalk.RevCommit; import org.xml.sax.Attributes; import org.xml.sax.InputSource; @@ -82,12 +84,13 @@ import org.xml.sax.helpers.XMLReaderFactory; * @see <a href="https://code.google.com/p/git-repo/">git-repo project page</a> * @since 3.4 */ -public class RepoCommand extends GitCommand<Void> { +public class RepoCommand extends GitCommand<RevCommit> { private String path; private String uri; private String groups; + private Git git; private ProgressMonitor monitor; private static class CopyFile { @@ -252,7 +255,8 @@ public class RepoCommand extends GitCommand<Void> { throw new SAXException( RepoText.get().copyFileFailed, e); } - AddCommand add = new AddCommand(command.repo) + AddCommand add = command.git + .add() .addFilepattern(copyfile.relativeDest); try { add.call(); @@ -344,13 +348,14 @@ public class RepoCommand extends GitCommand<Void> { } @Override - public Void call() throws GitAPIException { + public RevCommit call() throws GitAPIException { checkCallable(); if (path == null || path.length() == 0) throw new IllegalArgumentException(JGitText.get().pathNotConfigured); if (uri == null || uri.length() == 0) throw new IllegalArgumentException(JGitText.get().uriNotConfigured); + git = new Git(repo); XmlManifest manifest = new XmlManifest(this, path, uri, groups); try { manifest.read(); @@ -358,11 +363,15 @@ public class RepoCommand extends GitCommand<Void> { throw new ManifestErrorException(e); } - return null; + return git + .commit() + .setMessage(RepoText.get().repoCommitMessage) + .call(); } private void addSubmodule(String url, String name) throws SAXException { - SubmoduleAddCommand add = new SubmoduleAddCommand(repo) + SubmoduleAddCommand add = git + .submoduleAdd() .setPath(name) .setURI(url); if (monitor != null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/internal/RepoText.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/internal/RepoText.java index 50fc61d912..1313fff0d1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/internal/RepoText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/internal/RepoText.java @@ -63,4 +63,5 @@ public class RepoText extends TranslationBundle { /***/ public String errorNoDefault; /***/ public String errorParsingManifestFile; /***/ public String invalidManifest; + /***/ public String repoCommitMessage; } |