66
70
self.runbzr('branch . my_branch')
67
71
self.runbzr('fetch-ghosts my_branch')
74
self.runbzr('init source')
75
self.runbzr('checkout --lightweight source checkout')
76
self.runbzr('zap checkout')
77
self.assertIs(False, os.path.exists('checkout'))
78
self.assertIs(True, os.path.exists('source'))
80
def test_zap_branch(self):
81
self.runbzr('init source')
82
self.runbzr('checkout --lightweight source checkout')
83
self.runbzr('zap --branch checkout', retcode=3)
84
self.assertIs(True, os.path.exists('checkout'))
85
self.assertIs(True, os.path.exists('source'))
86
self.runbzr('branch source source2')
87
self.runbzr('checkout --lightweight source2 checkout2')
88
self.runbzr('zap --branch checkout2')
89
self.assertIs(False, os.path.exists('checkout2'))
90
self.assertIs(False, os.path.exists('source2'))
92
def test_branches(self):
93
self.runbzr('init source')
94
self.runbzr('init source/subsource')
95
self.runbzr('checkout --lightweight source checkout')
96
self.runbzr('init checkout/subcheckout')
97
self.runbzr('init checkout/.bzr/subcheckout')
98
out = self.capture('branches')
99
lines = out.split('\n')
100
self.assertIs(True, 'source' in lines)
101
self.assertIs(True, 'source/subsource' in lines)
102
self.assertIs(True, 'checkout/subcheckout' in lines)
103
self.assertIs(True, 'checkout' not in lines)
104
self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines)
106
def test_import_upstream(self):
107
self.runbzr('init source')
108
os.mkdir('source/src')
109
f = file('source/src/myfile', 'wb')
114
self.runbzr('commit -m hello')
115
self.runbzr('export ../source-0.1.tar.gz')
116
self.runbzr('export ../source-0.1.tar.bz2')
117
self.runbzr('init ../import')
118
os.chdir('../import')
119
self.runbzr('import ../source-0.1.tar.gz')
120
self.failUnlessExists('src/myfile')
121
result = self.runbzr('import ../source-0.1.tar.gz', retcode=3)[1]
122
self.assertContainsRe(result, 'Working tree has uncommitted changes')
123
self.runbzr('commit -m commit')
124
self.runbzr('import ../source-0.1.tar.gz')
126
self.runbzr('init import2')
127
self.runbzr('import source-0.1.tar.gz import2')
128
self.failUnlessExists('import2/src/myfile')
129
self.runbzr('import source-0.1.tar.gz import3')
130
self.failUnlessExists('import3/src/myfile')
131
self.runbzr('import source-0.1.tar.bz2 import4')
132
self.failUnlessExists('import4/src/myfile')
134
def test_shove(self):
135
self.runbzr('init source')
136
f = file('source/file', 'wb')
139
self.runbzr('add source/file')
140
self.runbzr('commit source -m foo')
141
self.runbzr('branch source target1')
142
self.runbzr('branch source target2')
143
f = file('source/file', 'wb')
146
self.runbzr('shove source target1')
147
f = file('target1/file', 'rb')
148
self.assertEqual(f.read(), 'goodbye\n')
151
self.runbzr('shove target2', retcode=3)
152
self.runbzr('shove ../target2')
153
f = file('../target2/file', 'rb')
154
self.assertEqual(f.read(), 'goodbye\n')
70
158
return makeSuite(TestBzrTools)