~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/blackbox.py

merge in John Meinels integration branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        f = file('.bzr/email', 'wt')
75
75
        f.write('Branch Identity <branch@identi.ty>')
76
76
        f.close()
 
77
        bzr_email = os.environ.get('BZREMAIL')
 
78
        if bzr_email is not None:
 
79
            del os.environ['BZREMAIL']
77
80
        whoami = self.runbzr("whoami",backtick=True)
78
81
        whoami_email = self.runbzr("whoami --email",backtick=True)
79
82
        self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>'))
80
83
        self.assertTrue(whoami_email.startswith('branch@identi.ty'))
 
84
        # Verify that the environment variable overrides the value 
 
85
        # in the file
 
86
        os.environ['BZREMAIL'] = 'Different ID <other@environ.ment>'
 
87
        whoami = self.runbzr("whoami",backtick=True)
 
88
        whoami_email = self.runbzr("whoami --email",backtick=True)
 
89
        self.assertTrue(whoami.startswith('Different ID <other@environ.ment>'))
 
90
        self.assertTrue(whoami_email.startswith('other@environ.ment'))
 
91
        if bzr_email is not None:
 
92
            os.environ['BZREMAIL'] = bzr_email
81
93
 
82
94
    def test_invalid_commands(self):
83
95
        self.runbzr("pants", retcode=1)
148
160
        os.rmdir('revertdir')
149
161
        self.runbzr('revert')
150
162
 
 
163
        file('hello', 'wt').write('xyz')
 
164
        self.runbzr('commit -m xyz hello')
 
165
        self.runbzr('revert -r 1 hello')
 
166
        self.check_file_contents('hello', 'foo')
 
167
        self.runbzr('revert hello')
 
168
        self.check_file_contents('hello', 'xyz')
 
169
 
151
170
    def test_mv_modes(self):
152
171
        """Test two modes of operation for mv"""
153
172
        from bzrlib.branch import Branch
193
212
        output = self.runbzr('diff -r last:3..last:1', backtick=1)
194
213
        self.assert_('\n+baz' in output)
195
214
 
196
 
    def test_revert(self):
 
215
    def test_diff(self):
197
216
        self.example_branch()
198
 
        file('hello', 'wt').write('bar')
199
 
        file('goodbye', 'wt').write('qux')
200
 
        self.runbzr('revert hello')
201
 
        self.check_file_contents('hello', 'foo')
202
 
        self.check_file_contents('goodbye', 'qux')
203
 
        self.runbzr('revert')
204
 
        self.check_file_contents('goodbye', 'baz')
 
217
        file('hello', 'wt').write('hello world!')
 
218
        self.runbzr('commit -m fixing hello')
 
219
        output = self.runbzr('diff -r 2..3', backtick=1)
 
220
        self.assert_('\n+hello world!' in output)
 
221
        output = self.runbzr('diff -r last:3..last:1', backtick=1)
 
222
        self.assert_('\n+baz' in output)
205
223
 
206
224
    def test_merge(self):
207
225
        from bzrlib.branch import Branch