[Python-Dev] whitespace normalization pre-commit hook is giving me grief

Georg Brandl g.brandl at gmx.net
Sat May 26 08:36:03 CEST 2007


Neal Norwitz schrieb:
> On 5/25/07, Brett Cannon <brett at python.org> wrote:
>> In my bcannon-objcap branch I am trying to check in a change that involves a
>> soft symlink from Lib/controlled_importlib.py to
>> ../importlib/controlled_importlib.py through ``ln -s
>> ../controlled_importlib.py controlled_importlib.py`` while in the Lib
>> directory.  I have done this before in this branch so as to allow for easy
>> importing of code from the svn import of importlib that the branch contains.
> 
> I don't know that we've ever tested the commit hook with a link.
> Maybe there is some other problem.

The cause: For symlinks, SVN saves a file containing "link /target" and sets
the "svn:special" property. Since the special file doesn't end with a newline,
reindent adds that, and boom.

The solution: add
     if fs.node_prop(txn_root, path, 'svn:special') == '*': continue

in the commit hook's for loop.

cheers,
Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list