1
"""Black-box tests for bzr aliases.
6
from bzrlib.branch import Branch
7
from bzrlib.tests import TestCaseInTempDir
8
from bzrlib.trace import mutter
9
from bzrlib.config import (config_dir, config_filename)
12
class TestAliases(TestCaseInTempDir):
14
def test_aliases(self):
16
def bzr(*args, **kwargs):
17
return self.run_bzr(*args, **kwargs)[0]
19
if os.path.isfile(config_filename()):
20
# Something is wrong in environment,
21
# we risk overwriting users config
22
self.assert_(config_filename() + "exists, abort")
24
os.mkdir(config_dir())
30
open(config_filename(),'wb').write(CONFIG)
37
open('a', 'wb').write(str1)
40
bzr('commit', '-m', '1')
42
self.assertEquals(bzr('c', 'a'), str1)
44
open('a', 'wb').write(str2)
45
bzr('commit', '-m', '2')
47
self.assertEquals(bzr('c', 'a'), str2)
48
self.assertEquals(bzr('c1', 'a'), str1)
49
self.assertEquals(bzr('c1', '--revision', '2', 'a'), str2)
51
# If --no-alias isn't working, we will not get retcode=3
52
bzr('--no-aliases', 'c', 'a', retcode=3)
54
bzr('c', '-r1', '-r2', retcode=3)
55
bzr('c1', '-r1', '-r2', retcode=3)
57
bzr('c2', '-r1', retcode=3)