aboutsummaryrefslogtreecommitdiff
path: root/gerrit-server
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2011-06-24 10:00:19 -0700
committerAndroid Code Review <code-review@android.com>2011-06-24 10:00:19 -0700
commitbc0916318c0369ca511ffa47bf9f27366a66a71b (patch)
tree8d67a1e00be991fa64d4c250085691f3b86e416d /gerrit-server
parent30306adf84139542b355bbbdee5710690fde5205 (diff)
parent6c6700f9b7a1f6080a19764d660e40e9ade02be5 (diff)
downloadgerrit-bc0916318c0369ca511ffa47bf9f27366a66a71b.tar.gz
Merge "Predicates to expose change/commit info to Prolog"
Diffstat (limited to 'gerrit-server')
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/rules/StoredValues.java4
-rw-r--r--gerrit-server/src/main/java/gerrit/AbstractCommitUserIdentityPredicate.java100
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_change_branch_1.java51
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_change_owner_1.java54
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_change_project_1.java51
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_change_topic_1.java54
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_commit_author_3.java45
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_commit_committer_3.java45
-rw-r--r--gerrit-server/src/main/java/gerrit/PRED_current_user_1.java77
-rw-r--r--gerrit-server/src/main/prolog/gerrit_common.pl16
10 files changed, 496 insertions, 1 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/rules/StoredValues.java b/gerrit-server/src/main/java/com/google/gerrit/rules/StoredValues.java
index cef129b7..1f0aacdb 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/rules/StoredValues.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/rules/StoredValues.java
@@ -18,6 +18,7 @@ import static com.google.gerrit.rules.StoredValue.create;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSetInfo;
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.server.project.ChangeControl;
@@ -26,7 +27,8 @@ public final class StoredValues {
public static final StoredValue<Change> CHANGE = create(Change.class);
public static final StoredValue<PatchSet.Id> PATCH_SET_ID = create(PatchSet.Id.class);
public static final StoredValue<ChangeControl> CHANGE_CONTROL = create(ChangeControl.class);
+ public static final StoredValue<PatchSetInfo> PATCH_SET_INFO = create(PatchSetInfo.class);
private StoredValues() {
}
-}
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/AbstractCommitUserIdentityPredicate.java b/gerrit-server/src/main/java/gerrit/AbstractCommitUserIdentityPredicate.java
new file mode 100644
index 00000000..3ea081e9
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/AbstractCommitUserIdentityPredicate.java
@@ -0,0 +1,100 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Account;
+import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSetInfo;
+import com.google.gerrit.reviewdb.UserIdentity;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+import com.google.gerrit.server.patch.PatchSetInfoFactory;
+import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
+
+import com.googlecode.prolog_cafe.lang.IntegerTerm;
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.StructureTerm;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+abstract class AbstractCommitUserIdentityPredicate extends Predicate.P3 {
+ private static final long serialVersionUID = 1L;
+ private static final SymbolTerm user = SymbolTerm.intern("user", 1);
+ private static final SymbolTerm anonymous = SymbolTerm.intern("anonymous");
+
+ AbstractCommitUserIdentityPredicate(Term a1, Term a2, Term a3, Operation n) {
+ arg1 = a1;
+ arg2 = a2;
+ arg3 = a3;
+ cont = n;
+ }
+
+ protected Operation exec(Prolog engine, UserIdentity userId) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+ Term a2 = arg2.dereference();
+ Term a3 = arg3.dereference();
+
+ Term idTerm;
+ Term nameTerm = Prolog.Nil;
+ Term emailTerm = Prolog.Nil;
+
+ Account.Id id = userId.getAccount();
+ if (id == null) {
+ idTerm = anonymous;
+ } else {
+ idTerm = new IntegerTerm(id.get());
+ }
+
+ String name = userId.getName();
+ if (name != null && !name.equals("")) {
+ nameTerm = SymbolTerm.create(name);
+ }
+
+ String email = userId.getEmail();
+ if (email != null && !email.equals("")) {
+ emailTerm = SymbolTerm.create(email);
+ }
+
+ if (!a1.unify(new StructureTerm(user, idTerm), engine.trail)) {
+ return engine.fail();
+ }
+ if (!a2.unify(nameTerm, engine.trail)) {
+ return engine.fail();
+ }
+ if (!a3.unify(emailTerm, engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+
+ protected PatchSetInfo getPatchSetInfo(Prolog engine)
+ throws PatchSetInfoNotAvailableException {
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ PatchSetInfo psInfo = env.get(StoredValues.PATCH_SET_INFO);
+ if (psInfo == null) {
+ PatchSet.Id patchSetId = env.get(StoredValues.PATCH_SET_ID);
+ PatchSetInfoFactory patchInfoFactory =
+ env.getInjector().getInstance(PatchSetInfoFactory.class);
+ psInfo = patchInfoFactory.get(patchSetId);
+ env.set(StoredValues.PATCH_SET_INFO, psInfo);
+ }
+
+ return psInfo;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_change_branch_1.java b/gerrit-server/src/main/java/gerrit/PRED_change_branch_1.java
new file mode 100644
index 00000000..ee26c089
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_change_branch_1.java
@@ -0,0 +1,51 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Branch;
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_change_branch_1 extends Predicate.P1 {
+ private static final long serialVersionUID = 1L;
+
+ public PRED_change_branch_1(Term a1, Operation n) {
+ arg1 = a1;
+ cont = n;
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ Change change = StoredValues.CHANGE.get(engine);
+ Branch.NameKey name = change.getDest();
+
+ if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_change_owner_1.java b/gerrit-server/src/main/java/gerrit/PRED_change_owner_1.java
new file mode 100644
index 00000000..20d70f33
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_change_owner_1.java
@@ -0,0 +1,54 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Account;
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+
+import com.googlecode.prolog_cafe.lang.IntegerTerm;
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.StructureTerm;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_change_owner_1 extends Predicate.P1 {
+ private static final long serialVersionUID = 1L;
+ private static final SymbolTerm user = SymbolTerm.intern("user", 1);
+
+ public PRED_change_owner_1(Term a1, Operation n) {
+ arg1 = a1;
+ cont = n;
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ Change change = StoredValues.CHANGE.get(engine);
+ Account.Id ownerId = change.getOwner();
+
+ if (!a1.unify(new StructureTerm(user, new IntegerTerm(ownerId.get())), engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_change_project_1.java b/gerrit-server/src/main/java/gerrit/PRED_change_project_1.java
new file mode 100644
index 00000000..c8d7e6df
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_change_project_1.java
@@ -0,0 +1,51 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.reviewdb.Project;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_change_project_1 extends Predicate.P1 {
+ private static final long serialVersionUID = 1L;
+
+ public PRED_change_project_1(Term a1, Operation n) {
+ arg1 = a1;
+ cont = n;
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ Change change = StoredValues.CHANGE.get(engine);
+ Project.NameKey name = change.getProject();
+
+ if (!a1.unify(SymbolTerm.create(name.get()), engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_change_topic_1.java b/gerrit-server/src/main/java/gerrit/PRED_change_topic_1.java
new file mode 100644
index 00000000..02786e52
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_change_topic_1.java
@@ -0,0 +1,54 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_change_topic_1 extends Predicate.P1 {
+ private static final long serialVersionUID = 1L;
+
+ public PRED_change_topic_1(Term a1, Operation n) {
+ arg1 = a1;
+ cont = n;
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ Term topicTerm = Prolog.Nil;
+ Change change = StoredValues.CHANGE.get(engine);
+ String topic = change.getTopic();
+ if (topic != null) {
+ topicTerm = SymbolTerm.create(topic);
+ }
+
+ if (!a1.unify(topicTerm, engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_commit_author_3.java b/gerrit-server/src/main/java/gerrit/PRED_commit_author_3.java
new file mode 100644
index 00000000..636f18bd
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_commit_author_3.java
@@ -0,0 +1,45 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.PatchSetInfo;
+import com.google.gerrit.reviewdb.UserIdentity;
+import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
+
+import com.googlecode.prolog_cafe.lang.JavaException;
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_commit_author_3 extends AbstractCommitUserIdentityPredicate {
+ private static final long serialVersionUID = 1L;
+
+ public PRED_commit_author_3(Term a1, Term a2, Term a3, Operation n) {
+ super(a1, a2, a3, n);
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ PatchSetInfo psInfo;
+ try {
+ psInfo = getPatchSetInfo(engine);
+ } catch (PatchSetInfoNotAvailableException err) {
+ throw new JavaException(this, 1, err);
+ }
+ UserIdentity author = psInfo.getAuthor();
+ return exec(engine, author);
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_commit_committer_3.java b/gerrit-server/src/main/java/gerrit/PRED_commit_committer_3.java
new file mode 100644
index 00000000..0d449b46
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_commit_committer_3.java
@@ -0,0 +1,45 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.PatchSetInfo;
+import com.google.gerrit.reviewdb.UserIdentity;
+import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException;
+
+import com.googlecode.prolog_cafe.lang.JavaException;
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_commit_committer_3 extends AbstractCommitUserIdentityPredicate {
+ private static final long serialVersionUID = 1L;
+
+ public PRED_commit_committer_3(Term a1, Term a2, Term a3, Operation n) {
+ super(a1, a2, a3, n);
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ PatchSetInfo psInfo;
+ try {
+ psInfo = getPatchSetInfo(engine);
+ } catch (PatchSetInfoNotAvailableException err) {
+ throw new JavaException(this, 1, err);
+ }
+ UserIdentity committer = psInfo.getCommitter();
+ return exec(engine, committer);
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/java/gerrit/PRED_current_user_1.java b/gerrit-server/src/main/java/gerrit/PRED_current_user_1.java
new file mode 100644
index 00000000..335b4eff
--- /dev/null
+++ b/gerrit-server/src/main/java/gerrit/PRED_current_user_1.java
@@ -0,0 +1,77 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gerrit;
+
+import com.google.gerrit.reviewdb.Account;
+import com.google.gerrit.rules.PrologEnvironment;
+import com.google.gerrit.rules.StoredValues;
+import com.google.gerrit.server.AnonymousUser;
+import com.google.gerrit.server.CurrentUser;
+import com.google.gerrit.server.IdentifiedUser;
+import com.google.gerrit.server.PeerDaemonUser;
+import com.google.gerrit.server.ReplicationUser;
+import com.google.gerrit.server.project.ChangeControl;
+
+import com.googlecode.prolog_cafe.lang.EvaluationException;
+import com.googlecode.prolog_cafe.lang.IntegerTerm;
+import com.googlecode.prolog_cafe.lang.Operation;
+import com.googlecode.prolog_cafe.lang.Predicate;
+import com.googlecode.prolog_cafe.lang.Prolog;
+import com.googlecode.prolog_cafe.lang.PrologException;
+import com.googlecode.prolog_cafe.lang.StructureTerm;
+import com.googlecode.prolog_cafe.lang.SymbolTerm;
+import com.googlecode.prolog_cafe.lang.Term;
+
+public class PRED_current_user_1 extends Predicate.P1 {
+ private static final long serialVersionUID = 1L;
+ private static final SymbolTerm user = SymbolTerm.intern("user", 1);
+ private static final SymbolTerm anonymous = SymbolTerm.intern("anonymous");
+ private static final SymbolTerm peerDaemon = SymbolTerm.intern("peer_daemon");
+ private static final SymbolTerm replication = SymbolTerm.intern("replication");
+
+ public PRED_current_user_1(Term a1, Operation n) {
+ arg1 = a1;
+ cont = n;
+ }
+
+ @Override
+ public Operation exec(Prolog engine) throws PrologException {
+ engine.setB0();
+ Term a1 = arg1.dereference();
+
+ PrologEnvironment env = (PrologEnvironment) engine.control;
+ ChangeControl cControl = StoredValues.CHANGE_CONTROL.get(engine);
+ CurrentUser curUser = cControl.getCurrentUser();
+ Term resultTerm;
+
+ if (curUser instanceof IdentifiedUser) {
+ Account.Id id = ((IdentifiedUser)curUser).getAccountId();
+ resultTerm = new IntegerTerm(id.get());
+ } else if (curUser instanceof AnonymousUser) {
+ resultTerm = anonymous;
+ } else if (curUser instanceof PeerDaemonUser) {
+ resultTerm = peerDaemon;
+ } else if (curUser instanceof ReplicationUser) {
+ resultTerm = replication;
+ } else {
+ throw new EvaluationException("Unknown user type");
+ }
+
+ if (!a1.unify(new StructureTerm(user, resultTerm), engine.trail)) {
+ return engine.fail();
+ }
+ return cont;
+ }
+} \ No newline at end of file
diff --git a/gerrit-server/src/main/prolog/gerrit_common.pl b/gerrit-server/src/main/prolog/gerrit_common.pl
index 18015dcf..b66311b4 100644
--- a/gerrit-server/src/main/prolog/gerrit_common.pl
+++ b/gerrit-server/src/main/prolog/gerrit_common.pl
@@ -264,3 +264,19 @@ check_label_range_permission(Label, ExpValue, ok(Who)) :-
% grant_range(Label, Group, Min, Max),
% Min @=< ExpValue, ExpValue @=< Max
% .
+
+
+%% commit_author/1:
+%%
+:- public commit_author/1.
+%%
+commit_author(Author) :-
+ commit_author(Author, _, _).
+
+
+%% commit_committer/1:
+%%
+:- public commit_committer/1.
+%%
+commit_committer(Committer) :-
+ commit_committer(Committer, _, _).