~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_uncommit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-03-30 05:35:57 UTC
  • mfrom: (1558.9.1 bzr.bound-uncommit)
  • Revision ID: pqm@pqm.ubuntu.com-20060330053557-a81c03289ce7560d
Fix uncommit to handle bound branches, and to do locking

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
import os
6
6
 
7
 
from bzrlib.errors import BzrError
 
7
from bzrlib.bzrdir import BzrDirMetaFormat1
 
8
from bzrlib.errors import BzrError, BoundBranchOutOfDate
 
9
from bzrlib.uncommit import uncommit
8
10
from bzrlib.tests import TestCaseInTempDir
9
11
 
10
12
class TestUncommit(TestCaseInTempDir):
61
63
 
62
64
        self.assertEquals(bzr('revno'), '1\n')
63
65
        self.assertEquals(bzr('status'), 'modified:\n  a\n')
 
66
 
 
67
    def test_uncommit_bound(self):
 
68
        os.mkdir('a')
 
69
        a = BzrDirMetaFormat1().initialize('a')
 
70
        a.create_repository()
 
71
        a.create_branch()
 
72
        t = a.create_workingtree()
 
73
        t.commit('commit 1')
 
74
        t.commit('commit 2')
 
75
        t.commit('commit 3')
 
76
        b = t.bzrdir.sprout('b').open_branch()
 
77
        b.bind(t.branch)
 
78
        uncommit(b)
 
79
        t.set_last_revision(t.branch.last_revision())
 
80
        self.assertEqual(len(b.revision_history()), 2)
 
81
        self.assertEqual(len(t.branch.revision_history()), 2)
 
82
        t.commit('commit 3b')
 
83
        self.assertRaises(BoundBranchOutOfDate, uncommit, b)
 
84
        b.pull(t.branch)
 
85
        uncommit(b)
 
86