Show More
@@ -272,7 +272,9 b' def debugbuilddag(' | |||
|
272 | 272 | x[fn].data() for x in (pa, p1, p2) |
|
273 | 273 | ] |
|
274 | 274 | m3 = simplemerge.Merge3Text(base, local, other) |
|
275 | ml = [l.strip() for l in simplemerge.merge_lines(m3)[0]] | |
|
275 | ml = [ | |
|
276 | l.strip() for l in simplemerge.render_markers(m3)[0] | |
|
277 | ] | |
|
276 | 278 | ml.append(b"") |
|
277 | 279 | elif at > 0: |
|
278 | 280 | ml = p1[fn].data().split(b"\n") |
@@ -341,7 +341,7 b' def _picklabels(defaults, overrides):' | |||
|
341 | 341 | return result |
|
342 | 342 | |
|
343 | 343 | |
|
344 | def merge_lines( | |
|
344 | def render_markers( | |
|
345 | 345 | m3, |
|
346 | 346 | name_a=None, |
|
347 | 347 | name_b=None, |
@@ -390,7 +390,7 b' def merge_lines(' | |||
|
390 | 390 | return lines, conflicts |
|
391 | 391 | |
|
392 | 392 | |
|
393 | def _mergediff(m3, name_a, name_b, name_base): | |
|
393 | def render_mergediff(m3, name_a, name_b, name_base): | |
|
394 | 394 | lines = [] |
|
395 | 395 | conflicts = False |
|
396 | 396 | for what, group_lines in m3.merge_groups(): |
@@ -500,7 +500,7 b' def simplemerge(ui, localctx, basectx, o' | |||
|
500 | 500 | [localctx.path(), otherctx.path(), None], opts.get('label', []) |
|
501 | 501 | ) |
|
502 | 502 | if mode == b'mergediff': |
|
503 | lines, conflicts = _mergediff(m3, name_a, name_b, name_base) | |
|
503 | lines, conflicts = render_mergediff(m3, name_a, name_b, name_base) | |
|
504 | 504 | else: |
|
505 | 505 | extrakwargs = { |
|
506 | 506 | 'minimize': True, |
@@ -509,7 +509,7 b' def simplemerge(ui, localctx, basectx, o' | |||
|
509 | 509 | extrakwargs['base_marker'] = b'|||||||' |
|
510 | 510 | extrakwargs['name_base'] = name_base |
|
511 | 511 | extrakwargs['minimize'] = False |
|
512 |
lines, conflicts = |
|
|
512 | lines, conflicts = render_markers( | |
|
513 | 513 | m3, name_a=name_a, name_b=name_b, **extrakwargs |
|
514 | 514 | ) |
|
515 | 515 |
@@ -179,7 +179,9 b' class TestMerge3(TestCase):' | |||
|
179 | 179 | |
|
180 | 180 | self.assertEqual(list(m3.merge_regions()), [(b'a', 0, 2)]) |
|
181 | 181 | |
|
182 | self.assertEqual(simplemerge.merge_lines(m3), ([b'aaa', b'bbb'], False)) | |
|
182 | self.assertEqual( | |
|
183 | simplemerge.render_markers(m3), ([b'aaa', b'bbb'], False) | |
|
184 | ) | |
|
183 | 185 | |
|
184 | 186 | def test_no_conflicts(self): |
|
185 | 187 | """No conflicts because only one side changed""" |
@@ -205,7 +207,7 b' class TestMerge3(TestCase):' | |||
|
205 | 207 | ) |
|
206 | 208 | |
|
207 | 209 | self.assertEqual( |
|
208 |
b''.join(simplemerge. |
|
|
210 | b''.join(simplemerge.render_markers(m3)[0]), b'aaa\nbbb\n222\n' | |
|
209 | 211 | ) |
|
210 | 212 | |
|
211 | 213 | def test_append_b(self): |
@@ -216,7 +218,7 b' class TestMerge3(TestCase):' | |||
|
216 | 218 | ) |
|
217 | 219 | |
|
218 | 220 | self.assertEqual( |
|
219 |
b''.join(simplemerge. |
|
|
221 | b''.join(simplemerge.render_markers(m3)[0]), b'aaa\nbbb\n222\n' | |
|
220 | 222 | ) |
|
221 | 223 | |
|
222 | 224 | def test_append_agreement(self): |
@@ -227,7 +229,7 b' class TestMerge3(TestCase):' | |||
|
227 | 229 | ) |
|
228 | 230 | |
|
229 | 231 | self.assertEqual( |
|
230 |
b''.join(simplemerge. |
|
|
232 | b''.join(simplemerge.render_markers(m3)[0]), b'aaa\nbbb\n222\n' | |
|
231 | 233 | ) |
|
232 | 234 | |
|
233 | 235 | def test_append_clash(self): |
@@ -237,7 +239,7 b' class TestMerge3(TestCase):' | |||
|
237 | 239 | [b'aaa\n', b'bbb\n', b'333\n'], |
|
238 | 240 | ) |
|
239 | 241 | |
|
240 |
ml, conflicts = simplemerge. |
|
|
242 | ml, conflicts = simplemerge.render_markers( | |
|
241 | 243 | m3, |
|
242 | 244 | name_a=b'a', |
|
243 | 245 | name_b=b'b', |
@@ -257,7 +259,7 b' class TestMerge3(TestCase):' | |||
|
257 | 259 | [b'aaa\n', b'222\n', b'bbb\n'], |
|
258 | 260 | ) |
|
259 | 261 | |
|
260 |
ml, conflicts = simplemerge. |
|
|
262 | ml, conflicts = simplemerge.render_markers( | |
|
261 | 263 | m3, |
|
262 | 264 | name_a=b'a', |
|
263 | 265 | name_b=b'b', |
@@ -298,7 +300,7 b' class TestMerge3(TestCase):' | |||
|
298 | 300 | ], |
|
299 | 301 | ) |
|
300 | 302 | |
|
301 |
ml, conflicts = simplemerge. |
|
|
303 | ml, conflicts = simplemerge.render_markers( | |
|
302 | 304 | m3, |
|
303 | 305 | name_a=b'a', |
|
304 | 306 | name_b=b'b', |
@@ -347,7 +349,7 b' bbb' | |||
|
347 | 349 | def test_merge_poem(self): |
|
348 | 350 | """Test case from diff3 manual""" |
|
349 | 351 | m3 = Merge3(TZU, LAO, TAO) |
|
350 |
ml, conflicts = simplemerge. |
|
|
352 | ml, conflicts = simplemerge.render_markers(m3, b'LAO', b'TAO') | |
|
351 | 353 | self.log(b'merge result:') |
|
352 | 354 | self.log(b''.join(ml)) |
|
353 | 355 | self.assertEqual(ml, MERGED_RESULT) |
@@ -365,7 +367,7 b' bbb' | |||
|
365 | 367 | other_text.splitlines(True), |
|
366 | 368 | this_text.splitlines(True), |
|
367 | 369 | ) |
|
368 |
m_lines, conflicts = simplemerge. |
|
|
370 | m_lines, conflicts = simplemerge.render_markers(m3, b'OTHER', b'THIS') | |
|
369 | 371 | self.assertEqual( |
|
370 | 372 | b'<<<<<<< OTHER\r\nc\r\n=======\r\nb\r\n' |
|
371 | 373 | b'>>>>>>> THIS\r\n'.splitlines(True), |
@@ -381,7 +383,7 b' bbb' | |||
|
381 | 383 | other_text.splitlines(True), |
|
382 | 384 | this_text.splitlines(True), |
|
383 | 385 | ) |
|
384 |
m_lines, conflicts = simplemerge. |
|
|
386 | m_lines, conflicts = simplemerge.render_markers(m3, b'OTHER', b'THIS') | |
|
385 | 387 | self.assertEqual( |
|
386 | 388 | b'<<<<<<< OTHER\rc\r=======\rb\r' |
|
387 | 389 | b'>>>>>>> THIS\r'.splitlines(True), |
General Comments 0
You need to be logged in to leave comments.
Login now