| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 04357d0 commit 3d0556a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -373,40 +373,33 @@ def create_from_tree(cls, repo, tree, message, parent_commits=None, head=False, | |||
| 373 | 373 | ||
| 374 | 374 | def _serialize(self, stream): | |
| 375 | 375 | write = stream.write | |
| 376 | - write("tree %s\n" % self.tree) | ||
| 376 | + write(("tree %s\n" % self.tree).encode('ascii')) | ||
| 377 | 377 | for p in self.parents: | |
| 378 | - write("parent %s\n" % p) | ||
| 378 | + write(("parent %s\n" % p).encode('ascii')) | ||
| 379 | 379 | ||
| 380 | 380 | a = self.author | |
| 381 | 381 | aname = a.name | |
| 382 | - if isinstance(aname, text_type): | ||
| 383 | - aname = aname.encode(self.encoding) | ||
| 384 | - # END handle unicode in name | ||
| 385 | - | ||
| 386 | 382 | c = self.committer | |
| 387 | 383 | fmt = "%s %s <%s> %s %s\n" | |
| 388 | - write(fmt % ("author", aname, a.email, | ||
| 384 | + write((fmt % ("author", aname, a.email, | ||
| 389 | 385 | self.authored_date, | |
| 390 | - altz_to_utctz_str(self.author_tz_offset))) | ||
| 386 | + altz_to_utctz_str(self.author_tz_offset))).encode(self.encoding)) | ||
| 391 | 387 | ||
| 392 | 388 | # encode committer | |
| 393 | 389 | aname = c.name | |
| 394 | - if isinstance(aname, text_type): | ||
| 395 | - aname = aname.encode(self.encoding) | ||
| 396 | - # END handle unicode in name | ||
| 397 | - write(fmt % ("committer", aname, c.email, | ||
| 390 | + write((fmt % ("committer", aname, c.email, | ||
| 398 | 391 | self.committed_date, | |
| 399 | - altz_to_utctz_str(self.committer_tz_offset))) | ||
| 392 | + altz_to_utctz_str(self.committer_tz_offset))).encode(self.encoding)) | ||
| 400 | 393 | ||
| 401 | 394 | if self.encoding != self.default_encoding: | |
| 402 | - write("encoding %s\n" % self.encoding) | ||
| 395 | + write(("encoding %s\n" % self.encoding).encode('ascii')) | ||
| 403 | 396 | ||
| 404 | 397 | if self.gpgsig: | |
| 405 | 398 | write("gpgsig") | |
| 406 | 399 | for sigline in self.gpgsig.rstrip("\n").split("\n"): | |
| 407 | - write(" " + sigline + "\n") | ||
| 400 | + write((" " + sigline + "\n").encode('ascii')) | ||
| 408 | 401 | ||
| 409 | - write("\n") | ||
| 402 | + write(b"\n") | ||
| 410 | 403 | ||
| 411 | 404 | # write plain bytes, be sure its encoded according to our encoding | |
| 412 | 405 | if isinstance(self.message, text_type): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,4 @@ | |||
| 1 | + #-*-coding:utf-8-*- | ||
| 1 | 2 | # test_base.py | |
| 2 | 3 | # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors | |
| 3 | 4 | # | |
@@ -106,3 +107,13 @@ def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo): | |||
| 106 | 107 | assert not rw_repo.config_reader("repository").getboolean("core", "bare") | |
| 107 | 108 | assert rw_remote_repo.config_reader("repository").getboolean("core", "bare") | |
| 108 | 109 | assert os.path.isdir(os.path.join(rw_repo.working_tree_dir, 'lib')) | |
| 110 | + | ||
| 111 | + @with_rw_repo('0.1.6') | ||
| 112 | + def test_add_unicode(self, rw_repo): | ||
| 113 | + filename = u"שלום.txt" | ||
| 114 | + | ||
| 115 | + file_path = os.path.join(rw_repo.working_dir, filename) | ||
| 116 | + open(file_path, "wb").write('something') | ||
| 117 | + | ||
| 118 | + rw_repo.git.add(rw_repo.working_dir) | ||
| 119 | + rw_repo.index.commit('message') | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments