Skip to content

Commit

Permalink
remote-bzr: set author if available
Browse files Browse the repository at this point in the history
[fc: added tests]

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
David Engster authored and Junio C Hamano committed Apr 7, 2013
1 parent bc51f7c commit 9d9d698
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contrib/remote-helpers/git-remote-bzr
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,12 @@ def export_branch(branch, name):
tz = rev.timezone
committer = rev.committer.encode('utf-8')
committer = "%s %u %s" % (fixup_user(committer), time, gittz(tz))
author = committer
authors = rev.get_apparent_authors()
if authors:
author = authors[0].encode('utf-8')
author = "%s %u %s" % (fixup_user(author), time, gittz(tz))
else:
author = committer
msg = rev.message.encode('utf-8')

msg += '\n'
Expand Down
15 changes: 15 additions & 0 deletions contrib/remote-helpers/test-bzr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,19 @@ test_expect_success 'moving directory' '
test_cmp expected actual
'

test_expect_success 'different authors' '
(cd bzrrepo &&
echo john >> content &&
bzr commit -m john \
--author "Jane Rey <jrey@example.com>" \
--author "John Doe <jdoe@example.com>") &&
(cd gitrepo &&
git pull &&
git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
test_cmp expected actual
'

test_done

0 comments on commit 9d9d698

Please sign in to comment.