tasks/push_svn.js
function(callback) {
        grunt.log.writeln('Push to tmp path...');
        // remove
        if (options.remove) {
          grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
            if (typeof subdir !== 'string') {
              subdir = '';
            }
            var subPath = path.join(subdir, filename);
            if (testIgnore(subPath, ['.svn', '.git'])) {
              return;
            }

            if (
              !grunt.file.exists(path.join(src, subPath)) && 
              !grunt.file.isMatch(options.removeIgnore, subPath)
            ) {
              // remove it
              grunt.log.writeln(util.format('Remove "%s"...', subPath));
              grunt.file.delete(abs);
            }
          });
        }

        // copy
        grunt.file.recurse(src, function(abs, rootdir, subdir, filename) {
          if (typeof subdir !== 'string') {
            subdir = '';
          }
          var subPath = path.join(subdir, filename),
              srcFile = abs,
              destFile = path.join(tmpPath, subPath),
              srcStats = fs.statSync(srcFile),
              destStats;

          if (testIgnore(subPath, ['.svn', '.git'])) {
            return;
          }

          if (!options.pushIgnore || !grunt.file.isMatch(options.pushIgnore, subPath)) {
            // dir
            if (grunt.file.isDir(srcFile)) {
              if (!grunt.file.isDir(destFile)) {
                if (grunt.file.exists(destFile)) {
                  grunt.file.delete(destFile);
                }
                grunt.log.writeln(util.format('Create folder "%s"...', subPath));
                grunt.file.mkdir(destFile);
              }
            }
            else {
              if (grunt.file.isDir(destFile)) {
                grunt.file.delete(destFile);
              }
              else if (grunt.file.exists(destFile)) {
                destStats = fs.statSync(destFile);

                if (srcStats.size !== destStats.size || (destStats.mtime - srcStats.mtime !== 0)) {
                  grunt.log.writeln(util.format('Push changed file "%s"...', subPath));
                  grunt.file.copy(srcFile, destFile);
                  fs.utimesSync(destFile, srcStats.atime, srcStats.mtime);
                }
              }
              else {
                grunt.log.writeln(util.format('Push new file "%s"...', subPath));
                grunt.file.copy(srcFile, destFile);
                fs.utimesSync(destFile, srcStats.atime, srcStats.mtime);
              }
            }
          }
        });
        callback(null);
      }
function(callback) {
        grunt.log.writeln('Push to tmp path...');
        // remove
        if (options.remove) {
          grunt.file.recurse(tmpPath, function(abs, rootdir, subdir, filename) {
            if (typeof subdir !== 'string') {
              subdir = '';
            }
            var subPath = path.join(subdir, filename);
            if (testIgnore(subPath, ['.svn', '.git'])) {
              return;
            }

            if (
              !grunt.file.exists(path.join(src, subPath)) && 
              !grunt.file.isMatch(options.removeIgnore, subPath)
            ) {
              // remove it
              grunt.log.writeln(util.format('Remove "%s"...', subPath));
              grunt.file.delete(abs);
            }
          });
        }

        // copy
        grunt.file.recurse(src, function(abs, rootdir, subdir, filename) {
          if (typeof subdir !== 'string') {
            subdir = '';
          }
          var subPath = path.join(subdir, filename),
              srcFile = abs,
              destFile = path.join(tmpPath, subPath),
              srcStats = fs.statSync(srcFile),
              destStats;

          if (testIgnore(subPath, ['.svn', '.git'])) {
            return;
          }

          if (!options.pushIgnore || !grunt.file.isMatch(options.pushIgnore, subPath)) {
            // dir
            if (grunt.file.isDir(srcFile)) {
              if (!grunt.file.isDir(destFile)) {
                if (grunt.file.exists(destFile)) {
                  grunt.file.delete(destFile);
                }
                grunt.log.writeln(util.format('Create folder "%s"...', subPath));
                grunt.file.mkdir(destFile);
              }
            }
            else {
              if (grunt.file.isDir(destFile)) {
                grunt.file.delete(destFile);
              }
              else if (grunt.file.exists(destFile)) {
                destStats = fs.statSync(destFile);

                if (srcStats.size !== destStats.size || (destStats.mtime - srcStats.mtime !== 0)) {
                  grunt.log.writeln(util.format('Push changed file "%s"...', subPath));
                  grunt.file.copy(srcFile, destFile);
                  fs.utimesSync(destFile, srcStats.atime, srcStats.mtime);
                }
              }
              else {
                grunt.log.writeln(util.format('Push new file "%s"...', subPath));
                grunt.file.copy(srcFile, destFile);
                fs.utimesSync(destFile, srcStats.atime, srcStats.mtime);
              }
            }
          }
        });
        callback(null);
      }
function ( callback ) { grunt . log . writeln ( 'Push to tmp path...' ) ; // remove if ( options . remove ) { grunt . file . recurse ( tmpPath , function ( abs , rootdir , subdir , filename ) { if ( typeof subdir !== 'string' ) { subdir = '' ; } var subPath = path . join ( subdir , filename ) ; if ( testIgnore ( subPath , [ '.svn' , '.git' ] ) ) { return ; } if ( ! grunt . file . exists ( path . join ( src , subPath ) ) && ! grunt . file . isMatch ( options . removeIgnore , subPath ) ) { // remove it grunt . log . writeln ( util . format ( 'Remove "%s"...' , subPath ) ) ; grunt . file . delete ( abs ) ; } } ) ; } // copy grunt . file . recurse ( src , function ( abs , rootdir , subdir , filename ) { if ( typeof subdir !== 'string' ) { subdir = '' ; } var subPath = path . join ( subdir , filename ) , srcFile = abs , destFile = path . join ( tmpPath , subPath ) , srcStats = fs . statSync ( srcFile ) , destStats ; if ( testIgnore ( subPath , [ '.svn' , '.git' ] ) ) { return ; } if ( ! options . pushIgnore || ! grunt . file . isMatch ( options . pushIgnore , subPath ) ) { // dir if ( grunt . file . isDir ( srcFile ) ) { if ( ! grunt . file . isDir ( destFile ) ) { if ( grunt . file . exists ( destFile ) ) { grunt . file . delete ( destFile ) ; } grunt . log . writeln ( util . format ( 'Create folder "%s"...' , subPath ) ) ; grunt . file . mkdir ( destFile ) ; } } else { if ( grunt . file . isDir ( destFile ) ) { grunt . file . delete ( destFile ) ; } else if ( grunt . file . exists ( destFile ) ) { destStats = fs . statSync ( destFile ) ; if ( srcStats . size !== destStats . size || ( destStats . mtime - srcStats . mtime !== 0 ) ) { grunt . log . writeln ( util . format ( 'Push changed file "%s"...' , subPath ) ) ; grunt . file . copy ( srcFile , destFile ) ; fs . utimesSync ( destFile , srcStats . atime , srcStats . mtime ) ; } } else { grunt . log . writeln ( util . format ( 'Push new file "%s"...' , subPath ) ) ; grunt . file . copy ( srcFile , destFile ) ; fs . utimesSync ( destFile , srcStats . atime , srcStats . mtime ) ; } } } } ) ; callback ( null ) ; }
sync with tmp working directory
sync with tmp working directory