~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-27 02:27:19 UTC
  • mfrom: (4634.3.19 gc-batching)
  • Revision ID: pqm@pqm.ubuntu.com-20090827022719-bl2yoqhpj3fcfczu
(andrew) Fix #402657: 2a fetch over dumb transport reads one group at
        a time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Black-box tests for bzr diff.
126
126
        # Get an error from a file that does not exist at all
127
127
        # (Malone #3619)
128
128
        self.make_example_branch()
129
 
        out, err = self.run_bzr('diff does-not-exist', retcode=3)
130
 
        self.assertContainsRe(err, 'not versioned.*does-not-exist')
 
129
        out, err = self.run_bzr('diff does-not-exist', retcode=3,
 
130
            error_regexes=('not versioned.*does-not-exist',))
131
131
 
132
132
    def test_diff_illegal_revision_specifiers(self):
133
 
        out, err = self.run_bzr('diff -r 1..23..123', retcode=3)
134
 
        self.assertContainsRe(err, 'one or two revision specifiers')
 
133
        out, err = self.run_bzr('diff -r 1..23..123', retcode=3,
 
134
            error_regexes=('one or two revision specifiers',))
 
135
 
 
136
    def test_diff_nonexistent_revision(self):
 
137
        out, err = self.run_bzr('diff -r 123', retcode=3,
 
138
            error_regexes=("Requested revision: '123' does not "
 
139
                "exist in branch:",))
 
140
 
 
141
    def test_diff_nonexistent_dotted_revision(self):
 
142
        out, err = self.run_bzr('diff -r 1.1', retcode=3)
 
143
        self.assertContainsRe(err,
 
144
            "Requested revision: '1.1' does not exist in branch:")
 
145
 
 
146
    def test_diff_nonexistent_dotted_revision_change(self):
 
147
        out, err = self.run_bzr('diff -c 1.1', retcode=3)
 
148
        self.assertContainsRe(err,
 
149
            "Requested revision: '1.1' does not exist in branch:")
135
150
 
136
151
    def test_diff_unversioned(self):
137
152
        # Get an error when diffing a non-versioned file.
187
202
 
188
203
    def test_diff_branches(self):
189
204
        self.example_branches()
190
 
        # should open branch1 and diff against branch2, 
 
205
        # should open branch1 and diff against branch2,
191
206
        self.check_b2_vs_b1('diff -r branch:branch2 branch1')
192
207
        # Compare two working trees using various syntax forms
193
208
        self.check_b2_vs_b1('diff --old branch2 --new branch1')
345
360
        # subprocess.py that we had to workaround).
346
361
        # However, if 'diff' may not be available
347
362
        self.make_example_branch()
348
 
        orig_progress = os.environ.get('BZR_PROGRESS_BAR')
349
 
        try:
350
 
            os.environ['BZR_PROGRESS_BAR'] = 'none'
351
 
            out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
352
 
                                               universal_newlines=True,
353
 
                                               retcode=None)
354
 
        finally:
355
 
            if orig_progress is None:
356
 
                del os.environ['BZR_PROGRESS_BAR']
357
 
            else:
358
 
                os.environ['BZR_PROGRESS_BAR'] = orig_progress
359
 
            
 
363
        # this will be automatically restored by the base bzr test class
 
364
        os.environ['BZR_PROGRESS_BAR'] = 'none'
 
365
        out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
 
366
                                           universal_newlines=True,
 
367
                                           retcode=None)
360
368
        if 'Diff is not installed on this machine' in err:
361
369
            raise TestSkipped("No external 'diff' is available")
362
370
        self.assertEqual('', err)