clone: make the samplehgrcs strings

Summary: These aren't bytes, they are strings.

Reviewed By: quark-zju

Differential Revision: D19656112

fbshipit-source-id: fcd505e3b4e522154358c80305e39ebca5936395
This commit is contained in:
Xavier Deguillard 2020-01-30 18:39:19 -08:00 committed by Facebook Github Bot
parent a4722f9515
commit d6d60bda6a
4 changed files with 8 additions and 7 deletions

View File

@ -1843,7 +1843,7 @@ def config(ui, repo, *values, **opts):
f = paths[0] f = paths[0]
fp = open(f, "wb") fp = open(f, "wb")
fp.write(util.tonativeeol(samplehgrc)) fp.write(pycompat.encodeutf8(util.tonativeeol(samplehgrc)))
fp.close() fp.close()
editor = ui.geteditor() editor = ui.geteditor()

View File

@ -37,6 +37,7 @@ from . import (
perftrace, perftrace,
phases, phases,
progress, progress,
pycompat,
repoview, repoview,
scmutil, scmutil,
sshpeer, sshpeer,
@ -760,7 +761,7 @@ def clone(
u = util.url(abspath) u = util.url(abspath)
u.passwd = None u.passwd = None
defaulturl = str(u) defaulturl = str(u)
fp.write(util.tonativeeol(template % defaulturl)) fp.write(pycompat.encodeutf8(util.tonativeeol(template % defaulturl)))
fp.close() fp.close()
destrepo.ui.setconfig("paths", "default", defaulturl, "clone") destrepo.ui.setconfig("paths", "default", defaulturl, "clone")

View File

@ -54,7 +54,7 @@ from .pycompat import decodeutf8, encodeutf8
urlreq = util.urlreq urlreq = util.urlreq
samplehgrcs = { samplehgrcs = {
"user": b"""# example user config (see 'hg help config' for more info) "user": """# example user config (see 'hg help config' for more info)
[ui] [ui]
# name and email, e.g. # name and email, e.g.
# username = Jane Doe <jdoe@example.com> # username = Jane Doe <jdoe@example.com>
@ -74,7 +74,7 @@ username =
# #
# churn = # churn =
""", """,
"cloned": b"""# example repository config (see 'hg help config' for more info) "cloned": """# example repository config (see 'hg help config' for more info)
[paths] [paths]
default = %s default = %s
@ -89,7 +89,7 @@ default = %s
# name and email (local to this repository, optional), e.g. # name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com> # username = Jane Doe <jdoe@example.com>
""", """,
"local": b"""# example repository config (see 'hg help config' for more info) "local": """# example repository config (see 'hg help config' for more info)
[paths] [paths]
# path aliases to other clones of this repo in URLs or filesystem paths # path aliases to other clones of this repo in URLs or filesystem paths
# (see 'hg help config.paths' for more info) # (see 'hg help config.paths' for more info)
@ -103,7 +103,7 @@ default = %s
# name and email (local to this repository, optional), e.g. # name and email (local to this repository, optional), e.g.
# username = Jane Doe <jdoe@example.com> # username = Jane Doe <jdoe@example.com>
""", """,
"global": b"""# example system-wide hg config (see 'hg help config' for more info) "global": """# example system-wide hg config (see 'hg help config' for more info)
[ui] [ui]
# uncomment to disable color in command output # uncomment to disable color in command output

View File

@ -2400,7 +2400,7 @@ bytecount = unitcountfn(
# Matches a single EOL which can either be a CRLF where repeated CR # Matches a single EOL which can either be a CRLF where repeated CR
# are removed or a LF. We do not care about old Macintosh files, so a # are removed or a LF. We do not care about old Macintosh files, so a
# stray CR is an error. # stray CR is an error.
_eolre = remod.compile(br"\r*\n") _eolre = remod.compile(r"\r*\n")
def tolf(s): def tolf(s):