mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Fix js munging
This commit is contained in:
parent
15db784238
commit
5a2c3aa7ee
@ -1070,7 +1070,13 @@ def concatjs(target, source, env):
|
||||
for s in source:
|
||||
f = open( str(s) , 'r' )
|
||||
for l in f:
|
||||
l = l.split("//")[0].strip()
|
||||
|
||||
#strip comments. special case if // is potentially in a string
|
||||
parts = l.split("//", 1)
|
||||
if (len(parts) > 1) and ('"' not in parts[1]) and ('"' not in parts[1]):
|
||||
l = parts[0]
|
||||
|
||||
l = l.strip()
|
||||
if len ( l ) == 0:
|
||||
continue
|
||||
|
||||
@ -1112,7 +1118,6 @@ def jsToH(target, source, env):
|
||||
|
||||
for l in open( str(source[0]) , 'r' ):
|
||||
l = l.strip()
|
||||
l = l.split( "//" )[0]
|
||||
l = l.replace( '\\' , "\\\\" )
|
||||
l = l.replace( '"' , "\\\"" )
|
||||
|
||||
|
@ -264,6 +264,7 @@ const char * jsconcatcode =
|
||||
"print( \"warning: no DBRef\" );}\n"
|
||||
"if ( typeof( BinData ) != \"undefined\" ){\n"
|
||||
"BinData.prototype.tojson = function () {\n"
|
||||
"//return \"BinData type: \" + this.type + \" len: \" + this.len;\n"
|
||||
"return this.toString();}}\n"
|
||||
"else {\n"
|
||||
"print( \"warning: no BinData class\" );}\n"
|
||||
@ -522,6 +523,8 @@ const char * jsconcatcode =
|
||||
"print( tojson( x ) );}\n"
|
||||
"shellAutocomplete = function( prefix ){\n"
|
||||
"var a = [];\n"
|
||||
"//a.push( prefix + \"z\" )\n"
|
||||
"//a.push( prefix + \"y\" )\n"
|
||||
"__autocomplete__ = a;}\n"
|
||||
"shellHelper = function( command , rest , shouldPrint ){\n"
|
||||
"command = command.trim();\n"
|
||||
@ -653,7 +656,9 @@ const char * jsconcatcode =
|
||||
"print(\"\\trs.add(hostportstr) add a new member to the set with default attributes\");\n"
|
||||
"print(\"\\trs.conf() return configuration from local.system.replset\");\n"
|
||||
"print();\n"
|
||||
"print(\"\\tdb.isMaster() check who is primary\");}\n"
|
||||
"print(\"\\tdb.isMaster() check who is primary\");\n"
|
||||
"print();\n"
|
||||
"print(\"\\tsee also http://<host>:28017/_replSet for additional diagnostic info\");}\n"
|
||||
"rs.status = function () { return db._adminCommand(\"replSetGetStatus\"); }\n"
|
||||
"rs.initiate = function (c) { return db._adminCommand({ replSetInitiate: c }); }\n"
|
||||
"rs.add = function (hostport) {\n"
|
||||
@ -1373,6 +1378,7 @@ const char * jsconcatcode =
|
||||
"DBQuery.prototype.toString = function(){\n"
|
||||
"return \"DBQuery: \" + this._ns + \" -> \" + tojson( this.query );}\n"
|
||||
"DBQuery.shellBatchSize = 20;\n"
|
||||
"// or db[\"colName\"]\n"
|
||||
"if ( ( typeof DBCollection ) == \"undefined\" ){\n"
|
||||
"DBCollection = function( mongo , db , shortName , fullName ){\n"
|
||||
"this._mongo = mongo;\n"
|
||||
@ -1679,6 +1685,7 @@ const char * jsconcatcode =
|
||||
"function( spec ){\n"
|
||||
"var coll = mydb.getCollection( shortName + \".$\" + spec.name );\n"
|
||||
"var mysize = coll.storageSize();\n"
|
||||
"//print( coll + \"\\t\" + mysize + \"\\t\" + tojson( coll.validate() ) );\n"
|
||||
"total += coll.dataSize();}\n"
|
||||
");\n"
|
||||
"return total;}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user