29
29
def test_aliases(self):
31
def bzr(args, **kwargs):
32
return self.run_bzr(args, **kwargs)[0]
31
def bzr(*args, **kwargs):
32
return self.run_bzr(*args, **kwargs)[0]
34
def bzr_catch_error(args, **kwargs):
35
return self.run_bzr(args, **kwargs)[1]
34
def bzr_catch_error(*args, **kwargs):
35
return self.run_bzr(*args, **kwargs)[1]
38
38
if os.path.isfile(config_filename()):
56
56
open('a', 'wb').write(str1)
61
self.assertEquals(bzr('c a'), str1)
59
bzr('commit', '-m', '1')
61
self.assertEquals(bzr('c', 'a'), str1)
63
63
open('a', 'wb').write(str2)
64
bzr('commit', '-m', '2')
66
self.assertEquals(bzr('c a'), str2)
67
self.assertEquals(bzr('c1 a'), str1)
68
self.assertEquals(bzr('c1 --revision 2 a'), str2)
66
self.assertEquals(bzr('c', 'a'), str2)
67
self.assertEquals(bzr('c1', 'a'), str1)
68
self.assertEquals(bzr('c1', '--revision', '2', 'a'), str2)
70
70
# If --no-aliases isn't working, we will not get retcode=3
71
bzr('--no-aliases c a', retcode=3)
71
bzr('--no-aliases', 'c', 'a', retcode=3)
73
73
# If --no-aliases breaks all of bzr, we also get retcode=3
74
74
# So we need to catch the output as well
75
self.assertEquals(bzr_catch_error('--no-aliases c a',
75
self.assertEquals(bzr_catch_error('--no-aliases', 'c', 'a',
77
77
'bzr: ERROR: unknown command "c"\n')
79
bzr('c -r1 -r2', retcode=3)
80
bzr('c1 -r1 -r2', retcode=3)
79
bzr('c', '-r1', '-r2', retcode=3)
80
bzr('c1', '-r1', '-r2', retcode=3)
81
81
bzr('c2', retcode=3)
82
bzr('c2 -r1', retcode=3)
82
bzr('c2', '-r1', retcode=3)