From 6eee79466abb29c96ee08261bf3b1acc909a8c1a Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 7 Jun 2016 14:44:51 +0000 Subject: [PATCH] Use consistent formatting for deprecations Add a warn() function for use in consistently displaying warning messages, for use in things like deprecation warnings. Also make the one current deprecation warning use this and be more explicit about future removal. Change-Id: I423524b30233ae45fbc04133566acf7a23828036 --- git_review/cmd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git_review/cmd.py b/git_review/cmd.py index 16c180bb..e099ae92 100755 --- a/git_review/cmd.py +++ b/git_review/cmd.py @@ -110,6 +110,10 @@ def printwrap(unwrapped): print('\n'.join(textwrap.wrap(unwrapped))) +def warn(warning): + printwrap("WARNING: %s") + + def parse_review_number(review): parts = review.split(',') if len(parts) < 2: @@ -280,8 +284,9 @@ class Config(object): if os.path.exists(filename): if filename != config_file: msg = ("Using global/system git-review config files (%s) " - "is deprecated") - print(msg % filename) + "is deprecated and will be removed in a future " + "release") + warn(msg % filename) self.config.update(load_config_file(filename)) def __getitem__(self, key):