Refactor error message display in project.py
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/project.py b/project.py
index 6ffbd02..33cb344 100644
--- a/project.py
+++ b/project.py
@@ -34,6 +34,10 @@
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 @@
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):