Jump to content

Comparing class versions


Recommended Posts

Does anyone know if it is possible to compare two versions of a class in a meaningful way?

For example, say I create a class (Newclass.lvclass) and save it in a repository.

Subsequently I make a change to the class (e.g., I add a Boolean control to the class data definition).

Now I want to compare the current version to the previous version.

A .lvclass file is a text file so using TortoiseSVN's default Diff Viewer shows the textual differences between the files, but even for the simple case of adding a Boolean control described above this is not human readable.

I don't see a way to access the .ctls associated with the class for comparison either.

Has anyone figured out a way to do this?

Paul

Link to comment

Norm,

Very nice. I think what you have here is the start of a VI (maybe "CMP Compare two LVClasses.vi") that belongs perhaps in the prochmphier.llb library. Then we could write a version of LVDiff to call it when the file type is .lvclass....

So nothing like this exists with LabVIEW currently, then? If not then I will submit an enhancement request to NI, since I think this should be part of LabVIEW itself in future releases.

Paul

Link to comment

QUOTE (Paul_at_Lowell @ Oct 1 2008, 06:37 PM)

Norm,

Very nice. I think what you have here is the start of a VI (maybe "CMP Compare two LVClasses.vi") that belongs perhaps in the prochmphier.llb library. Then we could write a version of LVDiff to call it when the file type is .lvclass....

So nothing like this exists with LabVIEW currently, then? If not then I will submit an enhancement request to NI, since I think this should be part of LabVIEW itself in future releases.

Paul

I'm glad you think it's a good start. I don't use SVN myself (not yet anyway, but when I have time I'll install it and play a little.)

I don't think it currently exists in 8.6 (but I've been proven wrng before!) That would make a good suggestion for NI.

BTW: Thanks for the wiki on SVN. It's gonna be useful.

Link to comment

Sorry about the delay in replying. I wanted to try something first....

AQ's post tells me:

LabVIEW's comparison VI works with .ctls :-)

I need to use the ClassName.lvclass:ClassName.ctl (project path) format to access the controls (that's hugely helpful!)

Now, keeping in mind that I want to work with a SCC provider...

1) What I want to do is edit lvdiff.vi so that it will compare the .ctl files if the file extension is .lvclass.

Unfortunately I haven't been able to get this to work. Lvdiff.vi uses "Open VI Reference" but this doesn't work with .lvclass files (returns Error 1059: LabVIEW: Unexpected file type). (And no, simply adding :ClassName.ctl doesn't work—then I end up with Error 7: File not found.) I know I have to use the project path as AQ describes but I don't know how to open the files—in LabVIEW--in the first place. I'd like to know how to do this anyway. Any hints?

2) This way I will have a solution to do a comparison from the TortoiseSVN client to Subversion. (I just have to specify to use the modified lvdiff tool as the DiffTool for .lvclass files.) NI does not currently support TortoiseSVN as an integrated source code control provider. The next question is: can LabVIEW compare .lvclass controls in this way using an integrated SCC provider? My guess (haven't tried this) is that it doesn't so NI still needs to develop this. Maybe this would be a compare two LabVIEW classes method. (Then maybe I could use this to update lvdiff.)

TortoiseSVN's own textual comparison tool or Beyond Compare or CompareIt! will all show me the differences in the XML file, but the coded information isn't directly useful. What I really want to do is compare the .ctls as AQ's example does (works quite well, by the way). That's exactly what I want to do. I just want to use it with a SCC provider.

Thanks!

Paul

Hmmm...maybe Norm's approach will help me with getting a reference to the .lvclass.... but can I open the class this way, I wonder?

Link to comment

QUOTE (Paul_at_Lowell @ Oct 3 2008, 05:26 PM)

1) What I want to do is edit lvdiff.vi so that it will compare the .ctl files if the file extension is .lvclass.

Unfortunately I haven't been able to get this to work. Lvdiff.vi uses "Open VI Reference" but this doesn't work with .lvclass files (returns Error 1059: LabVIEW: Unexpected file type). (And no, simply adding :ClassName.ctl doesn't work—then I end up with Error 7: File not found.) I know I have to use the project path as AQ describes but I don't know how to open the files—in LabVIEW--in the first place. I'd like to know how to do this anyway. Any hints?

Hmmm...maybe Norm's approach will help me with getting a reference to the .lvclass.... but can I open the class this way, I wonder?

You sure can. Notice that I use the VIReference property of "ProjectItem" class to get a reference to the "ClassName.lvclass:ClassName.ctl" VI. This is the only way I found you could access the class Private Data control. Don't forget that ctl files are VIs too...

PS: Not only will adding ":ClassName.ctl" not work, but using the full path ".lvclass\ClassName.ctl" will not work either.

Link to comment

QUOTE (normandinf @ Oct 3 2008, 02:54 PM)

You sure can. Notice that I use the VIReference property of "ProjectItem" class to get a reference to the "ClassName.lvclass:ClassName.ctl" VI. This is the only way I found you could access the class Private Data control. Don't forget that ctl files are VIs too...

PS: Not only will adding ":ClassName.ctl" not work, but using the full path ".lvclass\ClassName.ctl" will not work either.

Norm,

Your example helped immensely. I was able to get it to work with LVDiff and everything. I'll post the result in a few minutes here....

Paul

OK,

I just replaced the "Open VI Reference" in "lvdiff.vi" with "obtainReference.vi" that uses Norm's method to get a reference to the .ctl for the class if the type is LabVIEW class; otherwise, it uses "Open VI Reference" as before.

I set up TortoiseSVN to use lvdiff as the "Diff Viewer" if the file extension is .lvclass.

Everything seems to work great.

Many thanks, Norm and AQ!!!

Now we need to see if we can get LVDiff updated at its source.....

Paul

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.