~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/resolved_tests.py

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
#
3
 
#  resolved_tests.py:  testing "resolved" cases.
4
 
#
5
 
#  Subversion is a tool for revision control.
6
 
#  See http://subversion.apache.org for more information.
7
 
#
8
 
# ====================================================================
9
 
#    Licensed to the Apache Software Foundation (ASF) under one
10
 
#    or more contributor license agreements.  See the NOTICE file
11
 
#    distributed with this work for additional information
12
 
#    regarding copyright ownership.  The ASF licenses this file
13
 
#    to you under the Apache License, Version 2.0 (the
14
 
#    "License"); you may not use this file except in compliance
15
 
#    with the License.  You may obtain a copy of the License at
16
 
#
17
 
#      http://www.apache.org/licenses/LICENSE-2.0
18
 
#
19
 
#    Unless required by applicable law or agreed to in writing,
20
 
#    software distributed under the License is distributed on an
21
 
#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
 
#    KIND, either express or implied.  See the License for the
23
 
#    specific language governing permissions and limitations
24
 
#    under the License.
25
 
######################################################################
26
 
 
27
 
# General modules
28
 
import sys, re, os
29
 
 
30
 
# Our testing module
31
 
import svntest
32
 
from svntest import wc
33
 
 
34
 
# (abbreviation)
35
 
Skip = svntest.testcase.Skip_deco
36
 
SkipUnless = svntest.testcase.SkipUnless_deco
37
 
XFail = svntest.testcase.XFail_deco
38
 
Issues = svntest.testcase.Issues_deco
39
 
Issue = svntest.testcase.Issue_deco
40
 
Wimp = svntest.testcase.Wimp_deco
41
 
Item = svntest.wc.StateItem
42
 
 
43
 
from svntest.main import SVN_PROP_MERGEINFO, server_has_mergeinfo
44
 
 
45
 
######################################################################
46
 
# Tests
47
 
#
48
 
#   Each test must return on success or raise on failure.
49
 
 
50
 
 
51
 
#----------------------------------------------------------------------
52
 
 
53
 
def resolved_on_wc_root(sbox):
54
 
  "resolved on working copy root"
55
 
 
56
 
  sbox.build()
57
 
  wc = sbox.wc_dir
58
 
 
59
 
  i = os.path.join(wc, 'iota')
60
 
  B = os.path.join(wc, 'A', 'B')
61
 
  g = os.path.join(wc, 'A', 'D', 'gamma')
62
 
 
63
 
  # Create some conflicts...
64
 
  # Commit mods
65
 
  svntest.main.file_append(i, "changed iota.\n")
66
 
  svntest.main.file_append(g, "changed gamma.\n")
67
 
  svntest.actions.run_and_verify_svn(None, None, [],
68
 
                                     'propset', 'foo', 'foo-val', B)
69
 
 
70
 
  expected_output = svntest.wc.State(wc, {
71
 
      'iota'              : Item(verb='Sending'),
72
 
      'A/B'               : Item(verb='Sending'),
73
 
      'A/D/gamma'         : Item(verb='Sending'),
74
 
    })
75
 
 
76
 
  expected_status = svntest.actions.get_virginal_state(wc, 1)
77
 
  expected_status.tweak('iota', 'A/B', 'A/D/gamma', wc_rev = 2)
78
 
 
79
 
  svntest.actions.run_and_verify_commit(wc,
80
 
                                        expected_output,
81
 
                                        expected_status,
82
 
                                        None,
83
 
                                        wc)
84
 
 
85
 
  # Go back to rev 1
86
 
  expected_output = svntest.wc.State(wc, {
87
 
    'iota'              : Item(status='U '),
88
 
    'A/B'               : Item(status=' U'),
89
 
    'A/D/gamma'         : Item(status='U '),
90
 
  })
91
 
  expected_status = svntest.actions.get_virginal_state(wc, 1)
92
 
  expected_disk = svntest.main.greek_state.copy()
93
 
  svntest.actions.run_and_verify_update(wc,
94
 
                                        expected_output,
95
 
                                        expected_disk,
96
 
                                        expected_status,
97
 
                                        None, None, None, None, None, False,
98
 
                                        '-r1', wc)
99
 
 
100
 
  # Deletions so that the item becomes unversioned and
101
 
  # will have a tree-conflict upon update.
102
 
  svntest.actions.run_and_verify_svn(None, None, [],
103
 
                                     'rm', i, B, g)
104
 
 
105
 
  # Update so that conflicts appear
