Add a patch download command to patch sets

Like pull and cherry-pick, only we use format-patch on the client
to produce the patch script on stdout.  Its not nearly as easy to
use as download the patch file directly from our HTTP server, but
it is easier to implement without cross-domain security problems.

Change-Id: I946b910507c7a371934f7d0a0d497e1f9302e3d4
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-03-02 11:50:51 -08:00
parent 2a41231c0e
commit 87775b444f
2 changed files with 10 additions and 2 deletions

View File

@@ -42,7 +42,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.InlineLabel;
@@ -242,6 +241,15 @@ class PatchSetPanel extends Composite implements OpenHandler<DisclosurePanel> {
+ " && git cherry-pick FETCH_HEAD");
}
});
commands.add(new DownloadCommandLink(DownloadCommand.FORMAT_PATCH,
"patch") {
@Override
void setCurrentUrl(DownloadUrlLink link) {
urls.setVisible(true);
copyLabel.setText("git fetch " + link.urlData
+ " && git format-patch -1 --stdout FETCH_HEAD");
}
});
}
final FlowPanel fp = new FlowPanel();

View File

@@ -41,7 +41,7 @@ public final class AccountGeneralPreferences {
/** Preferred method to download a change. */
public static enum DownloadCommand {
REPO_DOWNLOAD, PULL, CHERRY_PICK;
REPO_DOWNLOAD, PULL, CHERRY_PICK, FORMAT_PATCH;
}
/** Default number of lines of context when viewing a patch. */