Show More
@@ -22,7 +22,9 b' from .i18n import _' | |||||
22 | from . import ( |
|
22 | from . import ( | |
23 | error, |
|
23 | error, | |
24 | mdiff, |
|
24 | mdiff, | |
|
25 | node as nodemod, | |||
25 | pycompat, |
|
26 | pycompat, | |
|
27 | util, | |||
26 | ) |
|
28 | ) | |
27 | from .utils import stringutil |
|
29 | from .utils import stringutil | |
28 |
|
30 | |||
@@ -449,6 +451,17 b' def _picklabels(defaults, overrides):' | |||||
449 | return result |
|
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 | def simplemerge(ui, localctx, basectx, otherctx, **opts): |
|
465 | def simplemerge(ui, localctx, basectx, otherctx, **opts): | |
453 | """Performs the simplemerge algorithm. |
|
466 | """Performs the simplemerge algorithm. | |
454 |
|
467 | |||
@@ -503,8 +516,20 b' def simplemerge(ui, localctx, basectx, o' | |||||
503 | else: |
|
516 | else: | |
504 | mergedtext += line |
|
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 | if not opts.get(b'print'): |
|
531 | if not opts.get(b'print'): | |
507 |
localctx.write(mergedtext, |
|
532 | localctx.write(mergedtext, flags) | |
508 |
|
533 | |||
509 | if m3.conflicts and not mode == b'union': |
|
534 | if m3.conflicts and not mode == b'union': | |
510 | return 1 |
|
535 | return 1 |
General Comments 0
You need to be logged in to leave comments.
Login now