/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/selftest/testrevprops.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:
 
1
# (C) 2005 Canonical
 
2
 
 
3
"""Tests for revision properties."""
 
4
 
 
5
from bzrlib.branch import Branch
 
6
from bzrlib.selftest import TestCaseInTempDir
 
7
 
 
8
class TestRevProps(TestCaseInTempDir):
 
9
    def test_simple_revprops(self):
 
10
        """Simple revision properties"""
 
11
        b = Branch.initialize('.')
 
12
        props = dict(flavor='choc-mint', 
 
13
                     condiment='orange\n  mint\n\tcandy')
 
14
        b.commit(message='initial null commit', 
 
15
                 revprops=props,
 
16
                 allow_pointless=True,
 
17
                 rev_id='test@user-1')
 
18
        rev = b.get_revision('test@user-1')
 
19
        self.assertTrue('flavor' in rev.properties)
 
20
        self.assertEquals(rev.properties['flavor'], 'choc-mint')
 
21
        self.assertEquals(sorted(rev.properties.items()),
 
22
                          [('condiment', 'orange\n  mint\n\tcandy'),
 
23
                           ('flavor', 'choc-mint')])
 
24
 
 
25
    def test_invalid_revprops(self):
 
26
        """Invalid revision properties"""
 
27
        b = Branch.initialize('.')
 
28
        self.assertRaises(ValueError,
 
29
                          b.commit, 
 
30
                          message='invalid',
 
31
                          revprops={'what a silly property': 'fine'})
 
32
        self.assertRaises(ValueError,
 
33
                          b.commit, 
 
34
                          message='invalid',
 
35
                          revprops=dict(number=13))