From 48244781c2cad1565b4b32b4524ff9931a39f848 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 16 Apr 2009 08:25:57 -0700 Subject: [PATCH] Refactor error message display in project.py Signed-off-by: Shawn O. Pearce --- project.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/project.py b/project.py index 6ffbd023..33cb3444 100644 --- a/project.py +++ b/project.py @@ -34,6 +34,10 @@ R_TAGS = 'refs/tags/' R_PUB = 'refs/published/' R_M = 'refs/remotes/m/' +def _error(fmt, *args): + msg = fmt % args + print >>sys.stderr, 'error: %s' % msg + def _warn(fmt, *args): msg = fmt % args print >>sys.stderr, 'warn: %s' % msg @@ -199,9 +203,7 @@ class _CopyFile: mode = mode & ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH) os.chmod(dest, mode) except IOError: - print >>sys.stderr, \ - 'error: Cannot copy file %s to %s' \ - % (src, dest) + _error('Cannot copy file %s to %s', src, dest) class Project(object):