Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 42974:71bb9363818c
merge: check argument value with if/raise instead of an assert
This shouldn't make any difference for legal code, but it'll prevent
the assertion from being optimized out if someone decides to do -O on
our code.
Differential Revision: https://phab.mercurial-scm.org/D6879
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 25 Sep 2019 11:04:08 -0400 |
parents | 1ad3ebb39c61 |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
42973:ee1ef76d7339 | 42974:71bb9363818c |
---|---|
1996 # TODO: remove the default once all callers that pass branchmerge=False | 1996 # TODO: remove the default once all callers that pass branchmerge=False |
1997 # and force=False pass a value for updatecheck. We may want to allow | 1997 # and force=False pass a value for updatecheck. We may want to allow |
1998 # updatecheck='abort' to better suppport some of these callers. | 1998 # updatecheck='abort' to better suppport some of these callers. |
1999 if updatecheck is None: | 1999 if updatecheck is None: |
2000 updatecheck = UPDATECHECK_LINEAR | 2000 updatecheck = UPDATECHECK_LINEAR |
2001 assert updatecheck in (UPDATECHECK_NONE, | 2001 if updatecheck not in (UPDATECHECK_NONE, |
2002 UPDATECHECK_LINEAR, | 2002 UPDATECHECK_LINEAR, |
2003 UPDATECHECK_NO_CONFLICT, | 2003 UPDATECHECK_NO_CONFLICT, |
2004 ) | 2004 ): |
2005 raise ValueError(r'Invalid updatecheck %r (can accept %r)' % ( | |
2006 updatecheck, (UPDATECHECK_NONE, | |
2007 UPDATECHECK_LINEAR, | |
2008 UPDATECHECK_NO_CONFLICT, | |
2009 ))) | |
2005 # If we're doing a partial update, we need to skip updating | 2010 # If we're doing a partial update, we need to skip updating |
2006 # the dirstate, so make a note of any partial-ness to the | 2011 # the dirstate, so make a note of any partial-ness to the |
2007 # update here. | 2012 # update here. |
2008 if matcher is None or matcher.always(): | 2013 if matcher is None or matcher.always(): |
2009 partial = False | 2014 partial = False |