From ea09f8ce7b1bcea38a7d9f0079a28c6109989342 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 21 Dec 2008 11:55:52 +0100 Subject: [PATCH] stg mail: Improve error message for unknown sender identity MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Organization: Straylight/Edgeware From: Gustav Hållberg Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- stgit/commands/mail.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index 2dd88c3..cab896b 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -154,9 +154,14 @@ def __get_sender(): try: sender = str(git.user()) except git.GitException: - sender = str(git.author()) + try: + sender = str(git.author()) + except git.GitException: + pass if not sender: - raise CmdException, 'unknown sender details' + raise CmdException, ('Unknown sender name and e-mail; you should' + ' for example set git config user.name and' + ' user.email') sender = email.Utils.parseaddr(sender) return email.Utils.formataddr(address_or_alias(sender)) @@ -551,6 +556,9 @@ def func(parser, options, args): else: raise CmdException, 'Incorrect options. Unknown patches to send' + # early test for sender identity + __get_sender() + out.start('Checking the validity of the patches') for p in patches: if crt_series.empty_patch(p): -- [mdw]