[ANN] EOL conversion support now in bzr.dev

Brian de Alwis bsd at cs.ubc.ca
Sun Apr 5 01:06:27 BST 2009


On 4-Apr-2009, at 4:42 PM, Ian Clatworthy wrote:
> Make sure your branch+tree are using 1.14 format? What does 'bar  
> info' say?

Yup:

$ /scratch/dev/bzr-1.14/bzr info
==> loaded filters/__init__.py
==> loaded rules.py
Standalone tree (format: 1.14)
Location:
   branch root: .

(the "==>" lines are from print statements I added to the end of the  
files.)

As an aside, shouldn't .bzr/branch/format specify bzr 1.14 now?

$ cat .bzr/branch/format
Bazaar Branch Format 7 (needs bzr 1.6)


> The -Dfilters flag may help see what's happening. See 'bzr help  
> debug-flags'.


Unfortunately -Dfilters doesn't show anything:

$ rm j.cs ~/.bzr.log
$ /scratch/dev/bzr-1.14/bzr -Dfilters revert j.cs
==> loaded filters/__init__.py
==> loaded rules.py
  N  j.cs
$ cat ~/.bzr.log
Sat 2009-04-04 17:01:46 -0600
0.034  bzr arguments: [u'-Dfilters', u'revert', u'j.cs']
0.055  looking for plugins in /Users/bsd/.bazaar/plugins
0.320  looking for plugins in /scratch/dev/bzr-1.14/bzrlib/plugins
0.330  looking for plugins in /usr/pkg/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/site-packages/bzrlib/plugins
0.331  Plugin name launchpad already loaded
0.331  Plugin name netrc_credential_store already loaded
0.333  encoding stdout as sys.stdin encoding 'UTF-8'
0.348  opening working tree '/private/tmp/dotfiles'
[ 4033] 2009-04-04 17:01:47.297 INFO:  N  j.cs
0.438  return code 0

Nor does 'bzr cat --filters'.

What is supposed to cause filters/eol.py to be imported normally?



If I explicitly import bzrlib.filters.eol at the end of bzrlib/ 
rules.py, then 'bzr -Dfilters cat --filters' does show a message about  
a content-filter found, and the content is suitably filtered.

But revert of the file does not seem to do the right thing.   
Interestingly, 'bzr -Dfilters revert' only reports a content-filter on  
a second revert (with my "==>" removed) and sometimes the third  
revert; regardless, the filter doesn't seem to be applied:

$ /scratch/dev/bzr-1.14/bzr init --1.14 test
Created a standalone tree (format: 1.14)

$ cd test

$ cat >test.cs
this
is
a
test

$ cat > ~/.bazaar/rules
[name *.cs]
eol = lf-with-crlf-in-repo

$ /scratch/dev/bzr-1.14/bzr add
adding test.cs

$ /scratch/dev/bzr-1.14/bzr -Dfilters commit -m 'Should be transformed'
Committing to: /private/tmp/test/
added test.cs
*** test.cs content-filter: (('eol', u'lf-with-crlf-in-repo'),) =>  
[reader: <function _to_crlf_converter at 0x7b0730>, writer: <function  
_to_lf_converter at 0x7b06f0>]
Committed revision 1.

# check that repo has endings in CR-LF
$ /scratch/dev/bzr-1.14/bzr -Dfilters cat test.cs | hexdump -C
00000000  74 68 69 73 0d 0a 69 73  0d 0a 61 0d 0a 74 65 73  | 
this..is..a..tes|
00000010  74 0d 0a                                          |t..|
00000013

# But when filtered, should have LF
cuttlefish /tmp/test[397](1)$ /scratch/dev/bzr-1.14/bzr -Dfilters cat  
--filters test.cs | hexdump -C
*** test.cs content-filter: (('eol', u'lf-with-crlf-in-repo'),) =>  
[reader: <function _to_crlf_converter at 0x7b0730>, writer: <function  
_to_lf_converter at 0x7b06f0>]
00000000  74 68 69 73 0a 69 73 0a  61 0a 74 65 73 74 0a     | 
this.is.a.test.|
0000000f

# Now try deleting and reverting the file: should have LF endings
$ rm test.cs
$ /scratch/dev/bzr-1.14/bzr -Dfilters revert test.cs
  N  test.cs

$ hexdump -C test.cs
00000000  74 68 69 73 0d 0a 69 73  0d 0a 61 0d 0a 74 65 73  | 
this..is..a..tes|
00000010  74 0d 0a                                          |t..|
00000013

$ /scratch/dev/bzr-1.14/bzr -Dfilters revert test.cs
*** test.cs content-filter: (('eol', u'lf-with-crlf-in-repo'),) =>  
[reader: <function _to_crlf_converter at 0x7b0730>, writer: <function  
_to_lf_converter at 0x7b06f0>]

# but file still has CR-LF
$ hexdump -C test.cs
00000000  74 68 69 73 0d 0a 69 73  0d 0a 61 0d 0a 74 65 73  | 
this..is..a..tes|
00000010  74 0d 0a                                          |t..|
00000013
$

BTW: this is with bzr 1.14, revno 4242 from http://bazaar-vcs.org/bzr/bzr.1.14/ 
.  I get the same behaviour trying bzr.dev too .

Brian.

-- 
"Amusement to an observing mind is study." - Benjamin Disraeli




More information about the bazaar mailing list