Opened 15 years ago

Closed 14 years ago

#52 closed defect (fixed)

Repository CRNL purge

Reported by: adube Owned by:
Priority: minor Milestone:
Component: other Version:
Keywords: repository, svn, crnl, CRNL, \M Cc: adube@…

Description

situation

There are CRNL characters '\M' in many GeoPrisma files.

problem

When editing these in Linux, they can disappear and make patches much bigger and more complex they they would be.

solution

  1. Clean up all GeoPrisma files off all \M characters with dos2unix
  2. Commit this change
  3. Apply some kind of rule on the GeoPrisma repository that denies commits of files with \M
  4. Each commiter must configure his subversion to automatically remove \M characters on svn transactions
  5. Add (4) to a new documentation topic in sphinx

reference

Here's an article about this subject :
http://cwiki.apache.org/GMOxDEV/subversion-client-configuration.html

Attachments (2)

svn_apply_autoprops.py (2.1 KB ) - added by yvesm 15 years ago.
Applies svn properties set in ./subversion/config recursively from the calling dir
config (5.6 KB ) - added by yvesm 15 years ago.
Use this file to set the svn:eol-style property

Download all attachments as: .zip

Change History (5)

comment:1 by yvesm, 15 years ago

An excerpt that summarizes the issue : "typically, Unix programs treat the CR character present in Windows files as a regular character (usually rendered as ^M), and Windows programs combine all of the lines of a Unix file into one giant line because no carriage return-linefeed (or CRLF) character combination was found to denote the ends of the lines" (http://svnbook.red-bean.com/en/1.4/svn.advanced.props.file-portability.html)

About http://cwiki.apache.org/GMOxDEV/subversion-client-configuration.html : we can't just copy paste that. People setting their svn client configuration (on both windows and Linux because emacs will force LF !) must make sure that all the following file types have "svn:eol-style=native" :

*.php, *.xslt, *.rst

in addition to the svn:eol-style= directives set on that page.

In my own svn config :

### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
# enable-auto-props = yes

So I need to enable auto props, but that only kicks in at svn add time.

Test on my machine ( ~/.subversion/config) :

With default svn client settings (enable-auto-props = no [commented out]) :

yves@yves-laptop:~/osgeo/geoprisma/trunk/src/client/widgets/shortcut$ svn proplist Shortcut.rst

Nothing.

If I edit the svn config file :

enable-auto-props = yes
...
*.rst = svn:eol-style=native

yves@yves-laptop:~/osgeo/geoprisma/trunk/src/client/widgets/shortcut$ svn add test.rst 
A         test.rst
yves@yves-laptop:~/osgeo/geoprisma/trunk/src/client/widgets/shortcut$ svn proplist test.rst 
Propriétés sur 'test.rst'
  svn:eol-style

So from now on every file .rst file I'll be adding will have the eol-style svn property added and things will work smoothly between windows and Linux.

About a pre-commit hook, here's what we could use for a pre-commit hook : http://tarekziade.wordpress.com/2006/11/01/protecting-a-python-svn-code-base-with-the-pre-commit-hook/

by yvesm, 15 years ago

Attachment: svn_apply_autoprops.py added

Applies svn properties set in ./subversion/config recursively from the calling dir

by yvesm, 15 years ago

Attachment: config added

Use this file to set the svn:eol-style property

comment:2 by yvesm, 15 years ago

Here's what I did on the trunk/src directory :

1) CRLF -> LF for files that are not in .svn or /img or an image file (png, gif) :

file find -type f ! -path '*.svn*' | grep -Erl '|\r|' * | grep -v .svn | grep -v /img | grep -v .png | grep -v .gif | grep -v /merge | xargs dos2unix

2) Recursively apply the svn properties defined in ~./subversion/config (see attachment:config) recursively in the src directory

yves@yves-laptop:~/osgeo/geoprisma/trunk/src$ ~/svn_apply_autoprops.py (see attachment:svn_apply_autoprops.py)

One file didn't go through : Map.rst. Here's the full error :

Erreur : 

svn: Le fichier 'client/widgets/map/Map.rst' a des sauts de ligne incohérents
svn: Style de fin de ligne inconsistant
Command "svn propset svn:eol-style native client/widgets/mapfishrecenter/MapFishRecenter.rst
 client/widgets/quickzoom/QuickZoom.rst client/widgets/sample/Sample.rst client/widgets
/initialview/InitialView.rst client/widgets/scale/Scale.rst client/widgets/zoomslider
/ZoomSlider.rst client/widgets/split/Split.rst client/widgets/merge/Merge.rst client/widgets
/measuretool/MeasureTool.rst client/widgets/editfeature/delete/Delete.rst client/widgets
/editfeature/update/Update.rst client/widgets/editfeature/create/Create.rst client/widgets
/editfeature/EditFeature.rst client/widgets/toolbar/Toolbar.rst client/widgets/popup/PopUp.rst 
client/widgets/mapfishlayertree/MapFishLayerTree.rst client/widgets/resultextgrid
/ResultExtGrid.rst client/widgets/queryonclick/QueryOnClick.rst client/widgets/geoextux
/geonamessearchcombo/GeoNamesSearchCombo.rst client/widgets/featurepanel/selector
/FeaturePanel_Selector.rst client/widgets/featurepanel/form/FeaturePanel_Form.rst client/widgets
/shortcut/Shortcut.rst client/widgets/mouseposition/MousePosition.rst client/widgets/map/Map.rst 
client/widgets/getmouseposition/GetMousePosition.rst client/widgets/legendpanel/LegendPanel.rst 
client/widgets/geoexttoolbar/GeoExtToolbar.rst" failed with exit status 1

r765

comment:3 by adube, 14 years ago

Resolution: fixed
Status: newclosed

This task is done so I'm closing the ticket.

Note: See TracTickets for help on using tickets.