From 0fc4c2f05f3d4d43055150f04fd12628c2e75ee0 Mon Sep 17 00:00:00 2001 From: Farrin Reid Date: Sat, 23 Jun 2012 05:17:15 -0800 Subject: [PATCH] [fix] Changed require('sys') to require('util') for compatibility with node v0.8 --- benchmarks/benchmark.js | 10 ++-- lib/diff/diff.js | 4 +- lib/git/actor.js | 2 +- lib/git/binary_parser.js | 14 ++--- lib/git/commit.js | 2 +- lib/git/file_index.js | 2 +- lib/git/file_window.js | 4 +- lib/git/git.js | 2 +- lib/git/git_file_operations.js | 4 +- lib/git/git_index.js | 2 +- lib/git/head.js | 2 +- lib/git/internal/git_blob.js | 2 +- lib/git/internal/git_commit.js | 4 +- lib/git/internal/git_tag.js | 4 +- lib/git/internal/git_tree.js | 2 +- lib/git/loose_storage.js | 2 +- lib/git/mime/mime_types.js | 2 +- lib/git/pack_storage.js | 2 +- lib/git/raw_object.js | 2 +- lib/git/repo.js | 2 +- lib/git/repository.js | 2 +- lib/git/status.js | 2 +- lib/git/status_file.js | 2 +- lib/git/sub_module.js | 2 +- lib/git/tree.js | 2 +- lib/git/user_info.js | 2 +- lib/zlib/zlib.js | 96 +++++++++++++++++----------------- test/diff/test_diff.js | 2 +- 28 files changed, 90 insertions(+), 90 deletions(-) diff --git a/benchmarks/benchmark.js b/benchmarks/benchmark.js index b9fb012..1000338 100644 --- a/benchmarks/benchmark.js +++ b/benchmarks/benchmark.js @@ -1,6 +1,6 @@ var Repo = require('git/repo').Repo, - sys = require('sys'), + util = require('util'), fs = require('fs'), exec = require('child_process').exec; @@ -14,7 +14,7 @@ var create_tmp_directory = function(clone_path, callback) { // Copy the old directory to the new one var child = exec('cp -R ' + clone_path + ' ' + tmp_path, function (error, stdout, stderr) { if (error !== null) { - sys.puts('exec error: ' + error); + util.puts('exec error: ' + error); return callback(error, null); } return callback(null, tmp_path); @@ -25,7 +25,7 @@ var destroy_directory = function(directory, callback) { // Copy the old directory to the new one var child = exec('rm -rf ' + directory, function (error, stdout, stderr) { if (error !== null) { - sys.puts('exec error: ' + error); + util.puts('exec error: ' + error); return callback(error, null); } return callback(null, null); @@ -125,7 +125,7 @@ var execute_process = function(type) { var end_time = new Date(); var total_miliseconds = end_time.getTime() - start_time.getTime(); - sys.puts("[" + type + "]::executed in: " + (total_miliseconds/1000) + " seconds"); + util.puts("[" + type + "]::executed in: " + (total_miliseconds/1000) + " seconds"); // Delete the directory destroy_directory(target_path, function(err, result) {}); }); @@ -144,7 +144,7 @@ if(process.argv.length > 2 && process.argv[2].match(/packobj|commits1|commits2|b execute_process(process.argv[2]); } } else { - sys.puts("Please provide the benchmark you wish to run in the form ") + util.puts("Please provide the benchmark you wish to run in the form ") } diff --git a/lib/diff/diff.js b/lib/diff/diff.js index aa8c09b..da6455a 100644 --- a/lib/diff/diff.js +++ b/lib/diff/diff.js @@ -1,4 +1,4 @@ -var sys = require('sys'), +var util = require('util'), SequenceCallbacks = require('./callbacks').SequenceCallbacks, ContextChange = require('./change').ContextChange, Change = require('./change').Change, @@ -762,7 +762,7 @@ Difference.LCS.__normalize_patchset = function(patchset) { }); } } else { - throw "Cannot normalize the hunk: " + sys.inspect(hunk); + throw "Cannot normalize the hunk: " + util.inspect(hunk); } })); } diff --git a/lib/git/actor.js b/lib/git/actor.js index 923d1e3..6c1deb5 100644 --- a/lib/git/actor.js +++ b/lib/git/actor.js @@ -1,4 +1,4 @@ -var sys = require('sys'); +var util = require('util'); Actor = exports.Actor = function(name, email) { var _name = name, _email = email; diff --git a/lib/git/binary_parser.js b/lib/git/binary_parser.js index a65a913..a574d02 100644 --- a/lib/git/binary_parser.js +++ b/lib/git/binary_parser.js @@ -222,25 +222,25 @@ p.encode_utf8 = function(s) { }; p.pprint = function(s) { - var sys = require('sys'); + var util = require('util'); for (var i=0; ihttp://www.cs.tut.fi/~albert/Dev/gunzip/gunzip.c * @see http://www.cs.tut.fi/~albert */ -var sys = require('sys'); +var util = require('util'); var Zlib = exports.Zlib = {}; /** @@ -136,7 +136,7 @@ Zlib.Unzip = function (barray){ if (bytepos"); - // sys.debug(bA[bytepos++].toString(16)) + // util.debug(bA[bytepos++].toString(16)) // return String.fromCharCode(bA[bytepos++]); return bA[bytepos++]; } else @@ -227,7 +227,7 @@ Zlib.Unzip = function (barray){ var curplace = Places[treepos]; var tmp; if (debug) - sys.debug("len: " + len + " treepos: " + treepos) + util.debug("len: " + len + " treepos: " + treepos) if(len==17) { //war 17 return -1; } @@ -236,16 +236,16 @@ Zlib.Unzip = function (barray){ tmp = IsPat(); if (debug) - sys.debug("IsPat " + tmp) + util.debug("IsPat " + tmp) if(tmp >= 0) { curplace.b0 = tmp; /* leaf cell for 0-bit */ if (debug) - sys.debug("b0 " + curplace.b0) + util.debug("b0 " + curplace.b0) } else { /* Not a Leaf cell */ curplace.b0 = 0x8000; if (debug) - sys.debug("b0 " + curplace.b0) + util.debug("b0 " + curplace.b0) if(Rec()) return -1; } @@ -253,13 +253,13 @@ Zlib.Unzip = function (barray){ if(tmp >= 0) { curplace.b1 = tmp; /* leaf cell for 1-bit */ if (debug) - sys.debug("b1 " + curplace.b1); + util.debug("b1 " + curplace.b1); curplace.jump = null; /* Just for the display routine */ } else { /* Not a Leaf cell */ curplace.b1 = 0x8000; if (debug) - sys.debug("b1 " + curplace.b1); + util.debug("b1 " + curplace.b1); curplace.jump = Places[treepos]; curplace.jumppos = treepos; if(Rec()) @@ -274,7 +274,7 @@ Zlib.Unzip = function (barray){ /* Create the Huffman decode tree/table */ //document.write("
createtree
"); if (debug) - sys.debug("currentTree " + currentTree + " numval " + numval + " lengths " + lengths + " show " + show); + util.debug("currentTree " + currentTree + " numval " + numval + " lengths " + lengths + " show " + show); Places = currentTree; treepos=0; flens = lengths; @@ -285,14 +285,14 @@ Zlib.Unzip = function (barray){ if(Rec()) { //fprintf(stderr, "invalid huffman tree\n"); if (debug) - sys.debug("invalid huffman tree"); + util.debug("invalid huffman tree"); return -1; } if (debug){ - sys.debug("Tree: " + Places.length); + util.debug("Tree: " + Places.length); for (var a=0;a<32;a++){ - sys.debug("Places[" + a + "].b0=" + Places[a].b0); - sys.debug("Places[" + a + "].b1=" + Places[a].b1); + util.debug("Places[" + a + "].b0=" + Places[a].b0); + util.debug("Places[" + a + "].b1=" + Places[a].b1); } } @@ -324,11 +324,11 @@ Zlib.Unzip = function (barray){ while(1) { b=readBit(); if (debug) - sys.debug("b=" + b); + util.debug("b=" + b); if(b) { if(!(X.b1 & 0x8000)){ if (debug) - sys.debug("ret1"); + util.debug("ret1"); return X.b1; /* If leaf node, return data */ } X = X.jump; @@ -343,7 +343,7 @@ Zlib.Unzip = function (barray){ } else { if(!(X.b0 & 0x8000)){ if (debug) - sys.debug("ret2"); + util.debug("ret2"); return X.b0; /* If leaf node, return data */ } //X++; //?????????????????? @@ -352,7 +352,7 @@ Zlib.Unzip = function (barray){ } } if (debug) - sys.debug("ret3"); + util.debug("ret3"); return -1; }; @@ -371,23 +371,23 @@ Zlib.Unzip = function (barray){ switch(type) { case 0: if (debug) - sys.debug("Stored"); + util.debug("Stored"); break; case 1: if (debug) - sys.debug("Fixed Huffman codes"); + util.debug("Fixed Huffman codes"); break; case 2: if (debug) - sys.debug("Dynamic Huffman codes"); + util.debug("Dynamic Huffman codes"); break; case 3: if (debug) - sys.debug("Reserved block type!!"); + util.debug("Reserved block type!!"); break; default: if (debug) - sys.debug("Unexpected value " + type); + util.debug("Unexpected value " + type); break; } @@ -403,7 +403,7 @@ Zlib.Unzip = function (barray){ cSum |= (readByte()<<8); if(((blockLen ^ ~cSum) & 0xffff)) { - sys.debug("BlockLen checksum mismatch"); + util.debug("BlockLen checksum mismatch"); } while(blockLen--) { c = readByte(); @@ -508,9 +508,9 @@ Zlib.Unzip = function (barray){ return 1; } if (debug){ - sys.debug("distanceTree"); + util.debug("distanceTree"); for(var a=0;a= 256) { // In C64: if carry set @@ -636,7 +636,7 @@ Zlib.Unzip.prototype.unzipFile = function(name) { Zlib.Unzip.prototype.unzip = function() { //convertToByteArray(input); if (debug) - sys.debug(bA); + util.debug(bA); /*for (i=0;i