Fossil SCM
Rename "--limit" to "--count" and "--test" to "--nochange" in some fossil commands
Commit
e72af5058edcafd4d198817f56c1341e9b1ba992
Parent
91aa222d7f2a874…
9 files changed
+8
-4
+7
-7
+7
-7
+8
-4
+7
-3
+5
-5
+6
-6
+5
-5
+20
-20
+8
-4
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -456,26 +456,30 @@ | ||
| 456 | 456 | ** Options: |
| 457 | 457 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 458 | 458 | ** --dotfiles include files beginning with a dot (".") |
| 459 | 459 | ** --ignore <CSG> ignore files matching patterns from the |
| 460 | 460 | ** comma separated list of glob patterns. |
| 461 | -** --test If given, display instead of run actions | |
| 461 | +** --nochange|-n If given, display instead of run actions | |
| 462 | 462 | ** |
| 463 | 463 | ** See also: add, rm |
| 464 | 464 | */ |
| 465 | 465 | void addremove_cmd(void){ |
| 466 | 466 | Blob path; |
| 467 | 467 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 468 | 468 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 469 | - int isTest = find_option("test",0,0)!=0; | |
| 469 | + int nochangeFlag = find_option("nochange","n",0)!=0; | |
| 470 | 470 | int n; |
| 471 | 471 | Stmt q; |
| 472 | 472 | int vid; |
| 473 | 473 | int nAdd = 0; |
| 474 | 474 | int nDelete = 0; |
| 475 | 475 | Glob *pIgnore; |
| 476 | 476 | |
| 477 | + if( !nochangeFlag ){ | |
| 478 | + /* --test is deprecated */ | |
| 479 | + nochangeFlag = find_option("test",0,0)!=0; | |
| 480 | + } | |
| 477 | 481 | capture_case_sensitive_option(); |
| 478 | 482 | db_must_be_within_tree(); |
| 479 | 483 | if( zIgnoreFlag==0 ){ |
| 480 | 484 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 481 | 485 | } |
| @@ -512,11 +516,11 @@ | ||
| 512 | 516 | const char * zPath; |
| 513 | 517 | |
| 514 | 518 | zFile = db_column_text(&q, 0); |
| 515 | 519 | zPath = db_column_text(&q, 1); |
| 516 | 520 | if( !file_wd_isfile_or_link(zPath) ){ |
| 517 | - if( !isTest ){ | |
| 521 | + if( !nochangeFlag ){ | |
| 518 | 522 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 519 | 523 | } |
| 520 | 524 | fossil_print("DELETED %s\n", zFile); |
| 521 | 525 | nDelete++; |
| 522 | 526 | } |
| @@ -523,11 +527,11 @@ | ||
| 523 | 527 | } |
| 524 | 528 | db_finalize(&q); |
| 525 | 529 | /* show command summary */ |
| 526 | 530 | fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); |
| 527 | 531 | |
| 528 | - db_end_transaction(isTest); | |
| 532 | + db_end_transaction(nochangeFlag); | |
| 529 | 533 | } |
| 530 | 534 | |
| 531 | 535 | |
| 532 | 536 | /* |
| 533 | 537 | ** Rename a single file. |
| 534 | 538 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -456,26 +456,30 @@ | |
| 456 | ** Options: |
| 457 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 458 | ** --dotfiles include files beginning with a dot (".") |
| 459 | ** --ignore <CSG> ignore files matching patterns from the |
| 460 | ** comma separated list of glob patterns. |
| 461 | ** --test If given, display instead of run actions |
| 462 | ** |
| 463 | ** See also: add, rm |
| 464 | */ |
| 465 | void addremove_cmd(void){ |
| 466 | Blob path; |
| 467 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 468 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 469 | int isTest = find_option("test",0,0)!=0; |
| 470 | int n; |
| 471 | Stmt q; |
| 472 | int vid; |
| 473 | int nAdd = 0; |
| 474 | int nDelete = 0; |
| 475 | Glob *pIgnore; |
| 476 | |
| 477 | capture_case_sensitive_option(); |
| 478 | db_must_be_within_tree(); |
| 479 | if( zIgnoreFlag==0 ){ |
| 480 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 481 | } |
| @@ -512,11 +516,11 @@ | |
| 512 | const char * zPath; |
| 513 | |
| 514 | zFile = db_column_text(&q, 0); |
| 515 | zPath = db_column_text(&q, 1); |
| 516 | if( !file_wd_isfile_or_link(zPath) ){ |
| 517 | if( !isTest ){ |
| 518 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 519 | } |
| 520 | fossil_print("DELETED %s\n", zFile); |
| 521 | nDelete++; |
| 522 | } |
| @@ -523,11 +527,11 @@ | |
| 523 | } |
| 524 | db_finalize(&q); |
| 525 | /* show command summary */ |
| 526 | fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); |
| 527 | |
| 528 | db_end_transaction(isTest); |
| 529 | } |
| 530 | |
| 531 | |
| 532 | /* |
| 533 | ** Rename a single file. |
| 534 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -456,26 +456,30 @@ | |
| 456 | ** Options: |
| 457 | ** --case-sensitive <BOOL> override case-sensitive setting |
| 458 | ** --dotfiles include files beginning with a dot (".") |
| 459 | ** --ignore <CSG> ignore files matching patterns from the |
| 460 | ** comma separated list of glob patterns. |
| 461 | ** --nochange|-n If given, display instead of run actions |
| 462 | ** |
| 463 | ** See also: add, rm |
| 464 | */ |
| 465 | void addremove_cmd(void){ |
| 466 | Blob path; |
| 467 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 468 | unsigned scanFlags = find_option("dotfiles",0,0)!=0 ? SCAN_ALL : 0; |
| 469 | int nochangeFlag = find_option("nochange","n",0)!=0; |
| 470 | int n; |
| 471 | Stmt q; |
| 472 | int vid; |
| 473 | int nAdd = 0; |
| 474 | int nDelete = 0; |
| 475 | Glob *pIgnore; |
| 476 | |
| 477 | if( !nochangeFlag ){ |
| 478 | /* --test is deprecated */ |
| 479 | nochangeFlag = find_option("test",0,0)!=0; |
| 480 | } |
| 481 | capture_case_sensitive_option(); |
| 482 | db_must_be_within_tree(); |
| 483 | if( zIgnoreFlag==0 ){ |
| 484 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 485 | } |
| @@ -512,11 +516,11 @@ | |
| 516 | const char * zPath; |
| 517 | |
| 518 | zFile = db_column_text(&q, 0); |
| 519 | zPath = db_column_text(&q, 1); |
| 520 | if( !file_wd_isfile_or_link(zPath) ){ |
| 521 | if( !nochangeFlag ){ |
| 522 | db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile); |
| 523 | } |
| 524 | fossil_print("DELETED %s\n", zFile); |
| 525 | nDelete++; |
| 526 | } |
| @@ -523,11 +527,11 @@ | |
| 527 | } |
| 528 | db_finalize(&q); |
| 529 | /* show command summary */ |
| 530 | fossil_print("added %d files, deleted %d files\n", nAdd, nDelete); |
| 531 | |
| 532 | db_end_transaction(nochangeFlag); |
| 533 | } |
| 534 | |
| 535 | |
| 536 | /* |
| 537 | ** Rename a single file. |
| 538 |
+7
-7
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -109,20 +109,20 @@ | ||
| 109 | 109 | char *zFossil; |
| 110 | 110 | char *zQFilename; |
| 111 | 111 | Blob extra; |
| 112 | 112 | int useCheckouts = 0; |
| 113 | 113 | int quiet = 0; |
| 114 | - int testRun = 0; | |
| 114 | + int nochangeFlag = 0; | |
| 115 | 115 | int stopOnError = find_option("dontstop",0,0)==0; |
| 116 | 116 | int rc; |
| 117 | 117 | Bag outOfDate; |
| 118 | 118 | |
| 119 | - /* The undocumented --test option causes no changes to occur to any | |
| 119 | + /* The undocumented --nochange option causes no changes to occur to any | |
| 120 | 120 | ** repository, but instead show what would have happened. Intended for |
| 121 | 121 | ** test and debugging use. |
| 122 | 122 | */ |
| 123 | - testRun = find_option("test",0,0)!=0; | |
| 123 | + nochangeFlag = find_option("nochange","n",0)!=0; | |
| 124 | 124 | |
| 125 | 125 | if( g.argc<3 ){ |
| 126 | 126 | usage("changes|list|ls|pull|push|rebuild|sync"); |
| 127 | 127 | } |
| 128 | 128 | n = strlen(g.argv[2]); |
| @@ -169,11 +169,11 @@ | ||
| 169 | 169 | verify_all_options(); |
| 170 | 170 | db_begin_transaction(); |
| 171 | 171 | for(j=3; j<g.argc; j++){ |
| 172 | 172 | char *zSql = mprintf("DELETE FROM global_config" |
| 173 | 173 | " WHERE name GLOB 'repo:%q'", g.argv[j]); |
| 174 | - if( testRun ){ | |
| 174 | + if( nochangeFlag ){ | |
| 175 | 175 | fossil_print("%s\n", zSql); |
| 176 | 176 | }else{ |
| 177 | 177 | db_multi_exec("%s", zSql); |
| 178 | 178 | } |
| 179 | 179 | fossil_free(zSql); |
| @@ -218,15 +218,15 @@ | ||
| 218 | 218 | continue; |
| 219 | 219 | } |
| 220 | 220 | zQFilename = quoteFilename(zFilename); |
| 221 | 221 | zSyscmd = mprintf("%s %s %s%s", |
| 222 | 222 | zFossil, zCmd, zQFilename, blob_str(&extra)); |
| 223 | - if( !quiet || testRun ){ | |
| 223 | + if( !quiet || nochangeFlag ){ | |
| 224 | 224 | fossil_print("%s\n", zSyscmd); |
| 225 | 225 | fflush(stdout); |
| 226 | 226 | } |
| 227 | - rc = testRun ? 0 : fossil_system(zSyscmd); | |
| 227 | + rc = nochangeFlag ? 0 : fossil_system(zSyscmd); | |
| 228 | 228 | free(zSyscmd); |
| 229 | 229 | free(zQFilename); |
| 230 | 230 | if( stopOnError && rc ){ |
| 231 | 231 | break; |
| 232 | 232 | } |
| @@ -245,13 +245,13 @@ | ||
| 245 | 245 | for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){ |
| 246 | 246 | blob_appendf(&sql, "%s%d", zSep, rowid); |
| 247 | 247 | zSep = ","; |
| 248 | 248 | } |
| 249 | 249 | blob_appendf(&sql, ")"); |
| 250 | - if( testRun ){ | |
| 250 | + if( nochangeFlag ){ | |
| 251 | 251 | fossil_print("%s\n", blob_str(&sql)); |
| 252 | 252 | }else{ |
| 253 | 253 | db_multi_exec(blob_str(&sql)); |
| 254 | 254 | } |
| 255 | 255 | blob_reset(&sql); |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -109,20 +109,20 @@ | |
| 109 | char *zFossil; |
| 110 | char *zQFilename; |
| 111 | Blob extra; |
| 112 | int useCheckouts = 0; |
| 113 | int quiet = 0; |
| 114 | int testRun = 0; |
| 115 | int stopOnError = find_option("dontstop",0,0)==0; |
| 116 | int rc; |
| 117 | Bag outOfDate; |
| 118 | |
| 119 | /* The undocumented --test option causes no changes to occur to any |
| 120 | ** repository, but instead show what would have happened. Intended for |
| 121 | ** test and debugging use. |
| 122 | */ |
| 123 | testRun = find_option("test",0,0)!=0; |
| 124 | |
| 125 | if( g.argc<3 ){ |
| 126 | usage("changes|list|ls|pull|push|rebuild|sync"); |
| 127 | } |
| 128 | n = strlen(g.argv[2]); |
| @@ -169,11 +169,11 @@ | |
| 169 | verify_all_options(); |
| 170 | db_begin_transaction(); |
| 171 | for(j=3; j<g.argc; j++){ |
| 172 | char *zSql = mprintf("DELETE FROM global_config" |
| 173 | " WHERE name GLOB 'repo:%q'", g.argv[j]); |
| 174 | if( testRun ){ |
| 175 | fossil_print("%s\n", zSql); |
| 176 | }else{ |
| 177 | db_multi_exec("%s", zSql); |
| 178 | } |
| 179 | fossil_free(zSql); |
| @@ -218,15 +218,15 @@ | |
| 218 | continue; |
| 219 | } |
| 220 | zQFilename = quoteFilename(zFilename); |
| 221 | zSyscmd = mprintf("%s %s %s%s", |
| 222 | zFossil, zCmd, zQFilename, blob_str(&extra)); |
| 223 | if( !quiet || testRun ){ |
| 224 | fossil_print("%s\n", zSyscmd); |
| 225 | fflush(stdout); |
| 226 | } |
| 227 | rc = testRun ? 0 : fossil_system(zSyscmd); |
| 228 | free(zSyscmd); |
| 229 | free(zQFilename); |
| 230 | if( stopOnError && rc ){ |
| 231 | break; |
| 232 | } |
| @@ -245,13 +245,13 @@ | |
| 245 | for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){ |
| 246 | blob_appendf(&sql, "%s%d", zSep, rowid); |
| 247 | zSep = ","; |
| 248 | } |
| 249 | blob_appendf(&sql, ")"); |
| 250 | if( testRun ){ |
| 251 | fossil_print("%s\n", blob_str(&sql)); |
| 252 | }else{ |
| 253 | db_multi_exec(blob_str(&sql)); |
| 254 | } |
| 255 | blob_reset(&sql); |
| 256 | } |
| 257 | } |
| 258 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -109,20 +109,20 @@ | |
| 109 | char *zFossil; |
| 110 | char *zQFilename; |
| 111 | Blob extra; |
| 112 | int useCheckouts = 0; |
| 113 | int quiet = 0; |
| 114 | int nochangeFlag = 0; |
| 115 | int stopOnError = find_option("dontstop",0,0)==0; |
| 116 | int rc; |
| 117 | Bag outOfDate; |
| 118 | |
| 119 | /* The undocumented --nochange option causes no changes to occur to any |
| 120 | ** repository, but instead show what would have happened. Intended for |
| 121 | ** test and debugging use. |
| 122 | */ |
| 123 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 124 | |
| 125 | if( g.argc<3 ){ |
| 126 | usage("changes|list|ls|pull|push|rebuild|sync"); |
| 127 | } |
| 128 | n = strlen(g.argv[2]); |
| @@ -169,11 +169,11 @@ | |
| 169 | verify_all_options(); |
| 170 | db_begin_transaction(); |
| 171 | for(j=3; j<g.argc; j++){ |
| 172 | char *zSql = mprintf("DELETE FROM global_config" |
| 173 | " WHERE name GLOB 'repo:%q'", g.argv[j]); |
| 174 | if( nochangeFlag ){ |
| 175 | fossil_print("%s\n", zSql); |
| 176 | }else{ |
| 177 | db_multi_exec("%s", zSql); |
| 178 | } |
| 179 | fossil_free(zSql); |
| @@ -218,15 +218,15 @@ | |
| 218 | continue; |
| 219 | } |
| 220 | zQFilename = quoteFilename(zFilename); |
| 221 | zSyscmd = mprintf("%s %s %s%s", |
| 222 | zFossil, zCmd, zQFilename, blob_str(&extra)); |
| 223 | if( !quiet || nochangeFlag ){ |
| 224 | fossil_print("%s\n", zSyscmd); |
| 225 | fflush(stdout); |
| 226 | } |
| 227 | rc = nochangeFlag ? 0 : fossil_system(zSyscmd); |
| 228 | free(zSyscmd); |
| 229 | free(zQFilename); |
| 230 | if( stopOnError && rc ){ |
| 231 | break; |
| 232 | } |
| @@ -245,13 +245,13 @@ | |
| 245 | for(rowid=bag_first(&outOfDate); rowid>0; rowid=bag_next(&outOfDate,rowid)){ |
| 246 | blob_appendf(&sql, "%s%d", zSep, rowid); |
| 247 | zSep = ","; |
| 248 | } |
| 249 | blob_appendf(&sql, ")"); |
| 250 | if( nochangeFlag ){ |
| 251 | fossil_print("%s\n", blob_str(&sql)); |
| 252 | }else{ |
| 253 | db_multi_exec(blob_str(&sql)); |
| 254 | } |
| 255 | blob_reset(&sql); |
| 256 | } |
| 257 | } |
| 258 |
+7
-7
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -410,17 +410,17 @@ | ||
| 410 | 410 | const char *zIgnoreFlag; |
| 411 | 411 | Blob path, repo; |
| 412 | 412 | Stmt q; |
| 413 | 413 | int n; |
| 414 | 414 | Glob *pIgnore; |
| 415 | - int testFlag = 0; | |
| 415 | + int nochangeFlag = 0; | |
| 416 | 416 | |
| 417 | 417 | allFlag = find_option("force","f",0)!=0; |
| 418 | 418 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 419 | 419 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 420 | 420 | zIgnoreFlag = find_option("ignore",0,1); |
| 421 | - testFlag = find_option("test",0,0)!=0; | |
| 421 | + nochangeFlag = find_option("nochange","n",0)!=0; | |
| 422 | 422 | capture_case_sensitive_option(); |
| 423 | 423 | db_must_be_within_tree(); |
| 424 | 424 | if( zIgnoreFlag==0 ){ |
| 425 | 425 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 426 | 426 | } |
| @@ -440,11 +440,11 @@ | ||
| 440 | 440 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 441 | 441 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 442 | 442 | } |
| 443 | 443 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 444 | 444 | while( db_step(&q)==SQLITE_ROW ){ |
| 445 | - if( testFlag ){ | |
| 445 | + if( nochangeFlag ){ | |
| 446 | 446 | fossil_print("%s\n", db_column_text(&q,0)); |
| 447 | 447 | continue; |
| 448 | 448 | }else if( !allFlag ){ |
| 449 | 449 | Blob ans; |
| 450 | 450 | char cReply; |
| @@ -1154,11 +1154,11 @@ | ||
| 1154 | 1154 | int allowFork = 0; /* Allow the commit to fork */ |
| 1155 | 1155 | int allowOlder = 0; /* Allow a commit older than its ancestor */ |
| 1156 | 1156 | char *zManifestFile; /* Name of the manifest file */ |
| 1157 | 1157 | int useCksum; /* True if checksums should be computed and verified */ |
| 1158 | 1158 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1159 | - int testRun; /* True for a test run. Debugging only */ | |
| 1159 | + int nochangeFlag; /* True for a test run. Debugging only */ | |
| 1160 | 1160 | CheckinInfo sCiInfo; /* Information about this check-in */ |
| 1161 | 1161 | const char *zComFile; /* Read commit message from this file */ |
| 1162 | 1162 | int nTag = 0; /* Number of --tag arguments */ |
| 1163 | 1163 | const char *zTag; /* A single --tag argument */ |
| 1164 | 1164 | Blob manifest; /* Manifest in baseline form */ |
| @@ -1178,11 +1178,11 @@ | ||
| 1178 | 1178 | forceDelta = find_option("delta",0,0)!=0; |
| 1179 | 1179 | forceBaseline = find_option("baseline",0,0)!=0; |
| 1180 | 1180 | if( forceDelta && forceBaseline ){ |
| 1181 | 1181 | fossil_fatal("cannot use --delta and --baseline together"); |
| 1182 | 1182 | } |
| 1183 | - testRun = find_option("test",0,0)!=0; | |
| 1183 | + nochangeFlag = find_option("nochange","n",0)!=0; | |
| 1184 | 1184 | zComment = find_option("comment","m",1); |
| 1185 | 1185 | forceFlag = find_option("force", "f", 0)!=0; |
| 1186 | 1186 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1187 | 1187 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1188 | 1188 | allowFork = find_option("allow-fork",0,0)!=0; |
| @@ -1522,11 +1522,11 @@ | ||
| 1522 | 1522 | } |
| 1523 | 1523 | |
| 1524 | 1524 | /* If the --test option is specified, output the manifest file |
| 1525 | 1525 | ** and rollback the transaction. |
| 1526 | 1526 | */ |
| 1527 | - if( testRun ){ | |
| 1527 | + if( nochangeFlag ){ | |
| 1528 | 1528 | blob_write_to_file(&manifest, ""); |
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | if( outputManifest ){ |
| 1532 | 1532 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| @@ -1601,11 +1601,11 @@ | ||
| 1601 | 1601 | /* Clear the undo/redo stack */ |
| 1602 | 1602 | undo_reset(); |
| 1603 | 1603 | |
| 1604 | 1604 | /* Commit */ |
| 1605 | 1605 | db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); |
| 1606 | - if( testRun ){ | |
| 1606 | + if( nochangeFlag ){ | |
| 1607 | 1607 | db_end_transaction(1); |
| 1608 | 1608 | exit(1); |
| 1609 | 1609 | } |
| 1610 | 1610 | db_end_transaction(0); |
| 1611 | 1611 | |
| 1612 | 1612 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -410,17 +410,17 @@ | |
| 410 | const char *zIgnoreFlag; |
| 411 | Blob path, repo; |
| 412 | Stmt q; |
| 413 | int n; |
| 414 | Glob *pIgnore; |
| 415 | int testFlag = 0; |
| 416 | |
| 417 | allFlag = find_option("force","f",0)!=0; |
| 418 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 419 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 420 | zIgnoreFlag = find_option("ignore",0,1); |
| 421 | testFlag = find_option("test",0,0)!=0; |
| 422 | capture_case_sensitive_option(); |
| 423 | db_must_be_within_tree(); |
| 424 | if( zIgnoreFlag==0 ){ |
| 425 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 426 | } |
| @@ -440,11 +440,11 @@ | |
| 440 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 441 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 442 | } |
| 443 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 444 | while( db_step(&q)==SQLITE_ROW ){ |
| 445 | if( testFlag ){ |
| 446 | fossil_print("%s\n", db_column_text(&q,0)); |
| 447 | continue; |
| 448 | }else if( !allFlag ){ |
| 449 | Blob ans; |
| 450 | char cReply; |
| @@ -1154,11 +1154,11 @@ | |
| 1154 | int allowFork = 0; /* Allow the commit to fork */ |
| 1155 | int allowOlder = 0; /* Allow a commit older than its ancestor */ |
| 1156 | char *zManifestFile; /* Name of the manifest file */ |
| 1157 | int useCksum; /* True if checksums should be computed and verified */ |
| 1158 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1159 | int testRun; /* True for a test run. Debugging only */ |
| 1160 | CheckinInfo sCiInfo; /* Information about this check-in */ |
| 1161 | const char *zComFile; /* Read commit message from this file */ |
| 1162 | int nTag = 0; /* Number of --tag arguments */ |
| 1163 | const char *zTag; /* A single --tag argument */ |
| 1164 | Blob manifest; /* Manifest in baseline form */ |
| @@ -1178,11 +1178,11 @@ | |
| 1178 | forceDelta = find_option("delta",0,0)!=0; |
| 1179 | forceBaseline = find_option("baseline",0,0)!=0; |
| 1180 | if( forceDelta && forceBaseline ){ |
| 1181 | fossil_fatal("cannot use --delta and --baseline together"); |
| 1182 | } |
| 1183 | testRun = find_option("test",0,0)!=0; |
| 1184 | zComment = find_option("comment","m",1); |
| 1185 | forceFlag = find_option("force", "f", 0)!=0; |
| 1186 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1187 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1188 | allowFork = find_option("allow-fork",0,0)!=0; |
| @@ -1522,11 +1522,11 @@ | |
| 1522 | } |
| 1523 | |
| 1524 | /* If the --test option is specified, output the manifest file |
| 1525 | ** and rollback the transaction. |
| 1526 | */ |
| 1527 | if( testRun ){ |
| 1528 | blob_write_to_file(&manifest, ""); |
| 1529 | } |
| 1530 | |
| 1531 | if( outputManifest ){ |
| 1532 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| @@ -1601,11 +1601,11 @@ | |
| 1601 | /* Clear the undo/redo stack */ |
| 1602 | undo_reset(); |
| 1603 | |
| 1604 | /* Commit */ |
| 1605 | db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); |
| 1606 | if( testRun ){ |
| 1607 | db_end_transaction(1); |
| 1608 | exit(1); |
| 1609 | } |
| 1610 | db_end_transaction(0); |
| 1611 | |
| 1612 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -410,17 +410,17 @@ | |
| 410 | const char *zIgnoreFlag; |
| 411 | Blob path, repo; |
| 412 | Stmt q; |
| 413 | int n; |
| 414 | Glob *pIgnore; |
| 415 | int nochangeFlag = 0; |
| 416 | |
| 417 | allFlag = find_option("force","f",0)!=0; |
| 418 | if( find_option("dotfiles",0,0)!=0 ) scanFlags |= SCAN_ALL; |
| 419 | if( find_option("temp",0,0)!=0 ) scanFlags |= SCAN_TEMP; |
| 420 | zIgnoreFlag = find_option("ignore",0,1); |
| 421 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 422 | capture_case_sensitive_option(); |
| 423 | db_must_be_within_tree(); |
| 424 | if( zIgnoreFlag==0 ){ |
| 425 | zIgnoreFlag = db_get("ignore-glob", 0); |
| 426 | } |
| @@ -440,11 +440,11 @@ | |
| 440 | if( file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 441 | db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo); |
| 442 | } |
| 443 | db_multi_exec("DELETE FROM sfile WHERE x IN (SELECT pathname FROM vfile)"); |
| 444 | while( db_step(&q)==SQLITE_ROW ){ |
| 445 | if( nochangeFlag ){ |
| 446 | fossil_print("%s\n", db_column_text(&q,0)); |
| 447 | continue; |
| 448 | }else if( !allFlag ){ |
| 449 | Blob ans; |
| 450 | char cReply; |
| @@ -1154,11 +1154,11 @@ | |
| 1154 | int allowFork = 0; /* Allow the commit to fork */ |
| 1155 | int allowOlder = 0; /* Allow a commit older than its ancestor */ |
| 1156 | char *zManifestFile; /* Name of the manifest file */ |
| 1157 | int useCksum; /* True if checksums should be computed and verified */ |
| 1158 | int outputManifest; /* True to output "manifest" and "manifest.uuid" */ |
| 1159 | int nochangeFlag; /* True for a test run. Debugging only */ |
| 1160 | CheckinInfo sCiInfo; /* Information about this check-in */ |
| 1161 | const char *zComFile; /* Read commit message from this file */ |
| 1162 | int nTag = 0; /* Number of --tag arguments */ |
| 1163 | const char *zTag; /* A single --tag argument */ |
| 1164 | Blob manifest; /* Manifest in baseline form */ |
| @@ -1178,11 +1178,11 @@ | |
| 1178 | forceDelta = find_option("delta",0,0)!=0; |
| 1179 | forceBaseline = find_option("baseline",0,0)!=0; |
| 1180 | if( forceDelta && forceBaseline ){ |
| 1181 | fossil_fatal("cannot use --delta and --baseline together"); |
| 1182 | } |
| 1183 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 1184 | zComment = find_option("comment","m",1); |
| 1185 | forceFlag = find_option("force", "f", 0)!=0; |
| 1186 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1187 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1188 | allowFork = find_option("allow-fork",0,0)!=0; |
| @@ -1522,11 +1522,11 @@ | |
| 1522 | } |
| 1523 | |
| 1524 | /* If the --test option is specified, output the manifest file |
| 1525 | ** and rollback the transaction. |
| 1526 | */ |
| 1527 | if( nochangeFlag ){ |
| 1528 | blob_write_to_file(&manifest, ""); |
| 1529 | } |
| 1530 | |
| 1531 | if( outputManifest ){ |
| 1532 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| @@ -1601,11 +1601,11 @@ | |
| 1601 | /* Clear the undo/redo stack */ |
| 1602 | undo_reset(); |
| 1603 | |
| 1604 | /* Commit */ |
| 1605 | db_multi_exec("DELETE FROM vvar WHERE name='ci-comment'"); |
| 1606 | if( nochangeFlag ){ |
| 1607 | db_end_transaction(1); |
| 1608 | exit(1); |
| 1609 | } |
| 1610 | db_end_transaction(0); |
| 1611 | |
| 1612 |
+8
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2415,11 +2415,11 @@ | ||
| 2415 | 2415 | login_check_credentials(); |
| 2416 | 2416 | if( !g.perm.Read ){ login_needed(); return; } |
| 2417 | 2417 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2418 | 2418 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename")); |
| 2419 | 2419 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2420 | - iLimit = atoi(PD("limit","-1")); | |
| 2420 | + iLimit = atoi(PD("count","-1")); | |
| 2421 | 2421 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2422 | 2422 | fossil_redirect_home(); |
| 2423 | 2423 | } |
| 2424 | 2424 | compute_direct_ancestors(mid, 10000000); |
| 2425 | 2425 | style_header("File Annotation"); |
| @@ -2459,11 +2459,11 @@ | ||
| 2459 | 2459 | ** |
| 2460 | 2460 | ** Output the text of a file with markings to show when each line of |
| 2461 | 2461 | ** the file was last modified. |
| 2462 | 2462 | ** |
| 2463 | 2463 | ** Options: |
| 2464 | -** --limit N Only look backwards in time by N versions | |
| 2464 | +** --count|-n N Only look backwards in time by N versions | |
| 2465 | 2465 | ** --log List all versions analyzed |
| 2466 | 2466 | ** --filevers Show file version numbers rather than check-in versions |
| 2467 | 2467 | ** |
| 2468 | 2468 | ** See also: info, finfo, timeline |
| 2469 | 2469 | */ |
| @@ -2474,17 +2474,21 @@ | ||
| 2474 | 2474 | int cid; /* Checkout ID */ |
| 2475 | 2475 | Blob treename; /* FILENAME translated to canonical form */ |
| 2476 | 2476 | char *zFilename; /* Canonical filename */ |
| 2477 | 2477 | Annotator ann; /* The annotation of the file */ |
| 2478 | 2478 | int i; /* Loop counter */ |
| 2479 | - const char *zLimit; /* The value to the --limit option */ | |
| 2479 | + const char *zLimit; /* The value to the --count option */ | |
| 2480 | 2480 | int iLimit; /* How far back in time to look */ |
| 2481 | 2481 | int showLog; /* True to show the log */ |
| 2482 | 2482 | int fileVers; /* Show file version instead of check-in versions */ |
| 2483 | 2483 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2484 | 2484 | |
| 2485 | - zLimit = find_option("limit",0,1); | |
| 2485 | + zLimit = find_option("count","n",1); | |
| 2486 | + if(!zLimit){ | |
| 2487 | + /* deprecated */ | |
| 2488 | + zLimit = find_option("limit",0,1); | |
| 2489 | + } | |
| 2486 | 2490 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2487 | 2491 | iLimit = atoi(zLimit); |
| 2488 | 2492 | showLog = find_option("log",0,0)!=0; |
| 2489 | 2493 | fileVers = find_option("filevers",0,0)!=0; |
| 2490 | 2494 | db_must_be_within_tree(); |
| 2491 | 2495 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2415,11 +2415,11 @@ | |
| 2415 | login_check_credentials(); |
| 2416 | if( !g.perm.Read ){ login_needed(); return; } |
| 2417 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2418 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename")); |
| 2419 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2420 | iLimit = atoi(PD("limit","-1")); |
| 2421 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2422 | fossil_redirect_home(); |
| 2423 | } |
| 2424 | compute_direct_ancestors(mid, 10000000); |
| 2425 | style_header("File Annotation"); |
| @@ -2459,11 +2459,11 @@ | |
| 2459 | ** |
| 2460 | ** Output the text of a file with markings to show when each line of |
| 2461 | ** the file was last modified. |
| 2462 | ** |
| 2463 | ** Options: |
| 2464 | ** --limit N Only look backwards in time by N versions |
| 2465 | ** --log List all versions analyzed |
| 2466 | ** --filevers Show file version numbers rather than check-in versions |
| 2467 | ** |
| 2468 | ** See also: info, finfo, timeline |
| 2469 | */ |
| @@ -2474,17 +2474,21 @@ | |
| 2474 | int cid; /* Checkout ID */ |
| 2475 | Blob treename; /* FILENAME translated to canonical form */ |
| 2476 | char *zFilename; /* Canonical filename */ |
| 2477 | Annotator ann; /* The annotation of the file */ |
| 2478 | int i; /* Loop counter */ |
| 2479 | const char *zLimit; /* The value to the --limit option */ |
| 2480 | int iLimit; /* How far back in time to look */ |
| 2481 | int showLog; /* True to show the log */ |
| 2482 | int fileVers; /* Show file version instead of check-in versions */ |
| 2483 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2484 | |
| 2485 | zLimit = find_option("limit",0,1); |
| 2486 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2487 | iLimit = atoi(zLimit); |
| 2488 | showLog = find_option("log",0,0)!=0; |
| 2489 | fileVers = find_option("filevers",0,0)!=0; |
| 2490 | db_must_be_within_tree(); |
| 2491 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2415,11 +2415,11 @@ | |
| 2415 | login_check_credentials(); |
| 2416 | if( !g.perm.Read ){ login_needed(); return; } |
| 2417 | mid = name_to_typed_rid(PD("checkin","0"),"ci"); |
| 2418 | fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename")); |
| 2419 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2420 | iLimit = atoi(PD("count","-1")); |
| 2421 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2422 | fossil_redirect_home(); |
| 2423 | } |
| 2424 | compute_direct_ancestors(mid, 10000000); |
| 2425 | style_header("File Annotation"); |
| @@ -2459,11 +2459,11 @@ | |
| 2459 | ** |
| 2460 | ** Output the text of a file with markings to show when each line of |
| 2461 | ** the file was last modified. |
| 2462 | ** |
| 2463 | ** Options: |
| 2464 | ** --count|-n N Only look backwards in time by N versions |
| 2465 | ** --log List all versions analyzed |
| 2466 | ** --filevers Show file version numbers rather than check-in versions |
| 2467 | ** |
| 2468 | ** See also: info, finfo, timeline |
| 2469 | */ |
| @@ -2474,17 +2474,21 @@ | |
| 2474 | int cid; /* Checkout ID */ |
| 2475 | Blob treename; /* FILENAME translated to canonical form */ |
| 2476 | char *zFilename; /* Canonical filename */ |
| 2477 | Annotator ann; /* The annotation of the file */ |
| 2478 | int i; /* Loop counter */ |
| 2479 | const char *zLimit; /* The value to the --count option */ |
| 2480 | int iLimit; /* How far back in time to look */ |
| 2481 | int showLog; /* True to show the log */ |
| 2482 | int fileVers; /* Show file version instead of check-in versions */ |
| 2483 | int annFlags = 0; /* Flags to control annotation properties */ |
| 2484 | |
| 2485 | zLimit = find_option("count","n",1); |
| 2486 | if(!zLimit){ |
| 2487 | /* deprecated */ |
| 2488 | zLimit = find_option("limit",0,1); |
| 2489 | } |
| 2490 | if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1"; |
| 2491 | iLimit = atoi(zLimit); |
| 2492 | showLog = find_option("log",0,0)!=0; |
| 2493 | fileVers = find_option("filevers",0,0)!=0; |
| 2494 | db_must_be_within_tree(); |
| 2495 |
+7
-3
| --- src/finfo.c | ||
| +++ src/finfo.c | ||
| @@ -27,11 +27,11 @@ | ||
| 27 | 27 | ** |
| 28 | 28 | ** Print the complete change history for a single file going backwards |
| 29 | 29 | ** in time. The default mode is -l. |
| 30 | 30 | ** |
| 31 | 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | -** is printed, otherwise the full comment is printed. The "--limit N" | |
| 32 | +** is printed, otherwise the full comment is printed. The "--count N" | |
| 33 | 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | 34 | ** after skipping P changes. |
| 35 | 35 | ** |
| 36 | 36 | ** In the -s mode prints the status as <status> <revision>. This is |
| 37 | 37 | ** a quick status and does not check for up-to-date-ness of the file. |
| @@ -42,11 +42,11 @@ | ||
| 42 | 42 | ** |
| 43 | 43 | ** Options: |
| 44 | 44 | ** --brief|-b display a brief (one line / revision) summary |
| 45 | 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | -** --limit N display the first N changes | |
| 47 | +** --count|n N display the first N changes | |
| 48 | 48 | ** --log|-l select log mode (the default) |
| 49 | 49 | ** --offset P skip P changes |
| 50 | 50 | ** --print|-p select print mode |
| 51 | 51 | ** --revision|-r R print the given revision (or ckout, if none is given) |
| 52 | 52 | ** to stdout (only in print mode) |
| @@ -140,11 +140,15 @@ | ||
| 140 | 140 | int iLimit, iOffset, iBrief; |
| 141 | 141 | |
| 142 | 142 | if( find_option("log","l",0) ){ |
| 143 | 143 | /* this is the default, no-op */ |
| 144 | 144 | } |
| 145 | - zLimit = find_option("limit",0,1); | |
| 145 | + zLimit = find_option("count","n",1); | |
| 146 | + if( !zLimit ){ | |
| 147 | + /* deprecated */ | |
| 148 | + zLimit = find_option("limit",0,1); | |
| 149 | + } | |
| 146 | 150 | iLimit = zLimit ? atoi(zLimit) : -1; |
| 147 | 151 | zOffset = find_option("offset",0,1); |
| 148 | 152 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 149 | 153 | iBrief = (find_option("brief","b",0) == 0); |
| 150 | 154 | if( g.argc!=3 ){ |
| 151 | 155 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -27,11 +27,11 @@ | |
| 27 | ** |
| 28 | ** Print the complete change history for a single file going backwards |
| 29 | ** in time. The default mode is -l. |
| 30 | ** |
| 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | ** is printed, otherwise the full comment is printed. The "--limit N" |
| 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | ** after skipping P changes. |
| 35 | ** |
| 36 | ** In the -s mode prints the status as <status> <revision>. This is |
| 37 | ** a quick status and does not check for up-to-date-ness of the file. |
| @@ -42,11 +42,11 @@ | |
| 42 | ** |
| 43 | ** Options: |
| 44 | ** --brief|-b display a brief (one line / revision) summary |
| 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | ** --limit N display the first N changes |
| 48 | ** --log|-l select log mode (the default) |
| 49 | ** --offset P skip P changes |
| 50 | ** --print|-p select print mode |
| 51 | ** --revision|-r R print the given revision (or ckout, if none is given) |
| 52 | ** to stdout (only in print mode) |
| @@ -140,11 +140,15 @@ | |
| 140 | int iLimit, iOffset, iBrief; |
| 141 | |
| 142 | if( find_option("log","l",0) ){ |
| 143 | /* this is the default, no-op */ |
| 144 | } |
| 145 | zLimit = find_option("limit",0,1); |
| 146 | iLimit = zLimit ? atoi(zLimit) : -1; |
| 147 | zOffset = find_option("offset",0,1); |
| 148 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 149 | iBrief = (find_option("brief","b",0) == 0); |
| 150 | if( g.argc!=3 ){ |
| 151 |
| --- src/finfo.c | |
| +++ src/finfo.c | |
| @@ -27,11 +27,11 @@ | |
| 27 | ** |
| 28 | ** Print the complete change history for a single file going backwards |
| 29 | ** in time. The default mode is -l. |
| 30 | ** |
| 31 | ** For the -l|--log mode: If "-b|--brief" is specified one line per revision |
| 32 | ** is printed, otherwise the full comment is printed. The "--count N" |
| 33 | ** and "--offset P" options limits the output to the first N changes |
| 34 | ** after skipping P changes. |
| 35 | ** |
| 36 | ** In the -s mode prints the status as <status> <revision>. This is |
| 37 | ** a quick status and does not check for up-to-date-ness of the file. |
| @@ -42,11 +42,11 @@ | |
| 42 | ** |
| 43 | ** Options: |
| 44 | ** --brief|-b display a brief (one line / revision) summary |
| 45 | ** --case-sensitive B Enable or disable case-sensitive filenames. B is a |
| 46 | ** boolean: "yes", "no", "true", "false", etc. |
| 47 | ** --count|n N display the first N changes |
| 48 | ** --log|-l select log mode (the default) |
| 49 | ** --offset P skip P changes |
| 50 | ** --print|-p select print mode |
| 51 | ** --revision|-r R print the given revision (or ckout, if none is given) |
| 52 | ** to stdout (only in print mode) |
| @@ -140,11 +140,15 @@ | |
| 140 | int iLimit, iOffset, iBrief; |
| 141 | |
| 142 | if( find_option("log","l",0) ){ |
| 143 | /* this is the default, no-op */ |
| 144 | } |
| 145 | zLimit = find_option("count","n",1); |
| 146 | if( !zLimit ){ |
| 147 | /* deprecated */ |
| 148 | zLimit = find_option("limit",0,1); |
| 149 | } |
| 150 | iLimit = zLimit ? atoi(zLimit) : -1; |
| 151 | zOffset = find_option("offset",0,1); |
| 152 | iOffset = zOffset ? atoi(zOffset) : 0; |
| 153 | iBrief = (find_option("brief","b",0) == 0); |
| 154 | if( g.argc!=3 ){ |
| 155 |
+5
-5
| --- src/json_finfo.c | ||
| +++ src/json_finfo.c | ||
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | char const * zFilename = NULL; |
| 34 | 34 | Blob sql = empty_blob; |
| 35 | 35 | Stmt q = empty_Stmt; |
| 36 | 36 | char const * zAfter = NULL; |
| 37 | 37 | char const * zBefore = NULL; |
| 38 | - int limit = -1; | |
| 38 | + int count = -1; | |
| 39 | 39 | int currentRow = 0; |
| 40 | 40 | char const * zCheckin = NULL; |
| 41 | 41 | char sort = -1; |
| 42 | 42 | if(!g.perm.Read){ |
| 43 | 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| @@ -59,11 +59,11 @@ | ||
| 59 | 59 | return NULL; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | zBefore = json_find_option_cstr("before",NULL,"b"); |
| 63 | 63 | zAfter = json_find_option_cstr("after",NULL,"a"); |
| 64 | - limit = json_find_option_int("limit",NULL,"n", -1); | |
| 64 | + count = json_find_option_int("count",NULL,"n", -1); | |
| 65 | 65 | zCheckin = json_find_option_cstr("checkin",NULL,"ci"); |
| 66 | 66 | |
| 67 | 67 | blob_appendf(&sql, |
| 68 | 68 | /*0*/ "SELECT b.uuid," |
| 69 | 69 | /*1*/ " ci.uuid," |
| @@ -112,12 +112,12 @@ | ||
| 112 | 112 | SQL escapes*/); |
| 113 | 113 | blob_reset(&sql); |
| 114 | 114 | |
| 115 | 115 | pay = cson_new_object(); |
| 116 | 116 | cson_object_set(pay, "name", json_new_string(zFilename)); |
| 117 | - if( limit > 0 ){ | |
| 118 | - cson_object_set(pay, "limit", json_new_int(limit)); | |
| 117 | + if( count > 0 ){ | |
| 118 | + cson_object_set(pay, "count", json_new_int(count)); | |
| 119 | 119 | } |
| 120 | 120 | checkins = cson_new_array(); |
| 121 | 121 | cson_object_set(pay, "checkins", cson_array_value(checkins)); |
| 122 | 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | 123 | cson_object * row = cson_new_object(); |
| @@ -132,11 +132,11 @@ | ||
| 132 | 132 | cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) )); |
| 133 | 133 | /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/ |
| 134 | 134 | cson_object_set(row, "size", cson_value_new_integer( (cson_int_t)db_column_int64(&q,8) )); |
| 135 | 135 | cson_object_set(row, "state", |
| 136 | 136 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 137 | - if( (0 < limit) && (++currentRow >= limit) ){ | |
| 137 | + if( (0 < count) && (++currentRow >= count) ){ | |
| 138 | 138 | break; |
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | db_finalize(&q); |
| 142 | 142 | |
| 143 | 143 |
| --- src/json_finfo.c | |
| +++ src/json_finfo.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | char const * zFilename = NULL; |
| 34 | Blob sql = empty_blob; |
| 35 | Stmt q = empty_Stmt; |
| 36 | char const * zAfter = NULL; |
| 37 | char const * zBefore = NULL; |
| 38 | int limit = -1; |
| 39 | int currentRow = 0; |
| 40 | char const * zCheckin = NULL; |
| 41 | char sort = -1; |
| 42 | if(!g.perm.Read){ |
| 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| @@ -59,11 +59,11 @@ | |
| 59 | return NULL; |
| 60 | } |
| 61 | |
| 62 | zBefore = json_find_option_cstr("before",NULL,"b"); |
| 63 | zAfter = json_find_option_cstr("after",NULL,"a"); |
| 64 | limit = json_find_option_int("limit",NULL,"n", -1); |
| 65 | zCheckin = json_find_option_cstr("checkin",NULL,"ci"); |
| 66 | |
| 67 | blob_appendf(&sql, |
| 68 | /*0*/ "SELECT b.uuid," |
| 69 | /*1*/ " ci.uuid," |
| @@ -112,12 +112,12 @@ | |
| 112 | SQL escapes*/); |
| 113 | blob_reset(&sql); |
| 114 | |
| 115 | pay = cson_new_object(); |
| 116 | cson_object_set(pay, "name", json_new_string(zFilename)); |
| 117 | if( limit > 0 ){ |
| 118 | cson_object_set(pay, "limit", json_new_int(limit)); |
| 119 | } |
| 120 | checkins = cson_new_array(); |
| 121 | cson_object_set(pay, "checkins", cson_array_value(checkins)); |
| 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | cson_object * row = cson_new_object(); |
| @@ -132,11 +132,11 @@ | |
| 132 | cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) )); |
| 133 | /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/ |
| 134 | cson_object_set(row, "size", cson_value_new_integer( (cson_int_t)db_column_int64(&q,8) )); |
| 135 | cson_object_set(row, "state", |
| 136 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 137 | if( (0 < limit) && (++currentRow >= limit) ){ |
| 138 | break; |
| 139 | } |
| 140 | } |
| 141 | db_finalize(&q); |
| 142 | |
| 143 |
| --- src/json_finfo.c | |
| +++ src/json_finfo.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | char const * zFilename = NULL; |
| 34 | Blob sql = empty_blob; |
| 35 | Stmt q = empty_Stmt; |
| 36 | char const * zAfter = NULL; |
| 37 | char const * zBefore = NULL; |
| 38 | int count = -1; |
| 39 | int currentRow = 0; |
| 40 | char const * zCheckin = NULL; |
| 41 | char sort = -1; |
| 42 | if(!g.perm.Read){ |
| 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| @@ -59,11 +59,11 @@ | |
| 59 | return NULL; |
| 60 | } |
| 61 | |
| 62 | zBefore = json_find_option_cstr("before",NULL,"b"); |
| 63 | zAfter = json_find_option_cstr("after",NULL,"a"); |
| 64 | count = json_find_option_int("count",NULL,"n", -1); |
| 65 | zCheckin = json_find_option_cstr("checkin",NULL,"ci"); |
| 66 | |
| 67 | blob_appendf(&sql, |
| 68 | /*0*/ "SELECT b.uuid," |
| 69 | /*1*/ " ci.uuid," |
| @@ -112,12 +112,12 @@ | |
| 112 | SQL escapes*/); |
| 113 | blob_reset(&sql); |
| 114 | |
| 115 | pay = cson_new_object(); |
| 116 | cson_object_set(pay, "name", json_new_string(zFilename)); |
| 117 | if( count > 0 ){ |
| 118 | cson_object_set(pay, "count", json_new_int(count)); |
| 119 | } |
| 120 | checkins = cson_new_array(); |
| 121 | cson_object_set(pay, "checkins", cson_array_value(checkins)); |
| 122 | while( db_step(&q)==SQLITE_ROW ){ |
| 123 | cson_object * row = cson_new_object(); |
| @@ -132,11 +132,11 @@ | |
| 132 | cson_object_set(row, "comment", json_new_string( db_column_text(&q,5) )); |
| 133 | /*cson_object_set(row, "bgColor", json_new_string( db_column_text(&q,7) ));*/ |
| 134 | cson_object_set(row, "size", cson_value_new_integer( (cson_int_t)db_column_int64(&q,8) )); |
| 135 | cson_object_set(row, "state", |
| 136 | json_new_string(json_artifact_status_to_string(isNew,isDel))); |
| 137 | if( (0 < count) && (++currentRow >= count) ){ |
| 138 | break; |
| 139 | } |
| 140 | } |
| 141 | db_finalize(&q); |
| 142 | |
| 143 |
+6
-6
| --- src/json_report.c | ||
| +++ src/json_report.c | ||
| @@ -153,11 +153,11 @@ | ||
| 153 | 153 | ** |
| 154 | 154 | ** Options/arguments: |
| 155 | 155 | ** |
| 156 | 156 | ** report=int (CLI: -report # or -r #) is the report number to run. |
| 157 | 157 | ** |
| 158 | -** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands. | |
| 158 | +** count=int (CLI: -count # or -n #) -n is for compat. with other commands. | |
| 159 | 159 | ** |
| 160 | 160 | ** format=a|o Specifies result format: a=each row is an arry, o=each |
| 161 | 161 | ** row is an object. Default=o. |
| 162 | 162 | */ |
| 163 | 163 | static cson_value * json_report_run(){ |
| @@ -166,11 +166,11 @@ | ||
| 166 | 166 | cson_object * pay = NULL; |
| 167 | 167 | cson_array * tktList = NULL; |
| 168 | 168 | char const * zFmt; |
| 169 | 169 | char * zTitle = NULL; |
| 170 | 170 | Blob sql = empty_blob; |
| 171 | - int limit = 0; | |
| 171 | + int count = 0; | |
| 172 | 172 | cson_value * colNames = NULL; |
| 173 | 173 | int i; |
| 174 | 174 | |
| 175 | 175 | if(!g.perm.RdTkt){ |
| 176 | 176 | json_set_err(FSL_JSON_E_DENIED, |
| @@ -197,11 +197,11 @@ | ||
| 197 | 197 | nReport); |
| 198 | 198 | db_finalize(&q); |
| 199 | 199 | goto error; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - limit = json_find_option_int("limit",NULL,"n",-1); | |
| 202 | + count = json_find_option_int("count",NULL,"n",-1); | |
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | /* Copy over report's SQL...*/ |
| 206 | 206 | blob_append(&sql, db_column_text(&q,0), -1); |
| 207 | 207 | zTitle = mprintf("%s", db_column_text(&q,1)); |
| @@ -211,12 +211,12 @@ | ||
| 211 | 211 | /** Build the response... */ |
| 212 | 212 | pay = cson_new_object(); |
| 213 | 213 | |
| 214 | 214 | cson_object_set(pay, "report", json_new_int(nReport)); |
| 215 | 215 | cson_object_set(pay, "title", json_new_string(zTitle)); |
| 216 | - if(limit>0){ | |
| 217 | - cson_object_set(pay, "limit", json_new_int((limit<0) ? 0 : limit)); | |
| 216 | + if(count>0){ | |
| 217 | + cson_object_set(pay, "count", json_new_int((count<0) ? 0 : count)); | |
| 218 | 218 | } |
| 219 | 219 | free(zTitle); |
| 220 | 220 | zTitle = NULL; |
| 221 | 221 | |
| 222 | 222 | if(g.perm.TktFmt){ |
| @@ -226,11 +226,11 @@ | ||
| 226 | 226 | } |
| 227 | 227 | blob_reset(&sql); |
| 228 | 228 | |
| 229 | 229 | colNames = cson_sqlite3_column_names(q.pStmt); |
| 230 | 230 | cson_object_set( pay, "columnNames", colNames); |
| 231 | - for( i = 0 ; ((limit>0) ?(i < limit) : 1) | |
| 231 | + for( i = 0 ; ((count>0) ?(i < count) : 1) | |
| 232 | 232 | && (SQLITE_ROW == db_step(&q)); |
| 233 | 233 | ++i){ |
| 234 | 234 | cson_value * row = ('a'==*zFmt) |
| 235 | 235 | ? cson_sqlite3_row_to_array(q.pStmt) |
| 236 | 236 | : cson_sqlite3_row_to_object2(q.pStmt, |
| 237 | 237 |
| --- src/json_report.c | |
| +++ src/json_report.c | |
| @@ -153,11 +153,11 @@ | |
| 153 | ** |
| 154 | ** Options/arguments: |
| 155 | ** |
| 156 | ** report=int (CLI: -report # or -r #) is the report number to run. |
| 157 | ** |
| 158 | ** limit=int (CLI: -limit # or -n #) -n is for compat. with other commands. |
| 159 | ** |
| 160 | ** format=a|o Specifies result format: a=each row is an arry, o=each |
| 161 | ** row is an object. Default=o. |
| 162 | */ |
| 163 | static cson_value * json_report_run(){ |
| @@ -166,11 +166,11 @@ | |
| 166 | cson_object * pay = NULL; |
| 167 | cson_array * tktList = NULL; |
| 168 | char const * zFmt; |
| 169 | char * zTitle = NULL; |
| 170 | Blob sql = empty_blob; |
| 171 | int limit = 0; |
| 172 | cson_value * colNames = NULL; |
| 173 | int i; |
| 174 | |
| 175 | if(!g.perm.RdTkt){ |
| 176 | json_set_err(FSL_JSON_E_DENIED, |
| @@ -197,11 +197,11 @@ | |
| 197 | nReport); |
| 198 | db_finalize(&q); |
| 199 | goto error; |
| 200 | } |
| 201 | |
| 202 | limit = json_find_option_int("limit",NULL,"n",-1); |
| 203 | |
| 204 | |
| 205 | /* Copy over report's SQL...*/ |
| 206 | blob_append(&sql, db_column_text(&q,0), -1); |
| 207 | zTitle = mprintf("%s", db_column_text(&q,1)); |
| @@ -211,12 +211,12 @@ | |
| 211 | /** Build the response... */ |
| 212 | pay = cson_new_object(); |
| 213 | |
| 214 | cson_object_set(pay, "report", json_new_int(nReport)); |
| 215 | cson_object_set(pay, "title", json_new_string(zTitle)); |
| 216 | if(limit>0){ |
| 217 | cson_object_set(pay, "limit", json_new_int((limit<0) ? 0 : limit)); |
| 218 | } |
| 219 | free(zTitle); |
| 220 | zTitle = NULL; |
| 221 | |
| 222 | if(g.perm.TktFmt){ |
| @@ -226,11 +226,11 @@ | |
| 226 | } |
| 227 | blob_reset(&sql); |
| 228 | |
| 229 | colNames = cson_sqlite3_column_names(q.pStmt); |
| 230 | cson_object_set( pay, "columnNames", colNames); |
| 231 | for( i = 0 ; ((limit>0) ?(i < limit) : 1) |
| 232 | && (SQLITE_ROW == db_step(&q)); |
| 233 | ++i){ |
| 234 | cson_value * row = ('a'==*zFmt) |
| 235 | ? cson_sqlite3_row_to_array(q.pStmt) |
| 236 | : cson_sqlite3_row_to_object2(q.pStmt, |
| 237 |
| --- src/json_report.c | |
| +++ src/json_report.c | |
| @@ -153,11 +153,11 @@ | |
| 153 | ** |
| 154 | ** Options/arguments: |
| 155 | ** |
| 156 | ** report=int (CLI: -report # or -r #) is the report number to run. |
| 157 | ** |
| 158 | ** count=int (CLI: -count # or -n #) -n is for compat. with other commands. |
| 159 | ** |
| 160 | ** format=a|o Specifies result format: a=each row is an arry, o=each |
| 161 | ** row is an object. Default=o. |
| 162 | */ |
| 163 | static cson_value * json_report_run(){ |
| @@ -166,11 +166,11 @@ | |
| 166 | cson_object * pay = NULL; |
| 167 | cson_array * tktList = NULL; |
| 168 | char const * zFmt; |
| 169 | char * zTitle = NULL; |
| 170 | Blob sql = empty_blob; |
| 171 | int count = 0; |
| 172 | cson_value * colNames = NULL; |
| 173 | int i; |
| 174 | |
| 175 | if(!g.perm.RdTkt){ |
| 176 | json_set_err(FSL_JSON_E_DENIED, |
| @@ -197,11 +197,11 @@ | |
| 197 | nReport); |
| 198 | db_finalize(&q); |
| 199 | goto error; |
| 200 | } |
| 201 | |
| 202 | count = json_find_option_int("count",NULL,"n",-1); |
| 203 | |
| 204 | |
| 205 | /* Copy over report's SQL...*/ |
| 206 | blob_append(&sql, db_column_text(&q,0), -1); |
| 207 | zTitle = mprintf("%s", db_column_text(&q,1)); |
| @@ -211,12 +211,12 @@ | |
| 211 | /** Build the response... */ |
| 212 | pay = cson_new_object(); |
| 213 | |
| 214 | cson_object_set(pay, "report", json_new_int(nReport)); |
| 215 | cson_object_set(pay, "title", json_new_string(zTitle)); |
| 216 | if(count>0){ |
| 217 | cson_object_set(pay, "count", json_new_int((count<0) ? 0 : count)); |
| 218 | } |
| 219 | free(zTitle); |
| 220 | zTitle = NULL; |
| 221 | |
| 222 | if(g.perm.TktFmt){ |
| @@ -226,11 +226,11 @@ | |
| 226 | } |
| 227 | blob_reset(&sql); |
| 228 | |
| 229 | colNames = cson_sqlite3_column_names(q.pStmt); |
| 230 | cson_object_set( pay, "columnNames", colNames); |
| 231 | for( i = 0 ; ((count>0) ?(i < count) : 1) |
| 232 | && (SQLITE_ROW == db_step(&q)); |
| 233 | ++i){ |
| 234 | cson_value * row = ('a'==*zFmt) |
| 235 | ? cson_sqlite3_row_to_array(q.pStmt) |
| 236 | : cson_sqlite3_row_to_object2(q.pStmt, |
| 237 |
+5
-5
| --- src/json_tag.c | ||
| +++ src/json_tag.c | ||
| @@ -198,11 +198,11 @@ | ||
| 198 | 198 | char const * zName = NULL; |
| 199 | 199 | char const * zType = NULL; |
| 200 | 200 | char const * zType2 = NULL; |
| 201 | 201 | char fRaw = 0; |
| 202 | 202 | Stmt q = empty_Stmt; |
| 203 | - int limit = 0; | |
| 203 | + int count = 0; | |
| 204 | 204 | int tagid = 0; |
| 205 | 205 | |
| 206 | 206 | if( !g.perm.Read ){ |
| 207 | 207 | json_set_err(FSL_JSON_E_DENIED, |
| 208 | 208 | "Requires 'o' permissions."); |
| @@ -230,11 +230,11 @@ | ||
| 230 | 230 | case 'w': zType = "w"; zType2 = "wiki"; break; |
| 231 | 231 | case 't': zType = "t"; zType2 = "ticket"; break; |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - limit = json_find_option_int("limit",NULL,"n",0); | |
| 235 | + count = json_find_option_int("count",NULL,"n",0); | |
| 236 | 236 | fRaw = json_find_option_bool("raw",NULL,NULL,0); |
| 237 | 237 | |
| 238 | 238 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%s' || %Q", |
| 239 | 239 | fRaw ? "" : "sym-", |
| 240 | 240 | zName); |
| @@ -242,11 +242,11 @@ | ||
| 242 | 242 | payV = cson_value_new_object(); |
| 243 | 243 | pay = cson_value_get_object(payV); |
| 244 | 244 | cson_object_set(pay, "name", json_new_string(zName)); |
| 245 | 245 | cson_object_set(pay, "raw", cson_value_new_bool(fRaw)); |
| 246 | 246 | cson_object_set(pay, "type", json_new_string(zType2)); |
| 247 | - cson_object_set(pay, "limit", json_new_int(limit)); | |
| 247 | + cson_object_set(pay, "count", json_new_int(count)); | |
| 248 | 248 | |
| 249 | 249 | #if 1 |
| 250 | 250 | if( tagid<=0 ){ |
| 251 | 251 | cson_object_set(pay,"artifacts", cson_value_null()); |
| 252 | 252 | json_warn(FSL_JSON_W_TAG_NOT_FOUND, "Tag not found."); |
| @@ -260,11 +260,11 @@ | ||
| 260 | 260 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 261 | 261 | " AND tagxref.tagtype>0" |
| 262 | 262 | " AND blob.rid=tagxref.rid" |
| 263 | 263 | "%s LIMIT %d", |
| 264 | 264 | zName, |
| 265 | - (limit>0)?"":"--", limit | |
| 265 | + (count>0)?"":"--", count | |
| 266 | 266 | ); |
| 267 | 267 | while( db_step(&q)==SQLITE_ROW ){ |
| 268 | 268 | if(!listV){ |
| 269 | 269 | listV = cson_value_new_array(); |
| 270 | 270 | list = cson_value_get_array(listV); |
| @@ -302,11 +302,11 @@ | ||
| 302 | 302 | " WHERE tagtype>0 AND tagid=%d" |
| 303 | 303 | " )" |
| 304 | 304 | " ORDER BY event.mtime DESC" |
| 305 | 305 | "%s LIMIT %d", |
| 306 | 306 | zSqlBase, zType, tagid, |
| 307 | - (limit>0)?"":"--", limit | |
| 307 | + (count>0)?"":"--", count | |
| 308 | 308 | ); |
| 309 | 309 | listV = json_stmt_to_array_of_obj(&q, NULL); |
| 310 | 310 | db_finalize(&q); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 |
| --- src/json_tag.c | |
| +++ src/json_tag.c | |
| @@ -198,11 +198,11 @@ | |
| 198 | char const * zName = NULL; |
| 199 | char const * zType = NULL; |
| 200 | char const * zType2 = NULL; |
| 201 | char fRaw = 0; |
| 202 | Stmt q = empty_Stmt; |
| 203 | int limit = 0; |
| 204 | int tagid = 0; |
| 205 | |
| 206 | if( !g.perm.Read ){ |
| 207 | json_set_err(FSL_JSON_E_DENIED, |
| 208 | "Requires 'o' permissions."); |
| @@ -230,11 +230,11 @@ | |
| 230 | case 'w': zType = "w"; zType2 = "wiki"; break; |
| 231 | case 't': zType = "t"; zType2 = "ticket"; break; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | limit = json_find_option_int("limit",NULL,"n",0); |
| 236 | fRaw = json_find_option_bool("raw",NULL,NULL,0); |
| 237 | |
| 238 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%s' || %Q", |
| 239 | fRaw ? "" : "sym-", |
| 240 | zName); |
| @@ -242,11 +242,11 @@ | |
| 242 | payV = cson_value_new_object(); |
| 243 | pay = cson_value_get_object(payV); |
| 244 | cson_object_set(pay, "name", json_new_string(zName)); |
| 245 | cson_object_set(pay, "raw", cson_value_new_bool(fRaw)); |
| 246 | cson_object_set(pay, "type", json_new_string(zType2)); |
| 247 | cson_object_set(pay, "limit", json_new_int(limit)); |
| 248 | |
| 249 | #if 1 |
| 250 | if( tagid<=0 ){ |
| 251 | cson_object_set(pay,"artifacts", cson_value_null()); |
| 252 | json_warn(FSL_JSON_W_TAG_NOT_FOUND, "Tag not found."); |
| @@ -260,11 +260,11 @@ | |
| 260 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 261 | " AND tagxref.tagtype>0" |
| 262 | " AND blob.rid=tagxref.rid" |
| 263 | "%s LIMIT %d", |
| 264 | zName, |
| 265 | (limit>0)?"":"--", limit |
| 266 | ); |
| 267 | while( db_step(&q)==SQLITE_ROW ){ |
| 268 | if(!listV){ |
| 269 | listV = cson_value_new_array(); |
| 270 | list = cson_value_get_array(listV); |
| @@ -302,11 +302,11 @@ | |
| 302 | " WHERE tagtype>0 AND tagid=%d" |
| 303 | " )" |
| 304 | " ORDER BY event.mtime DESC" |
| 305 | "%s LIMIT %d", |
| 306 | zSqlBase, zType, tagid, |
| 307 | (limit>0)?"":"--", limit |
| 308 | ); |
| 309 | listV = json_stmt_to_array_of_obj(&q, NULL); |
| 310 | db_finalize(&q); |
| 311 | } |
| 312 | |
| 313 |
| --- src/json_tag.c | |
| +++ src/json_tag.c | |
| @@ -198,11 +198,11 @@ | |
| 198 | char const * zName = NULL; |
| 199 | char const * zType = NULL; |
| 200 | char const * zType2 = NULL; |
| 201 | char fRaw = 0; |
| 202 | Stmt q = empty_Stmt; |
| 203 | int count = 0; |
| 204 | int tagid = 0; |
| 205 | |
| 206 | if( !g.perm.Read ){ |
| 207 | json_set_err(FSL_JSON_E_DENIED, |
| 208 | "Requires 'o' permissions."); |
| @@ -230,11 +230,11 @@ | |
| 230 | case 'w': zType = "w"; zType2 = "wiki"; break; |
| 231 | case 't': zType = "t"; zType2 = "ticket"; break; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | count = json_find_option_int("count",NULL,"n",0); |
| 236 | fRaw = json_find_option_bool("raw",NULL,NULL,0); |
| 237 | |
| 238 | tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='%s' || %Q", |
| 239 | fRaw ? "" : "sym-", |
| 240 | zName); |
| @@ -242,11 +242,11 @@ | |
| 242 | payV = cson_value_new_object(); |
| 243 | pay = cson_value_get_object(payV); |
| 244 | cson_object_set(pay, "name", json_new_string(zName)); |
| 245 | cson_object_set(pay, "raw", cson_value_new_bool(fRaw)); |
| 246 | cson_object_set(pay, "type", json_new_string(zType2)); |
| 247 | cson_object_set(pay, "count", json_new_int(count)); |
| 248 | |
| 249 | #if 1 |
| 250 | if( tagid<=0 ){ |
| 251 | cson_object_set(pay,"artifacts", cson_value_null()); |
| 252 | json_warn(FSL_JSON_W_TAG_NOT_FOUND, "Tag not found."); |
| @@ -260,11 +260,11 @@ | |
| 260 | " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)" |
| 261 | " AND tagxref.tagtype>0" |
| 262 | " AND blob.rid=tagxref.rid" |
| 263 | "%s LIMIT %d", |
| 264 | zName, |
| 265 | (count>0)?"":"--", count |
| 266 | ); |
| 267 | while( db_step(&q)==SQLITE_ROW ){ |
| 268 | if(!listV){ |
| 269 | listV = cson_value_new_array(); |
| 270 | list = cson_value_get_array(listV); |
| @@ -302,11 +302,11 @@ | |
| 302 | " WHERE tagtype>0 AND tagid=%d" |
| 303 | " )" |
| 304 | " ORDER BY event.mtime DESC" |
| 305 | "%s LIMIT %d", |
| 306 | zSqlBase, zType, tagid, |
| 307 | (count>0)?"":"--", count |
| 308 | ); |
| 309 | listV = json_stmt_to_array_of_obj(&q, NULL); |
| 310 | db_finalize(&q); |
| 311 | } |
| 312 | |
| 313 |
+20
-20
| --- src/json_timeline.c | ||
| +++ src/json_timeline.c | ||
| @@ -224,28 +224,28 @@ | ||
| 224 | 224 | } |
| 225 | 225 | return rc; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /* |
| 229 | -** Tries to figure out a timeline query length limit base on | |
| 229 | +** Tries to figure out a timeline query length count base on | |
| 230 | 230 | ** environment parameters. If it can it returns that value, |
| 231 | 231 | ** else it returns some statically defined default value. |
| 232 | 232 | ** |
| 233 | -** Never returns a negative value. 0 means no limit. | |
| 233 | +** Never returns a negative value. 0 means no count. | |
| 234 | 234 | */ |
| 235 | -static int json_timeline_limit(int defaultLimit){ | |
| 236 | - int limit = -1; | |
| 235 | +static int json_timeline_count(int defaultCount){ | |
| 236 | + int count = -1; | |
| 237 | 237 | if(!g.isHTTP){/* CLI mode */ |
| 238 | - char const * arg = find_option("limit","n",1); | |
| 238 | + char const * arg = find_option("count","n",1); | |
| 239 | 239 | if(arg && *arg){ |
| 240 | - limit = atoi(arg); | |
| 240 | + count = atoi(arg); | |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | - if( (limit<0) && fossil_has_json() ){ | |
| 244 | - limit = json_getenv_int("limit",-1); | |
| 243 | + if( (count<0) && fossil_has_json() ){ | |
| 244 | + count = json_getenv_int("count",-1); | |
| 245 | 245 | } |
| 246 | - return (limit<0) ? defaultLimit : limit; | |
| 246 | + return (count<0) ? defaultCount : count; | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /* |
| 250 | 250 | ** Internal helper for the json_timeline_EVENTTYPE() family of |
| 251 | 251 | ** functions. zEventType must be one of (ci, w, t). pSql must be a |
| @@ -261,26 +261,26 @@ | ||
| 261 | 261 | ** the returned value should be used as g.json.resultCode. |
| 262 | 262 | */ |
| 263 | 263 | static int json_timeline_setup_sql( char const * zEventType, |
| 264 | 264 | Blob * pSql, |
| 265 | 265 | cson_object * pPayload ){ |
| 266 | - int limit; | |
| 266 | + int count; | |
| 267 | 267 | assert( zEventType && *zEventType && pSql ); |
| 268 | 268 | json_timeline_temp_table(); |
| 269 | 269 | blob_append(pSql, "INSERT OR IGNORE INTO json_timeline ", -1); |
| 270 | 270 | blob_append(pSql, json_timeline_query(), -1 ); |
| 271 | 271 | blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType); |
| 272 | 272 | if( json_timeline_add_tag_branch_clause(pSql, pPayload) < 0 ){ |
| 273 | 273 | return FSL_JSON_E_INVALID_ARGS; |
| 274 | 274 | } |
| 275 | 275 | json_timeline_add_time_clause(pSql); |
| 276 | - limit = json_timeline_limit(20); | |
| 277 | - if(limit>0){ | |
| 278 | - blob_appendf(pSql,"LIMIT %d ",limit); | |
| 276 | + count = json_timeline_count(20); | |
| 277 | + if(count>0){ | |
| 278 | + blob_appendf(pSql,"LIMIT %d ",count); | |
| 279 | 279 | } |
| 280 | 280 | if(pPayload){ |
| 281 | - cson_object_set(pPayload, "limit", json_new_int(limit)); | |
| 281 | + cson_object_set(pPayload, "count", json_new_int(count)); | |
| 282 | 282 | } |
| 283 | 283 | return 0; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | |
| @@ -342,11 +342,11 @@ | ||
| 342 | 342 | |
| 343 | 343 | static cson_value * json_timeline_branch(){ |
| 344 | 344 | cson_value * pay = NULL; |
| 345 | 345 | Blob sql = empty_blob; |
| 346 | 346 | Stmt q = empty_Stmt; |
| 347 | - int limit = 0; | |
| 347 | + int count = 0; | |
| 348 | 348 | if(!g.perm.Read){ |
| 349 | 349 | json_set_err(FSL_JSON_E_DENIED, |
| 350 | 350 | "Requires 'o' permissions."); |
| 351 | 351 | return NULL; |
| 352 | 352 | } |
| @@ -368,13 +368,13 @@ | ||
| 368 | 368 | " AND event.type='ci'" |
| 369 | 369 | " AND blob.rid IN (SELECT rid FROM tagxref" |
| 370 | 370 | " WHERE tagtype>0 AND tagid=%d AND srcid!=0)" |
| 371 | 371 | " ORDER BY event.mtime DESC", |
| 372 | 372 | TAG_BRANCH); |
| 373 | - limit = json_timeline_limit(20); | |
| 374 | - if(limit>0){ | |
| 375 | - blob_appendf(&sql," LIMIT %d ",limit); | |
| 373 | + count = json_timeline_count(20); | |
| 374 | + if(count>0){ | |
| 375 | + blob_appendf(&sql," LIMIT %d ",count); | |
| 376 | 376 | } |
| 377 | 377 | db_prepare(&q,"%s", blob_str(&sql)); |
| 378 | 378 | blob_reset(&sql); |
| 379 | 379 | pay = json_stmt_to_array_of_obj(&q, NULL); |
| 380 | 380 | db_finalize(&q); |
| @@ -404,12 +404,12 @@ | ||
| 404 | 404 | |
| 405 | 405 | /* now we wrap the payload in an outer shell, for consistency with |
| 406 | 406 | other /json/timeline/xyz APIs... |
| 407 | 407 | */ |
| 408 | 408 | outer = cson_new_object(); |
| 409 | - if(limit>0){ | |
| 410 | - cson_object_set( outer, "limit", json_new_int(limit) ); | |
| 409 | + if(count>0){ | |
| 410 | + cson_object_set( outer, "count", json_new_int(count) ); | |
| 411 | 411 | } |
| 412 | 412 | cson_object_set( outer, "timeline", pay ); |
| 413 | 413 | pay = cson_object_value(outer); |
| 414 | 414 | } |
| 415 | 415 | return pay; |
| 416 | 416 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -224,28 +224,28 @@ | |
| 224 | } |
| 225 | return rc; |
| 226 | } |
| 227 | |
| 228 | /* |
| 229 | ** Tries to figure out a timeline query length limit base on |
| 230 | ** environment parameters. If it can it returns that value, |
| 231 | ** else it returns some statically defined default value. |
| 232 | ** |
| 233 | ** Never returns a negative value. 0 means no limit. |
| 234 | */ |
| 235 | static int json_timeline_limit(int defaultLimit){ |
| 236 | int limit = -1; |
| 237 | if(!g.isHTTP){/* CLI mode */ |
| 238 | char const * arg = find_option("limit","n",1); |
| 239 | if(arg && *arg){ |
| 240 | limit = atoi(arg); |
| 241 | } |
| 242 | } |
| 243 | if( (limit<0) && fossil_has_json() ){ |
| 244 | limit = json_getenv_int("limit",-1); |
| 245 | } |
| 246 | return (limit<0) ? defaultLimit : limit; |
| 247 | } |
| 248 | |
| 249 | /* |
| 250 | ** Internal helper for the json_timeline_EVENTTYPE() family of |
| 251 | ** functions. zEventType must be one of (ci, w, t). pSql must be a |
| @@ -261,26 +261,26 @@ | |
| 261 | ** the returned value should be used as g.json.resultCode. |
| 262 | */ |
| 263 | static int json_timeline_setup_sql( char const * zEventType, |
| 264 | Blob * pSql, |
| 265 | cson_object * pPayload ){ |
| 266 | int limit; |
| 267 | assert( zEventType && *zEventType && pSql ); |
| 268 | json_timeline_temp_table(); |
| 269 | blob_append(pSql, "INSERT OR IGNORE INTO json_timeline ", -1); |
| 270 | blob_append(pSql, json_timeline_query(), -1 ); |
| 271 | blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType); |
| 272 | if( json_timeline_add_tag_branch_clause(pSql, pPayload) < 0 ){ |
| 273 | return FSL_JSON_E_INVALID_ARGS; |
| 274 | } |
| 275 | json_timeline_add_time_clause(pSql); |
| 276 | limit = json_timeline_limit(20); |
| 277 | if(limit>0){ |
| 278 | blob_appendf(pSql,"LIMIT %d ",limit); |
| 279 | } |
| 280 | if(pPayload){ |
| 281 | cson_object_set(pPayload, "limit", json_new_int(limit)); |
| 282 | } |
| 283 | return 0; |
| 284 | } |
| 285 | |
| 286 | |
| @@ -342,11 +342,11 @@ | |
| 342 | |
| 343 | static cson_value * json_timeline_branch(){ |
| 344 | cson_value * pay = NULL; |
| 345 | Blob sql = empty_blob; |
| 346 | Stmt q = empty_Stmt; |
| 347 | int limit = 0; |
| 348 | if(!g.perm.Read){ |
| 349 | json_set_err(FSL_JSON_E_DENIED, |
| 350 | "Requires 'o' permissions."); |
| 351 | return NULL; |
| 352 | } |
| @@ -368,13 +368,13 @@ | |
| 368 | " AND event.type='ci'" |
| 369 | " AND blob.rid IN (SELECT rid FROM tagxref" |
| 370 | " WHERE tagtype>0 AND tagid=%d AND srcid!=0)" |
| 371 | " ORDER BY event.mtime DESC", |
| 372 | TAG_BRANCH); |
| 373 | limit = json_timeline_limit(20); |
| 374 | if(limit>0){ |
| 375 | blob_appendf(&sql," LIMIT %d ",limit); |
| 376 | } |
| 377 | db_prepare(&q,"%s", blob_str(&sql)); |
| 378 | blob_reset(&sql); |
| 379 | pay = json_stmt_to_array_of_obj(&q, NULL); |
| 380 | db_finalize(&q); |
| @@ -404,12 +404,12 @@ | |
| 404 | |
| 405 | /* now we wrap the payload in an outer shell, for consistency with |
| 406 | other /json/timeline/xyz APIs... |
| 407 | */ |
| 408 | outer = cson_new_object(); |
| 409 | if(limit>0){ |
| 410 | cson_object_set( outer, "limit", json_new_int(limit) ); |
| 411 | } |
| 412 | cson_object_set( outer, "timeline", pay ); |
| 413 | pay = cson_object_value(outer); |
| 414 | } |
| 415 | return pay; |
| 416 |
| --- src/json_timeline.c | |
| +++ src/json_timeline.c | |
| @@ -224,28 +224,28 @@ | |
| 224 | } |
| 225 | return rc; |
| 226 | } |
| 227 | |
| 228 | /* |
| 229 | ** Tries to figure out a timeline query length count base on |
| 230 | ** environment parameters. If it can it returns that value, |
| 231 | ** else it returns some statically defined default value. |
| 232 | ** |
| 233 | ** Never returns a negative value. 0 means no count. |
| 234 | */ |
| 235 | static int json_timeline_count(int defaultCount){ |
| 236 | int count = -1; |
| 237 | if(!g.isHTTP){/* CLI mode */ |
| 238 | char const * arg = find_option("count","n",1); |
| 239 | if(arg && *arg){ |
| 240 | count = atoi(arg); |
| 241 | } |
| 242 | } |
| 243 | if( (count<0) && fossil_has_json() ){ |
| 244 | count = json_getenv_int("count",-1); |
| 245 | } |
| 246 | return (count<0) ? defaultCount : count; |
| 247 | } |
| 248 | |
| 249 | /* |
| 250 | ** Internal helper for the json_timeline_EVENTTYPE() family of |
| 251 | ** functions. zEventType must be one of (ci, w, t). pSql must be a |
| @@ -261,26 +261,26 @@ | |
| 261 | ** the returned value should be used as g.json.resultCode. |
| 262 | */ |
| 263 | static int json_timeline_setup_sql( char const * zEventType, |
| 264 | Blob * pSql, |
| 265 | cson_object * pPayload ){ |
| 266 | int count; |
| 267 | assert( zEventType && *zEventType && pSql ); |
| 268 | json_timeline_temp_table(); |
| 269 | blob_append(pSql, "INSERT OR IGNORE INTO json_timeline ", -1); |
| 270 | blob_append(pSql, json_timeline_query(), -1 ); |
| 271 | blob_appendf(pSql, " AND event.type IN(%Q) ", zEventType); |
| 272 | if( json_timeline_add_tag_branch_clause(pSql, pPayload) < 0 ){ |
| 273 | return FSL_JSON_E_INVALID_ARGS; |
| 274 | } |
| 275 | json_timeline_add_time_clause(pSql); |
| 276 | count = json_timeline_count(20); |
| 277 | if(count>0){ |
| 278 | blob_appendf(pSql,"LIMIT %d ",count); |
| 279 | } |
| 280 | if(pPayload){ |
| 281 | cson_object_set(pPayload, "count", json_new_int(count)); |
| 282 | } |
| 283 | return 0; |
| 284 | } |
| 285 | |
| 286 | |
| @@ -342,11 +342,11 @@ | |
| 342 | |
| 343 | static cson_value * json_timeline_branch(){ |
| 344 | cson_value * pay = NULL; |
| 345 | Blob sql = empty_blob; |
| 346 | Stmt q = empty_Stmt; |
| 347 | int count = 0; |
| 348 | if(!g.perm.Read){ |
| 349 | json_set_err(FSL_JSON_E_DENIED, |
| 350 | "Requires 'o' permissions."); |
| 351 | return NULL; |
| 352 | } |
| @@ -368,13 +368,13 @@ | |
| 368 | " AND event.type='ci'" |
| 369 | " AND blob.rid IN (SELECT rid FROM tagxref" |
| 370 | " WHERE tagtype>0 AND tagid=%d AND srcid!=0)" |
| 371 | " ORDER BY event.mtime DESC", |
| 372 | TAG_BRANCH); |
| 373 | count = json_timeline_count(20); |
| 374 | if(count>0){ |
| 375 | blob_appendf(&sql," LIMIT %d ",count); |
| 376 | } |
| 377 | db_prepare(&q,"%s", blob_str(&sql)); |
| 378 | blob_reset(&sql); |
| 379 | pay = json_stmt_to_array_of_obj(&q, NULL); |
| 380 | db_finalize(&q); |
| @@ -404,12 +404,12 @@ | |
| 404 | |
| 405 | /* now we wrap the payload in an outer shell, for consistency with |
| 406 | other /json/timeline/xyz APIs... |
| 407 | */ |
| 408 | outer = cson_new_object(); |
| 409 | if(count>0){ |
| 410 | cson_object_set( outer, "count", json_new_int(count) ); |
| 411 | } |
| 412 | cson_object_set( outer, "timeline", pay ); |
| 413 | pay = cson_object_value(outer); |
| 414 | } |
| 415 | return pay; |
| 416 |