diff test/test_subversion.py @ 282:f58f9adb7dc3

Add functions to get SVN logs and extract tag revisions from it. Add some tests for the log parsing.
author Bernhard Herzog <bh@intevation.de>
date Tue, 04 Aug 2009 10:09:12 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/test_subversion.py	Tue Aug 04 10:09:12 2009 +0000
@@ -0,0 +1,199 @@
+# Copyright (C) 2008, 2009 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh@intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+"""Tests for the treepkg.subversion module"""
+
+
+import unittest
+
+from treepkg.subversion import extract_tag_revisions
+
+
+class TestTagDetector(unittest.TestCase):
+
+    def test_tag_changes_count_one_copy_command(self):
+        xml = """\
+<?xml version="1.0"?>
+<log>
+<logentry
+   revision="1001832">
+<author>tmcguire</author>
+<date>2009-07-24T11:01:19.722901Z</date>
+<paths>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/kontact/src/main.cpp</path>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/kmail/kmversion.h</path>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/korganizer/version.h</path>
+</paths>
+<msg>SVN_SILENT Update version numbers for today's release.</msg>
+</logentry>
+<logentry
+   revision="1001837">
+<author>tmcguire</author>
+<date>2009-07-24T11:02:47.403605Z</date>
+<paths>
+<path
+   copyfrom-path="/branches/kdepim/enterprise/kdepim"
+   copyfrom-rev="1001836"
+   action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
+</paths>
+<msg>SVN_SILENT Tag kdepim.</msg>
+</logentry>
+<logentry
+   revision="1004164">
+<author>winterz</author>
+<date>2009-07-29T13:23:42.262028Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/scheduler.cpp</path>
+</paths>
+<msg>merge SVN commit 1004159 by winterz:
+
+Allow an attendee to decline an new invitation without getting the error
+message that the event couldn't be found in their calendar.
+kolab/issue3780
+
+</msg>
+</logentry>
+<logentry
+   revision="1004558">
+<author>winterz</author>
+<date>2009-07-30T13:34:18.385413Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/kmail/newfolderdialog.cpp</path>
+</paths>
+<msg>merge SVN commit 1004535 by tmcguire:
+
+Fix silly crash when creating a folder.
+
+kolab/issue3777
+</msg>
+</logentry>
+<logentry
+   revision="1004604">
+<author>winterz</author>
+<date>2009-07-30T15:25:19.331744Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/incidenceformatter.cpp</path>
+</paths>
+<msg>merge SVN commit 1004601 by winterz:
+
+possible fix for kolab/issue3724 and kolab/issue3780, whereby multiple
+persons having write access to a folder can confuse things for other
+users accessing that folder.
+
+</msg>
+</logentry>
+</log>
+"""
+        #
+
+        self.assertEquals(extract_tag_revisions(xml),
+                          ["1001837", "1004164", "1004558", "1004604"])
+
+
+    def test_tag_changes_count_two_copy_commands(self):
+        xml = """\
+<?xml version="1.0"?>
+<log>
+<logentry
+   revision="901832">
+<author>tmcguire</author>
+<date>2009-07-24T11:01:19.722901Z</date>
+<paths>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/kontact/src/main.cpp</path>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/kmail/kmversion.h</path>
+<path
+   action="M">/branches/kdepim/enterprise/kdepim/korganizer/version.h</path>
+</paths>
+<msg>SVN_SILENT Update version numbers for today's release.</msg>
+</logentry>
+<logentry
+   revision="901837">
+<author>tmcguire</author>
+<date>2009-07-24T11:02:47.403605Z</date>
+<paths>
+<path
+   copyfrom-path="/branches/kdepim/enterprise/kdepim"
+   copyfrom-rev="1001836"
+   action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
+</paths>
+<msg>SVN_SILENT Tag kdepim.</msg>
+</logentry>
+<logentry
+   revision="1004164">
+<author>winterz</author>
+<date>2009-07-29T13:23:42.262028Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/scheduler.cpp</path>
+</paths>
+<msg>merge SVN commit 1004159 by winterz:
+
+Allow an attendee to decline an new invitation without getting the error
+message that the event couldn't be found in their calendar.
+kolab/issue3780
+
+</msg>
+</logentry>
+<logentry
+   revision="1004558">
+<author>winterz</author>
+<date>2009-07-30T13:34:18.385413Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/kmail/newfolderdialog.cpp</path>
+</paths>
+<msg>merge SVN commit 1004535 by tmcguire:
+
+Fix silly crash when creating a folder.
+
+kolab/issue3777
+</msg>
+</logentry>
+<logentry
+   revision="1004604">
+<author>winterz</author>
+<date>2009-07-30T15:25:19.331744Z</date>
+<paths>
+<path
+   action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/incidenceformatter.cpp</path>
+</paths>
+<msg>merge SVN commit 1004601 by winterz:
+
+possible fix for kolab/issue3724 and kolab/issue3780, whereby multiple
+persons having write access to a folder can confuse things for other
+users accessing that folder.
+
+</msg>
+</logentry>
+<logentry
+   revision="1005000">
+<author>somebody</author>
+<date>2009-07-24T12:02:47.403605Z</date>
+<paths>
+<path
+   copyfrom-path="/branches/kdepim/enterprise/kdepim"
+   copyfrom-rev="1001836"
+   action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
+</paths>
+<msg>ficticious commit that looks like the earlier copy that created the tag.
+</msg>
+</logentry>
+</log>
+"""
+        #
+
+        self.assertEquals(extract_tag_revisions(xml),
+                          ["901837", "1004164", "1004558", "1004604",
+                           "1005000"])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)