diff options
author | Konrad Kügler | 2014-02-11 22:22:06 +0000 |
---|---|---|
committer | Matthias Sohn | 2014-02-13 20:11:08 +0000 |
commit | aaba3270d8e2130a5d9e27161e0797a8f51da269 (patch) | |
tree | 126780e1ae0a8b37a5d923e8373d8af64e87f7ce /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal | |
parent | a41ca8e7db559cdeb7dfdc31edb3d5081eeba654 (diff) | |
download | egit-aaba3270d8e2130a5d9e27161e0797a8f51da269.tar.gz egit-aaba3270d8e2130a5d9e27161e0797a8f51da269.tar.xz egit-aaba3270d8e2130a5d9e27161e0797a8f51da269.zip |
UI support for pruned references in fetch results
When fetching with the prune mode enabled, show the pruned references
(especially deleted remote-tracking branches) in the fetch result table.
Fetching with reference pruning is available in EGit through git config
support recently introduced to JGit (see
https://git.eclipse.org/r/#/c/21845/ ).
Change-Id: I5e8cadce7e91f255c92d842a016e4844d2f84f23
Signed-off-by: Konrad Kügler <swamblumat-eclipsebugs@yahoo.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal')
3 files changed, 30 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java index 66f14e2d57..15bf9b9cc6 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java @@ -2767,6 +2767,9 @@ public class UIText extends NLS { public static String FetchResultTable_statusRejected; /** */ + public static String FetchResultTable_statusPruned; + + /** */ public static String FetchResultTable_statusUpToDate; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultTable.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultTable.java index 6acbd15982..22c9a2cebc 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultTable.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchResultTable.java @@ -16,6 +16,7 @@ import java.util.Map; import org.eclipse.egit.ui.Activator; import org.eclipse.egit.ui.UIUtils; +import org.eclipse.egit.ui.internal.DecorationOverlayDescriptor; import org.eclipse.egit.ui.internal.UIIcons; import org.eclipse.egit.ui.internal.UIText; import org.eclipse.egit.ui.internal.WorkbenchStyledLabelProvider; @@ -29,6 +30,7 @@ import org.eclipse.jface.util.OpenStrategy; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider; import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.IDecoration; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StyledString; @@ -85,6 +87,17 @@ class FetchResultTable { return PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_OBJS_ERROR_TSK); case FORCED: + if (isPruned()) { + ImageDescriptor icon = UIIcons.BRANCH; + if (update.getLocalName().startsWith(Constants.R_TAGS)) + icon = UIIcons.TAG; + if (update.getLocalName().startsWith(Constants.R_NOTES)) + icon = UIIcons.NOTE; + return new DecorationOverlayDescriptor(icon, + UIIcons.OVR_STAGED_REMOVE, IDecoration.TOP_RIGHT); + } + // else + //$FALL-THROUGH$ case RENAMED: case FAST_FORWARD: if (update.getRemoteName().startsWith(Constants.R_HEADS)) @@ -129,6 +142,10 @@ class FetchResultTable { switch (update.getResult()) { case FORCED: + if (isPruned()) + return NO_CHILDREN; + // else + //$FALL-THROUGH$ case FAST_FORWARD: RevWalk walk = new RevWalk(reader); try { @@ -193,7 +210,11 @@ class FetchResultTable { StyledString.DECORATIONS_STYLER); break; case FORCED: - addCommits(styled, "..."); //$NON-NLS-1$ + if (isPruned()) + styled.append(UIText.FetchResultTable_statusPruned, + StyledString.DECORATIONS_STYLER); + else + addCommits(styled, "..."); //$NON-NLS-1$ break; case FAST_FORWARD: addCommits(styled, ".."); //$NON-NLS-1$ @@ -211,6 +232,10 @@ class FetchResultTable { } return styled; } + + private boolean isPruned() { + return update.getNewObjectId().equals(ObjectId.zeroId()); + } } private final Composite treePanel; diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties index cf8bb33e02..724b0ea2b1 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties @@ -921,6 +921,7 @@ FetchResultTable_statusNewBranch=[new branch] FetchResultTable_statusNewTag=[new tag] FetchResultTable_statusRejected=[rejected] FetchResultTable_statusUpToDate=[up to date] +FetchResultTable_statusPruned=[pruned] FetchSourcePage_GettingRemoteRefsTaskname=Getting remote refs FetchSourcePage_PageMessage=The source is a branch or tag in the remote repository FetchSourcePage_PageTitle=Please select a fetch source |