summaryrefslogtreecommitdiffstats
path: root/java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java')
-rw-r--r--java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java b/java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java
index ad1f4c5155..c9280f1b61 100644
--- a/java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java
+++ b/java/com/google/gerrit/server/notedb/NoteDbUpdateManager.java
@@ -310,6 +310,12 @@ public class NoteDbUpdateManager implements AutoCloseable {
}
}
+ public BatchRefUpdate prepare() throws IOException {
+ checkNotExecuted();
+ stage();
+ return prepare(changeRepo, false, pushCert);
+ }
+
@Nullable
public BatchRefUpdate execute() throws IOException {
return execute(false);
@@ -365,7 +371,7 @@ public class NoteDbUpdateManager implements AutoCloseable {
cu -> cu.getAttentionSetUpdates().stream()));
}
- private BatchRefUpdate execute(OpenRepo or, boolean dryrun, @Nullable PushCertificate pushCert)
+ private BatchRefUpdate prepare(OpenRepo or, boolean dryrun, @Nullable PushCertificate pushCert)
throws IOException {
if (or == null || or.cmds.isEmpty()) {
return null;
@@ -394,7 +400,13 @@ public class NoteDbUpdateManager implements AutoCloseable {
bru = listener.beforeUpdateRefs(bru);
}
- if (!dryrun) {
+ return bru;
+ }
+
+ private BatchRefUpdate execute(OpenRepo or, boolean dryrun, @Nullable PushCertificate pushCert)
+ throws IOException {
+ BatchRefUpdate bru = prepare(or, dryrun, pushCert);
+ if (bru != null && !dryrun) {
RefUpdateUtil.executeChecked(bru, or.rw);
}
return bru;