Ticket #5431: 5431.patch

File 5431.patch, 3.9 KB (added by Garry Yao, 14 years ago)
  • _source/includes/ckreleaser.js

     
    1414        path : "",
    1515        revisionNumber : 0,
    1616
    17         timestamp : ( function()
    18         {
    19                 var time = new Date();
     17        timestamp : 0,
    2018
    21                 var timestamp = Integer.toString( time.getUTCFullYear() % 1000, 36 )
    22                                 + Integer.toString( time.getUTCMonth(), 36 ) + Integer.toString( time.getUTCDate(), 36 )
    23                                 + Integer.toString( time.getUTCHours(), 36 );
    24 
    25                 return timestamp.toUpperCase();
    26         } )(),
    27 
    2819        load : function( className )
    2920        {
    3021                if ( CKRELEASER.isCompiled )
  • _source/includes/releaser.js

     
    292292                }
    293293                if ( text.indexOf( "%REV%" ) != -1 )
    294294                {
    295                         if ( !CKRELEASER.revisionNumber )
    296                         {
    297                                 try
    298                                 {
    299                                         var o =
    300                                         {
    301                                                         output : ""
    302                                         };
    303 
    304                                         runCommand( "svn", "info", CKRELEASER.sourceDir, o );
    305 
    306                                         if ( o.output.indexOf( "Revision:" ) != -1 )
    307                                         {
    308                                                 CKRELEASER.revisionNumber = regexLib.packagerRev.matcher( o.output ).replaceAll( '$1' );
    309                                         }
    310                                         else
    311                                         {
    312                                                 if ( o.output.indexOf( "not a working" ) != -1 )
    313                                                         print( "\nWARNING: Unable to fetch the revision number, source directory is not under version control: "
    314                                                                         + CKRELEASER.sourceDir );
    315                                                 else
    316                                                         print( "\nWARNING: Unable to fetch the revision number, make sure that Subversion's bin directory is in your system path." );           
    317                                         }
    318                                 }
    319                                 catch( e )
    320                                 {
    321                                         print( "\nWARNING: Unable to run \"svn\" command to get the revision number, make sure that Subversion is installed and that Subversion's bin directory is in your system path." );
    322                                 }
    323                                
    324                                 if ( !CKRELEASER.revisionNumber )
    325                                         CKRELEASER.revisionNumber = "UNKNOWN";
    326                         }
    327 
    328295                        text = text.replace( /%REV%/g, CKRELEASER.revisionNumber );
    329296
    330297                        replaced = true;
     
    478445                                        throw "Target directory must be located outside the source directory";
    479446                        }
    480447
     448                        if ( !CKRELEASER.revisionNumber )
     449                        {
     450                                try
     451                                {
     452                                        var o =
     453                                        {
     454                                                        output : ""
     455                                        };
     456
     457                                        runCommand( "svn", "info", CKRELEASER.sourceDir, o );
     458
     459                                        if ( o.output.indexOf( "Revision:" ) != -1 )
     460                                                CKRELEASER.revisionNumber = parseInt( regexLib.packagerRev.matcher( o.output ).replaceAll( '$1' ) );
     461                                        else
     462                                        {
     463                                                if ( o.output.indexOf( "not a working" ) != -1 )
     464                                                        print( "\nWARNING: Unable to fetch the revision number, source directory is not under version control: "
     465                                                                        + CKRELEASER.sourceDir );
     466                                                else
     467                                                        print( "\nWARNING: Unable to fetch the revision number, make sure that Subversion's bin directory is in your system path." );
     468                                        }
     469                                }
     470                                catch( e )
     471                                {
     472                                        print( "\nWARNING: Unable to run \"svn\" command to get the revision number, make sure that Subversion is installed and that Subversion's bin directory is in your system path." );
     473                                }
     474
     475                                if ( !CKRELEASER.revisionNumber )
     476                                        CKRELEASER.revisionNumber = "UNKNOWN";
     477                        }
     478
     479                        if ( !CKRELEASER.timestamp )
     480                        {
     481                                var now = new Date();
     482                                var timestamp = Integer.toString( now.getUTCFullYear() % 1000, 36 )
     483                                                + Integer.toString( now.getUTCMonth(), 36 ) + Integer.toString( now.getUTCDate(), 36 )
     484                                                + Integer.toString( now.getUTCHours(), 36 );
     485
     486                                if ( typeof CKRELEASER.revisionNumber == 'number' )
     487                                        timestamp += Integer.toString( CKRELEASER.revisionNumber, 36 );
     488
     489                                print( '\nGenerating timestamp (base36 encode of YYMMDDHH[revision_number]): ' + timestamp.toUpperCase() );
     490
     491                                CKRELEASER.timestamp = timestamp.toUpperCase();
     492                        }
     493
    481494                        if ( !releaseDir.mkdirs() )
    482495                                throw "Cannot create release directory (" + releaseDir + ")";
    483496
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy