~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to zap.py

  • Committer: Aaron Bentley
  • Date: 2008-05-12 04:14:21 UTC
  • Revision ID: aaron@aaronbentley.com-20080512041421-hunspdyev3rxqx7u
Avoid using deprecated interface for heads

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
    revision as _mod_revision,
6
6
    )
7
7
from bzrlib.branch import Branch
8
 
from bzrlib.errors import NoWorkingTree, NotBranchError
 
8
from bzrlib.errors import NoWorkingTree, NotLocalUrl, NotBranchError
9
9
from bzrlib.workingtree import WorkingTree
10
10
 
11
11
from errors import (NotCheckout, UncommittedCheckout, ParentMissingRevisions,
50
50
    import os
51
51
    from unittest import makeSuite
52
52
 
 
53
    from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
 
54
    from bzrlib.branch import BranchReferenceFormat
53
55
    from bzrlib.tests import TestCaseInTempDir
54
56
 
55
57
    class TestZap(TestCaseInTempDir):
56
58
 
57
59
        def make_checkout(self):
58
 
            wt = bzrdir.BzrDir.create_standalone_workingtree('source')
59
 
            return wt.branch.create_checkout('checkout', lightweight=True)
 
60
            wt = BzrDir.create_standalone_workingtree('source')
 
61
            os.mkdir('checkout')
 
62
            checkout = BzrDirMetaFormat1().initialize('checkout')
 
63
            BranchReferenceFormat().initialize(checkout, wt.branch)
 
64
            return checkout.create_workingtree()
60
65
 
61
66
        def make_checkout2(self):
62
67
            wt = self.make_checkout()
63
68
            wt2 = wt.branch.bzrdir.sprout('source2').open_workingtree()
64
 
            return wt2.branch.create_checkout('checkout2', lightweight=True)
 
69
            os.mkdir('checkout2')
 
70
            checkout = BzrDirMetaFormat1().initialize('checkout2')
 
71
            BranchReferenceFormat().initialize(checkout, wt2.branch)
 
72
            return checkout.create_workingtree()
65
73
 
66
74
        def test_is_checkout(self):
67
75
            self.assertRaises(NotCheckout, zap, '.')
68
 
            wt = bzrdir.BzrDir.create_standalone_workingtree('.')
 
76
            wt = BzrDir.create_standalone_workingtree('.')
69
77
            self.assertRaises(NotCheckout, zap, '.')
70
78
 
71
79
        def test_zap_works(self):
75
83
            self.assertIs(False, os.path.exists('checkout'))
76
84
            self.assertIs(True, os.path.exists('source'))
77
85
 
78
 
        def test_zap_branch(self):
 
86
        def test_zap_branch(self):
79
87
            self.make_checkout2()
80
88
            base = WorkingTree.open('checkout').branch.base
81
89
            self.assertIs(True, os.path.exists('checkout'))