120 changes: 120 additions & 0 deletions scripts/release.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/perl
# creates a new release

# Copyright (C) 2014 Jürgen E. Fischer <jef@norbit.de>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;

my $newmajor;
my $newminor;
my $releasename;
my $help;

my $result = GetOptions(
"major" => \$newmajor,
"minor" => \$newminor,
"releasename=s" => \$releasename,
"help" => \$help
);

$releasename = shift @ARGV;

pod2usage(1) if $help or !defined $releasename;

my $major;
my $minor;
open F, "CMakeLists.txt";
while(<F>) {
if(/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/) {
$major = $1;
} elsif(/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/) {
$minor = $1;
}
}
close F;

if( defined $newmajor ) {
die "New major must be equal or greater than old major $major" if $newmajor <= $major;
$newminor = 0 unless defined $newminor;
} else {
$newmajor = $major;
}

if( defined $newminor ) {
die "New minor must be greater than current minor $minor" if $newmajor==$major && $newminor<=$minor;
} else {
$newminor = $minor + 1;
}

sub updateCMakeLists {
my($major,$minor,$release) = @_;

rename "CMakeLists.txt", "CMakeLists.txt.orig" or die "cannot rename CMakeLists.txt: $!";
open I, "CMakeLists.txt.orig";
open O, ">CMakeLists.txt" or die "cannot create CMakeLists.txt: $!";
while(<I>) {
s/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MAJOR "$major")/;
s/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/SET(CPACK_PACKAGE_VERSION_MINOR "$minor")/;
s/SET\(RELEASE_NAME "(.+)"\)/SET(RELEASE_NAME "$release")/;
print O;
}
close O;
close I;
}

print "Last pull rebase...\n";
system("git pull --rebase") == 0 or die "git pull rebase failed";

my $release = "$newmajor.$newminor";
my $relbranch = "release-${newmajor}_${newminor}";

print "Creating branch...\n";
system("git checkout -b $relbranch" ) == 0 or die "git checkout release branch failed";
updateCMakeLists($newmajor,$newminor,$releasename);

print "Updating branch...\n";
system("dch -r ''" ) == 0 or die "dch failed";
system( "dch --newversion $newmajor.$newminor.0 'Release of $release'" ) == 0 or die "dch failed";
system( "cp debian/changelog /tmp" ) == 0 or die "backup changelog failed";
system( "git commit -a -m 'Release of $release ($releasename)'" ) == 0 or die "release commit failed";

print "Producing archive...\n";
system( "git archive --format tar HEAD | bzip2 -c >qgis-$release.0.tar.bz2" ) == 0 or die "git archive failed";
system( "md5sum qgis-$newmajor.$newminor.0.tar.bz2 >qgis-$release.0.tar.bz2.md5" ) == 0 or die "md5sum failed";

$newminor++;

print "Updating master...\n";
system( "git checkout master" ) == 0 or die "checkout master failed";
updateCMakeLists($newmajor,$newminor,"Master");
system( "cp /tmp/changelog debian" ) == 0 or die "restore changelog failed";
system("dch -r ''" ) == 0 or die "dch failed";
system( "dch --newversion $newmajor.$newminor.0 'New development version $newmajor.$newminor after branch of $release'" ) == 0 or die "dch failed";
system( "git commit -a -m 'Bump version to $newmajor.$newminor'" ) == 0 or die "bump version failed";

print "Push dry-run...\n";
system( "git push -n origin master $relbranch" ) == 0 or die "git push -n failed";

print "Now manually push and upload the tarballs :\n\tgit push origin master $relbranch\n\trsync qgis-$release.0.tar.bz2* qgis.org:/var/www/downloads/\n\n";

