Mercurial > hg
changeset 44949:4bb0ea78a70f
simplemerge: rewrite flag merging loop as expression
I feel binary operations are more readable.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 02 Jun 2020 21:44:57 +0900 |
parents | eb6380da47a5 |
children | f9734b2d59cc |
files | mercurial/simplemerge.py |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/simplemerge.py Tue Jun 02 21:40:49 2020 +0900 +++ b/mercurial/simplemerge.py Tue Jun 02 21:44:57 2020 +0900 @@ -517,11 +517,9 @@ otherflags = set(pycompat.iterbytestr(otherctx.flags())) if is_not_null(basectx) and localflags != otherflags: baseflags = set(pycompat.iterbytestr(basectx.flags())) - flags = localflags & otherflags - for f in localflags.symmetric_difference(otherflags): - if f not in baseflags: - flags.add(f) - flags = b''.join(sorted(flags)) + commonflags = localflags & otherflags + addedflags = (localflags ^ otherflags) - baseflags + flags = b''.join(sorted(commonflags | addedflags)) if not opts.get(b'print'): localctx.write(mergedtext, flags)