comparison tests/test-simplemerge.py @ 26587:56b2bcea2529

error: get Abort from 'error' instead of 'util' The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be confused about that and gives all the credit to 'util' instead of the hardworking 'error'. In a spirit of equity, we break the cycle of injustice and give back to 'error' the respect it deserves. And screw that 'util' poser. For great justice.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 08 Oct 2015 12:55:45 -0700
parents f18830651811
children 86db5cb55d46
comparison
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, see <http://www.gnu.org/licenses/>. 14 # along with this program; if not, see <http://www.gnu.org/licenses/>.
15 15
16 import unittest 16 import unittest
17 from unittest import TestCase 17 from unittest import TestCase
18 from mercurial import util, simplemerge 18 from mercurial import util, simplemerge, error
19 19
20 # bzr compatible interface, for the tests 20 # bzr compatible interface, for the tests
21 class Merge3(simplemerge.Merge3Text): 21 class Merge3(simplemerge.Merge3Text):
22 """3-way merge of texts. 22 """3-way merge of texts.
23 23
27 def __init__(self, base, a, b): 27 def __init__(self, base, a, b):
28 basetext = '\n'.join([i.strip('\n') for i in base] + ['']) 28 basetext = '\n'.join([i.strip('\n') for i in base] + [''])
29 atext = '\n'.join([i.strip('\n') for i in a] + ['']) 29 atext = '\n'.join([i.strip('\n') for i in a] + [''])
30 btext = '\n'.join([i.strip('\n') for i in b] + ['']) 30 btext = '\n'.join([i.strip('\n') for i in b] + [''])
31 if util.binary(basetext) or util.binary(atext) or util.binary(btext): 31 if util.binary(basetext) or util.binary(atext) or util.binary(btext):
32 raise util.Abort("don't know how to merge binary files") 32 raise error.Abort("don't know how to merge binary files")
33 simplemerge.Merge3Text.__init__(self, basetext, atext, btext, 33 simplemerge.Merge3Text.__init__(self, basetext, atext, btext,
34 base, a, b) 34 base, a, b)
35 35
36 CantReprocessAndShowBase = simplemerge.CantReprocessAndShowBase 36 CantReprocessAndShowBase = simplemerge.CantReprocessAndShowBase
37 37
319 self.log('merge result:') 319 self.log('merge result:')
320 self.log(''.join(ml)) 320 self.log(''.join(ml))
321 self.assertEquals(ml, MERGED_RESULT) 321 self.assertEquals(ml, MERGED_RESULT)
322 322
323 def test_binary(self): 323 def test_binary(self):
324 self.assertRaises(util.Abort, Merge3, ['\x00'], ['a'], ['b']) 324 self.assertRaises(error.Abort, Merge3, ['\x00'], ['a'], ['b'])
325 325
326 def test_dos_text(self): 326 def test_dos_text(self):
327 base_text = 'a\r\n' 327 base_text = 'a\r\n'
328 this_text = 'b\r\n' 328 this_text = 'b\r\n'
329 other_text = 'c\r\n' 329 other_text = 'c\r\n'