Merge lp://qastaging/~piastucki/bzr-xmloutput/fix-551351-ignored-in-symlink-root into lp://qastaging/bzr-xmloutput

Proposed by Piotr Piastucki
Status: Merged
Merged at revision: 174
Proposed branch: lp://qastaging/~piastucki/bzr-xmloutput/fix-551351-ignored-in-symlink-root
Merge into: lp://qastaging/bzr-xmloutput
Diff against target: 57 lines (+23/-9)
2 files modified
lsxml.py (+6/-9)
tests/test_ls_xml.py (+17/-0)
To merge this branch: bzr merge lp://qastaging/~piastucki/bzr-xmloutput/fix-551351-ignored-in-symlink-root
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
Review via email: mp+173101@code.qastaging.launchpad.net

Description of the change

This patch fixes the way ignored files are handled in case the branch is access via symlink rather than a real path.

Invoking xmlls in the following way
bzr xmlls --ignored symlink

Results in an error (see traceback below) because the code first concatenates the symlink with the relative path of the ignored file and then tries to get the relative path by calling tree.relpath(fp). tree.relpath(fp) cannot find the relative path as bzr seems to expand symlinks so that the branch root (tree.basedir) contains the actual path.
The fix changes the order of pattern lookup and path concatenation and completely removes the need to call tree.relpath(fp).

Traceback:
0.102 Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/xmloutput/xml_errors.py", line 69, in xml_error_handling
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/xmloutput/cmds.py", line 385, in run
    lsxml.show_ls_xml(self.outf, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/xmloutput/lsxml.py", line 89, in show_ls_xml
    pattern = '<pattern>%s</pattern>' % _escape_cdata(pat)
  File "/usr/lib/python2.7/dist-packages/bzrlib/plugins/xmloutput/writer.py", line 13, in _escape_cdata
    text = text.replace("&", "&amp;")
AttributeError: 'NoneType' object has no attribute 'replace'

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

Thanks for working on this, can I ask you to add a test case for it?

Thanks.

review: Needs Information
174. By Piotr Piastucki

Add test case

Revision history for this message
Piotr Piastucki (piastucki) wrote :

Test case added

Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: