From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Tue, 26 Mar 2013 15:46:02 -0700 Subject: [U-Boot] [PATCH 5/8] patman: Provide option to ignore bad aliases In-Reply-To: References: <1363833781-14557-1-git-send-email-sjg@chromium.org> <1363833781-14557-6-git-send-email-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Doug, On Thu, Mar 21, 2013 at 10:09 AM, Doug Anderson wrote: > Simon, > > Nothing critical and this could go in as-is, but a few nits below. > > > On Wed, Mar 20, 2013 at 7:42 PM, Simon Glass wrote: >> - raw += LookupEmail(item, alias) >> + raw += LookupEmail(item, alias, raise_on_error=not ignore_errors) > > optional: Change it so functions are consistent about whether it's > "raise_on_error" or "ignore_errors" Will do. > > >> + >>> EmailPatches(series, 'cover', ['p1', 'p2'], True, False, 'cc-fname', \ >> + False, alias) > > Doctest that actually tests the raise_on_error? See doctests in > gitutil.py for example syntax. It is tested by LookupEmail() below. > > >> -def LookupEmail(lookup_name, alias=None, level=0): >> +def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0): >> """If an email address is an alias, look it up and return the full name >> >> TODO: Why not just use git's own alias feature? >> >> Args: >> lookup_name: Alias or email address to look up >> + alias: Dictionary containing aliases (None to use settings default) >> + raise_on_error: True to raise an error when an alias fails to match > > ...and what happens if you pass False? Will add comment. > > >> + >>> LookupEmail('odd', alias, False) >> + \033[1;31mAlias 'odd' not found\033[0m >> + [] >> + >>> # In this case the loop part will effectively be ignored. >> + >>> LookupEmail('loop', alias, False) >> + \033[1;31mRecursive email alias at 'other'\033[0m >> + \033[1;31mRecursive email alias at 'john'\033[0m >> + \033[1;31mRecursive email alias at 'mary'\033[0m >> + ['j.bloggs at napier.co.nz', 'm.poppins at cloud.net'] > > optional nit: for optional args it's nice to specify them with keywords, like > >>> LookupEmail('loop', alias=alias, raise_on_error=False) > > Please test the raise_on_error=True case. Yes, that's the current ignore_errors=False I think, so I will keep this. Regards, Simon