summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDave Borowitz2012-02-15 14:10:52 (EST)
committer Shawn O. Pearce2012-02-29 22:09:22 (EST)
commit4a01f47e824aba1898ee7aa1f0677b8014210cfb (patch)
treeeec07e85158be94ce382ecf37fc6ac77868c1345
parent4bf22ff6e840b190e0a019e86cce19001dc587f4 (diff)
downloadjgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.zip
jgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.tar.gz
jgit-4a01f47e824aba1898ee7aa1f0677b8014210cfb.tar.bz2
Allow creating ReceiveCommands with a specified typerefs/changes/90/5090/3
This allows callers who know in advance whether a command is UPDATE or UPDATE_NONFASTFORWARD to specify this in the constructor rather than with a separate method call. Change-Id: Iae483594a4ff370ff75d17a7b0648c5590b3d1bd
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
index da19f4c..a1788d1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceiveCommand.java
@@ -160,6 +160,28 @@ public class ReceiveCommand {
status = Result.NOT_ATTEMPTED;
}
+ /**
+ * Create a new command for {@link ReceivePack}.
+ *
+ * @param oldId
+ * the old object id; must not be null. Use
+ * {@link ObjectId#zeroId()} to indicate a ref creation.
+ * @param newId
+ * the new object id; must not be null. Use
+ * {@link ObjectId#zeroId()} to indicate a ref deletion.
+ * @param name
+ * name of the ref being affected.
+ * @param type
+ * type of the command.
+ */
+ public ReceiveCommand(final ObjectId oldId, final ObjectId newId,
+ final String name, final Type type) {
+ this.oldId = oldId;
+ this.newId = newId;
+ this.name = name;
+ this.type = type;
+ }
+
/** @return the old value the client thinks the ref has. */
public ObjectId getOldId() {
return oldId;