summaryrefslogtreecommitdiff
path: root/subversion/tests/cmdline/pegrev_parse_tests.py
blob: 91469db71fef99db18d9be5c7fb665380d0b1e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
#!/usr/bin/env python
#
#  basic_tests.py:  testing working-copy interactions with ra_local
#
#  Subversion is a tool for revision control.
#  See http://subversion.apache.org for more information.
#
# ====================================================================
#    Licensed to the Apache Software Foundation (ASF) under one
#    or more contributor license agreements.  See the NOTICE file
#    distributed with this work for additional information
#    regarding copyright ownership.  The ASF licenses this file
#    to you under the Apache License, Version 2.0 (the
#    "License"); you may not use this file except in compliance
#    with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing,
#    software distributed under the License is distributed on an
#    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#    KIND, either express or implied.  See the License for the
#    specific language governing permissions and limitations
#    under the License.
######################################################################

# General modules
import shutil, stat, re, os, logging

logger = logging.getLogger()

# Our testing module
import svntest
from svntest import wc
from svntest import main
from svntest import actions

# (abbreviation)
Skip = svntest.testcase.Skip_deco
SkipUnless = svntest.testcase.SkipUnless_deco
XFail = svntest.testcase.XFail_deco
Issues = svntest.testcase.Issues_deco
Issue = svntest.testcase.Issue_deco
Wimp = svntest.testcase.Wimp_deco
Item = wc.StateItem

######################################################################
# Helper functions

# Most of our tests use absolute paths as parameters on the command line. But
# for these tests, it's important that we can use bare file names in the
# commands, because the parser may have (and as of this writing does have)
# edge-case bugs that we can only expose in this way. Therefore, these helpers
# ensure that we run 'svn' with the CWD at the root of the working copy.
def run_svn(sbox, expected_status, expected_stderr, *varargs):
  if expected_stderr is None:
    expected_stderr = []

  cwd = os.getcwd()
  try:
    os.chdir(sbox.wc_dir)
    actions.run_and_verify_svn(None, expected_stderr, *varargs)
  finally:
    os.chdir(cwd)

  if expected_status is not None:
    actions.run_and_verify_status(sbox.wc_dir, expected_status)

def get_trojan_virginal_state(sbox):
  return actions.get_virginal_state(sbox.wc_dir, '1', tree='trojan')

def build_trojan_sandbox(sbox, expected_stderr):
  sbox.build(tree='trojan')
  if expected_stderr is None:
    return get_trojan_virginal_state(sbox)
  return None

def build_empty_sandbox(sbox, expected_stderr):
  sbox.build(empty=True)
  if expected_stderr is None:
    return svntest.wc.State(sbox.wc_dir, {
      '': svntest.wc.StateItem(status='  ', wc_rev='0')
    })
  return None

def build_sandbox(sbox, empty_sandbox, expected_stderr):
  if not empty_sandbox:
    return build_trojan_sandbox(sbox, expected_stderr)
  else:
    return build_empty_sandbox(sbox, expected_stderr)

def do_add_file(sbox, dst, dst_cmdline,
                expected_stderr=None, empty_sandbox=False):
  expected_status = build_sandbox(sbox, empty_sandbox, expected_stderr)
  if expected_status is not None:
    expected_status.add({dst: Item(status='A ', wc_rev='-')})

  main.file_write(sbox.ospath(dst), "This is file '"  + dst + "'.")
  run_svn(sbox, expected_status, expected_stderr,
          'add', dst_cmdline)

def do_add_file_e(sbox, dst, dst_cmdline, expected_stderr=None):
  "like do_add_file() but with an empty sandbox"
  return do_add_file(sbox, dst, dst_cmdline, expected_stderr, True)

def do_make_dir(sbox, dst, dst_cmdline,
                expected_stderr=None, empty_sandbox=False):
  expected_status = build_sandbox(sbox, empty_sandbox, expected_stderr)
  if expected_status is not None:
    expected_status.add({dst: Item(status='A ', wc_rev='-')})

  run_svn(sbox, expected_status, expected_stderr,
          'mkdir', dst_cmdline)

def do_make_dir_e(sbox, dst, dst_cmdline, expected_stderr=None):
  "like do_make_dir() but with an empty sandbox"
  return do_make_dir(sbox, dst, dst_cmdline, expected_stderr, True)

def do_remove(sbox, dst, dst_cmdline, expected_stderr=None):
  expected_status = build_trojan_sandbox(sbox, expected_stderr)
  if expected_status is not None and dst in expected_status.desc:
    expected_status.tweak(dst, status='D ')

  run_svn(sbox, expected_status, expected_stderr,
          'remove', dst_cmdline)

def do_rename(sbox, src, src_cmdline, dst, dst_cmdline,
              expected_stderr=None):
  expected_status = build_trojan_sandbox(sbox, expected_stderr)
  if expected_status is not None:
    expected_status.tweak(src, status='D ', moved_to=dst)
    expected_status.add({dst: Item(status='A ', copied='+',
                                   moved_from=src, wc_rev='-')})

  run_svn(sbox, expected_status, expected_stderr,
          'rename', src_cmdline, dst_cmdline)


######################################################################
# Tests
#
#   Each test must return on success or raise on failure.

#=====================================================================
# Tests for 'svn add' in the current directory

def add_file_here_1_escape_peg(sbox):
  "add file 'tau' with pegrev escape"
  do_add_file_e(sbox, 'tau', 'tau@')

def add_file_here_2_escape_peg(sbox):
  "add file '@tau' with pegrev escape"
  do_add_file_e(sbox, '@tau', '@tau@')

def add_file_here_3_escape_peg(sbox):
  "add file '_@tau' with pegrev escape"
  do_add_file_e(sbox, '_@tau', '_@tau@')

def add_file_here_4_escape_peg(sbox):
  "add file '.@tau' with pegrev escape"
  do_add_file_e(sbox, '.@tau', '.@tau@')

def add_file_here_5_escape_peg(sbox):
  "add file 'tau@' with pegrev escape"
  do_add_file_e(sbox, 'tau@', 'tau@@')

def add_file_here_6_escape_peg(sbox):
  "add file '@tau@' with pegrev escape"
  do_add_file_e(sbox, '@tau@', '@tau@@')

def add_file_here_7_escape_peg(sbox):
  "add file '@' with pegrev escape"
  do_add_file_e(sbox, '@', '@@')

#---------------------------------------------------------------------

def add_file_here_1_no_escape_peg(sbox):
  "add file 'tau' without pegrev escape"
  do_add_file_e(sbox, 'tau', 'tau')

def add_file_here_2_no_escape_peg(sbox):
  "add file '@tau' without pegrev escape"
  do_add_file_e(sbox, '@tau', '@tau', "svn: E125001: '@tau'")

def add_file_here_3_no_escape_peg(sbox):
  "add file '_@tau' without pegrev escape"
  do_add_file_e(sbox, '_@tau', '_@tau', "svn: E200009: '_@tau'")

@Wimp("The error message mentions '@tau' instead of '.@tau'")
def add_file_here_4_no_escape_peg(sbox):
  "add file '.@tau' without pegrev escape"
  do_add_file_e(sbox, '.@tau', '.@tau', "svn: E200009: '.@tau'")

def add_file_here_5_no_escape_peg(sbox):
  "add file 'tau@' without pegrev escape"
  do_add_file_e(sbox, 'tau@', 'tau@', 'svn: E200009: ')

def add_file_here_6_no_escape_peg(sbox):
  "add file '@tau@' without pegrev escape"
  do_add_file_e(sbox, '@tau@', '@tau@', 'svn: E200009: ')

def add_file_here_7_no_escape_peg(sbox):
  "add file '@' without pegrev escape"
  do_add_file_e(sbox, '@', '@', "svn: E125001: '@'")

#=====================================================================
# Tests for 'svn add' in a subdirectory

def add_file_subdir_1_escape_peg(sbox):
  "add file 'E/tau' with pegrev escape"
  do_add_file(sbox, 'E/tau', 'E/tau@')

def add_file_subdir_2_escape_peg(sbox):
  "add file 'E/@tau' with pegrev escape"
  do_add_file(sbox, 'E/@tau', 'E/@tau@')

def add_file_subdir_3_escape_peg(sbox):
  "add file 'E/_@tau' with pegrev escape"
  do_add_file(sbox, 'E/_@tau', 'E/_@tau@')

def add_file_subdir_4_escape_peg(sbox):
  "add file 'E/.@tau' with pegrev escape"
  do_add_file(sbox, 'E/.@tau', 'E/.@tau@')

def add_file_subdir_5_escape_peg(sbox):
  "add file 'E/tau@' with pegrev escape"
  do_add_file(sbox, 'E/tau@', 'E/tau@@')

def add_file_subdir_6_escape_peg(sbox):
  "add file 'E/@tau@' with pegrev escape"
  do_add_file(sbox, 'E/@tau@', 'E/@tau@@')

def add_file_subdir_7_escape_peg(sbox):
  "add file 'E/@' with pegrev escape"
  do_add_file(sbox, 'E/@', 'E/@@')

#---------------------------------------------------------------------

def add_file_subdir_1_no_escape_peg(sbox):
  "add file 'E/tau' without pegrev escape"
  do_add_file(sbox, 'E/tau', 'E/tau')

@Wimp("The error message mentions 'E@tau' instead of 'E/@tau'")
@Wimp("The error message should be E125001")
def add_file_subdir_2_no_escape_peg(sbox):
  "add file 'E/@tau' without pegrev escape"
  do_add_file(sbox, 'E/@tau', 'E/@tau', r"svn: E200009: 'E[\\/]@tau'")

def add_file_subdir_3_no_escape_peg(sbox):
  "add file 'E/_@tau' without pegrev escape"
  do_add_file(sbox, 'E/_@tau', 'E/_@tau', r"svn: E200009: 'E[\\/]_@tau'")

@Wimp("The error message mentions 'E@tau' instead of 'E/.@tau'")
def add_file_subdir_4_no_escape_peg(sbox):
  "add file 'E/.@tau' without pegrev escape"
  do_add_file(sbox, 'E/.@tau', 'E/.@tau', r"svn: E200009: 'E[\\/].@tau'")

def add_file_subdir_5_no_escape_peg(sbox):
  "add file 'E/tau@' without pegrev escape"
  do_add_file(sbox, 'E/tau@', 'E/tau@', 'svn: E200009: ')

def add_file_subdir_6_no_escape_peg(sbox):
  "add file 'E/@tau@' without pegrev escape"
  do_add_file(sbox, 'E/@tau@', 'E/@tau@', 'svn: E200009: ')

@Wimp("The error message is E200009 but should be E125001")
def add_file_subdir_7_no_escape_peg(sbox):
  "add file 'E/@' without pegrev escape"
  do_add_file(sbox, 'E/@', 'E/@', r"svn: E125001: 'E[\\/]@'")

#=====================================================================
# Tests for 'svn mkdir' in the current directory

def make_dir_here_1_escape_peg(sbox):
  "create directory 'T' with pegrev escape"
  do_make_dir_e(sbox, 'T', 'T@')

def make_dir_here_2_escape_peg(sbox):
  "create directory '@T' with pegrev escape"
  do_make_dir_e(sbox, '@T', '@T@')

def make_dir_here_3_escape_peg(sbox):
  "create directory '_@T' with pegrev escape"
  do_make_dir(sbox, '_@T', '_@T@')

def make_dir_here_4_escape_peg(sbox):
  "create directory '.@T' with pegrev escape"
  do_make_dir_e(sbox, '.@T', '.@T@')

def make_dir_here_5_escape_peg(sbox):
  "create directory 'T@' with pegrev escape"
  do_make_dir_e(sbox, 'T@', 'T@@')

def make_dir_here_6_escape_peg(sbox):
  "create directory '@T@' with pegrev escape"
  do_make_dir_e(sbox, '@T@', '@T@@')

def make_dir_here_7_escape_peg(sbox):
  "create directory '@' with pegrev escape"
  do_make_dir_e(sbox, '@', '@@')

