Mike Horgan wrote:
> That's great news on the client fixes/changes!
>
> By "previous," I simply mean the revision of the affected path/file
> before this change was committed.
>
> For example,
>
> Lets say I have FileA.cpp, which has revisions 250, 750, and 1000.
> (it's been touched 3 times).
>
> If I view the resource history of the trunk, I'll get to see all the
> revisions ever committed. If I choose revision 1000, perhaps 2 files
> were touched in that change: FileA.cpp(1000), and FileA.h(1000).
>
> I would see these two files in the 'affected paths'. It would be nice
> if I could right-click on FileA.cpp in the affected paths table, and
> have an option to compare between the FileA.cpp committed at that
> revision (1000), and FileA.cpp that existed prior to it (750)
>
> Simply put, it would be a short cut to finding FileA.cpp in the
> tree-view, viewing it's resource history, and comparing the FileA.cpp
> revision at 1000, and the one before it (750).
>
> Hope that's clearer :-\
Here is a patch that is fixing drag-n-drop folders to svn history view
and also adds a popup menu to the affected paths table:
-- Open
-- Show in Resource history
-- Show annotation
-- Compare with head
It seems that it will be necessary to fetch list of revisions for
selected path in order to compare it with prev or next revision. So, for
now you can use show in history and then select any two revisions.
However there is some weird issue I'm still debugging. There is
something long running kicked on a right click in paths table, so popup
menu appears after several second delay. Otherwise new actions work for me.
By the way, I wonder why comparison of two selected resources is not
enabled on the SVN repository explorer. That would help a bit with
comparing trunk and some other branch...
regards,
Eugene
IIndex:
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/actions/OpenLogEntryAction.java
===================================================================
---
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/actions/OpenLogEntryAction.java
(revision 1469)
+++
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/actions/OpenLogEntryAction.java
(working copy)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.Iterator;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
@@ -35,34 +36,35 @@
/**
* Returns the selected remote files
*/
- protected ILogEntry[] getSelectedLogEntries() {
- ArrayList entries = null;
- if (!selection.isEmpty()) {
- entries = new ArrayList();
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof ILogEntry) {
- entries.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(ILogEntry.class);
- if (adapter instanceof ILogEntry) {
- entries.add(adapter);
- continue;
- }
- }
- }
- }
- if (entries != null && !entries.isEmpty()) {
- ILogEntry[] result = new ILogEntry[entries.size()];
- entries.toArray(result);
- return result;
- }
- return new ILogEntry[0];
- }
+// protected IResource[] getSelectedResources() {
+// ArrayList entries = null;
+// if (!selection.isEmpty()) {
+// entries = new ArrayList();
+// Iterator elements = selection.iterator();
+// while (elements.hasNext()) {
+// Object next = elements.next();
+// if (next instanceof ILogEntry) {
+// entries.add(next);
+// continue;
+// }
+// if (next instanceof IAdaptable) {
+// IAdaptable a = (IAdaptable) next;
+// Object adapter = a.getAdapter(ILogEntry.class);
+// if (adapter instanceof ILogEntry) {
+// entries.add(adapter);
+// continue;
+// }
+// }
+// }
+// }
+// if (entries != null && !entries.isEmpty()) {
+// ISVNRemoteResource[] result = new
ISVNRemoteResource[entries.size()];
+// entries.toArray(result);
+// return result;
+// }
+// return new ISVNRemoteResource[0];
+// }
+
/*
* @see SVNAction#execute(IAction)
*/
@@ -72,9 +74,9 @@
IWorkbench workbench =
SVNUIPlugin.getPlugin().getWorkbench();
IEditorRegistry registry = workbench.getEditorRegistry();
IWorkbenchPage page =
workbench.getActiveWorkbenchWindow().getActivePage();
- final ILogEntry[] entries = getSelectedLogEntries();
+ final ISVNRemoteResource[] entries =
getSelectedRemoteResources();
for (int i = 0; i < entries.length; i++) {
- ISVNRemoteResource remoteResource =
entries[i].getRemoteResource();
+ ISVNRemoteResource remoteResource = entries[i];
if (!(remoteResource instanceof ISVNRemoteFile))
continue;
ISVNRemoteFile file = (ISVNRemoteFile)remoteResource;
@@ -106,9 +108,9 @@
* @see TeamAction#isEnabled()
*/
protected boolean isEnabled() throws TeamException {
- ILogEntry[] entries = getSelectedLogEntries();
- if (entries.length == 0) return false;
- if (entries[0].getRemoteResource() == null) return false;
+ ISVNRemoteResource[] resources = getSelectedRemoteResources();
+ if (resources.length == 0) return false;
+ if (resources[0] == null) return false;
return true;
}
}
Index:
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryDropAdapter.java
===================================================================
---
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryDropAdapter.java
(revision 1469)
+++
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryDropAdapter.java
(working copy)
@@ -59,7 +59,7 @@
IResource[] sources = (IResource[])data;
if (sources.length == 0) return false;
IResource resource = sources[0];
- if (!(resource instanceof IFile)) return false;
+ // if (!(resource instanceof IFile)) return false;
view.showHistory(resource, true /* fetch */);
return true;
} else if( data instanceof ISVNRemoteResource) {
Index:
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryView.java
===================================================================
---
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryView.java
(revision 1469)
+++
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/src/org/tigris/subversion/subclipse/ui/history/HistoryView.java
(working copy)
@@ -242,10 +242,10 @@
public void run() {
try {
if (resource == null) return;
- ISelection selection =
tableHistoryViewer.getSelection();
+ ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return;
IStructuredSelection ss =
(IStructuredSelection)selection;
- currentSelection = (ILogEntry)ss.getFirstElement();
+ currentSelection = getLogEntry(ss);
PlatformUI.getWorkbench().getProgressService().run(true, true, new
IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException {
try {
@@ -264,11 +264,11 @@
// we don't allow multiple selection
public boolean isEnabled() {
- ISelection selection = tableHistoryViewer.getSelection();
+ ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return false;
IStructuredSelection ss = (IStructuredSelection)selection;
if(ss.size() != 1) return false;
- currentSelection = (ILogEntry)ss.getFirstElement();
+ currentSelection = getLogEntry(ss);
return true;
}
};
@@ -281,10 +281,10 @@
public void run() {
SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
try {
- final ISelection selection =
tableHistoryViewer.getSelection();
+ final ISelection selection = getSelection();
if (!(selection instanceof
IStructuredSelection)) return;
IStructuredSelection ss =
(IStructuredSelection)selection;
- ILogEntry ourSelection =
(ILogEntry)ss.getFirstElement();
+ ILogEntry ourSelection = getLogEntry(ss);
SVNUrl repositoryUrl = null;
@@ -347,11 +347,11 @@
// we don't allow multiple selection
public boolean isEnabled() {
- ISelection selection =
tableHistoryViewer.getSelection();
+ ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return false;
IStructuredSelection ss =
(IStructuredSelection)selection;
if(ss.size() != 1) return false;
- currentSelection = (ILogEntry)ss.getFirstElement();
+ currentSelection = getLogEntry(ss);
return true;
}
};
@@ -359,6 +359,22 @@
return setCommitPropertiesAction;
}
+ private ILogEntry getLogEntry(IStructuredSelection ss) {
+ if(ss.getFirstElement() instanceof LogEntryChangePath) {
+ return ((LogEntryChangePath)ss.getFirstElement()).getLogEntry();
+ } else {
+ return (ILogEntry) ss.getFirstElement();
+ }
+ }
+
+ private ISelection getSelection() {
+ if( tableHistoryViewer.getControl().isFocusControl()) {
+ return tableHistoryViewer.getSelection();
+ } else {
+ return tableChangePathViewer.getSelection();
+ }
+ }
+
// open remote file action (double-click)
private Action getOpenRemoteFileAction() {
if (openAction == null) {
@@ -513,18 +529,35 @@
}
});
- // Contribute actions to popup menu for the table
- MenuManager menuMgr = new MenuManager();
- Menu menu =
menuMgr.createContextMenu(tableHistoryViewer.getTable());
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTableMenu(menuMgr);
- }
- });
- menuMgr.setRemoveAllWhenShown(true);
- tableHistoryViewer.getTable().setMenu(menu);
- getSite().registerContextMenu(menuMgr, tableHistoryViewer);
+ // Contribute actions to popup menu for the table
+ {
+ MenuManager menuMgr = new MenuManager();
+ Menu menu =
menuMgr.createContextMenu(tableHistoryViewer.getTable());
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuMgr) {
+ fillTableMenu(menuMgr);
+ }
+ });
+ menuMgr.setRemoveAllWhenShown(true);
+ tableHistoryViewer.getTable().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, tableHistoryViewer);
+ }
+
+ // Contribute actions to popup menu for the change path table
+ {
+ MenuManager menuMgr = new MenuManager();
+ Menu menu =
menuMgr.createContextMenu(tableChangePathViewer.getTable());
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuMgr) {
+ fillTableChangePathMenu(menuMgr);
+ }
+ });
+ menuMgr.setRemoveAllWhenShown(true);
+ tableChangePathViewer.getTable().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, tableChangePathViewer);
+ }
+
// Create the local tool bar
IToolBarManager tbm =
getViewSite().getActionBars().getToolBarManager();
tbm.add(getRefreshAction());
@@ -545,16 +578,19 @@
actionBars.updateActionBars();
// Contribute actions to popup menu for the comments area
- menuMgr = new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuMgr) {
- fillTextMenu(menuMgr);
- }
- });
- StyledText text = textViewer.getTextWidget();
- menu = menuMgr.createContextMenu(text);
- text.setMenu(menu);
+ {
+ MenuManager menuMgr = new MenuManager();
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuMgr) {
+ fillTextMenu(menuMgr);
+ }
+ });
+
+ StyledText text = textViewer.getTextWidget();
+ Menu menu = menuMgr.createContextMenu(text);
+ text.setMenu(menu);
+ }
}
/*
@@ -690,7 +726,7 @@
tableChangePathViewer.setContentProvider(new
IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
-
+
if (currentLogEntryChangePath != null) {
return currentLogEntryChangePath;
}
@@ -858,6 +894,11 @@
manager.add(new Separator("additions-end")); //$NON-NLS-1$
}
+ private void fillTableChangePathMenu(IMenuManager manager) {
+ // file actions go first (view file)
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
/**
* fill the popup menu for the comments area
*/
Index: C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.properties
===================================================================
---
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.properties
(revision 1469)
+++
C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.properties
(working copy)
@@ -40,6 +40,10 @@
CompareWithRevisionAction.tooltip=Compare with Revision on SVN Server
CompareWithBaseAction.label=&Base Revision
CompareWithBaseAction.tooltip=Compare with Local Base Revision
+
+CompareRemoteWithHeadAction.label=Compare &Latest from Repository
+CompareRemoteWithHeadAction.tooltip=Compare with Content on SVN Server
+
Console.name=SVN Console
ConsolePreferencePage.name=Console
ContentAction.label=Compare File Contents
Index: C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.xml
===================================================================
--- C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.xml
(revision 1469)
+++ C:/dev/eclipse/org.tigris.subversion.subclipse.ui/plugin.xml
(working copy)
@@ -263,7 +263,46 @@
id="org.tigris.subversion.subclipse.ui.showAnnotation">
</action>
</objectContribution>
+
<objectContribution
+
objectClass="org.tigris.subversion.subclipse.core.history.LogEntryChangePath"
+
id="org.tigris.subversion.subclipse.ui.LogEntryChangePathContributions">
+ <action
+ label="%ShowHistoryAction.label"
+ icon="icons/full/tortoise/log.gif"
+
helpContextId="org.tigris.subversion.subclipse.ui.show_in_history_action_context"
+
class="org.tigris.subversion.subclipse.ui.actions.ShowHistoryAction"
+ tooltip="%ShowHistoryAction.tooltip"
+ id="org.tigris.subversion.subclipse.ui.showHistory">
+ </action>
+ <action
+ label="%ShowAnnotationAction.label"
+ icon="icons/full/tortoise/blame.gif"
+
helpContextId="org.tigris.subversion.subclipse.ui.get_annotate_action_context"
+ tooltip="%ShowAnnotationAction.tooltip"
+
class="org.tigris.subversion.subclipse.ui.actions.ShowAnnotationAction"
+ id="org.tigris.subversion.subclipse.ui.showAnnotation">
+ </action>
+ <action
+ label="%OpenLogEntryAction.label"
+
helpContextId="org.tigris.subversion.subclipse.ui.open_remote_file_action_context"
+ tooltip="%OpenLogEntryAction.tooltip"
+
class="org.tigris.subversion.subclipse.ui.actions.OpenLogEntryAction"
+ id="org.tigris.subversion.subclipse.ui.openLogEntry">
+ </action>
+
+ <action
+
class="org.tigris.subversion.subclipse.ui.actions.CompareRemoteWithHeadRevisionAction"
+
helpContextId="org.tigris.subversion.subclipse.ui.compare_with_latest_action_context"
+
id="org.tigris.subversion.subclipse.ui.compareRemoteWithHead"
+ label="%CompareRemoteWithHeadAction.label"
+ menubarPath="compareGroup"
+ tooltip="%CompareRemoteWithHeadAction.tooltip">
+ </action>
+
+ </objectContribution>
+
+ <objectContribution
objectClass="org.tigris.subversion.svnclientadapter.ISVNProperty"
id="org.tigris.subversion.subclipse.ui.SVNPropertyContributions">
<action
Received on Fri Jul 22 18:11:38 2005