changeset 44989:eb6380da47a5

simplemerge: leverage pycompat function to convert byte string to set
author Yuya Nishihara <yuya@tcha.org>
date Tue, 02 Jun 2020 21:40:49 +0900
parents ad6971e6740c
children 4bb0ea78a70f
files mercurial/simplemerge.py
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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: