LocalVcs API

is LocalVcsLabel applied to all files in the project ? or just the files
that are changed ? if its just for changed files, how can I get the list of
those ?

I would like to get the history of a particular VirtualFile, What api should
I use ?

Thanks,
-Dash.

4 comments

Ok I will try to answer with my meager knowledge. Olesya would be the best obviously ;)
A label is global to any change. It will get attached to all files. The one thing I am not sure anymore with module is if Labels are global to the project or only to the module (Olesya?)
Try one of the LocalVcs.getChanges to get all changes or just the ones for a particular file. Especially
public abstract LvcsRevision[] getChanges(String path, LvcsLabel label, boolean upToDateOnly);
to get the history of a file.
LocalVcs.getAllLabels can be used to get all labels (index 0 is the oldest label)

Jacques

0

I guess from the revisions I can go back to the Labels using
getImplicitLabel. That should work for me right now.

Thanks,
Dash.

"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:22843742.1074056249541.JavaMail.itn@is.intellij.net...

Ok I will try to answer with my meager knowledge. Olesya would be the best

obviously ;)

A label is global to any change. It will get attached to all files. The

one thing I am not sure anymore with module is if Labels are global to the
project or only to the module (Olesya?)

Try one of the LocalVcs.getChanges to get all changes or just the ones for

a particular file. Especially

public abstract LvcsRevision[] getChanges(String path, LvcsLabel label,

boolean upToDateOnly);

to get the history of a file.
LocalVcs.getAllLabels can be used to get all labels (index 0 is the oldest

label)
>

Jacques



0

Now label is created in a module so it should be used with this module only
(that is why addLabel returns an array). I'm investigating the possibility
return to localvcs per project (because of right now localvcs storages for a
module are different for different project). What do you think about this?

--
Olesya Smirnova
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:22843742.1074056249541.JavaMail.itn@is.intellij.net...

Ok I will try to answer with my meager knowledge. Olesya would be the best

obviously ;)

A label is global to any change. It will get attached to all files. The

one thing I am not sure anymore with module is if Labels are global to the
project or only to the module (Olesya?)

Try one of the LocalVcs.getChanges to get all changes or just the ones for

a particular file. Especially

public abstract LvcsRevision[] getChanges(String path, LvcsLabel label,

boolean upToDateOnly);

to get the history of a file.
LocalVcs.getAllLabels can be used to get all labels (index 0 is the oldest

label)
>

Jacques



0

I would rather have an api that always return only 1 label. This business of returning an array of label on addLabel is rather confusing IMHO.
Instead a module LocalVcs (from LocalVcs.getInstance(Module) ) should only return labels that are created in the associated module. A project LocalVcs (from LocalVcs.getInstance(Project) ) should return labels that can be applied to any module and the project LocalVcses (these labels might contain all the module labels the api right now returns).

I now understand one of the exception I got one time with the TDD plugin. The plugin allows to rollback to the state of the project on the last successful test run. It uses rollbackToLabel() for that. Once, on rollback, IDEA complained that the label did not exist. I am using your new LvcsLabelListener (thousand thanks again ;-). This guy only returns one label. The plugin saves the last successful test label the listener returns and I bet that label only existed in one module. When I tried to rollback my project with that label, IDEA got mad.

I haven't verified it but I have 2 hypothesis here:
1. on a project with multiple modules, a listener registered in a project LocalVcs is called for every single module label created as part of the same action. I saved the last created module label (not likely since I would consistently get exceptions which I don't).
2. on execution of a run configuration associated with one leaf module (as opposed to the project main module) the project listener returns a label that exists in that module only. This would be a problem because AFAIK there isn't a way to find which module a label belongs to so I have no way to use this label to do anything!

So here are the solutions I could come up with:
1. a project listener won't get leaf module labels. Only the associated module listener would. Since it means extra work for me I don't like this option ;)
2. any run, even from a leaf module specific run configuration, label the entire project. project and module listener would get that label.

In general in the abscence of documentation you want your api to be VERY intuitive (at the very least it should be consistent with addLabel and pass an array of labels.).
I believe a little bit of Open Close Principle here would help simplify the client/api code. Hide the fact that every module have its own label by applying a Composite here: Create a project label that would be a "Composite" of module labels. The api would only deal with the base type (see code below).

Right now a plugin can really only deal with a project since we don't have ModuleComponent yet so a plugin cannot just be interested in one module.

In summary:
1. create a composite pattern for label. interface uses a common label interface that both module and project labels implement.
2. make sure that a label retrieved from one LocalVcs instance (through listener, getAllLabels,...) can be used w/o problem with rollbackToLabel, getChanges... of that same LocalVcs instance
3. add a entry point on label to identify what module or project that label belongs to. Right now addLabel returns an array of labels but how am i to know which one to use to rollback a module?

Something like

Do you agree and do want me to enter separate requests for these?

Thanks for your quick answer BTW

Jacques

0

Please sign in to leave a comment.