Merge lp:~javierder/bzr-eclipse/add-ignore into lp:~verterok/bzr-eclipse/trunk
- add-ignore
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~javierder/bzr-eclipse/add-ignore |
Merge into: | lp:~verterok/bzr-eclipse/trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~javierder/bzr-eclipse/add-ignore |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guillermo Gonzalez | Needs Fixing | ||
Review via email: mp+6185@code.launchpad.net |
Commit message
Description of the change
Javier Derderyan (javierder) wrote : | # |
Martin Albisetti (beuno) wrote : | # |
> 153 + // FIXME: exception handling
Is this handled somewhere else?
Javier Derderyan (javierder) wrote : | # |
> > 153 + // FIXME: exception handling
>
> Is this handled somewhere else?
That's all around BzrEclipse, probably needs to be checked all around
Also, I've pushed some changes, the "IgnoredDialog", that i hope doesn't get ignored...=P
Guillermo Gonzalez (verterok) wrote : | # |
> Added support for "Ignore".
>
> I'm working on a dialog to allow to manage .bzrignore in a "gui" way, but it
> would be nice to get this first part reviewed and merged.
Great!
I didn't got any spare time to review this (deadlines and that kind stuff ;), apologize the delay. I'll try to digg into this tonight.
In the meantime, please update the headers to reflect the correct license and copyright.
Cheers,
Guillermo Gonzalez (verterok) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
On Mon, May 4, 2009 at 5:40 PM, Javier Der Derian wro=
te:
> Javier Der Derian has proposed merging lp:~javierder/bzr-eclipse/add-igno=
re into lp:bzr-eclipse.
>
> Requested reviews:
> =C2=A0 =C2=A0Guillermo Gonzalez (verterok)
>
> Added support for "Ignore".
>
> I'm working on a dialog to allow to manage .bzrignore in a "gui" way, but=
it would be nice to get this first part reviewed and merged.
The UI looks good! keep the great work.
A few comments on some issues I'ld like to get fixed before merging:
1) Please remove the commented code if is not used, e.g:
- org.vcs.
- org.vcs.
2) I'm not entirely sure that both IgnoreCommand and AddIgnoredCommand
classes should extend ResourceChangeC
change involved in the operations. (looks like a branch level change,
or maybe it's a new type?)
3) In org.vcs.
private variable that's never used:
private List selection;
(and getSelection() method.)
4) Please externalize the strings to UITexts/Coretext accordingly.
I'm still need to run some tests.
I'll let you work on this minor issues first :)
>
>
> --
> https:/
> You are requested to review the proposed merge of lp:~javierder/bzr-eclip=
se/add-ignore into lp:bzr-eclipse.
>
Regards,
review needs-fixing
- --
Guillermo Gonzalez
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://
iEYEARECAAYFAko
OhQAn0HNxzVM5bI
=KPPT
-----END PGP SIGNATURE-----
Javier Derderyan (javierder) wrote : | # |
> -----BEGIN PGP SIGNED MESSAGE----- Hi, thanks for the review!
> Hash: SHA1
>
> Hi!
>
> On Mon, May 4, 2009 at 5:40 PM, Javier Der Derian wro=
> te:
> > Javier Der Derian has proposed merging lp:~javierder/bzr-eclipse/add-igno=
> re into lp:bzr-eclipse.
> >
> > Requested reviews:
> > =C2=A0 =C2=A0Guillermo Gonzalez (verterok)
> >
> > Added support for "Ignore".
> >
> > I'm working on a dialog to allow to manage .bzrignore in a "gui" way, but=
> it would be nice to get this first part reviewed and merged.
>
> The UI looks good! keep the great work.
>
> A few comments on some issues I'ld like to get fixed before merging:
>
> 1) Please remove the commented code if is not used, e.g:
> - org.vcs.
> - org.vcs.
>
> 2) I'm not entirely sure that both IgnoreCommand and AddIgnoredCommand
> classes should extend ResourceChangeC
> change involved in the operations. (looks like a branch level change,
> or maybe it's a new type?)
>
> 3) In org.vcs.
> private variable that's never used:
> private List selection;
> (and getSelection() method.)
>
> 4) Please externalize the strings to UITexts/Coretext accordingly.
>
> I'm still need to run some tests.
> I'll let you work on this minor issues first :)
>
> >
> >
> > --
> > https:/
> > You are requested to review the proposed merge of lp:~javierder/bzr-eclip=
> se/add-ignore into lp:bzr-eclipse.
> >
>
> Regards,
>
> review needs-fixing
>
> - --
> Guillermo Gonzalez
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Use GnuPG with Firefox : http://
>
> iEYEARECAAYFAko
> OhQAn0HNxzVM5bI
> =KPPT
> -----END PGP SIGNATURE-----
About the "ResourceChange
I don't know if it applies, but resources are changed everytime any of those commands is executed.
If ignore is executed, .bzrignore is changed.
If addignored is executed, files are added, just like in AddCommand
Guillermo Gonzalez (verterok) wrote : | # |
>
> Hi, thanks for the review!
>
Hi, apologize the delay.
> About the "ResourceChange
> I don't know if it applies, but resources are changed everytime any of those
> commands is executed.
sometimes what change is the the metadata associated with the branch, we could treat the ignored files as such, or as a resource modification, the difference is how the refresh is executed.
> If ignore is executed, .bzrignore is changed.
Actually .bzrignore might be changed, but ins't tracked so, isn't changing, let me digg a bit more about this. maybe we can improve this in a later branch.
> If addignored is executed, files are added, just like in AddCommand
Testing the ingored files dialog, I get NullPointer exceptions when unchecking one ignored file and clicking in ok.
java.lang.
at org.vcs.
at org.vcs.
at org.vcs.
at org.vcs.
at org.eclipse.
at org.eclipse.
at org.eclipse.
at org.vcs.
at org.eclipse.
looks like the problem is in IgnoredDialog.
fwiw, there is a list "uncheckedfiles" that's isn't used.
but the problem is that unchecked is populated with one null element.
possibly the error is in project.
maybe using IBzrResource classes to show the files might simplify this, as all the code is already there. If you go with this approach, the Map<String, String> returned by the ignored command should be preprocessed before passing it to the dialog, in order to pass a Map<IBzrResource, String> to the dialog.
Regards.
- 211. By Guillermo Gonzalez
-
merge lp:~javierder/bzr-eclipse/send_command, externalize strings in send dialog and fix Bug #373311
Guillermo Gonzalez (verterok) wrote : | # |
I missed to add the vote :p
Guillermo Gonzalez (verterok) wrote : | # |
Now that your send_command fixes are in trunk I got conflicts in org.vcs.
Guillermo Gonzalez (verterok) wrote : | # |
> > If ignore is executed, .bzrignore is changed.
> Actually .bzrignore might be changed, but ins't tracked so, isn't changing,
> let me digg a bit more about this. maybe we can improve this in a later
> branch.
>
Please ignore this ^
I meant that besides the change in .bzrignore other status are changed, but if you only return the affected resources, but not .bzrignore it might not be refreshed.
I'll double check this.
Thanks,
Regards.
Guillermo Gonzalez (verterok) wrote : | # |
Hi,
Please comment on the merge proposal the next time you address an issue that needs to be fixed, so I can take a look to it more quickly, as I'm not subscribed to the branches.
Please take a look to the issues detailed below:
1) You are adding a new command: 'AddIgnoredCommand' that it's based on AddCommand and isn't adding anything or doing something different from the plain AddCommand. please remove the command as isn't adding any value and it's almost a copy/paste of the AddCommand.
2) In the IgnoredAction you are directly using IBazaarClient, but the UI shouldn't know anything about the client, that's the reason to have the commands in the core module, it might look like a bit of overhead, but the idea is to handle all the File's (java.io.File) and low level stuff in the core, so we can change the backend and keep the UI intact, which should use the interfaces provided by eclipse (IResource, etc) and by bzr-eclipse core module, e.g: IBzrResource, etc.
You should create a IgnoredCommand class in order to get that data from the UI module.
3) In the IgnoreAction you could use Job as is a lot nicer than executing a runnable, the IgnoreAction.
protected void execute(IAction action) throws BazaarException, InvocationTarge
final IResource[] resources = getSelectedReso
Job ignoreJob = new WorkspaceJob(
@Override
public IStatus runInWorkspace(
throws CoreException {
BazaarTeamP
IgnoreCommand op = new IgnoreCommand(
op.
return Status.OK_STATUS;
}
};
if (resources.length == 1) {
ignoreJob.
ignoreJob.
ignoreJob.
ignoreJob.
}
}
Regards,
review needs-fixing
--
Guillermo Gonzalez
<http://
Javier Derderyan (javierder) wrote : | # |
Ok, the 3 issues have been resolved!
I also added some comments, let me know if that's what you need or if you need some kind of special hing.
Thanks!
Guillermo Gonzalez (verterok) wrote : | # |
Hi,
On Thu, May 28, 2009 at 9:22 PM, Javier Der Derian<email address hidden> wrote:
> Ok, the 3 issues have been resolved!
>
Great thanks!
> I also added some comments, let me know if that's what you need or if you need some kind of special hing.
Regarding the comment about if you need the: run(WorkspaceMo
you could also use a plain Runnable or a Job to do it if the command isn't going to modify the workspace, if you are going to modify the workspace there is WorkspaceJob.Hi,
On Thu, May 28, 2009 at 9:22 PM, Javier Der Derian<email address hidden> wrote:
> Ok, the 3 issues have been resolved!
>
Great thanks!
> I also added some comments, let me know if that's what you need or if you need some kind of special hing.
Regarding the comment about if you need the: run(WorkspaceMo
you could also use a plain Runnable or a Job to do it if the command isn't going to modify the workspace, if you are going to modify the workspace there is WorkspaceJob, and UIJob for jobs that modify the UI.
Have in mind that all this are executed asynchronously (the jobs).
Let me explain this a bit more :)
Java is multi threaded, Eclipse use several threads in order to be snappy. The model is basically: View/UI threads and Worker threads.
If you execute blocking code, e.g: a Command, in the UI Thread it 'll block the whole UI...and that's bad.
So you have to split the work into workers, this way you can update the UI in the UI Thread and do the heavy lifting in non-UI-workers. Eclipse provides abstractions so we don't have to work with low level threads directly, those are: Jobs, facilities to execute a Runnable, etc. The Job API is the recommended way of doing this.
If you need to update the UI from a Job or a WorkspaceJob you can't do that directly because it's executed in a different thread, so you can wait until the Job is done and do something to get the value and pass it to the code that's executed in the UI Thread, e.g: using a Listener, (there are plenty of examples in bzr-eclipse source), the other option is to schedule a UIJob or WorkbenchJob (that's executed in the UI Thread, you can find some examples of this approach too), or call Display.asyncExec but is not recommended (some old code still use this approach).
Let me know if I missed a command.
Now this is a bit more clear, please take a look for example, to the IgnoredAction class, in this case you'r running a pontential long running task in the same thread, at this particular task don't take too much time the UI freeze isn't noticeable.
I know there a lot of code that needs update, but one thing at time.
I know that a lot of code to run this Jobs is almost the same with minimal changes, but there some helper classes to simplify the boring tasks of working with them.
Take a look to this article for a detailed description of the Job API and it's benefits: http://
Th...
- 212. By Javier Derderyan
-
Internal Merge. Conclicts resolved
- 213. By Javier Derderyan
-
Merged with lp:~javierder/bzr-eclipse/add-ignore
Javier Derderyan (javierder) wrote : | # |
Hi,
Thanks for your long reply! It will be very helpfull!!
I've made some internal merges (with the send_command branch) to resolve all conflicts.
Now it merges OK in my config.
Guillermo Gonzalez (verterok) wrote : | # |
Hi,
Apologize the delay I was in offline mode, due to my vacations.
I just found an error in the way the paths(or patters) are passed to the IBazaarClient.
IgnoreCommand.java line: 48
instead of
BzrWorkspaceRoo
should be:
BzrWorkspaceRoo
as the current code returns the representation of the object that might not be the path, currentlt is the encoded path, so spaces are replaced with %20.
Let me know if you don't have the time to fix this (I know you'r working on some qbzr stuff), as I could branch from your branch and fix it.
Preview Diff
1 | === added file 'org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/commands/IgnoreCommand.java' |
2 | --- org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/commands/IgnoreCommand.java 1970-01-01 00:00:00 +0000 |
3 | +++ org.vcs.bazaar.eclipse.core/src/org/vcs/bazaar/eclipse/core/commands/IgnoreCommand.java 2009-04-28 18:33:15 +0000 |
4 | @@ -0,0 +1,46 @@ |
5 | +/** |
6 | + * LICENSE + COPYRIGHT |
7 | + */ |
8 | +package org.vcs.bazaar.eclipse.core.commands; |
9 | + |
10 | +import java.io.File; |
11 | +import java.util.List; |
12 | + |
13 | +import org.eclipse.core.resources.IResource; |
14 | +import org.eclipse.core.runtime.IProgressMonitor; |
15 | +import org.vcs.bazaar.client.core.BazaarClientException; |
16 | +import org.vcs.bazaar.eclipse.BzrWorkspaceRoot; |
17 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
18 | + |
19 | +/** |
20 | + * @author Guillermo Gonzalez <guillo.gonzo@gmail.com> |
21 | + * |
22 | + */ |
23 | +public class IgnoreCommand extends ResourceChangeCommand { |
24 | + |
25 | + private final List<? extends IResource> resources; |
26 | + private final BzrWorkspaceRoot root; |
27 | + |
28 | + public IgnoreCommand(BzrWorkspaceRoot bzrWorkspaceRoot, List<? extends IResource> resources) { |
29 | + this.root = bzrWorkspaceRoot; |
30 | + this.resources = resources; |
31 | + } |
32 | + |
33 | + public IResource[] execute(IProgressMonitor monitor) throws BazaarException { |
34 | + try { |
35 | + root.getClient().add(getFiles(resources)); |
36 | + return resources.toArray(new IResource[0]); |
37 | + } catch (BazaarClientException e) { |
38 | + throw BazaarException.wrapException(e, root.getBranch().getProject()); |
39 | + } |
40 | + } |
41 | + |
42 | + private static File[] getFiles(List<? extends IResource> resources) { |
43 | + File[] files = new File[resources.size()]; |
44 | + for (int i = 0; i < resources.size(); i++) { |
45 | + files[i] = resources.get(i).getLocation().toFile(); |
46 | + } |
47 | + return files; |
48 | + } |
49 | + |
50 | +} |
51 | |
52 | === modified file 'org.vcs.bazaar.eclipse.ui/plugin.properties' |
53 | --- org.vcs.bazaar.eclipse.ui/plugin.properties 2009-04-15 16:36:58 +0000 |
54 | +++ org.vcs.bazaar.eclipse.ui/plugin.properties 2009-04-28 18:33:15 +0000 |
55 | @@ -47,6 +47,8 @@ |
56 | ActionNick_tooltip=Show or set the branch nickname. |
57 | ActionRemove_label=R&emove... |
58 | ActionRemove_tooltip=Make a file unversioned. |
59 | +ActionIgnore_label=&Ignore... |
60 | +ActionIgnore_tooltip=Make a file ignored by Bazaar |
61 | ActionResolve_label=Resolv&e... |
62 | ActionResolve_tooltip=Mark a conflict as resolved. |
63 | ActionRevert_label=&Revert |
64 | |
65 | === modified file 'org.vcs.bazaar.eclipse.ui/plugin.xml' |
66 | --- org.vcs.bazaar.eclipse.ui/plugin.xml 2009-04-15 16:41:07 +0000 |
67 | +++ org.vcs.bazaar.eclipse.ui/plugin.xml 2009-04-28 18:33:15 +0000 |
68 | @@ -207,6 +207,14 @@ |
69 | label="%ActionRemove_label" menubarPath="team.main/group4" |
70 | tooltip="%ActionRemove_tooltip"> |
71 | </action> |
72 | + <action |
73 | + class="org.vcs.bazaar.eclipse.ui.actions.IgnoreAction" |
74 | + definitionId="org.vcs.bazaar.eclipse.ui.actions.ActionIgnore" |
75 | + icon="icons/bzrRemove.png" |
76 | + id="org.vcs.bazaar.eclipse.ui.actions.ActionIgnore" |
77 | + label="%ActionIgnore_label" menubarPath="team.main/group4" |
78 | + tooltip="%ActionIgnore_tooltip"> |
79 | + </action> |
80 | </objectContribution> |
81 | |
82 | <!-- Project only actions --> |
83 | |
84 | === added file 'org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/IgnoreAction.java' |
85 | --- org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/IgnoreAction.java 1970-01-01 00:00:00 +0000 |
86 | +++ org.vcs.bazaar.eclipse.ui/src/org/vcs/bazaar/eclipse/ui/actions/IgnoreAction.java 2009-04-28 18:33:15 +0000 |
87 | @@ -0,0 +1,86 @@ |
88 | +/** |
89 | + * LICENSE + COPYRIGHT |
90 | + */ |
91 | +package org.vcs.bazaar.eclipse.ui.actions; |
92 | + |
93 | +import java.lang.reflect.InvocationTargetException; |
94 | +import java.util.Arrays; |
95 | +import java.util.List; |
96 | +import java.util.Map; |
97 | +import java.util.Set; |
98 | + |
99 | +import org.eclipse.core.resources.IProject; |
100 | +import org.eclipse.core.resources.IResource; |
101 | +import org.eclipse.core.runtime.CoreException; |
102 | +import org.eclipse.core.runtime.IProgressMonitor; |
103 | +import org.eclipse.jface.action.IAction; |
104 | +import org.eclipse.jface.operation.IRunnableWithProgress; |
105 | +import org.eclipse.team.core.RepositoryProvider; |
106 | +import org.eclipse.ui.IWorkbenchWindowActionDelegate; |
107 | +import org.vcs.bazaar.eclipse.CoreTexts; |
108 | +import org.vcs.bazaar.eclipse.EclipseBazaarCore; |
109 | +import org.vcs.bazaar.eclipse.core.commands.AddCommand; |
110 | +import org.vcs.bazaar.eclipse.core.repository.BazaarTeamProvider; |
111 | +import org.vcs.bazaar.eclipse.internal.core.BazaarException; |
112 | +import org.vcs.bazaar.eclipse.ui.EclipseBazaarUI; |
113 | + |
114 | +/** |
115 | + * @author Guillermo Gonzalez |
116 | + * |
117 | + * TODO: Test me |
118 | + */ |
119 | + |
120 | +public class IgnoreAction extends WorkbenchAction { |
121 | + |
122 | + /** |
123 | + * The action has been activated. The argument of the method represents the |
124 | + * 'real' action sitting in the workbench UI. |
125 | + * |
126 | + * @see IWorkbenchWindowActionDelegate#run |
127 | + */ |
128 | + protected void execute(IAction action) throws BazaarException, InvocationTargetException, InterruptedException { |
129 | + run(new IRunnableWithProgress() { |
130 | + |
131 | + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { |
132 | + try { |
133 | + IProject[] projects = getSelectedProjects(); |
134 | + if (projects.length == 1) { |
135 | + IProject project = projects[0]; |
136 | + BazaarTeamProvider provider = (BazaarTeamProvider) RepositoryProvider.getProvider(project, EclipseBazaarCore.getProviderID()); |
137 | + AddCommand op = new AddCommand(provider.getBzrWorkspaceRoot(), Arrays.asList(projects)); |
138 | + op.run(EclipseBazaarCore.subProgressMonitorFor(monitor)); |
139 | + } else { |
140 | + // associate the resources with their respective |
141 | + // RepositoryProvider |
142 | + Map<BazaarTeamProvider, List<IResource>> map = getProviderMapping(getSelectedResources()); |
143 | + Set<BazaarTeamProvider> keySet = map.keySet(); |
144 | + monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$ |
145 | + monitor.setTaskName(CoreTexts.AddCommand_adding); //$NON-NLS-1$ |
146 | + for (BazaarTeamProvider provider : keySet) { |
147 | + List<IResource> resources = map.get(provider); |
148 | + AddCommand op = new AddCommand(provider.getBzrWorkspaceRoot(), resources); |
149 | + op.run(EclipseBazaarCore.subProgressMonitorFor(monitor)); |
150 | + } |
151 | + } |
152 | + } catch (CoreException e) { |
153 | + // FIXME: exception handling |
154 | + EclipseBazaarUI.log(e.getMessage(), e); |
155 | + throw new InvocationTargetException(e); |
156 | + } finally { |
157 | + monitor.done(); |
158 | + } |
159 | + } |
160 | + }, false /* no cancelable */, PROGRESS_DIALOG); |
161 | + } |
162 | + |
163 | + @Override |
164 | + protected boolean isEnabledForManagedResources() { |
165 | + return false; |
166 | + } |
167 | + @Override |
168 | + protected boolean isEnabledForUnmanagedResources() { |
169 | + return true; |
170 | + } |
171 | + |
172 | + |
173 | +} |
Added support for "Ignore".
I'm working on a dialog to allow to manage .bzrignore in a "gui" way, but it would be nice to get this first part reviewed and merged.