tags:

views:

67

answers:

3

Hello,

i'm new to this kind of things. Kinda the first post ever regarding programming, since till now i managed to google everything that i needed. Thanks for your patience:) .

About my problem/goal: On our project we will have to have some kind of documentation management control. We will have around 160 .docx files (all files are already known), for version control we will use SVN. Those files will be saved in different folders (further on i will make repository structure), folders will have the function of a phase we are currently on in our project (we will have around 12 folders). When a phase is done, tag aka. official release will be made. Every file will have it's place in MS Excel WorkSheet Column with data like: Phase, Name, Revision, Tag, Hyperlink ..

What i have to do is: Macro that will search for the file on repository, if found read it's revision,tag (latest) .. write it in excel sheet and also make a hyperlink to that file in another column.

Repository structure:

  • trunk
    • System_Development
      • System_Requirements_Specifications.docx
      • System_Architecture_Description.docx
      • System_Safety_Plan.docx
      • ...
    • Software Planing
      • Software_Quality_Assurance_Plan.docx
      • Software_Configuration_Management_Plan.docx
      • ...
    • ...
  • branches (probably won't get used, not sure yet)
  • tags
    • 1
      • System_Development
        • System_Requirements_Specifications.docx
        • System_Architecture_Description.docx
        • System_Safety_Plan.docx
        • ...
    • 2
      • System_Development
        • System_Requirements_Specifications.docx
        • System_Architecture_Description.docx
        • System_Safety_Plan.docx
        • ...
      • Software Planing
        • Software_Quality_Assurance_Plan.docx
        • Software_Configuration_Management_Plan.docx
        • ...

I already made a macro that does the exact thing, but the problem is it's very slow. How and why?

I was using ShellAndWait("cmd.exe /c svn list --verbose http:\\localhost\trunk > text.txt"), parse that text file to get folders in trunk, then checked which files are in those folders (with another ShellAndWait for each folder), if they were found get revision number and so on ..

As you see in the end, in my code svn command was executed 13 times so file in repository was found. With svn list --verbose i also got revision number. For svn command to execute it lasts around 0.15-0.20 of a second, so my revision number gathering lasts around 2 seconds. Which is not a problem.

Getting tag is a problem, as i have folder in folder, so in the end we could have around 40 or even more svn executes, which would make my tag function very slow.

I have no clue how to access repository in any other way then with svn.exe. I am thinking about accessing repository remotely and querying database or what ever, still researching that part.

Hope you understand my problem, for any more informations i am avail whole day! Thanks for your help!

A: 

You can write an Java thing which can access the SVN repository via SVNKit directly without calling svn.exe and extract the information from there and write into Excel files via PIO framework. That could be build as a web application and create the information on the fly...

khmarbaise
+1  A: 

svn list has an option -R or --recursive to include all subfolders. So, organizing your folder structure in a way that all required folders are subfolders of a main folder would reduce the number of calls needed. Alternatively, you can use the --depth option to control the depth of subfolders to descend.

Extract from svn help list output:

  -R [--recursive]         : descend recursively, same as --depth=infinity
  --depth ARG              : limit operation by depth ARG ('empty', 'files',
                            'immediates', or 'infinity')

I. e. organize you project in a way that the trunk and branches are relatively high in the folder structure, and the different phases are below that.

Frank
SVN commands don't include subfolders .. if so, prove me wrong please :) Reorganizing our repository is out of the question, not my decision! The problem started just because of new folder structure in the first place :(
krizajB
@krizajB - I just checked: it is not the default but an option to recurse subdirectories: -R or --recursive. I will edit my answer accordingly.
Frank
Thanks! I will try to work with this, really hope i find some use of this. I was looking at switches so hard i couldn't see the most important ones from a week of research :)
krizajB
For those who might wonder how i did it. For revision gathering, i used svn command like that: GetCommandOutput("cmd.exe /c svn list -v -R http:/localhost/documents/trunk"), parsed that string into array and inserted useful info into my Excel Sheet.For tags i used a lot faster command: GetCommandOutput("cmd.exe /c svn list --depth infinity http:/localhost/documents/tags"), parsed string to get tag.Frank, thanks again!
krizajB
A: 

You can access the repository using the API for .NET. See this answer

You will probably need to use VSTO instead of VBA though.

renick