/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2005-12-31 00:23:03 UTC
  • mto: (1587.1.6 bound-branches)
  • mto: This revision was merged to the branch mainline in revision 1590.
  • Revision ID: john@arbash-meinel.com-20051231002303-fbc5cf80469ef0cf
Updated commit to handle bound branches. Included test to handle commit after merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
        self.failUnlessExists('child')
43
43
 
44
 
        os.chdir('child')
45
 
        self.check_revno(1)
46
 
        self.failUnlessExists('.bzr/bound')
47
 
        os.chdir('..')
 
44
        self.check_revno(1, 'child')
 
45
        self.failUnlessExists('child/.bzr/bound')
48
46
 
49
47
    def check_revno(self, val, loc=None):
50
48
        if loc is not None:
51
49
            cwd = os.getcwd()
52
50
            os.chdir(loc)
53
 
        self.assertEquals(self.capture('revno').strip(), str(val))
 
51
        self.assertEquals(str(val), self.run_bzr('revno')[0].strip())
54
52
        if loc is not None:
55
53
            os.chdir(cwd)
56
54
 
88
86
        self.check_revno(2)
89
87
 
90
88
        # Make sure it committed on the parent
91
 
        os.chdir('../base')
92
 
        self.check_revno(2)
 
89
        self.check_revno(2, '../base')
93
90
 
94
91
    def test_bound_fail(self):
95
92
        """Make sure commit fails if out of date."""
109
106
 
110
107
        bzr('commit', '-m', 'child')
111
108
        self.check_revno(3)
112
 
        os.chdir('../base')
113
 
        self.check_revno(3)
 
109
        self.check_revno(3, '../base')
114
110
 
115
111
    def test_double_binding(self):
116
112
        bzr = self.run_bzr
159
155
 
160
156
        os.chdir('../child')
161
157
        bzr('commit', '-m', 'failure', '--unchanged', retcode=3)
162
 
        
163
158
 
164
159
    def test_pull_updates_both(self):
165
160
        bzr = self.run_bzr
176
171
        bzr('pull', '../newchild')
177
172
        self.check_revno(2)
178
173
 
179
 
        os.chdir('../base')
180
 
        self.check_revno(2)
 
174
        self.check_revno(2, '../base')
181
175
 
182
176
    def test_bind_diverged(self):
183
177
        bzr = self.run_bzr
211
205
        self.check_revno(3, '../base')
212
206
 
213
207
        # After binding, the revision history should be identical
214
 
        child_rh = self.capture('revision-history')
 
208
        child_rh = bzr('revision-history')[0]
215
209
        os.chdir('../base')
216
 
        base_rh = self.capture('revision-history')
 
210
        base_rh = bzr('revision-history')[0]
217
211
        self.assertEquals(child_rh, base_rh)
218
212
 
219
213
    def test_bind_parent_ahead(self):
269
263
        bzr('bind')
270
264
        self.check_revno(5, '../base')
271
265
 
 
266
    def test_commit_after_merge(self):
 
267
        bzr = self.run_bzr
 
268
        self.create_branches()
 
269
 
 
270
        # We want merge to be able to be a local only
 
271
        # operation, because it can be without violating
 
272
        # the binding invariants.
 
273
        # But we can't fail afterwards
 
274
 
 
275
        bzr('branch', 'child', 'other')
 
276
 
 
277
        os.chdir('other')
 
278
        open('c', 'wb').write('file c\n')
 
279
        bzr('add', 'c')
 
280
        bzr('commit', '-m', 'adding c')
 
281
        new_rev_id = bzr('revision-history')[0].strip().split('\n')[-1]
 
282
 
 
283
        os.chdir('../child')
 
284
        bzr('merge', '../other')
 
285
 
 
286
        self.failUnlessExists('c')
 
287
        self.assertEqual(new_rev_id,
 
288
                open('.bzr/pending-merges', 'rb').read().strip())
 
289
 
 
290
        # Make sure the local branch has the installed revision
 
291
        bzr('cat-revision', new_rev_id)
 
292
        
 
293
        # And make sure that the base tree does not
 
294
        os.chdir('../base')
 
295
        bzr('cat-revision', new_rev_id, retcode=3)
 
296
 
 
297
        # Commit should succeed, and cause merged revisions to
 
298
        # be pulled into base
 
299
        os.chdir('../child')
 
300
        bzr('commit', '-m', 'merge other')
 
301
 
 
302
        self.check_revno(2)
 
303
 
 
304
        os.chdir('../base')
 
305
        self.check_revno(2)
 
306
 
 
307
        bzr('cat-revision', new_rev_id)
 
308
 
 
309