Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I connect to Visual SVN server Repository C++ with Qt



  • I just want to access local visual svn server repositories with my C++ QT code.
    I want to display the folder and subfolder names in the following adress https://desktop/!/#repo (address of local svn repository).

    Thanks for your help.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How are you querying that server for information ?
    Does it provide an API to access such information ?



  • @es11
    It's years since I wrote an SVN interface in a C# project, but.... SVN servers (including Visual SVN Server) act as a DAV server. You send it requests over HTTP using method names like REPORT or PROPFIND. Your request input body is XML, in a certain format with various property specifications, and it sends you back an XML payload with response in similar-ish format. From Qt you will use QNetworkAccessManager classes to do HTTP requests/responses.

    To give you some idea of what it looks like, here's C# code for the simplest request/response, just asking for the server's OPTIONS:

        private XmlDocument SVNDavOptions(string url)
        {
          // Issue a *server*-side "OPTIONS" query against a SVN DAV Server
          // to test it works OK
    
          ICWebClient icwc = new ICWebClient();
          SetSVNDavWebClientCredentials(icwc);
    
          string query =
    	"<D:options " + SVNDavNamespacesDeclaration + ">" +
    	"<D:activity-collection-set/>" +
    	"</D:options>";
    
          XmlDocument xmlResponse = icwc.HttpDavMethod("OPTIONS", null, url, query);
          return xmlResponse;
        }
    

    Unfortunately, I no longer have any recollection where the SVN DAV protocol is explained. You'll have to Google. I come across e.g. https://svn.apache.org/repos/asf/subversion/trunk/notes/http-and-webdav/webdav-protocol or https://tools.ietf.org/html/rfc2518. These are the sort of documentation I used to create client code against.



  • @SGaist
    I think I need a library for that. I found the java version which is SVNKit. However, I couldn't find for C++ Qt version. This is the code for java with a library: https://wiki.svnkit.com/Printing_Out_A_Subversion_Repository_Tree
    this is what I tried to do with QT but I don't have any library for connection to the server.


  • Lifetime Qt Champion

    One thing: there's no C++ Qt version. Qt is a C++ toolkit, not a variant of the language.

    Subversion already provides an API for you to use: http://subversion.apache.org/docs/api/latest/index.html.

    By the way, Qt Creator has a SVN client somewhere since it's listed as a supported VCS systems. You might want to take a look at it.



  • I downloaded subversion however I couldn't integrate with my code. Should I add all the header files to my project? I am very new to C ++ programming sorry and thanks for help .


Log in to reply