Mercurial > hg
comparison mercurial/merge.py @ 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 | 588695ccbb22 |
children | 5408e532e50a |
comparison
equal
deleted
inserted
replaced
28225:5c11702fe2a3 | 28226:377f0d8ff874 |
---|---|
799 copied = set(copy.values()) | 799 copied = set(copy.values()) |
800 copied.update(movewithdir.values()) | 800 copied.update(movewithdir.values()) |
801 | 801 |
802 if '.hgsubstate' in m1: | 802 if '.hgsubstate' in m1: |
803 # check whether sub state is modified | 803 # check whether sub state is modified |
804 for s in sorted(wctx.substate): | 804 if any(wctx.sub(s).dirty() for s in wctx.substate): |
805 if wctx.sub(s).dirty(): | 805 m1['.hgsubstate'] += '+' |
806 m1['.hgsubstate'] += '+' | |
807 break | |
808 | 806 |
809 # Compare manifests | 807 # Compare manifests |
810 if matcher is not None: | 808 if matcher is not None: |
811 m1 = m1.matches(matcher) | 809 m1 = m1.matches(matcher) |
812 m2 = m2.matches(matcher) | 810 m2 = m2.matches(matcher) |