/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_too_much.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    def test_revert(self):
60
60
        self.run_bzr('init')
61
61
 
62
 
        with open('hello', 'wt') as f: f.write('foo')
 
62
        with open('hello', 'wt') as f:
 
63
            f.write('foo')
63
64
        self.run_bzr('add hello')
64
65
        self.run_bzr('commit -m setup hello')
65
66
 
66
 
        with open('goodbye', 'wt') as f: f.write('baz')
 
67
        with open('goodbye', 'wt') as f:
 
68
            f.write('baz')
67
69
        self.run_bzr('add goodbye')
68
70
        self.run_bzr('commit -m setup goodbye')
69
71
 
70
 
        with open('hello', 'wt') as f: f.write('bar')
71
 
        with open('goodbye', 'wt') as f: f.write('qux')
 
72
        with open('hello', 'wt') as f:
 
73
            f.write('bar')
 
74
        with open('goodbye', 'wt') as f:
 
75
            f.write('qux')
72
76
        self.run_bzr('revert hello')
73
77
        self.check_file_contents('hello', b'foo')
74
78
        self.check_file_contents('goodbye', b'qux')
96
100
        else:
97
101
            self.log("skipping revert symlink tests")
98
102
 
99
 
        with open('hello', 'wt') as f: f.write('xyz')
 
103
        with open('hello', 'wt') as f:
 
104
            f.write('xyz')
100
105
        self.run_bzr('commit -m xyz hello')
101
106
        self.run_bzr('revert -r 1 hello')
102
107
        self.check_file_contents('hello', b'foo')
108
113
 
109
114
    def example_branch(test):
110
115
        test.run_bzr('init')
111
 
        with open('hello', 'wt') as f: f.write('foo')
 
116
        with open('hello', 'wt') as f:
 
117
            f.write('foo')
112
118
        test.run_bzr('add hello')
113
119
        test.run_bzr('commit -m setup hello')
114
 
        with open('goodbye', 'wt') as f: f.write('baz')
 
120
        with open('goodbye', 'wt') as f:
 
121
            f.write('baz')
115
122
        test.run_bzr('add goodbye')
116
123
        test.run_bzr('commit -m setup goodbye')
117
124
 
126
133
        os.chdir('..')
127
134
        self.run_bzr('branch a b')
128
135
        os.chdir('b')
129
 
        with open('b', 'wb') as f: f.write(b'else\n')
 
136
        with open('b', 'wb') as f:
 
137
            f.write(b'else\n')
130
138
        self.run_bzr('add b')
131
139
        self.run_bzr(['commit', '-m', 'added b'])
132
140
 
194
202
        """Create a conflicted tree"""
195
203
        os.mkdir('base')
196
204
        os.chdir('base')
197
 
        with open('hello', 'wb') as f: f.write(b"hi world")
198
 
        with open('answer', 'wb') as f: f.write(b"42")
 
205
        with open('hello', 'wb') as f:
 
206
            f.write(b"hi world")
 
207
        with open('answer', 'wb') as f:
 
208
            f.write(b"42")
199
209
        self.run_bzr('init')
200
210
        self.run_bzr('add')
201
211
        self.run_bzr('commit -m base')
202
212
        self.run_bzr('branch . ../other')
203
213
        self.run_bzr('branch . ../this')
204
214
        os.chdir('../other')
205
 
        with open('hello', 'wb') as f: f.write(b"Hello.")
206
 
        with open('answer', 'wb') as f: f.write(b"Is anyone there?")
 
215
        with open('hello', 'wb') as f:
 
216
            f.write(b"Hello.")
 
217
        with open('answer', 'wb') as f:
 
218
            f.write(b"Is anyone there?")
207
219
        self.run_bzr('commit -m other')
208
220
        os.chdir('../this')
209
 
        with open('hello', 'wb') as f: f.write(b"Hello, world")
 
221
        with open('hello', 'wb') as f:
 
222
            f.write(b"Hello, world")
210
223
        self.run_bzr('mv answer question')
211
 
        with open('question', 'wb') as f: f.write(b"What do you get when you multiply six"
212
 
                                   b"times nine?")
 
224
        with open('question', 'wb') as f:
 
225
            f.write(b"What do you get when you multiply six"
 
226
                    b"times nine?")
213
227
        self.run_bzr('commit -m this')
214
228
 
215
229
    def test_status(self):
227
241
        self.run_bzr('merge ../branch2')
228
242
        message = self.run_bzr('status')[0]
229
243
 
230
 
 
231
244
    def test_conflicts(self):
232
245
        """Handling of merge conflicts"""
233
246
        self.create_conflicts()
248
261
        self.assertTrue('hi world' not in conflict_text)
249
262
        result = self.run_bzr('conflicts')[0]
250
263
        self.assertEqual(result, "Text conflict in hello\nText conflict in"
251
 
                                  " question\n")
 
264
                         " question\n")
252
265
        result = self.run_bzr('status')[0]
253
266
        self.assertTrue("conflicts:\n  Text conflict in hello\n"
254
 
                     "  Text conflict in question\n" in result, result)
 
267
                        "  Text conflict in question\n" in result, result)
255
268
        self.run_bzr('resolve hello')
256
269
        result = self.run_bzr('conflicts')[0]
257
270
        self.assertEqual(result, "Text conflict in question\n")
421
434
        self.assertTrue("this is my new commit\n  and" in log_out)
422
435
        self.assertTrue("rename nested" not in log_out)
423
436
        self.assertTrue('revision-id' not in log_out)
424
 
        self.assertTrue('revision-id' in self.run_bzr('log --show-ids -m commit')[0])
 
437
        self.assertTrue(
 
438
            'revision-id' in self.run_bzr('log --show-ids -m commit')[0])
425
439
 
426
440
        log_out = self.run_bzr('log --line')[0]
427
441
        # determine the widest line we want
434
448
 
435
449
        progress("file with spaces in name")
436
450
        mkdir('sub directory')
437
 
        with open('sub directory/file with spaces ', 'wt') as f: f.write('see how this works\n')
 
451
        with open('sub directory/file with spaces ', 'wt') as f:
 
452
            f.write('see how this works\n')
438
453
        self.run_bzr('add .')
439
454
        self.run_bzr('diff', retcode=1)
440
455
        self.run_bzr('commit -m add-spaces')
506
521
 
507
522
            self.run_bzr('export -r 1 exp1.tmp')
508
523
            chdir("exp1.tmp")
509
 
            self.assertEqual(listdir_sorted("."), [ "link1" ])
 
524
            self.assertEqual(listdir_sorted("."), ["link1"])
510
525
            self.assertEqual(os.readlink("link1"), "NOWHERE1")
511
526
            chdir("..")
512
527
 
513
528
            self.run_bzr('export -r 2 exp2.tmp')
514
529
            chdir("exp2.tmp")
515
 
            self.assertEqual(listdir_sorted("."), [ "d1", "link1" ])
 
530
            self.assertEqual(listdir_sorted("."), ["d1", "link1"])
516
531
            chdir("..")
517
532
 
518
533
            self.run_bzr('export -r 3 exp3.tmp')
519
534
            chdir("exp3.tmp")
520
 
            self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
521
 
            self.assertEqual(listdir_sorted("d2"), [ "link1", "link3" ])
 
535
            self.assertEqual(listdir_sorted("."), ["d2", "link2"])
 
536
            self.assertEqual(listdir_sorted("d2"), ["link1", "link3"])
522
537
            self.assertEqual(os.readlink("d2/link1"), "NOWHERE1")
523
538
            self.assertEqual(os.readlink("link2"), "NOWHERE2")
524
539
            chdir("..")
525
540
 
526
541
            self.run_bzr('export -r 4 exp4.tmp')
527
542
            chdir("exp4.tmp")
528
 
            self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
 
543
            self.assertEqual(listdir_sorted("."), ["d2", "link2"])
529
544
            self.assertEqual(os.readlink("d2/link1"), "TARGET 1")
530
545
            self.assertEqual(os.readlink("link2"), "TARGET 2")
531
 
            self.assertEqual(listdir_sorted("d2"), [ "link1", "link3" ])
 
546
            self.assertEqual(listdir_sorted("d2"), ["link1", "link3"])
532
547
            chdir("..")
533
548
 
534
549
            self.run_bzr('export -r 5 exp5.tmp')
535
550
            chdir("exp5.tmp")
536
 
            self.assertEqual(listdir_sorted("."), [ "d2", "link2" ])
 
551
            self.assertEqual(listdir_sorted("."), ["d2", "link2"])
537
552
            self.assertTrue(os.path.islink("link2"))
538
 
            self.assertTrue(listdir_sorted("d2")== [ "link3" ])
 
553
            self.assertTrue(listdir_sorted("d2") == ["link3"])
539
554
            chdir("..")
540
555
 
541
556
            self.run_bzr('export -r 8 exp6.tmp')
542
557
            chdir("exp6.tmp")
543
 
            self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"])
544
 
            self.assertEqual(listdir_sorted("d1"), [ "link3new" ])
 
558
            self.assertEqual(listdir_sorted("."), ["d1", "d2", "link2"])
 
559
            self.assertEqual(listdir_sorted("d1"), ["link3new"])
545
560
            self.assertEqual(listdir_sorted("d2"), [])
546
561
            self.assertEqual(os.readlink("d1/link3new"), "NOWHERE3")
547
562
            chdir("..")
586
601
        os.mkdir('my-branch')
587
602
        os.chdir('my-branch')
588
603
        self.run_bzr('init')
589
 
        with open('hello', 'wt') as f: f.write('foo')
 
604
        with open('hello', 'wt') as f:
 
605
            f.write('foo')
590
606
        self.run_bzr('add hello')
591
607
        self.run_bzr('commit -m setup')
592
608