=head1 NAME
release.pl - create a new release
=head1 SYNOPSIS
release.pl [options] releasename
Options:
-major=newmajor new major number for release (defaults to current major version number)
-minor=newminor new minor number for release (defaults to current minor + 1 or 0 when major version number was increased)
next master will become minor + 1
=cut
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9474,7 +9474,7 @@ void QgisApp::namAuthenticationRequired( QNetworkReply *reply, QAuthenticator *a
if ( !ok )
return;

if( reply->isFinished() )
if ( reply->isFinished() )
return;

auth->setUser( username );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ void QgsFieldCalculator::accept()

bool newField = !mUpdateExistingGroupBox->isChecked();
QVariant emptyAttribute;
if( newField )
if ( newField )
emptyAttribute = QVariant( mVectorLayer->pendingFields()[mAttributeId].type() );

QgsFeatureIterator fit = mVectorLayer->getFeatures( QgsFeatureRequest().setFlags( useGeometry ? QgsFeatureRequest::NoFlags : QgsFeatureRequest::NoGeometry ) );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ void QgsFieldsProperties::on_pbnSelectEditForm_clicked()
return;

QFileInfo fi( uifilename );
myQSettings.setValue ( "style/lastUIDir", fi.path() );
myQSettings.setValue( "style/lastUIDir", fi.path() );
leEditForm->setText( uifilename );
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS( QString name )

QString mySql;

QString proj4String=mProj4;
QString proj4String = mProj4;
if ( proj4String.isEmpty() )
{
proj4String = toProj4();
Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ int QgsGeometry::addPart( const QList<QgsPoint> &points, QGis::GeometryType geom

int QgsGeometry::addPart( QgsGeometry *newPart )
{
if( !newPart )
if ( !newPart )
return 4;

const GEOSGeometry * geosPart = newPart->asGeos();
Expand Down Expand Up @@ -3329,7 +3329,7 @@ bool QgsGeometry::intersects( const QgsRectangle& r ) const

bool QgsGeometry::intersects( const QgsGeometry* geometry ) const
{
if( !geometry )
if ( !geometry )
return false;

try // geos might throw exception on error
Expand Down Expand Up @@ -3391,7 +3391,7 @@ bool QgsGeometry::geosRelOp(
const QgsGeometry *a,
const QgsGeometry *b )
{
if( !a || !b )
if ( !a || !b )
return false;

try // geos might throw exception on error
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
QNetworkRequest *pReq(( QNetworkRequest * ) &req ); // hack user agent

QString userAgent = s.value( "/qgis/networkAndProxy/userAgent", "Mozilla/5.0" ).toString();
if( !userAgent.isEmpty() )
if ( !userAgent.isEmpty() )
userAgent += " ";
userAgent += QString( "QGIS/%1" ).arg( QGis::QGIS_VERSION );
pReq->setRawHeader( "User-Agent", userAgent.toUtf8() );
Expand Down Expand Up @@ -189,7 +189,7 @@ void QgsNetworkAccessManager::abortRequest()

QgsMessageLog::logMessage( tr( "Network request %1 timed out" ).arg( reply->url().toString() ), tr( "Network" ) );

if( reply->isRunning() )
if ( reply->isRunning() )
reply->close();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,8 +699,8 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
mRendererV2->startRender( rendererContext, this );

QgsFeatureRequest featureRequest = QgsFeatureRequest()
.setFilterRect( rendererContext.extent() )
.setSubsetOfAttributes( attributes );
.setFilterRect( rendererContext.extent() )
.setSubsetOfAttributes( attributes );

// enable the simplification of the geometries (Using the current map2pixel context) before send it to renderer engine.
if ( simplifyDrawingCanbeApplied( rendererContext, QgsVectorLayer::GeometrySimplification ) )
Expand Down
16 changes: 8 additions & 8 deletions src/core/qgsvectorlayerfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayer* la
if ( request.filterType() == QgsFeatureRequest::FilterFid )
{
// only copy relevant parts
if( L->editBuffer()->addedFeatures().contains( request.filterFid() ) )
mAddedFeatures.insert( request.filterFid(), L->editBuffer()->addedFeatures()[ request.filterFid() ] );
if ( L->editBuffer()->addedFeatures().contains( request.filterFid() ) )
mAddedFeatures.insert( request.filterFid(), L->editBuffer()->addedFeatures()[ request.filterFid()] );

if( L->editBuffer()->changedGeometries().contains( request.filterFid() ) )
mChangedGeometries.insert( request.filterFid(), L->editBuffer()->changedGeometries()[ request.filterFid() ] );
if ( L->editBuffer()->changedGeometries().contains( request.filterFid() ) )
mChangedGeometries.insert( request.filterFid(), L->editBuffer()->changedGeometries()[ request.filterFid()] );

if( L->editBuffer()->deletedFeatureIds().contains( request.filterFid() ) )
if ( L->editBuffer()->deletedFeatureIds().contains( request.filterFid() ) )
mDeletedFeatureIds.insert( request.filterFid() );

if( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
mChangedAttributeValues.insert( request.filterFid(), L->editBuffer()->changedAttributeValues()[ request.filterFid() ] );
if ( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
mChangedAttributeValues.insert( request.filterFid(), L->editBuffer()->changedAttributeValues()[ request.filterFid()] );

if( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
if ( L->editBuffer()->changedAttributeValues().contains( request.filterFid() ) )
mChangedFeaturesRequest.setFilterFids( QgsFeatureIds() << request.filterFid() );
}
else
Expand Down
22 changes: 11 additions & 11 deletions src/providers/mssql/qgsmssqlsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,19 +756,19 @@ void QgsMssqlGeomColumnTypeThread::run()
{
QString table;
table = QString( "%1[%2]" )
.arg( layerProperty.schemaName.isEmpty() ? "" : QString("[%1].").arg( layerProperty.schemaName ))
.arg( layerProperty.schemaName.isEmpty() ? "" : QString( "[%1]." ).arg( layerProperty.schemaName ) )
.arg( layerProperty.tableName );

QString query = QString("SELECT %3"
" UPPER([%1].STGeometryType()),"
" [%1].STSrid"
" FROM %2"
" WHERE [%1] IS NOT NULL %4"
" GROUP BY [%1].STGeometryType(), [%1].STSrid")
.arg( layerProperty.geometryColName )
.arg( table )
.arg( mUseEstimatedMetadata ? "TOP 1" : "" )
.arg( layerProperty.sql.isEmpty() ? "" : QString( " AND %1" ).arg( layerProperty.sql ) );
QString query = QString( "SELECT %3"
" UPPER([%1].STGeometryType()),"
" [%1].STSrid"
" FROM %2"
" WHERE [%1] IS NOT NULL %4"
" GROUP BY [%1].STGeometryType(), [%1].STSrid" )
.arg( layerProperty.geometryColName )
.arg( table )
.arg( mUseEstimatedMetadata ? "TOP 1" : "" )
.arg( layerProperty.sql.isEmpty() ? "" : QString( " AND %1" ).arg( layerProperty.sql ) );

// issue the sql query
QSqlDatabase db = QSqlDatabase::database( mConnectionName );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlsourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
bool mEmbeddedMode;

// queue another query for the thread
void addSearchGeometryColumn(QString connectionName, QgsMssqlLayerProperty layerProperty , bool estimateMetadata);
void addSearchGeometryColumn( QString connectionName, QgsMssqlLayerProperty layerProperty , bool estimateMetadata );

// Set the position of the database connection list to the last
// used one.
Expand Down
4 changes: 2 additions & 2 deletions src/providers/oracle/qgsoracleconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ QString QgsOracleConn::quotedValue( const QVariant &value, QVariant::Type type )
QDateTime datetime( value.toDateTime() );
if ( datetime.isValid() )
return QString( "TO_DATE('%1','YYYY-MM-DD HH24:MI:SS')" ).arg( datetime.toString( "yyyy-MM-dd hh:mm:ss" ) );
break;
break;
}

case QVariant::Date:
Expand All @@ -300,7 +300,7 @@ QString QgsOracleConn::quotedValue( const QVariant &value, QVariant::Type type )
}

default:
break;
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsfeatureiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ bool QgsWFSFeatureIterator::fetchFeature( QgsFeature& f )

for ( ;; )
{
if( mFeatureIterator == mSelectedFeatures.constEnd() )
if ( mFeatureIterator == mSelectedFeatures.constEnd() )
return false;

QMap<QgsFeatureId, QgsFeature* >::iterator it = mProvider->mFeatures.find( *mFeatureIterator );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/providers/testqgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void TestQgsWcsProvider::read( )
QStringList versions;

// TODO: 1.1 test disabled for now beacuse it was failing, UMN Mapserver is giving
// 1x1 pixel response if GRIDORIGIN coordinate has a negative value, but it has to be
// 1x1 pixel response if GRIDORIGIN coordinate has a negative value, but it has to be
// verified if the problem is really on Mapserver side
//versions << "1.0" << "1.1";
versions << "1.0";
Expand Down