Revert "repo: include patchset number in commands"
This reverts commit 6b6c50e4f487b0f1ebf316e0625669260b226879.
Reason for revert: This change is affecting many users in chromium while editing a change from the UI. https://bugs.chromium.org/p/gerrit/issues/detail?id=13277
Change-Id: I8300978c1454d6cb6c66a0952941871c2ac956c1
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/BranchCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/BranchCommand.java
index 6592d5d..fd36718 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/BranchCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/BranchCommand.java
@@ -43,13 +43,12 @@
}
@Override
- String getRepoCommand(String url, String id, String ps) {
+ String getRepoCommand(String url, String id) {
return "repo download -b change-"
+ id.replaceAll("/", "-")
+ " "
+ QuoteUtil.quote(url)
+ " "
- + id
- + (ps.isEmpty() ? "" : "/" + ps);
+ + id;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
index 9e36970..bc3ede6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
@@ -37,8 +37,7 @@
}
@Override
- String getRepoCommand(String url, String id, String ps) {
- return "repo download " + QuoteUtil.quote(url) + " " + id
- + (ps.isEmpty() ? "" : "/" + ps);
+ String getRepoCommand(String url, String id) {
+ return "repo download " + QuoteUtil.quote(url) + " " + id;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
index d5a85fe..4856e83 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
@@ -37,8 +37,7 @@
}
@Override
- String getRepoCommand(String url, String id, String ps) {
- return "repo download -c " + QuoteUtil.quote(url) + " " + id
- + (ps.isEmpty() ? "" : "/" + ps);
+ String getRepoCommand(String url, String id) {
+ return "repo download -c " + QuoteUtil.quote(url) + " " + id;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
index 1da40ac..e106510 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
@@ -14,10 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
-import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.entities.Change;
-import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.entities.Project;
import com.google.gerrit.entities.RefNames;
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
@@ -76,10 +74,7 @@
}
if (scheme instanceof RepoScheme) {
- PatchSet.Id psIdFromRef = PatchSet.Id.fromRef(ref);
- checkNotNull(psIdFromRef);
- String ps = psIdFromRef.getId();
- return getRepoCommand(url, id, ps);
+ return getRepoCommand(url, id);
}
if (isValidUrl(url)) {
if (checkForHiddenChangeRefs) {
@@ -142,10 +137,9 @@
/**
* @param url The project URL this change is for.
- * @param id The change number.
- * @param ps The patchset (PS) number.
+ * @param id The change/PS numbers.
*/
- String getRepoCommand(String url, String id, String ps) {
+ String getRepoCommand(String url, String id) {
// Most commands don't support this, so default it to nothing.
return null;
}