~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-30 00:55:00 UTC
  • mto: (3815.2.5 prepare-1.9)
  • mto: This revision was merged to the branch mainline in revision 3811.
  • Revision ID: john@arbash-meinel.com-20081030005500-r5cej1cxflqhs3io
Switch so that we are using a simple timestamp as the first action.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import os
21
21
import sys
22
22
 
23
 
import bzrlib
24
23
from bzrlib import (
25
24
    osutils,
26
25
    ignores,
248
247
        # LANG env variable has no effect on Windows
249
248
        # but some characters anyway cannot be represented
250
249
        # in default user encoding
251
 
        char = probe_bad_non_ascii(bzrlib.user_encoding)
 
250
        char = probe_bad_non_ascii(osutils.get_user_encoding())
252
251
        if char is None:
253
252
            raise TestSkipped('Cannot find suitable non-ascii character'
254
 
                'for user_encoding (%s)' % bzrlib.user_encoding)
 
253
                'for user_encoding (%s)' % osutils.get_user_encoding())
255
254
        out,err = self.run_bzr_subprocess('commit -m "%s"' % char,
256
255
                                          retcode=1,
257
256
                                          env_changes={'LANG': 'C'})
331
330
        self.build_tree_contents([('u1/hosts', 'merge resolution\n')])
332
331
        self.run_bzr('commit -m checkin-merge-of-the-offline-work-from-u1 u1')
333
332
 
 
333
    def test_commit_exclude_excludes_modified_files(self):
 
334
        """Commit -x foo should ignore changes to foo."""
 
335
        tree = self.make_branch_and_tree('.')
 
336
        self.build_tree(['a', 'b', 'c'])
 
337
        tree.smart_add(['.'])
 
338
        out, err = self.run_bzr(['commit', '-m', 'test', '-x', 'b'])
 
339
        self.assertFalse('added b' in out)
 
340
        self.assertFalse('added b' in err)
 
341
        # If b was excluded it will still be 'added' in status.
 
342
        out, err = self.run_bzr(['added'])
 
343
        self.assertEqual('b\n', out)
 
344
        self.assertEqual('', err)
 
345
 
 
346
    def test_commit_exclude_twice_uses_both_rules(self):
 
347
        """Commit -x foo -x bar should ignore changes to foo and bar."""
 
348
        tree = self.make_branch_and_tree('.')
 
349
        self.build_tree(['a', 'b', 'c'])
 
350
        tree.smart_add(['.'])
 
351
        out, err = self.run_bzr(['commit', '-m', 'test', '-x', 'b', '-x', 'c'])
 
352
        self.assertFalse('added b' in out)
 
353
        self.assertFalse('added c' in out)
 
354
        self.assertFalse('added b' in err)
 
355
        self.assertFalse('added c' in err)
 
356
        # If b was excluded it will still be 'added' in status.
 
357
        out, err = self.run_bzr(['added'])
 
358
        self.assertTrue('b\n' in out)
 
359
        self.assertTrue('c\n' in out)
 
360
        self.assertEqual('', err)
 
361
 
334
362
    def test_commit_respects_spec_for_removals(self):
335
363
        """Commit with a file spec should only commit removals that match"""
336
364
        t = self.make_branch_and_tree('.')