106
 
  expected_output = svntest.wc.State(wc, {
107
 
    'iota'              : Item(status='  ', treeconflict='C'),
108
 
    'A/B'               : Item(status='  ', treeconflict='C'),
109
 
    'A/D/gamma'         : Item(status='  ', treeconflict='C'),
110
 
  })
111
 
 
112
 
  expected_disk = svntest.main.greek_state.copy()
113
 
  expected_disk.remove('iota',
114
 
                       'A/B/lambda',
115
 
                       'A/B/E/alpha', 'A/B/E/beta',
116
 
                       'A/D/gamma')
117
 
  if svntest.main.wc_is_singledb(sbox.wc_dir):
118
 
    expected_disk.remove('A/B/E', 'A/B/F', 'A/B')
119
 
 
120
 
  expected_status = svntest.actions.get_virginal_state(wc, 2)
121
 
  expected_status.tweak('iota', 'A/B', 'A/D/gamma',
122
 
                        status='D ', treeconflict='C')
123
 
  expected_status.tweak('A/B/lambda', 'A/B/E', 'A/B/E/alpha', 'A/B/E/beta',
124
 
                        'A/B/F', status='D ')
125
 
  svntest.actions.run_and_verify_update(wc,
126
 
                                        expected_output,
127
 
                                        expected_disk,
128
 
                                        None,
129
 
                                        None, None, None, None, None, False,
130
 
                                        wc)
131
 
  svntest.actions.run_and_verify_unquiet_status(wc, expected_status)
132
 
 
133
 
  # Resolve recursively
134
 
  svntest.actions.run_and_verify_resolved([i, B, g], '--depth=infinity', wc)
135
 
 
136
 
  expected_status.tweak('iota', 'A/B', 'A/D/gamma', treeconflict=None)
137
 
  svntest.actions.run_and_verify_unquiet_status(wc, expected_status)
138
 
 
139
 
 
140
 
 
141
 
 
142
 
 
143
 
def resolved_on_deleted_item(sbox):
144
 
  "resolved on deleted item"
145
 
 
146
 
  sbox.build()
147
 
  wc = sbox.wc_dir
148
 
 
149
 
  A = os.path.join(wc, 'A',)
150
 
  B = os.path.join(wc, 'A', 'B')
151
 
  g = os.path.join(wc, 'A', 'D', 'gamma')
152
 
  A2 = os.path.join(wc, 'A2')
153
 
  B2 = os.path.join(A2, 'B')
154
 
  g2 = os.path.join(A2, 'D', 'gamma')
155
 
 
156
 
  A_url = sbox.repo_url + '/A'
157
 
  A2_url = sbox.repo_url + '/A2'
158
 
 
159
 
  # make a copy of A
160
 
  svntest.actions.run_and_verify_svn(None, None, [],
161
 
                                     'cp', A_url, A2_url, '-m', 'm')
162
 
 
163
 
  expected_output = svntest.wc.State(wc, {
164
 
    'A2'                : Item(status='A '),
165
 
    'A2/B'              : Item(status='A '),
166
 
    'A2/B/lambda'       : Item(status='A '),
167
 
    'A2/B/E'            : Item(status='A '),
168
 
    'A2/B/E/alpha'      : Item(status='A '),
169
 
    'A2/B/E/beta'       : Item(status='A '),
170
 
    'A2/B/F'            : Item(status='A '),
171
 
    'A2/mu'             : Item(status='A '),
172
 
    'A2/C'              : Item(status='A '),
173
 
    'A2/D'              : Item(status='A '),
174
 
    'A2/D/gamma'        : Item(status='A '),
175
 
    'A2/D/G'            : Item(status='A '),
176
 
    'A2/D/G/pi'         : Item(status='A '),
177
 
    'A2/D/G/rho'        : Item(status='A '),
178
 
    'A2/D/G/tau'        : Item(status='A '),
179
 
    'A2/D/H'            : Item(status='A '),
180
 
    'A2/D/H/chi'        : Item(status='A '),
181
 
    'A2/D/H/omega'      : Item(status='A '),
182
 
    'A2/D/H/psi'        : Item(status='A '),
183
 
  })
184
 
 
185
 
 
186
 
  expected_disk = svntest.main.greek_state.copy()
