Patchwork D5665: tests: normalize XML values to bytes

login
register
mail settings
Submitter phabricator
Date Jan. 24, 2019, 2:26 a.m.
Message ID <390fe9ba73c6ae65bc47c1d2ed029831@localhost.localdomain>
Download mbox | patch
Permalink /patch/37946/
State Not Applicable
Headers show

Comments

phabricator - Jan. 24, 2019, 2:26 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7c54357be2ae: tests: normalize XML values to bytes (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5665?vs=13377&id=13383

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

AFFECTED FILES
  tests/svnxml.py

CHANGE DETAILS




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

Patch

diff --git a/tests/svnxml.py b/tests/svnxml.py
--- a/tests/svnxml.py
+++ b/tests/svnxml.py
@@ -20,10 +20,10 @@ 
     if paths:
         paths = paths[0]
         for p in paths.getElementsByTagName('path'):
-            action = p.getAttribute('action')
-            path = xmltext(p)
-            frompath = p.getAttribute('copyfrom-path')
-            fromrev = p.getAttribute('copyfrom-rev')
+            action = p.getAttribute('action').encode('utf-8')
+            path = xmltext(p).encode('utf-8')
+            frompath = p.getAttribute('copyfrom-path').encode('utf-8')
+            fromrev = p.getAttribute('copyfrom-rev').encode('utf-8')
             e['paths'].append((path, action, frompath, fromrev))
     return e
 
@@ -43,11 +43,11 @@ 
         for k in ('revision', 'author', 'msg'):
             fp.write(('%s: %s\n' % (k, e[k])).encode('utf-8'))
         for path, action, fpath, frev in sorted(e['paths']):
-            frominfo = ''
+            frominfo = b''
             if frev:
-                frominfo = ' (from %s@%s)' % (fpath, frev)
-            p = ' %s %s%s\n' % (action, path, frominfo)
-            fp.write(p.encode('utf-8'))
+                frominfo = b' (from %s@%s)' % (fpath, frev)
+            p = b' %s %s%s\n' % (action, path, frominfo)
+            fp.write(p)
 
 if __name__ == '__main__':
     data = sys.stdin.read()