##// END OF EJS Templates
flags: actually merge flags in simplemerge...
marmoute -
r45398:84614212 stable
parent child Browse files
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, localctx.flags())
532 localctx.write(mergedtext, flags)
508 533
509 534 if m3.conflicts and not mode == b'union':
510 535 return 1
@@ -195,7 +195,6 b' merge them (from the rename side)'
195 195 M z
196 196 a
197 197 $ [ -x z ] || echo "executable bit lost"
198 executable bit lost
199 198
200 199 merge them (from the chmod side)
201 200
General Comments 0
You need to be logged in to leave comments. Login now