[PATCH 4 of 5] eliminate scmutil.portabilityalert

Adrian Buehlmann adrian at cadifra.com
Sat Apr 30 18:20:11 CDT 2011


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1304201447 -7200
# Node ID 199a53a68e881fec42df2e51392ab503ee319c41
# Parent  e4ad6b8376cf7dcf8826173b6e308bf85c5b9d0f
eliminate scmutil.portabilityalert

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1325,8 +1325,11 @@
         if exact or f not in repo.dirstate:
             if existing:
                 if f.lower() in existing and existing[f.lower()] != f:
-                    scmutil.portabilityalert(ui, abort, warn,
-                        _('possible case-folding collision for %s') % f)
+                    msg = _('possible case-folding collision for %s') % f
+                    if abort:
+                        raise util.Abort("%s" % msg)
+                    elif warn:
+                        ui.warn(_("warning: %s\n") % msg)
                 existing[f.lower()] = f
             names.append(f)
             if ui.verbose or not exact:
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -21,7 +21,11 @@
     if abort or warn:
         msg = util.checkwinfilename(f)
         if msg:
-            portabilityalert(ui, abort, warn, "%s: %r" % (msg, f))
+            msg = "%s: %r" % (msg, f)
+            if abort:
+                raise util.Abort("%s" % msg)
+            elif warn:
+                ui.warn(_("warning: %s\n") % msg)
 
 def checkportabilityalert(ui):
     '''check if the user's config requests nothing, a warning, or abort for
@@ -36,12 +40,6 @@
             _("ui.portablefilenames value is invalid ('%s')") % val)
     return abort, warn
 
-def portabilityalert(ui, abort, warn, msg):
-    if abort:
-        raise util.Abort("%s" % msg)
-    elif warn:
-        ui.warn(_("warning: %s\n") % msg)
-
 class path_auditor(object):
     '''ensure that a filesystem path contains no banned components.
     the following properties of a path are checked:


More information about the Mercurial-devel mailing list