60
60
def test_revert(self):
61
61
self.run_bzr('init')
63
file('hello', 'wt').write('foo')
63
with file('hello', 'wt') as f: f.write('foo')
64
64
self.run_bzr('add hello')
65
65
self.run_bzr('commit -m setup hello')
67
file('goodbye', 'wt').write('baz')
67
with file('goodbye', 'wt') as f: f.write('baz')
68
68
self.run_bzr('add goodbye')
69
69
self.run_bzr('commit -m setup goodbye')
71
file('hello', 'wt').write('bar')
72
file('goodbye', 'wt').write('qux')
71
with file('hello', 'wt') as f: f.write('bar')
72
with file('goodbye', 'wt') as f: f.write('qux')
73
73
self.run_bzr('revert hello')
74
74
self.check_file_contents('hello', 'foo')
75
75
self.check_file_contents('goodbye', 'qux')
98
98
self.log("skipping revert symlink tests")
100
file('hello', 'wt').write('xyz')
100
with file('hello', 'wt') as f: f.write('xyz')
101
101
self.run_bzr('commit -m xyz hello')
102
102
self.run_bzr('revert -r 1 hello')
103
103
self.check_file_contents('hello', 'foo')
110
110
def example_branch(test):
111
111
test.run_bzr('init')
112
file('hello', 'wt').write('foo')
112
with file('hello', 'wt') as f: f.write('foo')
113
113
test.run_bzr('add hello')
114
114
test.run_bzr('commit -m setup hello')
115
file('goodbye', 'wt').write('baz')
115
with file('goodbye', 'wt') as f: f.write('baz')
116
116
test.run_bzr('add goodbye')
117
117
test.run_bzr('commit -m setup goodbye')
128
128
self.run_bzr('branch a b')
130
open('b', 'wb').write('else\n')
130
with open('b', 'wb') as f: f.write('else\n')
131
131
self.run_bzr('add b')
132
132
self.run_bzr(['commit', '-m', 'added b'])
195
195
"""Create a conflicted tree"""
198
file('hello', 'wb').write("hi world")
199
file('answer', 'wb').write("42")
198
with file('hello', 'wb') as f: f.write("hi world")
199
with file('answer', 'wb') as f: f.write("42")
200
200
self.run_bzr('init')
201
201
self.run_bzr('add')
202
202
self.run_bzr('commit -m base')
203
203
self.run_bzr('branch . ../other')
204
204
self.run_bzr('branch . ../this')
205
205
os.chdir('../other')
206
file('hello', 'wb').write("Hello.")
207
file('answer', 'wb').write("Is anyone there?")
206
with file('hello', 'wb') as f: f.write("Hello.")
207
with file('answer', 'wb') as f: f.write("Is anyone there?")
208
208
self.run_bzr('commit -m other')
209
209
os.chdir('../this')
210
file('hello', 'wb').write("Hello, world")
210
with file('hello', 'wb') as f: f.write("Hello, world")
211
211
self.run_bzr('mv answer question')
212
file('question', 'wb').write("What do you get when you multiply six"
212
with file('question', 'wb') as f: f.write("What do you get when you multiply six"
214
214
self.run_bzr('commit -m this')
439
439
progress("file with spaces in name")
440
440
mkdir('sub directory')
441
file('sub directory/file with spaces ', 'wt').write('see how this works\n')
441
with file('sub directory/file with spaces ', 'wt') as f: f.write('see how this works\n')
442
442
self.run_bzr('add .')
443
443
self.run_bzr('diff', retcode=1)
444
444
self.run_bzr('commit -m add-spaces')
590
590
os.mkdir('my-branch')
591
591
os.chdir('my-branch')
592
592
self.run_bzr('init')
593
file('hello', 'wt').write('foo')
593
with file('hello', 'wt') as f: f.write('foo')
594
594
self.run_bzr('add hello')
595
595
self.run_bzr('commit -m setup')