Ticket #1527: 1527_ckreleaser.patch

File 1527_ckreleaser.patch, 1.9 KB (added by Wiktor Walc, 15 years ago)
  • _source/includes/releaser.js

     
    223223        var regexLib =
    224224        {
    225225                packagerRemove : Pattern.compile( '(?m-s:^.*?%REMOVE_START%).*?(?m-s:%REMOVE_END%.*?$)', Pattern.DOTALL ),
    226                 packagerRemoveLine : Pattern.compile( '.*%REMOVE_LINE%.*(?:\\r\\n|\\r|\\n)?' )
     226                packagerRemoveLine : Pattern.compile( '.*%REMOVE_LINE%.*(?:\\r\\n|\\r|\\n)?' ),
     227                packagerRev : Pattern.compile( '.*Revision: (\\d+).*', Pattern.DOTALL )
    227228        };
    228229
    229230        /*
    230231         * %VERSION%:
    231232         *     the "version" string passed to the CKReleaser execution command.
     233         * %REVISION%:
     234         *     the SVN revision number of the source directory.
    232235         * %TIMESTAMP%:
    233236         *     a four characters string containing the
    234237         *     concatenation of the "Base 36" value of each of the following components
     
    249252                        text = text.replace( /%VERSION%/g, CKRELEASER.version );
    250253                        replaced = true;
    251254                }
     255                if ( text.indexOf( "%REVISION%" ) != -1 )
     256                {
     257                        var o =
     258                        {
     259                                output : ""
     260                        };
     261
     262                        runCommand( "svn", "info", CKRELEASER.sourceDir, o );
     263
     264                        if ( o.output.indexOf( "Revision:" ) != -1 )
     265                        {
     266                                var rev = regexLib.packagerRev.matcher( o.output ).replaceAll( '$1' );
     267                                text = text.replace( /%REVISION%/g, rev );
     268                        }
     269                        else
     270                        {
     271                                if ( o.output.indexOf( "not a working" ) != -1 )
     272                                        print( "WARNING: Unable to fetch the revision number, source directory is not under version control: "
     273                                                        + CKRELEASER.sourceDir );
     274                                else
     275                                        print( "WARNING: Unable to fetch the revision number, make sure that Subversion’s bin directory is in your system path." );
     276                                text = text.replace( /%REVISION%/g, "UNKNOWN" );
     277                        }
     278
     279                        replaced = true;
     280                }
    252281                if ( text.indexOf( "%TIMESTAMP%" ) != -1 )
    253282                {
    254283                        text = text.replace( /%TIMESTAMP%/g, CKRELEASER.timestamp );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy