# HG changeset patch # User Marcin Kuzminski # Date 2011-10-16 23:48:00 # Node ID a9888895b60d1af2a16fecfe670a3e39327ed290 # Parent ff41d5f00e28d296303e39f29125e83a01157330 added quiet flag into get_current_revision diff --git a/rhodecode/lib/__init__.py b/rhodecode/lib/__init__.py --- a/rhodecode/lib/__init__.py +++ b/rhodecode/lib/__init__.py @@ -383,10 +383,12 @@ def get_changeset_safe(repo, rev): return cs -def get_current_revision(): +def get_current_revision(quiet=False): """ Returns tuple of (number, id) from repository containing this package or None if repository could not be found. + + :param quiet: prints error for fetching revision if True """ try: @@ -399,6 +401,8 @@ def get_current_revision(): tip = repo.get_changeset() return (tip.revision, tip.short_id) except (ImportError, RepositoryError, VCSError), err: - print ("Cannot retrieve rhodecode's revision. Original error " - "was: %s" % err) + if not quiet: + print ("Cannot retrieve rhodecode's revision. Original error " + "was: %s" % err) return None +