Merge lp:~amujumdar/bzr-xmloutput/emit_authors into lp:bzr-xmloutput

Proposed by Piotr Piastucki
Status: Merged
Merge reported by: Guillermo Gonzalez
Merged at revision: not available
Proposed branch: lp:~amujumdar/bzr-xmloutput/emit_authors
Merge into: lp:bzr-xmloutput
Diff against target: 45 lines (+13/-2)
2 files modified
logxml.py (+6/-1)
tests/test_log_xml.py (+7/-1)
To merge this branch: bzr merge lp:~amujumdar/bzr-xmloutput/emit_authors
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Needs Fixing
Review via email: mp+155002@code.launchpad.net

Description of the change

I think this is a nice improvement and the changes look good. Please review.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Hi, the change looks good, just 2 notes:

1) please leave 1 empty line between methods
2) the test doesn't work, it's just a typo.

======================================================================
ERROR: bzrlib.plugins.xmloutput.tests.test_log_xml.TestLog.test_log_author
----------------------------------------------------------------------
_StringException: Empty attachments:
  log

Traceback (most recent call last):
  File "/home/guillermo/.bazaar/plugins/xmloutput/tests/test_log_xml.py", line 211, in test_log_author
    self_prepare()
NameError: global name 'self_prepare' is not defined

----------------------------------------------------------------------
Ran 96 tests in 6.139s

FAILED (errors=1)
1 test skipped

review: Needs Fixing
159. By Abhay Mujumdar

Incorporates review commentswq

Revision history for this message
Abhay Mujumdar (amujumdar) wrote :

I fixed the two things. I feel bad pushing it though; I couldn't get tests to work at all on my install.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'logxml.py'
2--- logxml.py 2011-12-12 15:11:38 +0000
3+++ logxml.py 2013-05-16 19:43:26 +0000
4@@ -148,9 +148,14 @@
5 self.to_file.write('<parent>%s</parent>' % parent_id)
6 if len(revision.rev.parent_ids) > 0:
7 self.to_file.write('</parents>')
8-
9 self.to_file.write('<committer>%s</committer>' % \
10 _escape_cdata(revision.rev.committer))
11+ authors = revision.rev.get_apparent_authors()
12+ if authors != [revision.rev.committer]:
13+ self.to_file.write('<authors>')
14+ for a in authors:
15+ self.to_file.write('<author>%s</author>' % _escape_cdata(a))
16+ self.to_file.write('</authors>')
17
18 try:
19 self.to_file.write('<branch-nick>%s</branch-nick>' % \
20
21=== modified file 'tests/test_log_xml.py'
22--- tests/test_log_xml.py 2012-02-21 10:14:16 +0000
23+++ tests/test_log_xml.py 2013-05-16 19:43:26 +0000
24@@ -40,7 +40,7 @@
25 tree.add('goodbye.txt')
26 tree.commit(message='message2')
27 tree.add('meep.txt')
28- tree.commit(message='message3')
29+ tree.commit(message='message3', author='John Doe <jdoe@example.com>')
30 self.full_log_xml = fromstring(self.run_bzr(["xmllog", path])[0])
31 return tree
32
33@@ -208,6 +208,12 @@
34 #self.assertTrue('revno: 2\n' in log)
35 #self.assertTrue('revno: 3\n' in log)
36
37+ def test_log_author(self):
38+ self._prepare()
39+ log_xml = fromstring(self.run_bzr("xmllog -r 3..3")[0])
40+ author = log_xml.findall('log/authors/author')[0]
41+ self.assertEquals(author.text, 'John Doe <jdoe@example.com>')
42+
43 class TestLogMerges(ExternalBase):
44
45 def _prepare(self):

Subscribers

People subscribed via source and target branches

to all changes: