~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testbranch.py

  • Committer: Robert Collins
  • Date: 2005-10-29 23:48:45 UTC
  • Revision ID: robertc@robertcollins.net-20051029234845-7ae4e7d118bdd3ed
Implement a 'bzr push' command, with saved locations; update diff to return 1.

    * 'bzr diff' now returns 1 when there are changes in the working 
      tree.

    * 'bzr push' now exists and can push changes to a remote location. 
      This uses the transport infrastructure, and can store the remote
      location in the ~/.bazaar/branches.conf configuration file.

    * WorkingTree.pull has been split across Branch and WorkingTree,
      to allow Branch only pulls.

    * commands.display_command now returns the result of the decorated 
      function.

    * LocationConfig now has a set_user_option(key, value) call to save
      a setting in its matching location section (a new one is created
      if needed).

    * Branch has two new methods, get_push_location and set_push_location
      to respectively, get and set the push location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
        self.failUnless(isinstance(self.branch._transaction,
335
335
                                   transactions.PassThroughTransaction))
336
336
        self.branch.unlock()
 
337
 
 
338
 
 
339
class TestBranchPushLocations(TestCaseInTempDir):
 
340
 
 
341
    def setUp(self):
 
342
        super(TestBranchPushLocations, self).setUp()
 
343
        self.branch = Branch.initialize('.')
 
344
        
 
345
    def test_get_push_location_unset(self):
 
346
        self.assertEqual(None, self.branch.get_push_location())
 
347
 
 
348
    def test_get_push_location_exact(self):
 
349
        self.build_tree(['.bazaar/'])
 
350
        print >> open('.bazaar/branches.conf', 'wt'), ("[%s]\n"
 
351
                                                       "push_location=foo" %
 
352
                                                       os.getcwdu())
 
353
        self.assertEqual("foo", self.branch.get_push_location())
 
354
 
 
355
    def test_set_push_location(self):
 
356
        self.branch.set_push_location('foo')
 
357
        self.assertFileEqual("[%s]\n"
 
358
                             "push_location = foo" % os.getcwdu(),
 
359
                             '.bazaar/branches.conf')
 
360
 
 
361
    # TODO RBC 20051029 test getting a push location from a branch in a 
 
362
    # recursive section - that is, it appends the branch name.