Index: src/add.c ================================================================== --- src/add.c +++ src/add.c @@ -456,26 +456,30 @@ ** Options: ** --case-sensitive override case-sensitive setting ** --dotfiles include files beginning with a dot (".") ** --ignore ignore files matching patterns from the ** comma separated list of glob patterns. -** --test If given, display instead of run actions +** --nochange|-n If given, display instead of run actions ** ** See also: add, rm */ void addremove_cmd(void){ Blob path; const char *zIgnoreFlag = find_option("ignore",0,1); unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; - int isTest = find_option("test",0,0)!=0; + int nochangeFlag = find_option("nochange","n",0)!=0; int n; Stmt q; int vid; int nAdd = 0; int nDelete = 0; Glob *pIgnore; + if( !nochangeFlag ){ + /* --test is deprecated */ + nochangeFlag = find_option("test",0,0)!=0; + } capture_case_sensitive_option(); db_must_be_within_tree(); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } @@ -512,11 +516,11 @@ const char * zPath; zFile = db_column_text(&q, 0); zPath = db_column_text(&q, 1); if( !file_wd_isfile_or_link(zPath) ){ - if( !isTest ){ + if( !nochangeFlag ){ db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); } fossil_print("DELETED %s\n", zFile); nDelete++; } @@ -523,11 +527,11 @@ } db_finalize(&q); /* show command summary */ fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); - db_end_transaction(isTest); + db_end_transaction(nochangeFlag); } /* ** Rename a single file. Index: src/allrepo.c ================================================================== --- src/allrepo.c +++ src/allrepo.c @@ -109,20 +109,20 @@ char *zFossil; char *zQFilename; Blob extra; int useCheckouts = 0; int quiet = 0; - int testRun = 0; + int nochangeFlag = 0; int stopOnError = find_option("dontstop",0,0)==0; int rc; Bag outOfDate; - /* The undocumented --test option causes no changes to occur to any + /* The undocumented --nochange option causes no changes to occur to any ** repository, but instead show what would have happened. Intended for ** test and debugging use. */ - testRun = find_option("test",0,0)!=0; + nochangeFlag = find_option("nochange","n",0)!=0; if( g.argc<3 ){ usage("changes|list|ls|pull|push|rebuild|sync"); } n = strlen(g.argv[2]); @@ -169,11 +169,11 @@ verify_all_options(); db_begin_transaction(); for(j=3; j0; rowid=bag_next(&outOfDate,rowid)){ blob_appendf(&sql, "%s%d", zSep, rowid); zSep = ","; } blob_appendf(&sql, ")"); - if( testRun ){ + if( nochangeFlag ){ fossil_print("%s\n", blob_str(&sql)); }else{ db_multi_exec(blob_str(&sql)); } blob_reset(&sql); } } Index: src/checkin.c ================================================================== --- src/checkin.c +++ src/checkin.c @@ -410,17 +410,17 @@ const char *zIgnoreFlag; Blob path, repo; Stmt q; int n; Glob *pIgnore; - int testFlag = 0; + int nochangeFlag = 0; allFlag = find_option("force","f",0)!=0; if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; zIgnoreFlag = find_option("ignore",0,1); - testFlag = find_option("test",0,0)!=0; + nochangeFlag = find_option("nochange","n",0)!=0; capture_case_sensitive_option(); db_must_be_within_tree(); if( zIgnoreFlag==0 ){ zIgnoreFlag = db_get("ignore-glob", 0); } @@ -440,11 +440,11 @@ if( file_tree_name(g.zRepositoryName, &repo, 0) ){ db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); } db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); while( db_step(&q)==SQLITE_ROW ){ - if( testFlag ){ + if( nochangeFlag ){ fossil_print("%s\n", db_column_text(&q,0)); continue; }else if( !allFlag ){ Blob ans; char cReply; @@ -1154,11 +1154,11 @@ int allowFork = 0; /* Allow the commit to fork */ int allowOlder = 0; /* Allow a commit older than its ancestor */ char *zManifestFile; /* Name of the manifest file */ int useCksum; /* True if checksums should be computed and verified */ int outputManifest; /* True to output "manifest" and "manifest.uuid" */ - int testRun; /* True for a test run. Debugging only */ + int nochangeFlag; /* True for a test run. Debugging only */ CheckinInfo sCiInfo; /* Information about this check-in */ const char *zComFile; /* Read commit message from this file */ int nTag = 0; /* Number of --tag arguments */ const char *zTag; /* A single --tag argument */ Blob manifest; /* Manifest in baseline form */ @@ -1178,11 +1178,11 @@ forceDelta = find_option("delta",0,0)!=0; forceBaseline = find_option("baseline",0,0)!=0; if( forceDelta && forceBaseline ){ fossil_fatal("cannot use --delta and --baseline together"); } - testRun = find_option("test",0,0)!=0; + nochangeFlag = find_option("nochange","n",0)!=0; zComment = find_option("comment","m",1); forceFlag = find_option("force", "f", 0)!=0; allowConflict = find_option("allow-conflict",0,0)!=0; allowEmpty = find_option("allow-empty",0,0)!=0; allowFork = find_option("allow-fork",0,0)!=0; @@ -1522,11 +1522,11 @@ } /* If the --test option is specified, output the manifest file ** and rollback the transaction. */ - if( testRun ){ + if( nochangeFlag ){ blob_write_to_file(&manifest, ""); } if( outputManifest ){ zManifestFile = mprintf("%smanifest", g.zLocalRoot); @@ -1601,11 +1601,11 @@ /* Clear the undo/redo stack */ undo_reset(); /* Commit */ db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); - if( testRun ){ + if( nochangeFlag ){ db_end_transaction(1); exit(1); } db_end_transaction(0); Index: src/diff.c ================================================================== --- src/diff.c +++ src/diff.c @@ -2415,11 +2415,11 @@ login_check_credentials(); if( !g.perm.Read ){ login_needed(); return; } mid = name_to_typed_rid(PD("checkin","0"),"ci"); fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename")); if( mid==0 || fnid==0 ){ fossil_redirect_home(); } - iLimit = atoi(PD("limit","-1")); + iLimit = atoi(PD("count","-1")); if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ fossil_redirect_home(); } compute_direct_ancestors(mid, 10000000); style_header("File Annotation"); @@ -2459,11 +2459,11 @@ ** ** Output the text of a file with markings to show when each line of ** the file was last modified. ** ** Options: -** --limit N Only look backwards in time by N versions +** --count|-n N Only look backwards in time by N versions ** --log List all versions analyzed ** --filevers Show file version numbers rather than check-in versions ** ** See also: info, finfo, timeline */ @@ -2474,17 +2474,21 @@ int cid; /* Checkout ID */ Blob treename; /* FILENAME translated to canonical form */ char *zFilename; /* Canonical filename */ Annotator ann; /* The annotation of the file */ int i; /* Loop counter */ - const char *zLimit; /* The value to the --limit option */ + const char *zLimit; /* The value to the --count option */ int iLimit; /* How far back in time to look */ int showLog; /* True to show the log */ int fileVers; /* Show file version instead of check-in versions */ int annFlags = 0; /* Flags to control annotation properties */ - zLimit = find_option("limit",0,1); + zLimit = find_option("count","n",1); + if(!zLimit){ + /* deprecated */ + zLimit = find_option("limit",0,1); + } if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; iLimit = atoi(zLimit); showLog = find_option("log",0,0)!=0; fileVers = find_option("filevers",0,0)!=0; db_must_be_within_tree(); Index: src/finfo.c ================================================================== --- src/finfo.c +++ src/finfo.c @@ -27,11 +27,11 @@ ** ** Print the complete change history for a single file going backwards ** in time. The default mode is -l. ** ** For the -l|--log mode: If "-b|--brief" is specified one line per revision -** is printed, otherwise the full comment is printed. The "--limit N" +** is printed, otherwise the full comment is printed. The "--count N" ** and "--offset P" options limits the output to the first N changes ** after skipping P changes. ** ** In the -s mode prints the status as . This is ** a quick status and does not check for up-to-date-ness of the file. @@ -42,11 +42,11 @@ ** ** Options: ** --brief|-b display a brief (one line / revision) summary ** --case-sensitive B Enable or disable case-sensitive filenames. B is a ** boolean: "yes", "no", "true", "false", etc. -** --limit N display the first N changes +** --count|n N display the first N changes ** --log|-l select log mode (the default) ** --offset P skip P changes ** --print|-p select print mode ** --revision|-r R print the given revision (or ckout, if none is given) ** to stdout (only in print mode) @@ -140,11 +140,15 @@ int iLimit, iOffset, iBrief; if( find_option("log","l",0) ){ /* this is the default, no-op */ } - zLimit = find_option("limit",0,1); + zLimit = find_option("count","n",1); + if( !zLimit ){ + /* deprecated */ + zLimit = find_option("limit",0,1); + } iLimit = zLimit ? atoi(zLimit) : -1; zOffset = find_option("offset",0,1); iOffset = zOffset ? atoi(zOffset) : 0; iBrief = (find_option("brief","b",0) == 0); if( g.argc!=3 ){ Index: src/json_finfo.c ================================================================== --- src/json_finfo.c +++ src/json_finfo.c @@ -33,11 +33,11 @@ char const * zFilename = NULL; Blob sql = empty_blob; Stmt q = empty_Stmt; char const * zAfter = NULL; char const * zBefore = NULL; - int limit = -1; + int count = -1; int currentRow = 0; char const * zCheckin = NULL; char sort = -1; if(!g.perm.Read){ json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); @@ -59,11 +59,11 @@ return NULL; } zBefore = json_find_option_cstr("before",NULL,"b"); zAfter = json_find_option_cstr("after",NULL,"a"); - limit = json_find_option_int("limit",NULL,"n", -1); + count = json_find_option_int("count",NULL,"n", -1); zCheckin = json_find_option_cstr("checkin",NULL,"ci"); blob_appendf(&sql, /*0*/ "SELECT b.uuid," /*1*/ " ci.uuid," @@ -112,12 +112,12 @@ SQL escapes*/); blob_reset(&sql); pay = cson_new_object(); cson_object_set(pay, "name", json_new_string(zFilename)); - if( limit > 0 ){ - cson_object_set(pay, "limit", json_new_int(limit)); + if( count > 0 ){ + cson_object_set(pay, "count", json_new_int(count)); } checkins = cson_new_array(); cson_object_set(pay, "checkins", cson_array_value(checkins)); while( db_step(&q)==SQLITE_ROW ){ cson_object * row = cson_new_object(); @@ -132,11 +132,11 @@ cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) )); /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/ cson_object_set(row, "size", cson_value_new_integer( (cson_int_t)db_column_int64(&q,8) )); cson_object_set(row, "state", json_new_string(json_artifact_status_to_string(isNew,isDel))); - if( (0 < limit) && (++currentRow >= limit) ){ + if( (0 < count) && (++currentRow >= count) ){ break; } } db_finalize(&q); Index: src/json_report.c ================================================================== --- src/json_report.c +++ src/json_report.c @@ -153,11 +153,11 @@ ** ** Options/arguments: ** ** report=int (CLI: -report # or -r #) is the report number to run. ** -** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands. +** count=int (CLI: -count # or -n #) -n is for compat. with other commands. ** ** format=a|o Specifies result format: a=each row is an arry, o=each ** row is an object. Default=o. */ static cson_value * json_report_run(){ @@ -166,11 +166,11 @@ cson_object * pay = NULL; cson_array * tktList = NULL; char const * zFmt; char * zTitle = NULL; Blob sql = empty_blob; - int limit = 0; + int count = 0; cson_value * colNames = NULL; int i; if(!g.perm.RdTkt){ json_set_err(FSL_JSON_E_DENIED, @@ -197,11 +197,11 @@ nReport); db_finalize(&q); goto error; } - limit = json_find_option_int("limit",NULL,"n",-1); + count = json_find_option_int("count",NULL,"n",-1); /* Copy over report's SQL...*/ blob_append(&sql, db_column_text(&q,0), -1); zTitle = mprintf("%s", db_column_text(&q,1)); @@ -211,12 +211,12 @@ /** Build the response... */ pay = cson_new_object(); cson_object_set(pay, "report", json_new_int(nReport)); cson_object_set(pay, "title", json_new_string(zTitle)); - if(limit>0){ - cson_object_set(pay, "limit", json_new_int((limit<0) ? 0 : limit)); + if(count>0){ + cson_object_set(pay, "count", json_new_int((count<0) ? 0 : count)); } free(zTitle); zTitle = NULL; if(g.perm.TktFmt){ @@ -226,11 +226,11 @@ } blob_reset(&sql); colNames = cson_sqlite3_column_names(q.pStmt); cson_object_set( pay, "columnNames", colNames); - for( i = 0 ; ((limit>0) ?(i < limit) : 1) + for( i = 0 ; ((count>0) ?(i < count) : 1) && (SQLITE_ROW == db_step(&q)); ++i){ cson_value * row = ('a'==*zFmt) ? cson_sqlite3_row_to_array(q.pStmt) : cson_sqlite3_row_to_object2(q.pStmt, Index: src/json_tag.c ================================================================== --- src/json_tag.c +++ src/json_tag.c @@ -198,11 +198,11 @@ char const * zName = NULL; char const * zType = NULL; char const * zType2 = NULL; char fRaw = 0; Stmt q = empty_Stmt; - int limit = 0; + int count = 0; int tagid = 0; if( !g.perm.Read ){ json_set_err(FSL_JSON_E_DENIED, "Requires 'o' permissions."); @@ -230,11 +230,11 @@ case 'w': zType = "w"; zType2 = "wiki"; break; case 't': zType = "t"; zType2 = "ticket"; break; } } - limit = json_find_option_int("limit",NULL,"n",0); + count = json_find_option_int("count",NULL,"n",0); fRaw = json_find_option_bool("raw",NULL,NULL,0); tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%s' || %Q", fRaw ? "" : "sym-", zName); @@ -242,11 +242,11 @@ payV = cson_value_new_object(); pay = cson_value_get_object(payV); cson_object_set(pay, "name", json_new_string(zName)); cson_object_set(pay, "raw", cson_value_new_bool(fRaw)); cson_object_set(pay, "type", json_new_string(zType2)); - cson_object_set(pay, "limit", json_new_int(limit)); + cson_object_set(pay, "count", json_new_int(count)); #if 1 if( tagid<=0 ){ cson_object_set(pay,"artifacts", cson_value_null()); json_warn(FSL_JSON_W_TAG_NOT_FOUND, "Tag not found."); @@ -260,11 +260,11 @@ " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" " AND tagxref.tagtype>0" " AND blob.rid=tagxref.rid" "%s LIMIT %d", zName, - (limit>0)?"":"--", limit + (count>0)?"":"--", count ); while( db_step(&q)==SQLITE_ROW ){ if(!listV){ listV = cson_value_new_array(); list = cson_value_get_array(listV); @@ -302,11 +302,11 @@ " WHERE tagtype>0 AND tagid=%d" " )" " ORDER BY event.mtime DESC" "%s LIMIT %d", zSqlBase, zType, tagid, - (limit>0)?"":"--", limit + (count>0)?"":"--", count ); listV = json_stmt_to_array_of_obj(&q, NULL); db_finalize(&q); } Index: src/json_timeline.c ================================================================== --- src/json_timeline.c +++ src/json_timeline.c @@ -224,28 +224,28 @@ } return rc; } /* -** Tries to figure out a timeline query length limit base on +** Tries to figure out a timeline query length count base on ** environment parameters. If it can it returns that value, ** else it returns some statically defined default value. ** -** Never returns a negative value. 0 means no limit. +** Never returns a negative value. 0 means no count. */ -static int json_timeline_limit(int defaultLimit){ - int limit = -1; +static int json_timeline_count(int defaultCount){ + int count = -1; if(!g.isHTTP){/* CLI mode */ - char const * arg = find_option("limit","n",1); + char const * arg = find_option("count","n",1); if(arg && *arg){ - limit = atoi(arg); + count = atoi(arg); } } - if( (limit<0) && fossil_has_json() ){ - limit = json_getenv_int("limit",-1); + if( (count<0) && fossil_has_json() ){ + count = json_getenv_int("count",-1); } - return (limit<0) ? defaultLimit : limit; + return (count<0) ? defaultCount : count; } /* ** Internal helper for the json_timeline_EVENTTYPE() family of ** functions. zEventType must be one of (ci, w, t). pSql must be a @@ -261,26 +261,26 @@ ** the returned value should be used as g.json.resultCode. */ static int json_timeline_setup_sql( char const * zEventType, Blob * pSql, cson_object * pPayload ){ - int limit; + int count; assert( zEventType && *zEventType && pSql ); json_timeline_temp_table(); blob_append(pSql, "INSERT OR IGNORE INTO json_timeline ", -1); blob_append(pSql, json_timeline_query(), -1 ); blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType); if( json_timeline_add_tag_branch_clause(pSql, pPayload) < 0 ){ return FSL_JSON_E_INVALID_ARGS; } json_timeline_add_time_clause(pSql); - limit = json_timeline_limit(20); - if(limit>0){ - blob_appendf(pSql,"LIMIT %d ",limit); + count = json_timeline_count(20); + if(count>0){ + blob_appendf(pSql,"LIMIT %d ",count); } if(pPayload){ - cson_object_set(pPayload, "limit", json_new_int(limit)); + cson_object_set(pPayload, "count", json_new_int(count)); } return 0; } @@ -342,11 +342,11 @@ static cson_value * json_timeline_branch(){ cson_value * pay = NULL; Blob sql = empty_blob; Stmt q = empty_Stmt; - int limit = 0; + int count = 0; if(!g.perm.Read){ json_set_err(FSL_JSON_E_DENIED, "Requires 'o' permissions."); return NULL; } @@ -368,13 +368,13 @@ " AND event.type='ci'" " AND blob.rid IN (SELECT rid FROM tagxref" " WHERE tagtype>0 AND tagid=%d AND srcid!=0)" " ORDER BY event.mtime DESC", TAG_BRANCH); - limit = json_timeline_limit(20); - if(limit>0){ - blob_appendf(&sql," LIMIT %d ",limit); + count = json_timeline_count(20); + if(count>0){ + blob_appendf(&sql," LIMIT %d ",count); } db_prepare(&q,"%s", blob_str(&sql)); blob_reset(&sql); pay = json_stmt_to_array_of_obj(&q, NULL); db_finalize(&q); @@ -404,12 +404,12 @@ /* now we wrap the payload in an outer shell, for consistency with other /json/timeline/xyz APIs... */ outer = cson_new_object(); - if(limit>0){ - cson_object_set( outer, "limit", json_new_int(limit) ); + if(count>0){ + cson_object_set( outer, "count", json_new_int(count) ); } cson_object_set( outer, "timeline", pay ); pay = cson_object_value(outer); } return pay;