diff mercurial/simplemerge.py @ 8266:bb9f13974d8e

simplemerge: use ui.warn() for warnings
author Steve Borho <steve@borho.org>
date Thu, 30 Apr 2009 23:57:36 -0500 (2009-05-01)
parents 810ca383da9c
children b87a50b7125c
line wrap: on
line diff
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -24,11 +24,6 @@
 class CantReprocessAndShowBase(Exception):
     pass
 
-def warn(message):
-    sys.stdout.flush()
-    sys.stderr.write(message)
-    sys.stderr.flush()
-
 def intersect(ra, rb):
     """Given two ranges return the range where they intersect or None.
 
@@ -405,7 +400,7 @@
 
         return unc
 
-def simplemerge(local, base, other, **opts):
+def simplemerge(ui, local, base, other, **opts):
     def readfile(filename):
         f = open(filename, "rb")
         text = f.read()
@@ -415,7 +410,7 @@
             if not opts.get('text'):
                 raise util.Abort(msg)
             elif not opts.get('quiet'):
-                warn(_('warning: %s\n') % msg)
+                ui.warn(_('warning: %s\n') % msg)
         return text
 
     name_a = local
@@ -451,5 +446,5 @@
 
     if m3.conflicts:
         if not opts.get('quiet'):
-            warn(_("warning: conflicts during merge.\n"))
+            ui.warn(_("warning: conflicts during merge.\n"))
         return 1