187
 
  expected_disk.add({
188
 
    'A2/mu'             : Item(contents="This is the file 'mu'.\n"),
189
 
    'A2/D/gamma'        : Item(contents="This is the file 'gamma'.\n"),
190
 
    'A2/D/H/psi'        : Item(contents="This is the file 'psi'.\n"),
191
 
    'A2/D/H/omega'      : Item(contents="This is the file 'omega'.\n"),
192
 
    'A2/D/H/chi'        : Item(contents="This is the file 'chi'.\n"),
193
 
    'A2/D/G/rho'        : Item(contents="This is the file 'rho'.\n"),
194
 
    'A2/D/G/pi'         : Item(contents="This is the file 'pi'.\n"),
195
 
    'A2/D/G/tau'        : Item(contents="This is the file 'tau'.\n"),
196
 
    'A2/B/lambda'       : Item(contents="This is the file 'lambda'.\n"),
197
 
    'A2/B/F'            : Item(),
198
 
    'A2/B/E/beta'       : Item(contents="This is the file 'beta'.\n"),
199
 
    'A2/B/E/alpha'      : Item(contents="This is the file 'alpha'.\n"),
200
 
    'A2/C'              : Item(),
201
 
  })
202
 
 
203
 
 
204
 
  expected_status = svntest.actions.get_virginal_state(wc, 2)
205
 
  expected_status.add({
206
 
    'A2'                : Item(),
207
 
    'A2/B'              : Item(),
208
 
    'A2/B/lambda'       : Item(),
209
 
    'A2/B/E'            : Item(),
210
 
    'A2/B/E/alpha'      : Item(),
211
 
    'A2/B/E/beta'       : Item(),
212
 
    'A2/B/F'            : Item(),
213
 
    'A2/mu'             : Item(),
214
 
    'A2/C'              : Item(),
215
 
    'A2/D'              : Item(),
216
 
    'A2/D/gamma'        : Item(),
217
 
    'A2/D/G'            : Item(),
218
 
    'A2/D/G/pi'         : Item(),
219
 
    'A2/D/G/rho'        : Item(),
220
 
    'A2/D/G/tau'        : Item(),
221
 
    'A2/D/H'            : Item(),
222
 
    'A2/D/H/chi'        : Item(),
223
 
    'A2/D/H/omega'      : Item(),
224
 
    'A2/D/H/psi'        : Item(),
225
 
  })
226
 
  expected_status.tweak(status='  ', wc_rev='2')
227
 
 
228
 
  svntest.actions.run_and_verify_update(wc,
229
 
                                        expected_output,
230
 
                                        expected_disk,
231
 
                                        expected_status,
232
 
                                        None, None, None, None, None, False,
233
 
                                        wc)
234
 
 
235
 
  # Create some conflicts...
236
 
 
237
 
  # Modify the paths in the one directory.
238
 
  svntest.actions.run_and_verify_svn(None, None, [],
239
 
                                     'propset', 'foo', 'foo-val', B)
240
 
  svntest.main.file_append(g, "Modified gamma.\n")
241
 
 
242
 
  expected_output = svntest.wc.State(wc, {
243
 
      'A/B'               : Item(verb='Sending'),
244
 
      'A/D/gamma'         : Item(verb='Sending'),
245
 
    })
246
 
 
247
 
  expected_status.tweak('A/B', 'A/D/gamma', wc_rev='3')
248
 
 
249
 
  svntest.actions.run_and_verify_commit(wc,
250
 
                                        expected_output,
251
 
                                        expected_status,
252
 
                                        None,
253
 
                                        wc)
254
 
 
255
 
  # Delete the paths in the second directory.
256
 
  svntest.actions.run_and_verify_svn(None, None, [],
257
 
                                     'rm', B2, g2)
258
 
 
259
 
  expected_output = svntest.wc.State(wc, {
260
 
      'A2/B'              : Item(verb='Deleting'),
261
 
      'A2/D/gamma'        : Item(verb='Deleting'),
262
 
    })
263
 
 
264
 
  expected_status.remove('A2/B', 'A2/B/lambda',
265
 
                         'A2/B/E', 'A2/B/E/alpha', 'A2/B/E/beta',
266
 
                         'A2/B/F',
267
 
                         'A2/D/gamma')
268
 
 
269
 
  svntest.actions.run_and_verify_commit(wc,
270
 
                                        expected_output,
271
 
                                        expected_status,
272
 
                                        None,
273
 
                                        A2)
274
 
 
275
 
  # Now merge A to A2, creating conflicts...
276
 
 
277
 
  expected_output = svntest.wc.State(A2, {
278
 
      'B'                 : Item(status='  ', treeconflict='C'),
279
 
      'D/gamma'           : Item(status='  ', treeconflict='C'),
280
 
    })
281
 
  expected_mergeinfo_output = svntest.wc.State(A2, {
282
 
      '' : Item(status=' U')
283
 
    })
284
 
  expected_elision_output = svntest.wc.State(A2, {
285
 
    })