#---------------------------------------------------------------------

def make_dir_here_1_no_escape_peg(sbox):
  "create directory 'T' without pegrev escape"
  do_make_dir_e(sbox, 'T', 'T')

def make_dir_here_2_no_escape_peg(sbox):
  "create directory '@T' without pegrev escape"
  do_make_dir_e(sbox, '@T', '@T', "svn: E125001: '@T'")

def make_dir_here_3_no_escape_peg(sbox):
  "create directory '_@T' without pegrev escape"
  do_make_dir_e(sbox, '_@T', '_@T', "svn: E200009: '_@T'")

@Wimp("The error message mentions '@T' instead of '.@T'")
def make_dir_here_4_no_escape_peg(sbox):
  "create directory '.@T' without pegrev escape"
  do_make_dir_e(sbox, '.@T', '.@T', "svn: E200009: '.@T'")

# Skip tests 5 and 6 that create a directory with a trailing @ in the name
# because is correctly interpreted as a peg revision escape. This is already
# tested by:
#   - make_dir_here_5_escape_peg
#   - make_dir_here_6_escape_peg

def make_dir_here_7_no_escape_peg(sbox):
  "create directory '@' without pegrev escape"
  do_make_dir_e(sbox, '@', '@', "svn: E125001: '@'")

#=====================================================================
# Tests for 'svn add' in a subdirectory

def make_dir_subdir_1_escape_peg(sbox):
  "create directory 'E/T' with pegrev escape"
  do_make_dir(sbox, 'E/T', 'E/T@')

def make_dir_subdir_2_escape_peg(sbox):
  "create directory 'E/@T' with pegrev escape"
  do_make_dir(sbox, 'E/@T', 'E/@T@')

def make_dir_subdir_3_escape_peg(sbox):
  "create directory 'E/_@T' with pegrev escape"
  do_make_dir(sbox, 'E/_@T', 'E/_@T@')

def make_dir_subdir_4_escape_peg(sbox):
  "create directory 'E/.@T' with pegrev escape"
  do_make_dir(sbox, 'E/.@T', 'E/.@T@')

def make_dir_subdir_5_escape_peg(sbox):
  "create directory 'E/T@' with pegrev escape"
  do_make_dir(sbox, 'E/T@', 'E/T@@')

def make_dir_subdir_6_escape_peg(sbox):
  "create directory 'E/@T@' with pegrev escape"
  do_make_dir(sbox, 'E/@T@', 'E/@T@@')

def make_dir_subdir_7_escape_peg(sbox):
  "create directory 'E/@' with pegrev escape"
  do_make_dir(sbox, 'E/@', 'E/@@')

#---------------------------------------------------------------------

def make_dir_subdir_1_no_escape_peg(sbox):
  "create directory 'E/T' without pegrev escape"
  do_make_dir(sbox, 'E/T', 'E/T')

@Wimp("The error message mentions 'E@T' instead of 'E/@T'")
@Wimp("The error message should be E125001")
def make_dir_subdir_2_no_escape_peg(sbox):
  "create directory 'E/@T' without pegrev escape"
  do_make_dir(sbox, 'E/@T', 'E/@T', r"svn: E200009: 'E[\\/]@T'")

def make_dir_subdir_3_no_escape_peg(sbox):
  "create directory 'E/_@T' without pegrev escape"
  do_make_dir(sbox, 'E/_@T', 'E/_@T', r"svn: E200009: 'E[\\/]_@T'")

@Wimp("The error message mentions 'E@T' instead of 'E/.@T'")
def make_dir_subdir_4_no_escape_peg(sbox):
  "create directory 'E/.@T' without pegrev escape"
  do_make_dir(sbox, 'E/.@T', 'E/.@T', r"svn: E200009: 'E[\\/].@T'")

# Skip tests 5 and 6 that create a directory with a trailing @ in the name
# because is correctly interpreted as a peg revision escape. This is already
# tested by:
#   - make_dir_subdir_5_escape_peg
#   - make_dir_subdir_6_escape_peg

