# HG changeset patch # User Yuya Nishihara # Date 1591101649 -32400 # Node ID eb6380da47a545e854bd61fddc0c0dfe7a0596c8 # Parent ad6971e6740c143062ba2275dc7b07742ea33364 simplemerge: leverage pycompat function to convert byte string to set diff -r ad6971e6740c -r eb6380da47a5 mercurial/simplemerge.py --- a/mercurial/simplemerge.py Tue Jun 02 21:39:07 2020 +0900 +++ b/mercurial/simplemerge.py Tue Jun 02 21:40:49 2020 +0900 @@ -451,11 +451,6 @@ return result -def _bytes_to_set(b): - """turns a multiple bytes (usually flags) into a set of individual byte""" - return set(b[x : x + 1] for x in range(len(b))) - - def is_not_null(ctx): if not util.safehasattr(ctx, "node"): return False @@ -518,10 +513,10 @@ # merge flags if necessary flags = localctx.flags() - localflags = _bytes_to_set(flags) - otherflags = _bytes_to_set(otherctx.flags()) + localflags = set(pycompat.iterbytestr(flags)) + otherflags = set(pycompat.iterbytestr(otherctx.flags())) if is_not_null(basectx) and localflags != otherflags: - baseflags = _bytes_to_set(basectx.flags()) + baseflags = set(pycompat.iterbytestr(basectx.flags())) flags = localflags & otherflags for f in localflags.symmetric_difference(otherflags): if f not in baseflags: