~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-07-07 15:22:42 UTC
  • mfrom: (1843 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1846.
  • Revision ID: john@arbash-meinel.com-20060707152242-a7b5e0afd64d9d5a
[merge] bzr.dev 1843

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 
58
58
class TestCommands(ExternalBase):
59
59
 
60
 
    def test_whoami(self):
61
 
        # this should always identify something, if only "john@localhost"
62
 
        self.runbzr("whoami")
63
 
        self.runbzr("whoami --email")
64
 
 
65
 
        self.assertEquals(self.runbzr("whoami --email",
66
 
                                      backtick=True).count('@'), 1)
67
 
        
68
 
    def test_whoami_branch(self):
69
 
        """branch specific user identity works."""
70
 
        self.runbzr('init')
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 
81
 
        # in the file
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
89
 
 
90
60
    def test_nick_command(self):
91
61
        """bzr nick for viewing, setting nicknames"""
92
62
        os.mkdir('me.dev')
107
77
        self.runbzr('init')
108
78
        self.assertEquals(self.capture('unknowns'), '')
109
79
 
110
 
        file('foo.tmp', 'wt').write('tmp files are ignored')
111
 
        self.assertEquals(self.capture('unknowns'), '')
112
 
 
113
80
        file('foo.c', 'wt').write('int main() {}')
114
81
        self.assertEquals(self.capture('unknowns'), 'foo.c\n')
115
82
 
296
263
            self.assertEquals(out, value)
297
264
 
298
265
        bzr('init')
299
 
        open('a', 'wb').write('hello\n')
 
266
        self.build_tree_contents(
 
267
            [('.bzrignore', '*.pyo\n'),
 
268
             ('a', 'hello\n'),
 
269
             ])
300
270
 
301
271
        # Can't supply both
302
272
        bzr('ls --verbose --null', retcode=3)
303
273
 
304
 
        ls_equals('a\n')
305
 
        ls_equals('?        a\n', '--verbose')
306
 
        ls_equals('a\n', '--unknown')
 
274
        ls_equals('.bzrignore\na\n')
 
275
        ls_equals('?        .bzrignore\n'
 
276
                  '?        a\n',
 
277
                  '--verbose')
 
278
        ls_equals('.bzrignore\n'
 
279
                  'a\n',
 
280
                  '--unknown')
307
281
        ls_equals('', '--ignored')
308
282
        ls_equals('', '--versioned')
309
 
        ls_equals('a\n', '--unknown', '--ignored', '--versioned')
 
283
        ls_equals('.bzrignore\n'
 
284
                  'a\n',
 
285
                  '--unknown', '--ignored', '--versioned')
310
286
        ls_equals('', '--ignored', '--versioned')
311
 
        ls_equals('a\0', '--null')
 
287
        ls_equals('.bzrignore\0a\0', '--null')
312
288
 
313
289
        bzr('add a')
314
 
        ls_equals('V        a\n', '--verbose')
 
290
        ls_equals('?        .bzrignore\nV        a\n', '--verbose')
315
291
        bzr('commit -m add')
316
292
        
317
293
        os.mkdir('subdir')
318
 
        ls_equals('V        a\n'
 
294
        ls_equals('?        .bzrignore\n'
 
295
                  'V        a\n'
319
296
                  '?        subdir/\n'
320
297
                  , '--verbose')
321
298
        open('subdir/b', 'wb').write('b\n')
322
299
        bzr('add')
323
 
        ls_equals('V        a\n'
 
300
        ls_equals('V        .bzrignore\n'
 
301
                  'V        a\n'
324
302
                  'V        subdir/\n'
325
303
                  'V        subdir/b\n'
326
304
                  , '--verbose')
327
305
        bzr('commit -m subdir')
328
306
 
329
 
        ls_equals('a\n'
 
307
        ls_equals('.bzrignore\n'
 
308
                  'a\n'
330
309
                  'subdir\n'
331
310
                  , '--non-recursive')
332
311
 
333
 
        ls_equals('V        a\n'
 
312
        ls_equals('V        .bzrignore\n'
 
313
                  'V        a\n'
334
314
                  'V        subdir/\n'
335
315
                  , '--verbose', '--non-recursive')
336
316
 
339
319
        ls_equals('b\n')
340
320
        ls_equals('b\0'
341
321
                  , '--null')
342
 
        ls_equals('a\n'
 
322
        ls_equals('.bzrignore\n'
 
323
                  'a\n'
343
324
                  'subdir\n'
344
325
                  'subdir/b\n'
345
326
                  , '--from-root')
346
 
        ls_equals('a\0'
 
327
        ls_equals('.bzrignore\0'
 
328
                  'a\0'
347
329
                  'subdir\0'
348
330
                  'subdir/b\0'
349
331
                  , '--from-root', '--null')
350
 
        ls_equals('a\n'
 
332
        ls_equals('.bzrignore\n'
 
333
                  'a\n'
351
334
                  'subdir\n'
352
335
                  , '--from-root', '--non-recursive')
353
336
 
365
348
        os.chdir('..')
366
349
        open('blah.py', 'wb').write('unknown\n')
367
350
        open('blah.pyo', 'wb').write('ignored\n')
368
 
        ls_equals('a\n'
 
351
        ls_equals('.bzrignore\n'
 
352
                  'a\n'
369
353
                  'blah.py\n'
370
354
                  'blah.pyo\n'
371
355
                  'subdir\n'
372
356
                  'subdir/b\n')
373
 
        ls_equals('V        a\n'
 
357
        ls_equals('V        .bzrignore\n'
 
358
                  'V        a\n'
374
359
                  '?        blah.py\n'
375
360
                  'I        blah.pyo\n'
376
361
                  'V        subdir/\n'
380
365
                  , '--ignored')
381
366
        ls_equals('blah.py\n'
382
367
                  , '--unknown')
383
 
        ls_equals('a\n'
 
368
        ls_equals('.bzrignore\n'
 
369
                  'a\n'
384
370
                  'subdir\n'
385
371
                  'subdir/b\n'
386
372
                  , '--versioned')