Mercurial > hg
changeset 8526:f78eadbb5769
patch: simplify Boolean expression slightly
The context variable is either True, False or None. Abbreviate it as C
and we get the following truth table where the second column is the
original expression and the third column is the new expression:
C | C or C == None | C is not False
True | True | True
False | False | False
None | True | True
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 20 May 2009 00:43:23 +0200 |
parents | b169ba60eebe |
children | f9a80054dd3c |
files | mercurial/patch.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Tue May 05 10:29:34 2009 +0200 +++ b/mercurial/patch.py Wed May 20 00:43:23 2009 +0200 @@ -870,7 +870,7 @@ current_hunk = None gitworkdone = False if ((sourcefile or state == BFILE) and ((not context and x[0] == '@') or - ((context or context == None) and x.startswith('***************')))): + ((context is not False) and x.startswith('***************')))): try: if context == None and x.startswith('***************'): context = True