[Qgis-developer] using indentation scripts
mayeul.kauffmann at free.fr
mayeul.kauffmann at free.fr
Fri May 6 13:19:24 EDT 2011
Hi jef and all,
I guess it's better to have this discussion here than on a comment of line 351 of src/core/symbology-ng/qgsrendererv2.cpp at https://github.com/qgis/Quantum-GIS/pull/3/files#r26150
Probably it would help other people (Is everybody already always using the indentation scripts? If yes, I should get many answers, if not, please read one of today's commits: "If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)").
Jef, you wrote that the reason I could not use the indentation scripts "should be fixed in SHA: 86bcdc4bac26a28c1a25"
Thanks for the hint! Sorry, but I do not understand from the above what to do.
Looking in qgis github for the above code, I arrived here https://github.com/qgis/Quantum-GIS/commits/master
I found this, whose code name is similar to the above:
https://github.com/qgis/Quantum-GIS/commit/86bcdc4bac26a28c1a25adf0ad088390c3bd16d3
Should I take the CMakeLists.txt from the above, replace mine and start again?
Still I found another of your commits that contains much more changes related to astyle:
https://github.com/qgis/Quantum-GIS/commit/dcc723c067a795b240247754817c3c21abdffc28
Tim: you said I should use git as this would be easier than sending a new patch file, but now I see that the 1_7_0 branch lacks the correct files to do the indentation. So should I ask a pull request to port the two above-mentioned commits into 1_7_0 ??! Or fork 1_7_0 into my branch, merge the above into my branch (no idea how to do this with git), re-indent the new code, undo the previous merge (so that it does not propagate to 1_7_0), commit this to my branch and request another pull?!
I guess the whole point of branching to 1_7_0 just before migrating to git is to have a faster release (let people learn git on master). Currently, the 1_7_0 branch is not ready for indenting scripts with git, should that be mandatory? I do not mind trying, but I need some more guidance here. I tried to modify the prepare-commit.sh script to give it the list of files to re-indent but it failed. Any hint on how to do this? Thanks.
Jef, you wrote: "our version of astyle is built in scripts/"
Yes, I saw this and wrote that it "puzzles me". Let me put it differently: from where should I run the script ( my `pwd`) and with which option (I saw the "PATH" hack) to have it find the astyle.sh which is in the folder.
Thanks a lot!
Mayeul
PS: Better to discuss this here for another reason: the hash code in the from/reply to messages sent by git scared my wife ;-) (well, now I redirect them in another folder for sake of her heart).
MK
----- Mail Original -----
De: "Mayeul Kauffmann" <mayeul.kauffmann at free.fr>
À: "jef-n" <reply+p-26150-dcf470ddf5342821ac35239d6bd69865a2dbdb05 at reply.github.com>
Cc: "qgis-developer" <qgis-developer at lists.osgeo.org>
Envoyé: Jeudi 5 Mai 2011 23h49:20 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: [Qgis-developer] using indentation scripts
Hi Jef,
Following your comments on indentation in my patch, I tried to use
prepare-commit.sh for more than one hour in vain. When applied after git
commit it says nothing has changed (in effect, after commit, my working
copy is ahead). So I created a new branch locally to restart from
scratch, reapplied my patch, tried the script, in vain again. The best I
get is:
"Unable to determine upstream SVN information from working tree history"
The only help I could find is a few lines on the following page:
http://www.qgis.org/wiki/Developers_Manual#Coding_Style
"There is a scripts/prepare-commit.sh that looks up the changed files
and reindents them using astyle. This should be run before committing.
As newer versions of astyle indent differently than the version used to
do a complete reindentation of the source, the script uses an old astyle
version, that we include in our repository."
I had to guess by reading the source code of the script that I needed to
install flip (and astyle?), and pass the path to the project as first
parameter, but I could not find any documentation on this. Should the
script be run form the root folder? Should I install astyle or not? (the
comment above on the astyle versions puzzles me).
Finally the following command took 10 minutes:
cd /hometb/mk/sig/dev/release-1_7_0-4May/Quantum-GIS
./scrips/prepare-commit.sh .
before telling me:
"Unable to determine upstream SVN information from working tree history"
I tried from several places with relative or absolute path, in vain.
So I tried to follow this advice on the same wiki:
"There is a .indent.pro file in the QGIS src directory that contains the
switches to be used when indenting code using the GNU indent program. If
you don't use GNU indent, you should emulate these settings."
So I installed GNU indent... but could not find the .indent.pro file in
the QGIS src directory. What indent options should I use?
If I cannot make scrips/prepare-commit.sh work, I do not mind formatting
my code manually, but which guidelines? The manual only says "Tab
spacing should be set to 2 spaces" and "Braces should start on the line
following the expression", which I tried to follow.
I do not mind to try and "emulate these settings", if I know where to
look for.
Still, thank you jef for you comments on coding style and other hints.
Could you please give me some hints on how to solve the above
indentation problem?
Thanks a lot in advance!
Mayeul
jef-n wrote at https://github.com/qgis/Quantum-GIS/pull/3/files#r26150 :
> > @@ -348,7 +348,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::load( QDomElement& element )
> > QgsFeatureRendererV2* r = m->createRenderer( element );
> > if ( r )
> > r->setUsingSymbolLevels( element.attribute( "symbollevels", "0" ).toInt() );
> > -
> > + r->setUsingFirstRule( element.attribute( "firstrule", "0" ).toInt() );
>
> use scripts/prepare-commit.sh please and braces here.
>
See also:
http://osgeo-org.1803224.n2.nabble.com/indentation-scripts-td3194208.html
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list