D2582: util: teach escapedata() about bytearray

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sat Mar 3 10:22:54 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc98d1c6763a6: util: teach escapedata() about bytearray (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2582?vs=6426&id=6430

REVISION DETAIL
  https://phab.mercurial-scm.org/D2582

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -702,6 +702,9 @@
 DATA_ESCAPE_RE = remod.compile(br'[\x00-\x08\x0a-\x1f\\\x7f-\xff]')
 
 def escapedata(s):
+    if isinstance(s, bytearray):
+        s = bytes(s)
+
     return DATA_ESCAPE_RE.sub(lambda m: DATA_ESCAPE_MAP[m.group(0)], s)
 
 class fileobjectobserver(object):



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list