Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDariusz Luksza2011-02-03 17:39:32 -0500
committerMatthias Sohn2011-02-03 17:40:50 -0500
commit9b77590320c6754cc88c9e2d035d51e59ba5bee4 (patch)
treec8844f1b9085302d63e50d949fbda6c3d54ca6e4
parent390b6b146aa218a9c985e6ce9df2845eb575be48 (diff)
downloadegit-9b77590320c6754cc88c9e2d035d51e59ba5bee4.tar.gz
egit-9b77590320c6754cc88c9e2d035d51e59ba5bee4.tar.xz
egit-9b77590320c6754cc88c9e2d035d51e59ba5bee4.zip
[sync] Show separate node for tags in sync-dialog
Show all tags in separate node "tags" in synchronize dialog. Also improve labels in this dialog. Change-Id: I9705d79b9d5703993cbf4db121373805530e0097 Signed-off-by: Dariusz Luksza <dariusz@luksza.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewTest.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SynchronizeWithActionHandler.java36
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties7
4 files changed, 35 insertions, 17 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewTest.java
index be494508c..cb16a981e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewTest.java
@@ -118,7 +118,7 @@ public class SynchronizeViewTest extends LocalRepositoryTestCase {
.click();
bot.comboBox(0)
- .setSelection(UIText.SynchronizeWithAction_localRepoName);
+ .setSelection(UIText.SynchronizeWithAction_tagsName);
bot.comboBox(1).setSelection("v0.0");
bot.comboBox(2)
@@ -157,11 +157,11 @@ public class SynchronizeViewTest extends LocalRepositoryTestCase {
.click();
bot.comboBox(0)
- .setSelection(UIText.SynchronizeWithAction_localRepoName);
+ .setSelection(UIText.SynchronizeWithAction_tagsName);
bot.comboBox(1).setSelection("v0.1");
bot.comboBox(2)
- .setSelection(UIText.SynchronizeWithAction_localRepoName);
+ .setSelection(UIText.SynchronizeWithAction_tagsName);
bot.comboBox(3).setSelection("v0.2");
// fire action
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index d03560d7a..6ca4e5368 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -3134,6 +3134,9 @@ public class UIText extends NLS {
public static String SynchronizeWithAction_localRepoName;
/** */
+ public static String SynchronizeWithAction_tagsName;
+
+ /** */
public static String ValidationUtils_CanNotResolveRefMessage;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SynchronizeWithActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SynchronizeWithActionHandler.java
index 3aa129aac..0b867377b 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SynchronizeWithActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SynchronizeWithActionHandler.java
@@ -79,6 +79,7 @@ public class SynchronizeWithActionHandler extends RepositoryActionHandler {
List<SyncRepoEntity> syncRepoEntitys = new ArrayList<SyncRepoEntity>();
syncRepoEntitys.add(getLocalSyncRepo(repo));
+ syncRepoEntitys.add(getTagsSyncRepo(repo));
for (RemoteConfig rc : remoteConfigs)
syncRepoEntitys.add(getRemoteSyncRepo(refDatabase, rc));
@@ -94,12 +95,12 @@ public class SynchronizeWithActionHandler extends RepositoryActionHandler {
Set<String> allRefs = repo.getAllRefs().keySet();
SyncRepoEntity local = new SyncRepoEntity(
UIText.SynchronizeWithAction_localRepoName);
- for (String ref : allRefs) {
- if (!ref.startsWith(Constants.R_REMOTES)) {
- String name = ref.substring(ref.lastIndexOf('/') + 1);
- local.addRef(new SyncRefEntity(name, ref));
+ for (String ref : allRefs)
+ if (!ref.startsWith(Constants.R_REMOTES)
+ && !ref.startsWith(Constants.R_TAGS)) {
+ local.addRef(createSyncRepoEntity(ref));
}
- }
+
return local;
}
@@ -108,15 +109,28 @@ public class SynchronizeWithActionHandler extends RepositoryActionHandler {
SyncRepoEntity syncRepoEnt = new SyncRepoEntity(rc.getName());
Collection<Ref> remoteRefs = getRemoteRef(refDatabase, rc.getName());
- for (Ref ref : remoteRefs) {
- String refName = ref.getName();
- String refHumanName = refName
- .substring(refName.lastIndexOf('/') + 1);
- syncRepoEnt.addRef(new SyncRefEntity(refHumanName, refName));
- }
+ for (Ref ref : remoteRefs)
+ syncRepoEnt.addRef(createSyncRepoEntity(ref.getName()));
+
return syncRepoEnt;
}
+ private SyncRepoEntity getTagsSyncRepo(Repository repo) {
+ Set<String> allRefs = repo.getAllRefs().keySet();
+ SyncRepoEntity local = new SyncRepoEntity(
+ UIText.SynchronizeWithAction_tagsName);
+ for (String ref : allRefs)
+ if (ref.startsWith(Constants.R_TAGS))
+ local.addRef(createSyncRepoEntity(ref));
+
+ return local;
+ }
+
+ private SyncRefEntity createSyncRepoEntity(String ref) {
+ String name = ref.substring(ref.lastIndexOf('/') + 1);
+ return new SyncRefEntity(name, ref);
+ }
+
private Collection<Ref> getRemoteRef(RefDatabase refDb, String remoteName)
throws IOException {
return refDb.getRefs(Constants.R_REMOTES + remoteName + "/").values(); //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index cc1c23382..5bb3e9222 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -1004,9 +1004,9 @@ NonDeletedFilesTree_ResourcePathsButton=Show Resource &paths
RemoteConnectionPreferencePage_TimeoutLabel=&Remote connection timeout (seconds):
RemoteConnectionPreferencePage_ZeroValueTooltip=0 is equivalent to no timeout
-RemoteSelectionCombo_sourceName=&Source Repository:
+RemoteSelectionCombo_sourceName=&Source:
RemoteSelectionCombo_sourceRef=R&ef:
-RemoteSelectionCombo_destinationName=&Destination Repository:
+RemoteSelectionCombo_destinationName=&Destination:
RemoteSelectionCombo_destinationRef=Re&f:
RemoveCommand_ConfirmDeleteBareRepositoryMessage=This will delete Repository {0} permanently, do you want to continue?
RemoveCommand_ConfirmDeleteBareRepositoryTitle=Delete Bare Repository
@@ -1063,7 +1063,8 @@ SimpleConfigurePushDialog_URILabel=&URI:
SkipRebaseCommand_CancelDialogMessage=The Skip operation was canceled
SkipRebaseCommand_JobName=Skipping Rebase
-SynchronizeWithAction_localRepoName=<local .git>
+SynchronizeWithAction_localRepoName=<local branch>
+SynchronizeWithAction_tagsName=<tag>
ValidationUtils_CanNotResolveRefMessage=Can not resolve {0}
ValidationUtils_InvalidRefNameMessage={0} is not a valid name for a Ref
ValidationUtils_RefAlreadyExistsMessage=Ref {0} already exists

Back to the top