Mercurial > hg > hg-git
changeset 203:104a4fd6a0af
trying to fix some of the broken tests
author | Abderrahim Kitouni <a.kitouni@gmail.com> |
---|---|
date | Mon, 29 Jun 2009 15:28:25 +0100 |
parents | 1593538448b1 |
children | 4734153365ac |
files | git_handler.py tests/test-encoding.out |
diffstat | 2 files changed, 23 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/git_handler.py +++ b/git_handler.py @@ -167,7 +167,7 @@ ctx = self.repo.changectx(rev) state = ctx.extra().get('hg-git', None) if state == 'octopus': - self.ui.debug("revision %d is a part of octopus explosion\n" % rev) + self.ui.debug("revision %d is a part of octopus explosion\n" % ctx.rev()) continue self.export_hg_commit(rev) self.save_map() @@ -181,6 +181,8 @@ self.ui.note(_("converting revision %s\n") % rev) + oldenc = self.swap_out_encoding() + # make sure parents are converted first ctx = self.repo.changectx(rev) extra = ctx.extra() @@ -209,8 +211,8 @@ commit['tree'] = tree_sha (time, timezone) = ctx.date() - if 'git-author' in extra: - author = extra['git-author'] + if 'author' in extra: + author = extra['author'] else: # hg authors might not have emails author = ctx.user() @@ -230,8 +232,8 @@ commit['author'] = author + ' ' + str(int(time)) + ' ' + format_timezone(-timezone) - if 'git-commit-message' in extra: - commit['message'] = extra['git-commit-message'] + if 'message' in extra: + commit['message'] = extra['message'] else: message = ctx.description() commit['message'] = ctx.description() + "\n" @@ -260,7 +262,7 @@ extra_message += "rename : " + oldfile + " => " + newfile + "\n" for key, value in extra.iteritems(): - if key in ['committer', 'encoding', 'branch', 'hg-git']: + if key in ('author', 'committer', 'encoding', 'message', 'branch', 'hg-git'): continue else: add_extras = True @@ -287,6 +289,9 @@ commit_sha = self.git.write_commit_hash(commit) # writing new blobs to git self.map_set(commit_sha, ctx.hex()) + + self.swap_out_encoding(oldenc) + return commit_sha def write_git_tree(self, ctx): @@ -462,7 +467,7 @@ try: text.decode('utf-8') except UnicodeDecodeError: - extra['git-commit-message'] = text + extra['message'] = text text = self.decode_guess(text, commit._encoding) author = commit.author @@ -483,7 +488,7 @@ try: author.decode('utf-8') except UnicodeDecodeError: - extra['git-author'] = author + extra['author'] = author author = self.decode_guess(author, commit._encoding) oldenc = self.swap_out_encoding()
--- a/tests/test-encoding.out +++ b/tests/test-encoding.out @@ -17,50 +17,50 @@ at: 0/4 updating working directory 4 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 3:6b43c82c4322c117a8b8b6fab37534af23c1632d +@ changeset: 3:4194aac3187933e5859d85d8f572234e41f79f3d | tag: master | tag: default/master | tag: tip -| parent: 2:b2e3167afdf71f860238838daa0065b6f8660f15 +| parent: 2:c7896464e6b20cb173d7f3dbe69d99498aa4264a | parent: -1:0000000000000000000000000000000000000000 | manifest: 3:ea49f93388380ead5601c8fcbfa187516e7c2ed8 | user: tést èncödîng <test@example.org> | date: Mon Jan 01 00:00:13 2007 +0000 | files+: delta +| extra: author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> | extra: branch=default | extra: committer=test <test@example.org> 1167609613 0 | extra: encoding=latin-1 -| extra: git-author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> -| extra: git-commit-message=\nadd d\xe9lt\xe0\n +| extra: message=\nadd d\xe9lt\xe0\n | description: | add déltà | | -o changeset: 2:b2e3167afdf71f860238838daa0065b6f8660f15 -| parent: 1:d62a8db24a4f5d5f77b6b55ddf481a254f4e6635 +o changeset: 2:c7896464e6b20cb173d7f3dbe69d99498aa4264a +| parent: 1:ee2901710a4e5d3a1c79f937c0e2ee62074489de | parent: -1:0000000000000000000000000000000000000000 | manifest: 2:f580e7da3673c137370da2b931a1dee83590d7b4 | user: tést èncödîng <test@example.org> | date: Mon Jan 01 00:00:12 2007 +0000 | files+: gamma +| extra: author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> | extra: branch=default | extra: committer=test <test@example.org> 1167609612 0 -| extra: git-author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> -| extra: git-commit-message=add g\xe4mm\xe2\n +| extra: message=add g\xe4mm\xe2\n | description: | add gämmâ | | -o changeset: 1:d62a8db24a4f5d5f77b6b55ddf481a254f4e6635 +o changeset: 1:ee2901710a4e5d3a1c79f937c0e2ee62074489de | parent: 0:bb7d36568d6188ce0de2392246c43f6f213df954 | parent: -1:0000000000000000000000000000000000000000 | manifest: 1:f0bd6fbafbaebe4bb59c35108428f6fce152431d | user: tést èncödîng <test@example.org> | date: Mon Jan 01 00:00:11 2007 +0000 | files+: beta +| extra: author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> | extra: branch=default | extra: committer=test <test@example.org> 1167609611 0 -| extra: git-author=t\xe9st \xe8nc\xf6d\xeeng <test@example.org> | description: | add beta |