simplemerge: leverage pycompat function to convert byte string to set
authorYuya Nishihara <yuya@tcha.org>
Tue, 02 Jun 2020 21:40:49 +0900
changeset 44948 eb6380da47a5
parent 44947 ad6971e6740c
child 44949 4bb0ea78a70f
simplemerge: leverage pycompat function to convert byte string to set
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: