Geeks With Blogs
Saif Khan { I am Saif } "Knowledge is power, information is free, share it!"
I deploy apps via ClickOnce. After each deployment we have to review the changes made and send out an email to the users with the changes. What I decided now to do is to use CodebaseHQ’s API to access a project’s SVN repository and display the commit notes so some users who download new updates can check what was changed or updated in an app. This saves a heck of a lot of time, especially when your apps are in beta and you are making several changes daily based on feedback.
You can read up on their API here
Here is a sample on how to access the Repositories API from a windows app
Public Sub GetLog()
        If String.IsNullOrEmpty(_url) Then Exit Sub
        Dim answer As String = String.Empty
        Dim myReq As HttpWebRequest = WebRequest.Create(_url)
        With myReq

            .Headers.Add("Authorization", String.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes("username:password"))))
            .ContentType = "application/xml"
            .Accept = "application/xml"
            .Method = "POST"
        End With

        Try

            Using response As HttpWebResponse = myReq.GetResponse()

                Using sr As New System.IO.StreamReader(response.GetResponseStream())
                    answer = sr.ReadToEnd()
                    Dim doc As XDocument = XDocument.Parse(answer)
                    Dim commits = From commit In doc.Descendants("commit") _
                                  Select Message = commit.Element("message").Value, _
                                                AuthorName = commit.Element("author-name").Value, _
                                                AuthoredDate = DateTime.Parse(commit.Element("authored-at").Value).Date
                    grdLogData.BeginUpdate()
                    grdLogData.DataSource = commits.ToList()
                    grdLogData.EndUpdate()

                End Using
            End Using

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

 

Originally I was using myReq.Credentials = New NetworkCredential("username", "password") and then it stopped working after a few weeks. It looks like CodebaseHQ change their API access to Basic authorization.

The _url variable is basically the path to your repository e.g. https://mycompany.codebasehq.com/projectname/repositoryname/commits/head. You can find more information on the API here

Here is a list of available properties from the commits

<commit>
     <ref>40320d0d4f85fa7294a71e2d5291b8660f60c01f</ref>
     <message>add dev &amp; staging to reserved domains</message>
     <author-name>Adam Cooke</author-name>
     <author-email>adam@atechmedia.com</author-email>
     <authored-at type="datetime">2009-10-12T17:49:25+01:00</authored-at>
     <committer-name>Adam Cooke</committer-name>
     <committer-email>adam@atechmedia.com</committer-email>
     <committed-at type="datetime">2009-10-12T17:49:46+01:00</committed-at>
     <parent-refs>48fe6489f9b68777aa36f1a6009b3039d4a7c234</parent-refs>
     <tree-ref>78ce1e531939b1c4e10820f8e1c293339208d3ee</tree-ref>
     <author-user>adam</author-user>
     <committer-user>adam</committer-user>
 </commit>
 

 EDIT:

Here is what my change-log screen lools like in my app

4-3-2011 1-34-03 AM

Posted on Sunday, May 2, 2010 5:48 PM | Back to top


Comments on this post: Getting codebaseHQ SVN ChangeLog data in your application

# re: Getting codebaseHQ SVN ChangeLog data in your application
Requesting Gravatar...
Thanks for sharing:) I will come back here!
Left by pasmanteria on Oct 14, 2010 10:00 PM

# re: Getting codebaseHQ SVN ChangeLog data in your application
Requesting Gravatar...
This is the kind of info I am looking for sir. I have been stomped trying to figure out a way to get this codes and you just gave me an idea. many thanks.
Left by sunday press on Feb 10, 2011 8:41 AM

Your comment:
 (will show your gravatar)


Copyright © saifkhan | Powered by: GeeksWithBlogs.net