comparison 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
comparison
equal deleted inserted replaced
281:2b9d94f0ccad 282:f58f9adb7dc3
1 # Copyright (C) 2008, 2009 by Intevation GmbH
2 # Authors:
3 # Bernhard Herzog <bh@intevation.de>
4 #
5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with the software for details.
7
8 """Tests for the treepkg.subversion module"""
9
10
11 import unittest
12
13 from treepkg.subversion import extract_tag_revisions
14
15
16 class TestTagDetector(unittest.TestCase):
17
18 def test_tag_changes_count_one_copy_command(self):
19 xml = """\
20 <?xml version="1.0"?>
21 <log>
22 <logentry
23 revision="1001832">
24 <author>tmcguire</author>
25 <date>2009-07-24T11:01:19.722901Z</date>
26 <paths>
27 <path
28 action="M">/branches/kdepim/enterprise/kdepim/kontact/src/main.cpp</path>
29 <path
30 action="M">/branches/kdepim/enterprise/kdepim/kmail/kmversion.h</path>
31 <path
32 action="M">/branches/kdepim/enterprise/kdepim/korganizer/version.h</path>
33 </paths>
34 <msg>SVN_SILENT Update version numbers for today's release.</msg>
35 </logentry>
36 <logentry
37 revision="1001837">
38 <author>tmcguire</author>
39 <date>2009-07-24T11:02:47.403605Z</date>
40 <paths>
41 <path
42 copyfrom-path="/branches/kdepim/enterprise/kdepim"
43 copyfrom-rev="1001836"
44 action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
45 </paths>
46 <msg>SVN_SILENT Tag kdepim.</msg>
47 </logentry>
48 <logentry
49 revision="1004164">
50 <author>winterz</author>
51 <date>2009-07-29T13:23:42.262028Z</date>
52 <paths>
53 <path
54 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/scheduler.cpp</path>
55 </paths>
56 <msg>merge SVN commit 1004159 by winterz:
57
58 Allow an attendee to decline an new invitation without getting the error
59 message that the event couldn't be found in their calendar.
60 kolab/issue3780
61
62 </msg>
63 </logentry>
64 <logentry
65 revision="1004558">
66 <author>winterz</author>
67 <date>2009-07-30T13:34:18.385413Z</date>
68 <paths>
69 <path
70 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/kmail/newfolderdialog.cpp</path>
71 </paths>
72 <msg>merge SVN commit 1004535 by tmcguire:
73
74 Fix silly crash when creating a folder.
75
76 kolab/issue3777
77 </msg>
78 </logentry>
79 <logentry
80 revision="1004604">
81 <author>winterz</author>
82 <date>2009-07-30T15:25:19.331744Z</date>
83 <paths>
84 <path
85 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/incidenceformatter.cpp</path>
86 </paths>
87 <msg>merge SVN commit 1004601 by winterz:
88
89 possible fix for kolab/issue3724 and kolab/issue3780, whereby multiple
90 persons having write access to a folder can confuse things for other
91 users accessing that folder.
92
93 </msg>
94 </logentry>
95 </log>
96 """
97 #
98
99 self.assertEquals(extract_tag_revisions(xml),
100 ["1001837", "1004164", "1004558", "1004604"])
101
102
103 def test_tag_changes_count_two_copy_commands(self):
104 xml = """\
105 <?xml version="1.0"?>
106 <log>
107 <logentry
108 revision="901832">
109 <author>tmcguire</author>
110 <date>2009-07-24T11:01:19.722901Z</date>
111 <paths>
112 <path
113 action="M">/branches/kdepim/enterprise/kdepim/kontact/src/main.cpp</path>
114 <path
115 action="M">/branches/kdepim/enterprise/kdepim/kmail/kmversion.h</path>
116 <path
117 action="M">/branches/kdepim/enterprise/kdepim/korganizer/version.h</path>
118 </paths>
119 <msg>SVN_SILENT Update version numbers for today's release.</msg>
120 </logentry>
121 <logentry
122 revision="901837">
123 <author>tmcguire</author>
124 <date>2009-07-24T11:02:47.403605Z</date>
125 <paths>
126 <path
127 copyfrom-path="/branches/kdepim/enterprise/kdepim"
128 copyfrom-rev="1001836"
129 action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
130 </paths>
131 <msg>SVN_SILENT Tag kdepim.</msg>
132 </logentry>
133 <logentry
134 revision="1004164">
135 <author>winterz</author>
136 <date>2009-07-29T13:23:42.262028Z</date>
137 <paths>
138 <path
139 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/scheduler.cpp</path>
140 </paths>
141 <msg>merge SVN commit 1004159 by winterz:
142
143 Allow an attendee to decline an new invitation without getting the error
144 message that the event couldn't be found in their calendar.
145 kolab/issue3780
146
147 </msg>
148 </logentry>
149 <logentry
150 revision="1004558">
151 <author>winterz</author>
152 <date>2009-07-30T13:34:18.385413Z</date>
153 <paths>
154 <path
155 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/kmail/newfolderdialog.cpp</path>
156 </paths>
157 <msg>merge SVN commit 1004535 by tmcguire:
158
159 Fix silly crash when creating a folder.
160
161 kolab/issue3777
162 </msg>
163 </logentry>
164 <logentry
165 revision="1004604">
166 <author>winterz</author>
167 <date>2009-07-30T15:25:19.331744Z</date>
168 <paths>
169 <path
170 action="M">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim/libkcal/incidenceformatter.cpp</path>
171 </paths>
172 <msg>merge SVN commit 1004601 by winterz:
173
174 possible fix for kolab/issue3724 and kolab/issue3780, whereby multiple
175 persons having write access to a folder can confuse things for other
176 users accessing that folder.
177
178 </msg>
179 </logentry>
180 <logentry
181 revision="1005000">
182 <author>somebody</author>
183 <date>2009-07-24T12:02:47.403605Z</date>
184 <paths>
185 <path
186 copyfrom-path="/branches/kdepim/enterprise/kdepim"
187 copyfrom-rev="1001836"
188 action="A">/tags/kdepim/enterprise35.0.20090724.1001831/kdepim</path>
189 </paths>
190 <msg>ficticious commit that looks like the earlier copy that created the tag.
191 </msg>
192 </logentry>
193 </log>
194 """
195 #
196
197 self.assertEquals(extract_tag_revisions(xml),
198 ["901837", "1004164", "1004558", "1004604",
199 "1005000"])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)