~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

Merged mailine

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
 
18
import sys
18
19
 
19
20
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
20
21
from bzrlib.clone import copy_branch
22
23
import bzrlib.errors as errors
23
24
from bzrlib.errors import NoSuchRevision, UnlistableBranch, NotBranchError
24
25
import bzrlib.gpg
 
26
from bzrlib.osutils import getcwd
25
27
from bzrlib.tests import TestCase, TestCaseInTempDir
26
28
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
27
29
from bzrlib.trace import mutter
49
51
        os.mkdir('b2')
50
52
        b1 = Branch.initialize('b1')
51
53
        b2 = Branch.initialize('b2')
52
 
        file(os.sep.join(['b1', 'foo']), 'w').write('hello')
 
54
        file('b1/foo', 'w').write('hello')
53
55
        b1.working_tree().add(['foo'], ['foo-id'])
54
56
        b1.working_tree().commit('lala!', rev_id='revision-1', allow_pointless=False)
55
57
 
219
221
        self.assertEqual(committed.properties["branch-nick"], 
220
222
                         "My happy branch")
221
223
 
 
224
    def test_no_ancestry_weave(self):
 
225
        # We no longer need to create the ancestry.weave file
 
226
        # since it is *never* used.
 
227
        branch = Branch.initialize(u'.')
 
228
        self.failIfExists('.bzr/ancestry.weave')
 
229
 
222
230
 
223
231
class TestRemote(TestCaseWithWebserver):
224
232
 
374
382
        self.assertEqual(None, self.branch.get_push_location())
375
383
 
376
384
    def test_get_push_location_exact(self):
377
 
        self.build_tree(['.bazaar/'])
378
 
        print >> open('.bazaar/branches.conf', 'wt'), ("[%s]\n"
379
 
                                                       "push_location=foo" %
380
 
                                                       os.getcwdu())
 
385
        from bzrlib.config import (branches_config_filename,
 
386
                                   ensure_config_dir_exists)
 
387
        ensure_config_dir_exists()
 
388
        fn = branches_config_filename()
 
389
        print >> open(fn, 'wt'), ("[%s]\n"
 
390
                                  "push_location=foo" %
 
391
                                  getcwd())
381
392
        self.assertEqual("foo", self.branch.get_push_location())
382
393
 
383
394
    def test_set_push_location(self):
 
395
        from bzrlib.config import (branches_config_filename,
 
396
                                   ensure_config_dir_exists)
 
397
        ensure_config_dir_exists()
 
398
        fn = branches_config_filename()
384
399
        self.branch.set_push_location('foo')
385
400
        self.assertFileEqual("[%s]\n"
386
 
                             "push_location = foo" % os.getcwdu(),
387
 
                             '.bazaar/branches.conf')
 
401
                             "push_location = foo" % getcwd(),
 
402
                             fn)
388
403
 
389
404
    # TODO RBC 20051029 test getting a push location from a branch in a 
390
405
    # recursive section - that is, it appends the branch name.