Update plugin to support Gerrit 2.14.1 Change-Id: I9abb8b02da4f40871f356f492dd4418181536517
diff --git a/pom.xml b/pom.xml index 39e9f48..8e7626b 100644 --- a/pom.xml +++ b/pom.xml
@@ -26,14 +26,14 @@ <properties> <Gerrit-ApiType>plugin</Gerrit-ApiType> - <Gerrit-ApiVersion>2.12.3</Gerrit-ApiVersion> + <Gerrit-ApiVersion>2.14.1</Gerrit-ApiVersion> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jaxb2-basics-runtime.version>0.6.4</jaxb2-basics-runtime.version> <jacoco.version>0.7.5.201505241946</jacoco.version> <gitdescribe-maven-plugin.version>3.0</gitdescribe-maven-plugin.version> <maven-jaxb2-plugin.version>0.7.0</maven-jaxb2-plugin.version> <truth.version>0.27</truth.version> - <jgit.junit.version>4.1.1.201511131810-r</jgit.junit.version> + <jgit.junit.version>4.7.0.201704051617-r</jgit.junit.version> </properties> <build>
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/ProjectBranchKey.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/ProjectBranchKey.java index 899e340..ea8842d 100644 --- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/ProjectBranchKey.java +++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/ProjectBranchKey.java
@@ -50,7 +50,7 @@ @Override public String toString() { - return com.google.common.base.Objects.toStringHelper(this) + return com.google.common.base.MoreObjects.toStringHelper(this) .add("project", project) .add("branch", branch) .toString();
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java index 3ff0ee5..2a85b37 100644 --- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java +++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/Utilities.java
@@ -30,8 +30,10 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.errors.ConfigInvalidException; import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.RefUpdate; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.transport.ReceiveCommand; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -125,12 +127,9 @@ // https://gerrit-review.googlesource.com/55540 if (commit != null) { if (!commit.equals(commitId)) { - ObjectId parent = ObjectId.zeroId(); - - if (commit.getParents().length > 0) { - parent = commit.getParent(0).getId(); - } - gitRefUpdated.fire(p, refName, parent, commit.getId() ); + RefUpdate refUpdate = repo.updateRef(refName); + refUpdate.setNewObjectId(commit.getId()); + gitRefUpdated.fire(p, refUpdate,null); } return commit.getId(); } else {
diff --git a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java index 196a945..d8787b5 100644 --- a/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java +++ b/src/main/java/com/amd/gerrit/plugins/manifestsubscription/VersionedManifests.java
@@ -28,11 +28,7 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.lib.CommitBuilder; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.PersonIdent; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.lib.*; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.treewalk.TreeWalk; @@ -279,7 +275,9 @@ Git git = new Git(db)) { try { Ref r = git.branchCreate().setName(branch).setStartPoint(hash).call(); - gitReferenceUpdated.fire(p, branch, ObjectId.zeroId(), r.getObjectId()); + RefUpdate refUpdate = db.updateRef(branch); + refUpdate.setNewObjectId(r.getObjectId()); + gitReferenceUpdated.fire(p, refUpdate, null); } catch (Exception e) { }
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md index 2060215..f62b4a0 100644 --- a/src/main/resources/Documentation/about.md +++ b/src/main/resources/Documentation/about.md
@@ -2,7 +2,7 @@ and generate rev-specific manifests (similar to "repo manifest -o") and store them to a separate git repository (configurable.) -> **Warning: this plugin is currently under development and is targeting 2.12.3** +> **Warning: this plugin is currently under development and is targeting 2.14.1** The rev-specific manifest of each source manifest is stored in its own branch with the following naming convention: