Getting codebaseHQ SVN ChangeLog data in your application

Posted by saifkhan on Geeks with Blogs See other posts from Geeks with Blogs or by saifkhan
Published on Mon, 03 May 2010 04:48:25 GMT Indexed on 2010/05/03 5:59 UTC
Read the original article Hit count: 349

Filed under:
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

© Geeks with Blogs or respective owner