diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py
index 19ed212de2d102731daffee4185eb6a5295bb8f1_aGdleHQvcmVsZWFzZW5vdGVzLnB5..96e50dfd8c9425c277cb0aeeffa4f9488dfa9a00_aGdleHQvcmVsZWFzZW5vdGVzLnB5 100644
--- a/hgext/releasenotes.py
+++ b/hgext/releasenotes.py
@@ -16,7 +16,6 @@
 import difflib
 import errno
 import re
-import textwrap
 
 from mercurial.i18n import _
 from mercurial import (
@@ -29,6 +28,9 @@
     scmutil,
     util,
 )
+from mercurial.utils import (
+    stringutil,
+)
 
 cmdtable = {}
 command = registrar.command(cmdtable)
@@ -58,20 +60,6 @@
 
 BULLET_SECTION = _('Other Changes')
 
-if pycompat.ispy3:
-    class byteswrapper(object):
-        def __init__(self, **kwargs):
-            for k in kwargs:
-                v = kwargs[k]
-                if not isinstance(v, str) and isinstance(v, bytes):
-                    kwargs[k] = v.decode('utf8')
-            self._tw = textwrap.TextWrapper(**kwargs)
-        def wrap(self, data):
-            return [
-                l.encode('utf8') for l in self._tw.wrap(data.decode('utf8'))]
-else:
-    byteswrapper = textwrap.TextWrapper
-
 class parsedreleasenotes(object):
     def __init__(self):
         self.sections = {}
@@ -457,7 +445,6 @@
             lines.append('-' * len(title))
             lines.append('')
 
-            wrapper = byteswrapper(width=78)
             for i, para in enumerate(paragraphs):
                 if i:
                     lines.append('')
@@ -461,7 +448,8 @@
             for i, para in enumerate(paragraphs):
                 if i:
                     lines.append('')
-                lines.extend(wrapper.wrap(' '.join(para)))
+                lines.extend(stringutil.wrap(' '.join(para),
+                                             width=78).splitlines())
 
             lines.append('')
 
@@ -479,8 +467,8 @@
             lines.append('')
 
         for paragraphs in nontitled:
-            wrapper = byteswrapper(initial_indent='* ',
-                                   subsequent_indent='  ',
-                                   width=78)
-            lines.extend(wrapper.wrap(' '.join(paragraphs[0])))
+            lines.extend(stringutil.wrap(' '.join(paragraphs[0]),
+                                         width=78,
+                                         initindent='* ',
+                                         hangindent='  ').splitlines())
 
@@ -486,6 +474,3 @@
 
-            wrapper = byteswrapper(initial_indent='  ',
-                                   subsequent_indent='  ',
-                                   width=78)
             for para in paragraphs[1:]:
                 lines.append('')
@@ -490,6 +475,9 @@
             for para in paragraphs[1:]:
                 lines.append('')
-                lines.extend(wrapper.wrap(' '.join(para)))
+                lines.extend(stringutil.wrap(' '.join(para),
+                                             width=78,
+                                             initindent='  ',
+                                             hangindent='  ').splitlines())
 
             lines.append('')