@Wimp("Reports error that E exists but should be E125001 for E/@")
def make_dir_subdir_7_no_escape_peg(sbox):
  "create directory 'E/@' without pegrev escape"
  do_make_dir(sbox, 'E/@', 'E/@', r"svn: E125001: 'E[\\/]@'")

#=====================================================================
# Tests for 'svn remove' in the current directory

def remove_here_1_escape_peg(sbox):
  "remove 'iota' with pegrev escape"
  do_remove(sbox, 'iota', 'iota@')

def remove_here_2_escape_peg(sbox):
  "remove '@zeta' with pegrev escape"
  do_remove(sbox, '@zeta', '@zeta@')

def remove_here_3_escape_peg(sbox):
  "remove '_@theta' with pegrev escape"
  do_remove(sbox, '_@theta', '_@theta@')

def remove_here_4_escape_peg(sbox):
  "remove '.@kappa' with pegrev escape"
  do_remove(sbox, '.@kappa', '.@kappa@')

def remove_here_5_escape_peg(sbox):
  "remove 'lambda@' with pegrev escape"
  do_remove(sbox, 'lambda@', 'lambda@@')

def remove_here_6_escape_peg(sbox):
  "remove '@omicron@' with pegrev escape"
  do_remove(sbox, '@omicron@', '@omicron@@')

def remove_here_7_escape_peg(sbox):
  "remove '@' with pegrev escape"
  do_remove(sbox, '@', '@@')

#---------------------------------------------------------------------

def remove_here_1_no_escape_peg(sbox):
  "remove 'iota' without pegrev escape"
  do_remove(sbox, 'iota', 'iota')

def remove_here_2_no_escape_peg(sbox):
  "remove '@zeta' without pegrev escape"
  do_remove(sbox, '@zeta', '@zeta', "svn: E125001: '@zeta'")

def remove_here_3_no_escape_peg(sbox):
  "remove '_@theta' without pegrev escape"
  do_remove(sbox, '_@theta', '_@theta', "svn: E200009: '_@theta'")

@Wimp("The error message mentions '@kappa' instead of '.@kappa'")
def remove_here_4_no_escape_peg(sbox):
  "remove '.@kappa' without pegrev escape"
  do_remove(sbox, '.@kappa', '.@kappa', "svn: E200009: '.@kappa'")

def remove_here_5_no_escape_peg(sbox):
  "remove 'lambda@' without pegrev escape"
  do_remove(sbox, 'lambda@', 'lambda@', 'svn: E200005: ')

def remove_here_6_no_escape_peg(sbox):
  "remove '@omicron@' without pegrev escape"
  do_remove(sbox, '@omicron@', '@omicron@', 'svn: E200005: ')

def remove_here_7_no_escape_peg(sbox):
  "remove '@' without pegrev escape"
  do_remove(sbox, '@', '@', "svn: E125001: '@'")

#=====================================================================
# Tests for 'svn remove' in a subdirectory directory

def remove_subdir_1_escape_peg(sbox):
  "remove 'A/alpha' with pegrev escape"
  do_remove(sbox, 'A/alpha', 'A/alpha@')

def remove_subdir_2_escape_peg(sbox):
  "remove 'B/@beta' with pegrev escape"
  do_remove(sbox, 'B/@beta', 'B/@beta@')

def remove_subdir_3_escape_peg(sbox):
  "remove 'G/_@gamma' with pegrev escape"
  do_remove(sbox, 'G/_@gamma', 'G/_@gamma@')

def remove_subdir_4_escape_peg(sbox):
  "remove 'D/.@delta' with pegrev escape"
  do_remove(sbox, 'D/.@delta', 'D/.@delta@')

def remove_subdir_5_escape_peg(sbox):
  "remove 'B/pi@' with pegrev escape"
  do_remove(sbox, 'B/pi@', 'B/pi@@')

def remove_subdir_6_escape_peg(sbox):
  "remove 'A/@omega@' with pegrev escape"
  do_remove(sbox, 'A/@omega@', 'A/@omega@@')

def remove_subdir_7_escape_peg(sbox):
  "remove 'B/@' with pegrev escape"
  do_remove(sbox, 'B/@', 'B/@@')

def remove_subdir_7a_escape_peg(sbox):
  "remove missing 'E/@' with pegrev escape"
  do_remove(sbox, 'E/@', 'E/@@', r"svn: E200005: '.*[\\/]E[\\/]@'")

def remove_subdir_7b_escape_peg(sbox):
  "remove missing '@/@' with pegrev escape"
  do_remove(sbox, '@/@@', '@/@@', r"svn: E200005: '.*[\\/]@[\\/]@'")

#---------------------------------------------------------------------

def remove_subdir_1_no_escape_peg(sbox):
  "remove 'A/alpha' without pegrev escape"
  do_remove(sbox, 'A/alpha', 'A/alpha')

@Wimp("The error message mentions 'B@beta' instead of 'B/@beta'")
@Wimp("The error message should be E125001")
def remove_subdir_2_no_escape_peg(sbox):
  "remove 'B/@beta' without pegrev escape"
  do_remove(sbox, 'B/@beta', 'B/@beta', r"svn: E200009: 'B[\\/]@beta'")

def remove_subdir_3_no_escape_peg(sbox):
  "remove 'G/_@gamma' without pegrev escape"
  do_remove(sbox, 'G/_@gamma', 'G/_@gamma', r"svn: E200009: 'G[\\/]_@gamma'")

@Wimp("The error message mentions 'D@delta' instead of 'D/.@delta'")
def remove_subdir_4_no_escape_peg(sbox):
  "remove 'D/.@delta' without pegrev escape"
  do_remove(sbox, 'D/.@delta', 'D/.@delta', "svn: E200009: 'D/.@delta'")

# Skip tests 5 and 6 that remove a node with a trailing @ in the name
# because is correctly interpreted as a peg revision escape. This is already
# tested by:
#   - remove_subdir_5_escape_peg
#   - remove_subdir__escape_peg

@Wimp("Removes B instead of reporting E125001 for B/@")
def remove_subdir_7_no_escape_peg(sbox):
  "remove 'B/@' without pegrev escape"
  do_remove(sbox, 'B/@', 'B/@') #, r"svn: E125001: 'B[\\/]@'")

@Wimp("Removes E instead of reporting ENOENT or E125001 for E/@")
def remove_subdir_7a_no_escape_peg(sbox):
  "remove missing 'E/@' without pegrev escape"
  do_remove(sbox, 'E/@', 'E/@') #, r"svn: E125001: 'E[\\/]@'")

@Wimp("Removes @ instead of reporting ENOENT or E125001 for @/@")
def remove_subdir_7b_no_escape_peg(sbox):
  "remove missing '@/@' without pegrev escape"
  do_remove(sbox, '@/@', '@/@') #, r"svn: E125001: '@[\\/]@'")

#=====================================================================
# Test for 'svn move' to a subdirectory

@Wimp("Rename creates 'E/@tau@' instead of '@/@tau'")
@Issue(4530)
def rename_to_subdir_2_dst_escape_peg(sbox):
  "rename 'iota' to 'E/@tau with pegrev escape"
  # NOTE: This rename succeeds, but creates E/@tau@ instead of E/@tau, even
  #       though it should strip away the pegrev escape from the target.
  do_rename(sbox, 'iota', 'iota', 'E/@tau', 'E/@tau@')

#---------------------------------------------------------------------

@Wimp("Rename creates 'E@tau' instead of failing")
@Issue(4530)
def rename_to_subdir_2_no_dst_escape_peg(sbox):
  "rename 'iota' to 'E/@tau without pegrev escape"
  # NOTE: This rename succeeds, but creates E@tau in the current directory,
  #       when instead it should fail with 'svn: E125001: ...'.
  do_rename(sbox, 'iota', 'iota', 'E/@tau', 'E/@tau') ### 'svn: E200009: '


########################################################################
# Run the tests

# list all tests here, starting with None:
test_list = [ None,
              add_file_here_1_escape_peg,
              add_file_here_2_escape_peg,
              add_file_here_3_escape_peg,
              add_file_here_4_escape_peg,
              add_file_here_5_escape_peg,
              add_file_here_6_escape_peg,
              add_file_here_7_escape_peg,

              add_file_here_1_no_escape_peg,
              add_file_here_2_no_escape_peg,
              add_file_here_3_no_escape_peg,
              add_file_here_4_no_escape_peg,
              add_file_here_5_no_escape_peg,
              add_file_here_6_no_escape_peg,
              add_file_here_7_no_escape_peg,

              add_file_subdir_1_escape_peg,
              add_file_subdir_2_escape_peg,
              add_file_subdir_3_escape_peg,
              add_file_subdir_4_escape_peg,
              add_file_subdir_5_escape_peg,
              add_file_subdir_6_escape_peg,
              add_file_subdir_7_escape_peg,

              add_file_subdir_1_no_escape_peg,
              add_file_subdir_2_no_escape_peg,
              add_file_subdir_3_no_escape_peg,
              add_file_subdir_4_no_escape_peg,
              add_file_subdir_5_no_escape_peg,
              add_file_subdir_6_no_escape_peg,
              add_file_subdir_7_no_escape_peg,

              make_dir_here_1_escape_peg,
              make_dir_here_2_escape_peg,
              make_dir_here_3_escape_peg,
              make_dir_here_4_escape_peg,
              make_dir_here_5_escape_peg,
              make_dir_here_6_escape_peg,
              make_dir_here_7_escape_peg,

              make_dir_here_1_no_escape_peg,
              make_dir_here_2_no_escape_peg,
              make_dir_here_3_no_escape_peg,
              make_dir_here_4_no_escape_peg,
              # skipped: make_dir_here_5_no_escape_peg
              # skipped: make_dir_here_6_no_escape_peg
              make_dir_here_7_no_escape_peg,

              make_dir_subdir_1_escape_peg,
              make_dir_subdir_2_escape_peg,
              make_dir_subdir_3_escape_peg,
              make_dir_subdir_4_escape_peg,
              make_dir_subdir_5_escape_peg,
              make_dir_subdir_6_escape_peg,
              make_dir_subdir_7_escape_peg,

              make_dir_subdir_1_no_escape_peg,
              make_dir_subdir_2_no_escape_peg,
              make_dir_subdir_3_no_escape_peg,
              make_dir_subdir_4_no_escape_peg,
              # skipped: make_dir_subdir_5_no_escape_peg
              # skipped: make_dir_subdir_6_no_escape_peg
              make_dir_subdir_7_no_escape_peg,

              remove_here_1_escape_peg,
              remove_here_2_escape_peg,
              remove_here_3_escape_peg,
              remove_here_4_escape_peg,
              remove_here_5_escape_peg,
              remove_here_6_escape_peg,
              remove_here_7_escape_peg,

              remove_here_1_no_escape_peg,
              remove_here_2_no_escape_peg,
              remove_here_3_no_escape_peg,
              remove_here_4_no_escape_peg,
              remove_here_5_no_escape_peg,
              remove_here_6_no_escape_peg,
              remove_here_7_no_escape_peg,

              remove_subdir_1_escape_peg,
              remove_subdir_2_escape_peg,
              remove_subdir_3_escape_peg,
              remove_subdir_4_escape_peg,
              remove_subdir_5_escape_peg,
              remove_subdir_6_escape_peg,
              remove_subdir_7_escape_peg,
              remove_subdir_7a_escape_peg,
              remove_subdir_7b_escape_peg,

              remove_subdir_1_no_escape_peg,
              remove_subdir_2_no_escape_peg,
              remove_subdir_3_no_escape_peg,
              remove_subdir_4_no_escape_peg,
              # skipped: remove_subdir_5_no_escape_peg,
              # skipped: remove_subdir_6_no_escape_peg,
              remove_subdir_7_no_escape_peg,
              remove_subdir_7a_no_escape_peg,
              remove_subdir_7b_no_escape_peg,

              rename_to_subdir_2_dst_escape_peg,
              rename_to_subdir_2_no_dst_escape_peg,
             ]

if __name__ == '__main__':
  svntest.main.run_tests(test_list)
  # NOTREACHED


### End of file.