286
 
  expected_disk = svntest.wc.State('', {
287
 
      'mu'                : Item(contents="This is the file 'mu'.\n"),
288
 
      'D'                 : Item(),
289
 
      'D/H'               : Item(),
290
 
      'D/H/psi'           : Item(contents="This is the file 'psi'.\n"),
291
 
      'D/H/omega'         : Item(contents="This is the file 'omega'.\n"),
292
 
      'D/H/chi'           : Item(contents="This is the file 'chi'.\n"),
293
 
      'D/G'               : Item(),
294
 
      'D/G/rho'           : Item(contents="This is the file 'rho'.\n"),
295
 
      'D/G/pi'            : Item(contents="This is the file 'pi'.\n"),
296
 
      'D/G/tau'           : Item(contents="This is the file 'tau'.\n"),
297
 
      'C'                 : Item(),
298
 
    })
299
 
 
300
 
 
301
 
  expected_skip = svntest.wc.State(wc, {
302
 
    })
303
 
 
304
 
  expected_status = svntest.wc.State(A2, {
305
 
    ''                  : Item(status=' M', wc_rev='2'),
306
 
    'D'                 : Item(status='  ', wc_rev='2'),
307
 
    'D/gamma'           : Item(status='! ', treeconflict='C'),
308
 
    'D/G'               : Item(status='  ', wc_rev='2'),
309
 
    'D/G/pi'            : Item(status='  ', wc_rev='2'),
310
 
    'D/G/rho'           : Item(status='  ', wc_rev='2'),
311
 
    'D/G/tau'           : Item(status='  ', wc_rev='2'),
312
 
    'D/H'               : Item(status='  ', wc_rev='2'),
313
 
    'D/H/chi'           : Item(status='  ', wc_rev='2'),
314
 
    'D/H/omega'         : Item(status='  ', wc_rev='2'),
315
 
    'D/H/psi'           : Item(status='  ', wc_rev='2'),
316
 
    'B'                 : Item(status='! ', treeconflict='C'),
317
 
    'mu'                : Item(status='  ', wc_rev='2'),
318
 
    'C'                 : Item(status='  ', wc_rev='2'),
319
 
  })
320
 
 
321
 
  svntest.actions.run_and_verify_merge(A2, None, None, A_url, None,
322
 
                                       expected_output,
323
 
                                       expected_mergeinfo_output,
324
 
                                       expected_elision_output,
325
 
                                       expected_disk, None, expected_skip,
326
 
                                       None, dry_run = False)
327
 
  svntest.actions.run_and_verify_unquiet_status(A2, expected_status)
328
 
 
329
 
 
330
 
  # Now resolve by recursing on the working copy root.
331
 
  svntest.actions.run_and_verify_resolved([B2, g2], '--depth=infinity', wc)
332
 
 
333
 
  expected_status.remove('B', 'D/gamma')
334
 
  svntest.actions.run_and_verify_unquiet_status(A2, expected_status)
335
 
 
336
 
 
337
 
 
338
 
def theirs_conflict_in_subdir(sbox):
339
 
  "resolve to 'theirs-conflict' in sub-directory"
340
 
 
341
 
  sbox.build()
342
 
  wc = sbox.wc_dir
343
 
  wc2 = sbox.add_wc_path('wc2')
344
 
  svntest.actions.duplicate_dir(sbox.wc_dir, wc2)
345
 
 
346
 
  alpha_path = os.path.join(wc, 'A', 'B', 'E', 'alpha')
347
 
  alpha_path2 = os.path.join(wc2, 'A', 'B', 'E', 'alpha')
348
 
 
349
 
  svntest.main.file_append(alpha_path, "Modified alpha.\n")
350
 
  svntest.main.run_svn(None, 'ci', '-m', 'logmsg', wc)
351
 
 
352
 
  svntest.main.file_append(alpha_path2, "Modified alpha, too.\n")
353
 
  svntest.main.run_svn(None, 'up', wc2)
354
 
 
355
 
  svntest.actions.run_and_verify_resolve([alpha_path2],
356
 
                                         '--accept=theirs-conflict',
357
 
                                         alpha_path2)
358
 
 
359
 
#######################################################################
360
 
# Run the tests
361
 
 
362
 
 
363
 
# list all tests here, starting with None:
364
 
test_list = [ None,
365
 
              resolved_on_wc_root,
366
 
              resolved_on_deleted_item,
367
 
              theirs_conflict_in_subdir,
368
 
             ]
369
 
 
370
 
if __name__ == '__main__':
371
 
  svntest.main.run_tests(test_list)
372
 
  # NOTREACHED
373
 
 
374
 
 
375
 
### End of file.