"hg diff @123456" is equivalent to"hg diff x.go y.go".
'''
-# TODO(rsc):
-# fix utf-8 upload bug
-
from mercurial import cmdutil, commands, hg, util, error, match
from mercurial.node import nullrev, hex, nullid, short
import os, re
lines.append('--' + BOUNDARY)
lines.append('Content-Disposition: form-data; name="%s"' % key)
lines.append('')
+ if type(value) == str:
+ value = value.decode("utf-8")
lines.append(value)
for (key, filename, value) in files:
+ if type(filename) == str:
+ filename = filename.decode("utf-8")
+ if type(value) == str:
+ value = value.decode("utf-8")
lines.append('--' + BOUNDARY)
lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
(key, filename))
lines.append('')
body = CRLF.join(lines)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
- return content_type, body
+ return content_type, body.encode("utf-8")
def GetContentType(filename):