1
# Copyright (C) 2019 Breezy Developers
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
from breezy.tests import TestCaseWithTransport
21
class TestPatch(TestCaseWithTransport):
25
with open('myfile', 'w') as f:
28
self.run_bzr('commit -m hello')
29
with open('myfile', 'w') as f:
31
with open('mypatch', 'w') as f:
32
f.write(self.run_bzr('diff -p1', retcode=1)[0])
33
self.run_bzr('revert')
34
self.assertFileEqual('hello', 'myfile')
35
self.run_bzr('patch -p1 --silent mypatch')
36
self.assertFileEqual('goodbye', 'myfile')
38
def test_patch_invalid_strip(self):
40
args="patch --strip=a",
42
'brz: ERROR: invalid value for option -p/--strip: a'])