58
58
class TestCommands(ExternalBase):
60
def test_whoami(self):
61
# this should always identify something, if only "john@localhost"
63
self.runbzr("whoami --email")
65
self.assertEquals(self.runbzr("whoami --email",
66
backtick=True).count('@'), 1)
68
def test_whoami_branch(self):
69
"""branch specific user identity works."""
71
b = bzrlib.branch.Branch.open('.')
72
b.control_files.put_utf8('email', 'Branch Identity <branch@identi.ty>')
73
bzr_email = os.environ.get('BZREMAIL')
74
if bzr_email is not None:
75
del os.environ['BZREMAIL']
76
whoami = self.runbzr("whoami",backtick=True)
77
whoami_email = self.runbzr("whoami --email",backtick=True)
78
self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>'))
79
self.assertTrue(whoami_email.startswith('branch@identi.ty'))
80
# Verify that the environment variable overrides the value
82
os.environ['BZREMAIL'] = 'Different ID <other@environ.ment>'
83
whoami = self.runbzr("whoami",backtick=True)
84
whoami_email = self.runbzr("whoami --email",backtick=True)
85
self.assertTrue(whoami.startswith('Different ID <other@environ.ment>'))
86
self.assertTrue(whoami_email.startswith('other@environ.ment'))
87
if bzr_email is not None:
88
os.environ['BZREMAIL'] = bzr_email
90
60
def test_nick_command(self):
91
61
"""bzr nick for viewing, setting nicknames"""
107
77
self.runbzr('init')
108
78
self.assertEquals(self.capture('unknowns'), '')
110
file('foo.tmp', 'wt').write('tmp files are ignored')
111
self.assertEquals(self.capture('unknowns'), '')
113
80
file('foo.c', 'wt').write('int main() {}')
114
81
self.assertEquals(self.capture('unknowns'), 'foo.c\n')
296
263
self.assertEquals(out, value)
299
open('a', 'wb').write('hello\n')
266
self.build_tree_contents(
267
[('.bzrignore', '*.pyo\n'),
301
271
# Can't supply both
302
272
bzr('ls --verbose --null', retcode=3)
305
ls_equals('? a\n', '--verbose')
306
ls_equals('a\n', '--unknown')
274
ls_equals('.bzrignore\na\n')
275
ls_equals('? .bzrignore\n'
278
ls_equals('.bzrignore\n'
307
281
ls_equals('', '--ignored')
308
282
ls_equals('', '--versioned')
309
ls_equals('a\n', '--unknown', '--ignored', '--versioned')
283
ls_equals('.bzrignore\n'
285
'--unknown', '--ignored', '--versioned')
310
286
ls_equals('', '--ignored', '--versioned')
311
ls_equals('a\0', '--null')
287
ls_equals('.bzrignore\0a\0', '--null')
314
ls_equals('V a\n', '--verbose')
290
ls_equals('? .bzrignore\nV a\n', '--verbose')
315
291
bzr('commit -m add')
317
293
os.mkdir('subdir')
294
ls_equals('? .bzrignore\n'
321
298
open('subdir/b', 'wb').write('b\n')
300
ls_equals('V .bzrignore\n'
327
305
bzr('commit -m subdir')
307
ls_equals('.bzrignore\n'
331
310
, '--non-recursive')
312
ls_equals('V .bzrignore\n'
335
315
, '--verbose', '--non-recursive')