Show More
@@ -22,7 +22,9 b' from .i18n import _' | |||
|
22 | 22 | from . import ( |
|
23 | 23 | error, |
|
24 | 24 | mdiff, |
|
25 | node as nodemod, | |
|
25 | 26 | pycompat, |
|
27 | util, | |
|
26 | 28 | ) |
|
27 | 29 | from .utils import stringutil |
|
28 | 30 | |
@@ -449,6 +451,17 b' def _picklabels(defaults, overrides):' | |||
|
449 | 451 | return result |
|
450 | 452 | |
|
451 | 453 | |
|
454 | def _bytes_to_set(b): | |
|
455 | """turns a multiple bytes (usually flags) into a set of individual byte""" | |
|
456 | return set(b[x : x + 1] for x in range(len(b))) | |
|
457 | ||
|
458 | ||
|
459 | def is_null(ctx): | |
|
460 | if not util.safehasattr(ctx, "node"): | |
|
461 | return False | |
|
462 | return ctx.node() != nodemod.nullid | |
|
463 | ||
|
464 | ||
|
452 | 465 | def simplemerge(ui, localctx, basectx, otherctx, **opts): |
|
453 | 466 | """Performs the simplemerge algorithm. |
|
454 | 467 | |
@@ -503,8 +516,20 b' def simplemerge(ui, localctx, basectx, o' | |||
|
503 | 516 | else: |
|
504 | 517 | mergedtext += line |
|
505 | 518 | |
|
519 | # merge flags if necessary | |
|
520 | flags = localctx.flags() | |
|
521 | localflags = _bytes_to_set(flags) | |
|
522 | otherflags = _bytes_to_set(otherctx.flags()) | |
|
523 | if is_null(basectx) and localflags != otherflags: | |
|
524 | baseflags = _bytes_to_set(basectx.flags()) | |
|
525 | flags = localflags & otherflags | |
|
526 | for f in localflags.symmetric_difference(otherflags): | |
|
527 | if f not in baseflags: | |
|
528 | flags.add(f) | |
|
529 | flags = b''.join(sorted(flags)) | |
|
530 | ||
|
506 | 531 | if not opts.get(b'print'): |
|
507 |
localctx.write(mergedtext, |
|
|
532 | localctx.write(mergedtext, flags) | |
|
508 | 533 | |
|
509 | 534 | if m3.conflicts and not mode == b'union': |
|
510 | 535 | return 1 |
General Comments 0
You need to be logged in to leave comments.
Login now