[EGIT PATCH 4/6] Add tag fetching strategy selection to fetch version of RefSpecPage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tag strategy selection determines tagOpt for Transport, which should be
under user control for fetch operation. RefSpecPage seems to be the best
place for such setting.

Signed-off-by: Marek Zawirski <marek.zawirski@xxxxxxxxx>
---
 .../src/org/spearce/egit/ui/UIText.java            |   12 ++++
 .../egit/ui/internal/components/RefSpecPage.java   |   70 ++++++++++++++++++--
 .../src/org/spearce/egit/ui/uitext.properties      |    4 +
 3 files changed, 81 insertions(+), 5 deletions(-)

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 2bbe218..ab70048 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -386,6 +386,18 @@
 	public static String RefSpecPage_titlePush;
 
 	/** */
+	public static String RefSpecPage_annotatedTagsGroup;
+
+	/** */
+	public static String RefSpecPage_annotatedTagsAutoFollow;
+
+	/** */
+	public static String RefSpecPage_annotatedTagsFetchTags;
+
+	/** */
+	public static String RefSpecPage_annotatedTagsNoTags;
+
+	/** */
 	public static String Decorator_failedLazyLoading;
 
 	/** */
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RefSpecPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RefSpecPage.java
index 45a8505..586e5d9 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RefSpecPage.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/components/RefSpecPage.java
@@ -23,11 +23,13 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
 import org.spearce.egit.core.op.ListRemoteOperation;
 import org.spearce.egit.ui.Activator;
 import org.spearce.egit.ui.UIText;
 import org.spearce.jgit.lib.Repository;
 import org.spearce.jgit.transport.RefSpec;
+import org.spearce.jgit.transport.TagOpt;
 import org.spearce.jgit.transport.URIish;
 
 /**
@@ -54,6 +56,12 @@
 
 	private Button saveButton;
 
+	private Button tagsAutoFollowButton;
+
+	private Button tagsFetchTagsButton;
+
+	private Button tagsNoTagsButton;
+
 	private String transportError;
 
 	/**
@@ -106,14 +114,35 @@ public void selectionChanged() {
 			}
 		});
 
-		saveButton = new Button(panel, SWT.CHECK);
-		saveButton.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
-		saveButton.addSelectionListener(new SelectionAdapter() {
+		final SelectionAdapter changesNotifier = new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				notifySelectionChanged();
 			}
-		});
+		};
+		if (!pushPage) {
+			final Group tagsGroup = new Group(panel, SWT.NULL);
+			tagsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
+					false));
+			tagsGroup.setText(UIText.RefSpecPage_annotatedTagsGroup);
+			tagsGroup.setLayout(new GridLayout());
+			tagsAutoFollowButton = new Button(tagsGroup, SWT.RADIO);
+			tagsAutoFollowButton
+					.setText(UIText.RefSpecPage_annotatedTagsAutoFollow);
+			tagsFetchTagsButton = new Button(tagsGroup, SWT.RADIO);
+			tagsFetchTagsButton
+					.setText(UIText.RefSpecPage_annotatedTagsFetchTags);
+			tagsNoTagsButton = new Button(tagsGroup, SWT.RADIO);
+			tagsNoTagsButton
+					.setText(UIText.RefSpecPage_annotatedTagsNoTags);
+			tagsAutoFollowButton.addSelectionListener(changesNotifier);
+			tagsFetchTagsButton.addSelectionListener(changesNotifier);
+			tagsNoTagsButton.addSelectionListener(changesNotifier);
+		}
+
+		saveButton = new Button(panel, SWT.CHECK);
+		saveButton.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
+		saveButton.addSelectionListener(changesNotifier);
 
 		setControl(panel);
 		notifySelectionChanged();
@@ -147,6 +176,18 @@ public boolean isSaveRequested() {
 	}
 
 	/**
+	 * @return selected tag fetching strategy. This result is relevant only for
+	 *         fetch page.
+	 */
+	public TagOpt getTagOpt() {
+		if (tagsAutoFollowButton.getSelection())
+			return TagOpt.AUTO_FOLLOW;
+		if (tagsFetchTagsButton.getSelection())
+			return TagOpt.FETCH_TAGS;
+		return TagOpt.NO_TAGS;
+	}
+
+	/**
 	 * Compare provided specifications to currently selected ones.
 	 *
 	 * @param specs
@@ -206,12 +247,31 @@ private void revalidateImpl(final RepositorySelection newRepoSelection) {
 		final String remoteName = validatedRepoSelection.getConfigName();
 		specsPanel.setAssistanceData(local, listRemotesOp.getRemoteRefs(),
 				remoteName);
+
+		tagsAutoFollowButton.setSelection(false);
+		tagsFetchTagsButton.setSelection(false);
+		tagsNoTagsButton.setSelection(false);
+
 		if (newRepoSelection.isConfigSelected()) {
 			saveButton.setVisible(true);
 			saveButton.setText(NLS.bind(UIText.RefSpecPage_saveSpecifications,
 					remoteName));
 			saveButton.getParent().layout();
-		}
+			final TagOpt tagOpt = newRepoSelection.getConfig().getTagOpt();
+			switch (tagOpt) {
+			case AUTO_FOLLOW:
+				tagsAutoFollowButton.setSelection(true);
+				break;
+			case FETCH_TAGS:
+				tagsFetchTagsButton.setSelection(true);
+				break;
+			case NO_TAGS:
+				tagsNoTagsButton.setSelection(true);
+				break;
+			}
+		} else
+			tagsAutoFollowButton.setSelection(true);
+
 		checkPage();
 	}
 
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index c2b91f7..2349334 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -147,6 +147,10 @@ RefSpecPage_operationCancelled=Operation cancelled.
 RefSpecPage_saveSpecifications=Save specifications in "{0}" configuration
 RefSpecPage_titleFetch=Fetch Ref Specifications
 RefSpecPage_titlePush=Push Ref Specifications
+RefSpecPage_annotatedTagsGroup=Annotated tags fetching strategy
+RefSpecPage_annotatedTagsAutoFollow=Automatically follow tags if we fetch the thing they point at
+RefSpecPage_annotatedTagsFetchTags=Always fetch tags, even if we do not have the thing it points at
+RefSpecPage_annotatedTagsNoTags=Never fetch tags, even if we have the thing it points at
 
 Decorator_failedLazyLoading=Resource decorator failed to load tree contents on demand.
 QuickDiff_failedLoading=Quick diff failed to obtain file data.
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux