diff --git a/hggit/git_handler.py b/hggit/git_handler.py index cd897a67ec0b6ec60a8b93d2b6ac82cda16b9958_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..da65c2fdeac40e917544bdd9884e59ef3ee4bd4b_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -653,7 +653,7 @@ >>> from collections import namedtuple >>> from mercurial.ui import ui >>> mockrepo = namedtuple('localrepo', ['vfs', 'sharedpath', 'path']) - >>> mockrepo.vfs = '' - >>> mockrepo.sharedpath = '' - >>> mockrepo.path = '' + >>> mockrepo.vfs = b'' + >>> mockrepo.sharedpath = b'' + >>> mockrepo.path = b'' >>> g = GitHandler(mockrepo, ui()).get_valid_git_username_email @@ -659,3 +659,3 @@ >>> g = GitHandler(mockrepo, ui()).get_valid_git_username_email - >>> g('John Doe') + >>> g(b'John Doe') 'John Doe' @@ -661,3 +661,3 @@ 'John Doe' - >>> g('john@doe.com') + >>> g(b'john@doe.com') 'john@doe.com' @@ -663,3 +663,3 @@ 'john@doe.com' - >>> g(' <john@doe.com> ') + >>> g(b' <john@doe.com> ') 'john@doe.com' @@ -665,3 +665,3 @@ 'john@doe.com' - >>> g(' <random<\n<garbage\n> > > ') + >>> g(b' <random<\n<garbage\n> > > ') 'random???garbage?' @@ -667,5 +667,5 @@ 'random???garbage?' - >>> g('Typo in hgrc >but.hg-git@handles.it.gracefully>') + >>> g(b'Typo in hgrc >but.hg-git@handles.it.gracefully>') 'Typo in hgrc ?but.hg-git@handles.it.gracefully' """ return RE_GIT_SANITIZE_AUTHOR.sub(b'?', name.lstrip(b'< ').rstrip(b'> ')) @@ -1672,8 +1672,8 @@ >>> from dulwich.client import HttpGitClient, SSHGitClient >>> from mercurial.ui import ui >>> mockrepo = namedtuple('localrepo', ['vfs', 'sharedpath', 'path']) - >>> mockrepo.vfs = '' - >>> mockrepo.sharedpath = '' - >>> mockrepo.path = '' + >>> mockrepo.vfs = b'' + >>> mockrepo.sharedpath = b'' + >>> mockrepo.path = b'' >>> g = GitHandler(mockrepo, ui()) >>> tp = g.get_transport_and_path @@ -1678,7 +1678,7 @@ >>> g = GitHandler(mockrepo, ui()) >>> tp = g.get_transport_and_path - >>> client, url = tp('http://fqdn.com/test.git') + >>> client, url = tp(b'http://fqdn.com/test.git') >>> print(isinstance(client, HttpGitClient)) True >>> print(url) http://fqdn.com/test.git @@ -1681,8 +1681,8 @@ >>> print(isinstance(client, HttpGitClient)) True >>> print(url) http://fqdn.com/test.git - >>> client, url = tp('git@fqdn.com:user/repo.git') + >>> client, url = tp(b'git@fqdn.com:user/repo.git') >>> print(isinstance(client, SSHGitClient)) True >>> print(url) diff --git a/hggit/hg2git.py b/hggit/hg2git.py index cd897a67ec0b6ec60a8b93d2b6ac82cda16b9958_aGdnaXQvaGcyZ2l0LnB5..da65c2fdeac40e917544bdd9884e59ef3ee4bd4b_aGdnaXQvaGcyZ2l0LnB5 100644 --- a/hggit/hg2git.py +++ b/hggit/hg2git.py @@ -37,7 +37,7 @@ ... def warn(self, s): ... print(s) >>> u = fakeui() - >>> audit_git_path(u, 'foo/git~100/wat') + >>> audit_git_path(u, b'foo/git~100/wat') ... # doctest: +ELLIPSIS warning: path 'foo/git~100/wat' contains a potentially dangerous ... It may not be legal to check out in Git. @@ -49,7 +49,7 @@ It may not be legal to check out in Git. It may also be rejected by some git server configurations. <BLANKLINE> - >>> audit_git_path(u, 'this/is/safe') + >>> audit_git_path(u, b'this/is/safe') """ dangerous = False for c in path.split(os.path.sep): diff --git a/hggit/util.py b/hggit/util.py index cd897a67ec0b6ec60a8b93d2b6ac82cda16b9958_aGdnaXQvdXRpbC5weQ==..da65c2fdeac40e917544bdd9884e59ef3ee4bd4b_aGdnaXQvdXRpbC5weQ== 100644 --- a/hggit/util.py +++ b/hggit/util.py @@ -73,5 +73,5 @@ Tests: - >>> print(isgitsshuri('http://fqdn.com/hg')) + >>> print(isgitsshuri(b'http://fqdn.com/hg')) False @@ -77,3 +77,3 @@ False - >>> print(isgitsshuri('http://fqdn.com/test.git')) + >>> print(isgitsshuri(b'http://fqdn.com/test.git')) False @@ -79,3 +79,3 @@ False - >>> print(isgitsshuri('git@github.com:user/repo.git')) + >>> print(isgitsshuri(b'git@github.com:user/repo.git')) True @@ -81,3 +81,3 @@ True - >>> print(isgitsshuri('github-123.com:user/repo.git')) + >>> print(isgitsshuri(b'github-123.com:user/repo.git')) True @@ -83,3 +83,3 @@ True - >>> print(isgitsshuri('git@127.0.0.1:repo.git')) + >>> print(isgitsshuri(b'git@127.0.0.1:repo.git')) True @@ -85,5 +85,5 @@ True - >>> print(isgitsshuri('git@[2001:db8::1]:repository.git')) + >>> print(isgitsshuri(b'git@[2001:db8::1]:repository.git')) True """ for scheme in gitschemes: diff --git a/tests/test-extra.t b/tests/test-extra.t index cd897a67ec0b6ec60a8b93d2b6ac82cda16b9958_dGVzdHMvdGVzdC1leHRyYS50..da65c2fdeac40e917544bdd9884e59ef3ee4bd4b_dGVzdHMvdGVzdC1leHRyYS50 100644 --- a/tests/test-extra.t +++ b/tests/test-extra.t @@ -132,9 +132,9 @@ >>> from dulwich.porcelain import open_repo >>> repo = open_repo('.') >>> c = Commit() - >>> c.author = 'test <test@example.org>' + >>> c.author = b'test <test@example.org>' >>> c.author_time = 0 >>> c.author_timezone = 0 >>> c.committer = c.author >>> c.commit_time = 0 >>> c.commit_timezone = 0 @@ -136,12 +136,12 @@ >>> c.author_time = 0 >>> c.author_timezone = 0 >>> c.committer = c.author >>> c.commit_time = 0 >>> c.commit_timezone = 0 - >>> c.parents = ['$commit_sha'] - >>> c.tree = '$tree_sha' - >>> c.message = 'extra commit\n' - >>> c.extra.extend([('zzz:zzz', 'data:zzz'), ('aaa:aaa', 'data:aaa'), - ... ('HG:extra', 'hgaaa:dataaaa'), - ... ('HG:extra', 'hgzzz:datazzz')]) + >>> c.parents = [b'$commit_sha'] + >>> c.tree = b'$tree_sha' + >>> c.message = b'extra commit\n' + >>> c.extra.extend([(b'zzz:zzz', b'data:zzz'), (b'aaa:aaa', b'data:aaa'), + ... (b'HG:extra', b'hgaaa:dataaaa'), + ... (b'HG:extra', b'hgzzz:datazzz')]) >>> repo.object_store.add_object(c) @@ -147,5 +147,5 @@ >>> repo.object_store.add_object(c) - >>> repo.refs.set_if_equals('refs/heads/master', None, c.id) + >>> repo.refs.set_if_equals(b'refs/heads/master', None, c.id) True $ git cat-file commit master