/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/tests/blackbox/test_commit.py

  • Committer: Martin Pool
  • Date: 2009-11-26 01:42:06 UTC
  • mfrom: (4827 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4828.
  • Revision ID: mbp@sourcefrog.net-20091126014206-qvf8jfpwpro558r4
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    ignores,
26
26
    msgeditor,
27
27
    osutils,
 
28
    tests,
28
29
    )
29
30
from bzrlib.bzrdir import BzrDir
30
31
from bzrlib.tests import (
263
264
        self.run_bzr('commit -m ""', retcode=3)
264
265
 
265
266
    def test_unsupported_encoding_commit_message(self):
 
267
        if sys.platform == 'win32':
 
268
            raise tests.TestNotApplicable('Win32 parses arguments directly'
 
269
                ' as Unicode, so we can\'t pass invalid non-ascii')
266
270
        tree = self.make_branch_and_tree('.')
267
271
        self.build_tree_contents([('foo.c', 'int main() {}')])
268
272
        tree.add('foo.c')
273
277
        if char is None:
274
278
            raise TestSkipped('Cannot find suitable non-ascii character'
275
279
                'for user_encoding (%s)' % osutils.get_user_encoding())
276
 
        # TODO: jam 2009-07-23 This test seems to fail on Windows now. My best
277
 
        #       guess is that the change to use Unicode command lines means
278
 
        #       that we no longer pay any attention to LANG=C when decoding the
279
 
        #       commandline arguments.
280
280
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
281
281
                                          retcode=1,
282
282
                                          env_changes={'LANG': 'C'})
608
608
        properties = last_rev.properties
609
609
        self.assertEqual('John Doe\nJane Rey', properties['authors'])
610
610
 
 
611
    def test_commit_time(self):
 
612
        tree = self.make_branch_and_tree('tree')
 
613
        self.build_tree(['tree/hello.txt'])
 
614
        tree.add('hello.txt')
 
615
        out, err = self.run_bzr("commit -m hello "
 
616
            "--commit-time='2009-10-10 08:00:00 +0100' tree/hello.txt")
 
617
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
 
618
        self.assertEqual(
 
619
            'Sat 2009-10-10 08:00:00 +0100',
 
620
            osutils.format_date(last_rev.timestamp, last_rev.timezone))
 
621
        
 
622
    def test_commit_time_bad_time(self):
 
623
        tree = self.make_branch_and_tree('tree')
 
624
        self.build_tree(['tree/hello.txt'])
 
625
        tree.add('hello.txt')
 
626
        out, err = self.run_bzr("commit -m hello "
 
627
            "--commit-time='NOT A TIME' tree/hello.txt", retcode=3)
 
628
        self.assertStartsWith(
 
629
            err, "bzr: ERROR: Could not parse --commit-time:")
 
630
 
611
631
    def test_partial_commit_with_renames_in_tree(self):
612
632
        # this test illustrates bug #140419
613
633
        t = self.make_branch_and_tree('.')