Mercurial > hg
diff mercurial/merge.py @ 48703:6c4b10d01af0
merge: break up two not-so-one-liner for extra readability
Differential Revision: https://phab.mercurial-scm.org/D12106
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 28 Jan 2022 14:25:05 +0100 |
parents | ec23b0ba85c2 |
children | 58a2c66fa94c |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Jan 28 14:24:41 2022 +0100 +++ b/mercurial/merge.py Fri Jan 28 14:25:05 2022 +0100 @@ -1885,22 +1885,11 @@ # updatecheck='abort' to better suppport some of these callers. if updatecheck is None: updatecheck = UPDATECHECK_LINEAR - if updatecheck not in ( - UPDATECHECK_NONE, - UPDATECHECK_LINEAR, - UPDATECHECK_NO_CONFLICT, - ): - raise ValueError( - r'Invalid updatecheck %r (can accept %r)' - % ( - updatecheck, - ( - UPDATECHECK_NONE, - UPDATECHECK_LINEAR, - UPDATECHECK_NO_CONFLICT, - ), - ) - ) + okay = (UPDATECHECK_NONE, UPDATECHECK_LINEAR, UPDATECHECK_NO_CONFLICT) + if updatecheck not in okay: + msg = r'Invalid updatecheck %r (can accept %r)' + msg %= (updatecheck, okay) + raise ValueError(msg) if wc is not None and wc.isinmemory(): maybe_wlock = util.nullcontextmanager() else: @@ -1929,10 +1918,9 @@ raise error.StateError(_(b"outstanding uncommitted merge")) ms = wc.mergestate() if ms.unresolvedcount(): - raise error.StateError( - _(b"outstanding merge conflicts"), - hint=_(b"use 'hg resolve' to resolve"), - ) + msg = _(b"outstanding merge conflicts") + hint = _(b"use 'hg resolve' to resolve") + raise error.StateError(msg, hint=hint) if branchmerge: if pas == [p2]: raise error.Abort(