Mercurial > hg
comparison contrib/simplemerge @ 4408:1ef4445c6506
simplemerge: flush stdout before writing to stderr.
Besides, stderr is not always unbuffered under win32 (when redirections occur for instance), and it should be flushed too.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 06 May 2007 16:40:53 +0200 |
parents | d5c3a70f8422 |
children | ea7b982b6c08 |
comparison
equal
deleted
inserted
replaced
4407:f97b89314fb3 | 4408:1ef4445c6506 |
---|---|
26 from mercurial.i18n import _ | 26 from mercurial.i18n import _ |
27 | 27 |
28 | 28 |
29 class CantReprocessAndShowBase(Exception): | 29 class CantReprocessAndShowBase(Exception): |
30 pass | 30 pass |
31 | |
32 | |
33 def warn(message): | |
34 sys.stdout.flush() | |
35 sys.stderr.write(message) | |
36 sys.stderr.flush() | |
31 | 37 |
32 | 38 |
33 def intersect(ra, rb): | 39 def intersect(ra, rb): |
34 """Given two ranges return the range where they intersect or None. | 40 """Given two ranges return the range where they intersect or None. |
35 | 41 |
451 if util.binary(text): | 457 if util.binary(text): |
452 msg = _("%s looks like a binary file.") % filename | 458 msg = _("%s looks like a binary file.") % filename |
453 if not opts.get('text'): | 459 if not opts.get('text'): |
454 raise util.Abort(msg) | 460 raise util.Abort(msg) |
455 elif not opts.get('quiet'): | 461 elif not opts.get('quiet'): |
456 sys.stderr.write(_('warning: %s\n') % msg) | 462 warn(_('warning: %s\n') % msg) |
457 return text | 463 return text |
458 | 464 |
459 name_a = local | 465 name_a = local |
460 name_b = other | 466 name_b = other |
461 labels = opts.get('label', []) | 467 labels = opts.get('label', []) |
488 if not opts.get('print'): | 494 if not opts.get('print'): |
489 out.rename() | 495 out.rename() |
490 | 496 |
491 if m3.conflicts: | 497 if m3.conflicts: |
492 if not opts.get('quiet'): | 498 if not opts.get('quiet'): |
493 sys.stdout.flush() | 499 warn(_("warning: conflicts during merge.\n")) |
494 sys.stderr.write(_("warning: conflicts during merge.\n")) | |
495 return 1 | 500 return 1 |
496 | 501 |
497 options = [('L', 'label', [], _('labels to use on conflict markers')), | 502 options = [('L', 'label', [], _('labels to use on conflict markers')), |
498 ('a', 'text', None, _('treat all files as text')), | 503 ('a', 'text', None, _('treat all files as text')), |
499 ('p', 'print', None, | 504 ('p', 'print', None, |