git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MZMarek Zawirski <marek.zawirski@gmail.com>
Date
Aug 27, 2008, 18:41 UTC
Message-ID
<1219862506-11075-5-git-send-email-marek.zawirski@gmail.com>
In-Reply-To
<1219862506-11075-4-git-send-email-marek.zawirski@gmail.com>

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@gmail.com>
---
 .../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
Previous: Marek ZawirskiNext: Marek Zawirski
Message 5 of 10 in “Fetch UI, minor improvements/fixes”
  1. 0/6 Fetch UI, minor improvements/fixesMarek Zawirski, Aug 27, 2008
  2. 1/6 Reduce PushOperationResult contructor visibility, accept null insteadMarek Zawirski, Aug 27, 2008
  3. 2/6 Fix RefSpecPanel to not display mode column in fetch versionMarek Zawirski, Aug 27, 2008
  4. 3/6 Handle null remoteName in RefSpecPanel betterMarek Zawirski, Aug 27, 2008
  5. 4/6 Add tag fetching strategy selection to fetch version of RefSpecPageMarek Zawirski, Aug 27, 2008
  6. 5/6 Rename ResultDialog to PushResultDialogMarek Zawirski, Aug 27, 2008
  7. 6/6 Fetch GUIMarek Zawirski, Aug 27, 2008
  8. Robin RosenbergAug 27, 2008
  9. Marek ZawirskiAug 27, 2008
  10. Shawn O. PearceAug 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.