Mercurial > hg
changeset 28226:377f0d8ff874
merge: use any() instead of for loop when checking for dirty subrepos
I think it's both simpler and clearer to use any() than the current
for loop.
While at it, also drop the call to sorted(), since it doesn't matter
which order we iterate over subrepos.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 23 Feb 2016 10:59:25 -0800 |
parents | 5c11702fe2a3 |
children | 1c36cc8e7870 |
files | mercurial/merge.py |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Feb 24 19:31:55 2016 +0000 +++ b/mercurial/merge.py Tue Feb 23 10:59:25 2016 -0800 @@ -801,10 +801,8 @@ if '.hgsubstate' in m1: # check whether sub state is modified - for s in sorted(wctx.substate): - if wctx.sub(s).dirty(): - m1['.hgsubstate'] += '+' - break + if any(wctx.sub(s).dirty() for s in wctx.substate): + m1['.hgsubstate'] += '+' # Compare manifests if matcher is not None: