~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: 2011-01-12 01:01:53 UTC
  • mfrom: (5597 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5599.
  • Revision ID: john@arbash-meinel.com-20110112010153-op19823r9e6hy7u6
Merge bzr.dev 5597 to resolve NEWS, aka bzr-2.3.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
import sys
23
23
 
24
24
from bzrlib import (
 
25
    bzrdir,
25
26
    osutils,
26
27
    ignores,
27
28
    msgeditor,
32
33
from bzrlib.tests import (
33
34
    probe_bad_non_ascii,
34
35
    TestSkipped,
 
36
    UnicodeFilenameFeature,
35
37
    )
36
38
from bzrlib.tests import TestCaseWithTransport
37
39
 
111
113
    def test_unicode_commit_message_is_filename(self):
112
114
        """Unicode commit message same as a filename (Bug #563646).
113
115
        """
 
116
        self.requireFeature(UnicodeFilenameFeature)
114
117
        file_name = u'\N{euro sign}'
115
118
        self.run_bzr(['init'])
116
119
        open(file_name, 'w').write('hello world')
716
719
            f = file('fed.bat', 'w')
717
720
            f.write('@rem dummy fed')
718
721
            f.close()
719
 
            osutils.set_or_unset_env('BZR_EDITOR', "fed.bat")
 
722
            self.overrideEnv('BZR_EDITOR', "fed.bat")
720
723
        else:
721
724
            f = file('fed.sh', 'wb')
722
725
            f.write('#!/bin/sh\n')
723
726
            f.close()
724
727
            os.chmod('fed.sh', 0755)
725
 
            osutils.set_or_unset_env('BZR_EDITOR', "./fed.sh")
 
728
            self.overrideEnv('BZR_EDITOR', "./fed.sh")
726
729
 
727
730
    def setup_commit_with_template(self):
728
731
        self.setup_editor()
753
756
        os.chdir('foo')
754
757
        open('foo.txt', 'w').write('hello')
755
758
        self.run_bzr(['add'])
756
 
        osutils.set_or_unset_env('EMAIL', None)
757
 
        osutils.set_or_unset_env('BZR_EMAIL', None)
 
759
        self.overrideEnv('EMAIL', None)
 
760
        self.overrideEnv('BZR_EMAIL', None)
758
761
        out, err = self.run_bzr(['commit', '-m', 'initial'], 3)
759
762
        self.assertContainsRe(err, 'Unable to determine your name')
 
763
 
 
764
    def test_commit_recursive_checkout(self):
 
765
        """Ensure that a commit to a recursive checkout fails cleanly.
 
766
        """
 
767
        self.run_bzr(['init', 'test_branch'])
 
768
        self.run_bzr(['checkout', 'test_branch', 'test_checkout'])
 
769
        os.chdir('test_checkout')
 
770
        self.run_bzr(['bind', '.']) # bind to self
 
771
        open('foo.txt', 'w').write('hello')
 
772
        self.run_bzr(['add'])
 
773
        out, err = self.run_bzr(['commit', '-m', 'addedfoo'], 3)
 
774
        self.assertEqual(out, '')
 
775
        self.assertContainsRe(err,
 
776
            'Branch.*test_checkout.*appears to be bound to itself')
 
777