Fossil SCM
Merge the status command into the changes command.
Commit
2c3a108c72e7d596aa7ee3a653784d75aee437af
Parent
442a3cd5e56bcc5…
1 file changed
+54
-73
+54
-73
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -266,14 +266,21 @@ | ||
| 266 | 266 | blob_reset(&report); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /* |
| 270 | 270 | ** COMMAND: changes |
| 271 | +** COMMAND: status | |
| 271 | 272 | ** |
| 272 | -** Usage: %fossil changes ?OPTIONS? | |
| 273 | +** Usage: %fossil changes|status ?OPTIONS? | |
| 273 | 274 | ** |
| 274 | 275 | ** Report the change status of files in the current checkout. |
| 276 | +** | |
| 277 | +** The status command is similar to the changes command, except it lacks | |
| 278 | +** several of the options supported by changes and it has its own header | |
| 279 | +** and footer information. The header information is a subset of that | |
| 280 | +** shown by the info command, and the footer shows if there are any forks. | |
| 281 | +** Change type classification is always enabled for the status command. | |
| 275 | 282 | ** |
| 276 | 283 | ** Each line of output is the name of a changed file, with paths shown |
| 277 | 284 | ** according to the "relative-paths" setting, unless overridden by the |
| 278 | 285 | ** --abs-paths or --rel-paths options. |
| 279 | 286 | ** |
| @@ -311,10 +318,12 @@ | ||
| 311 | 318 | ** --abs-paths Display absolute pathnames. |
| 312 | 319 | ** --rel-paths Display pathnames relative to the current working |
| 313 | 320 | ** directory. |
| 314 | 321 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| 315 | 322 | ** relying on file mtimes. |
| 323 | +** | |
| 324 | +** Options specific to the changes command: | |
| 316 | 325 | ** --header Identify the repository if report is non-empty. |
| 317 | 326 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 318 | 327 | ** --classify Start each line with the file's change type. |
| 319 | 328 | ** --no-classify Do not print file change types. |
| 320 | 329 | ** |
| @@ -332,29 +341,30 @@ | ||
| 332 | 341 | ** --all Display all managed files, i.e. all of the above. |
| 333 | 342 | ** --extra Display unmanaged files. |
| 334 | 343 | ** --merge Display merge contributors. |
| 335 | 344 | ** --no-merge Do not display merge contributors. |
| 336 | 345 | ** |
| 337 | -** See also: extras, ls, status | |
| 346 | +** See also: extras, ls | |
| 338 | 347 | */ |
| 339 | -void changes_cmd(void){ | |
| 348 | +void status_cmd(void){ | |
| 340 | 349 | /* Affirmative and negative flag option tables. */ |
| 341 | 350 | static const struct { |
| 342 | 351 | const char *option; |
| 343 | 352 | unsigned mask; |
| 353 | + int changesOnly; | |
| 344 | 354 | } flagDefs[] = { |
| 345 | - {"edited" , C_EDITED }, {"updated" , C_UPDATED }, | |
| 346 | - {"changed" , C_CHANGED }, {"missing" , C_MISSING }, | |
| 347 | - {"added" , C_ADDED }, {"deleted" , C_DELETED }, | |
| 348 | - {"renamed" , C_RENAMED }, {"conflict" , C_CONFLICT }, | |
| 349 | - {"meta" , C_META }, {"unmodified" , C_UNMODIFIED}, | |
| 350 | - {"all" , C_ALL }, {"extra" , C_EXTRA }, | |
| 351 | - {"merge" , C_MERGE }, {"sha1sum" , C_SHA1SUM }, | |
| 352 | - {"header" , C_HEADER }, {"v" , C_VERBOSE }, | |
| 353 | - {"verbose" , C_VERBOSE }, {"classify" , C_CLASSIFY }, | |
| 355 | + {"edited" , C_EDITED , 0}, {"updated" , C_UPDATED , 0}, | |
| 356 | + {"changed" , C_CHANGED, 0}, {"missing" , C_MISSING , 0}, | |
| 357 | + {"added" , C_ADDED , 0}, {"deleted" , C_DELETED , 0}, | |
| 358 | + {"renamed" , C_RENAMED, 0}, {"conflict" , C_CONFLICT , 0}, | |
| 359 | + {"meta" , C_META , 0}, {"unmodified" , C_UNMODIFIED, 0}, | |
| 360 | + {"all" , C_ALL , 0}, {"extra" , C_EXTRA , 0}, | |
| 361 | + {"merge" , C_MERGE , 0}, {"sha1sum" , C_SHA1SUM , 0}, | |
| 362 | + {"header" , C_HEADER , 1}, {"v" , C_VERBOSE , 1}, | |
| 363 | + {"verbose" , C_VERBOSE, 1}, {"classify" , C_CLASSIFY , 1}, | |
| 354 | 364 | }, noFlagDefs[] = { |
| 355 | - {"no-merge", C_MERGE }, {"no-classify", C_CLASSIFY }, | |
| 365 | + {"no-merge", C_MERGE , 0}, {"no-classify", C_CLASSIFY , 1}, | |
| 356 | 366 | }; |
| 357 | 367 | |
| 358 | 368 | #ifdef FOSSIL_DEBUG |
| 359 | 369 | static const char *const bits[] = { |
| 360 | 370 | "EDITED", "UPDATED", "CHANGED", "MISSING", "ADDED", "DELETED", "RENAMED", |
| @@ -361,16 +371,18 @@ | ||
| 361 | 371 | "CONFLICT", "META", "UNMODIFIED", "EXTRA", "MERGE", "RELPATH", "SHA1SUM", |
| 362 | 372 | "HEADER", "VERBOSE", "CLASSIFY", |
| 363 | 373 | }; |
| 364 | 374 | #endif |
| 365 | 375 | |
| 376 | + int changes = g.argv[1][0]=='c'; | |
| 366 | 377 | unsigned flags = 0; |
| 367 | - int i; | |
| 378 | + int vid, i; | |
| 368 | 379 | |
| 369 | 380 | /* Load affirmative flag options. */ |
| 370 | 381 | for( i=0; i<count(flagDefs); ++i ){ |
| 371 | - if( find_option(flagDefs[i].option, 0, 0) ){ | |
| 382 | + if( (!flagDefs[i].changesOnly || changes) | |
| 383 | + && find_option(flagDefs[i].option, 0, 0) ){ | |
| 372 | 384 | flags |= flagDefs[i].mask; |
| 373 | 385 | } |
| 374 | 386 | } |
| 375 | 387 | |
| 376 | 388 | /* If no filter options are specified, enable defaults. */ |
| @@ -380,22 +392,25 @@ | ||
| 380 | 392 | |
| 381 | 393 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 382 | 394 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 383 | 395 | * number masked by one less than itself is zero, it's either zero or a power |
| 384 | 396 | * of two. It's already known to not be zero because of the above defaults. |
| 385 | - * Unlike --all, --changed is a single filter, i.e. it sets only one bit. */ | |
| 386 | - if( flags & (flags-1) & C_FILTER ){ | |
| 397 | + * Unlike --all, --changed is a single filter, i.e. it sets only one bit. | |
| 398 | + * Also force classification for the status command. */ | |
| 399 | + if( !changes || (flags & (flags-1) & C_FILTER) ){ | |
| 387 | 400 | flags |= C_CLASSIFY; |
| 388 | 401 | } |
| 389 | 402 | |
| 390 | 403 | /* Negative flag options override defaults applied above. */ |
| 391 | 404 | for( i=0; i<count(noFlagDefs); ++i ){ |
| 392 | - if( find_option(noFlagDefs[i].option, 0, 0) ){ | |
| 405 | + if( (!noFlagDefs[i].changesOnly || changes) | |
| 406 | + && find_option(noFlagDefs[i].option, 0, 0) ){ | |
| 393 | 407 | flags &= ~noFlagDefs[i].mask; |
| 394 | 408 | } |
| 395 | 409 | } |
| 396 | 410 | |
| 411 | + /* Confirm current working directory is within checkout. */ | |
| 397 | 412 | db_must_be_within_tree(); |
| 398 | 413 | |
| 399 | 414 | /* Relative path flag determination is done by a shared function. */ |
| 400 | 415 | if( determine_cwd_relative_option() ){ |
| 401 | 416 | flags |= C_RELPATH; |
| @@ -411,65 +426,31 @@ | ||
| 411 | 426 | #endif |
| 412 | 427 | |
| 413 | 428 | /* We should be done with options. */ |
| 414 | 429 | verify_all_options(); |
| 415 | 430 | |
| 416 | - print_changes(flags); | |
| 417 | -} | |
| 418 | - | |
| 419 | -/* | |
| 420 | -** COMMAND: status | |
| 421 | -** | |
| 422 | -** Usage: %fossil status ?OPTIONS? | |
| 423 | -** | |
| 424 | -** Report on the status of the current checkout. | |
| 425 | -** | |
| 426 | -** Pathnames are displayed according to the "relative-paths" setting, | |
| 427 | -** unless overridden by the --abs-paths or --rel-paths options. | |
| 428 | -** | |
| 429 | -** Options: | |
| 430 | -** | |
| 431 | -** --abs-paths Display absolute pathnames. | |
| 432 | -** --rel-paths Display pathnames relative to the current working | |
| 433 | -** directory. | |
| 434 | -** --sha1sum Verify file status using SHA1 hashing rather | |
| 435 | -** than relying on file mtimes. | |
| 436 | -** | |
| 437 | -** See also: changes, extras, ls | |
| 438 | -*/ | |
| 439 | -void status_cmd(void){ | |
| 440 | - int vid; | |
| 441 | - unsigned flags = C_DEFAULT; | |
| 442 | - | |
| 443 | - /* Check options. */ | |
| 444 | - db_must_be_within_tree(); | |
| 445 | - if( find_option("sha1sum", 0, 0) ){ | |
| 446 | - flags |= C_SHA1SUM; | |
| 447 | - } | |
| 448 | - if( find_option("header", 0, 0) ){ | |
| 449 | - flags |= C_HEADER; | |
| 450 | - } | |
| 451 | - if( find_option("verbose", "v", 0) ){ | |
| 452 | - flags |= C_VERBOSE; | |
| 453 | - } | |
| 454 | - if( determine_cwd_relative_option() ){ | |
| 455 | - flags |= C_RELPATH; | |
| 456 | - } | |
| 457 | - verify_all_options(); | |
| 458 | - | |
| 459 | - fossil_print("repository: %s\n", db_repository_filename()); | |
| 460 | - fossil_print("local-root: %s\n", g.zLocalRoot); | |
| 461 | - if( g.zConfigDbName ){ | |
| 462 | - fossil_print("config-db: %s\n", g.zConfigDbName); | |
| 463 | - } | |
| 464 | - vid = db_lget_int("checkout", 0); | |
| 465 | - if( vid ){ | |
| 466 | - show_common_info(vid, "checkout:", 1, 1); | |
| 467 | - } | |
| 468 | - db_record_repository_filename(0); | |
| 469 | - print_changes(flags); | |
| 470 | - leaf_ambiguity_warning(vid, vid); | |
| 431 | + /* The status command prints general information before the change list. */ | |
| 432 | + if( !changes ){ | |
| 433 | + vid = db_lget_int("checkout", 0); | |
| 434 | + fossil_print("repository: %s\n", db_repository_filename()); | |
| 435 | + fossil_print("local-root: %s\n", g.zLocalRoot); | |
| 436 | + if( g.zConfigDbName ){ | |
| 437 | + fossil_print("config-db: %s\n", g.zConfigDbName); | |
| 438 | + } | |
| 439 | + if( vid ){ | |
| 440 | + show_common_info(vid, "checkout:", 1, 1); | |
| 441 | + } | |
| 442 | + db_record_repository_filename(0); | |
| 443 | + } | |
| 444 | + | |
| 445 | + /* Print all requested changes. */ | |
| 446 | + print_changes(flags); | |
| 447 | + | |
| 448 | + /* The status command ends with warnings about ambiguous leaves (forks). */ | |
| 449 | + if( !changes ){ | |
| 450 | + leaf_ambiguity_warning(vid, vid); | |
| 451 | + } | |
| 471 | 452 | } |
| 472 | 453 | |
| 473 | 454 | /* |
| 474 | 455 | ** Take care of -r version of ls command |
| 475 | 456 | */ |
| 476 | 457 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -266,14 +266,21 @@ | |
| 266 | blob_reset(&report); |
| 267 | } |
| 268 | |
| 269 | /* |
| 270 | ** COMMAND: changes |
| 271 | ** |
| 272 | ** Usage: %fossil changes ?OPTIONS? |
| 273 | ** |
| 274 | ** Report the change status of files in the current checkout. |
| 275 | ** |
| 276 | ** Each line of output is the name of a changed file, with paths shown |
| 277 | ** according to the "relative-paths" setting, unless overridden by the |
| 278 | ** --abs-paths or --rel-paths options. |
| 279 | ** |
| @@ -311,10 +318,12 @@ | |
| 311 | ** --abs-paths Display absolute pathnames. |
| 312 | ** --rel-paths Display pathnames relative to the current working |
| 313 | ** directory. |
| 314 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| 315 | ** relying on file mtimes. |
| 316 | ** --header Identify the repository if report is non-empty. |
| 317 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 318 | ** --classify Start each line with the file's change type. |
| 319 | ** --no-classify Do not print file change types. |
| 320 | ** |
| @@ -332,29 +341,30 @@ | |
| 332 | ** --all Display all managed files, i.e. all of the above. |
| 333 | ** --extra Display unmanaged files. |
| 334 | ** --merge Display merge contributors. |
| 335 | ** --no-merge Do not display merge contributors. |
| 336 | ** |
| 337 | ** See also: extras, ls, status |
| 338 | */ |
| 339 | void changes_cmd(void){ |
| 340 | /* Affirmative and negative flag option tables. */ |
| 341 | static const struct { |
| 342 | const char *option; |
| 343 | unsigned mask; |
| 344 | } flagDefs[] = { |
| 345 | {"edited" , C_EDITED }, {"updated" , C_UPDATED }, |
| 346 | {"changed" , C_CHANGED }, {"missing" , C_MISSING }, |
| 347 | {"added" , C_ADDED }, {"deleted" , C_DELETED }, |
| 348 | {"renamed" , C_RENAMED }, {"conflict" , C_CONFLICT }, |
| 349 | {"meta" , C_META }, {"unmodified" , C_UNMODIFIED}, |
| 350 | {"all" , C_ALL }, {"extra" , C_EXTRA }, |
| 351 | {"merge" , C_MERGE }, {"sha1sum" , C_SHA1SUM }, |
| 352 | {"header" , C_HEADER }, {"v" , C_VERBOSE }, |
| 353 | {"verbose" , C_VERBOSE }, {"classify" , C_CLASSIFY }, |
| 354 | }, noFlagDefs[] = { |
| 355 | {"no-merge", C_MERGE }, {"no-classify", C_CLASSIFY }, |
| 356 | }; |
| 357 | |
| 358 | #ifdef FOSSIL_DEBUG |
| 359 | static const char *const bits[] = { |
| 360 | "EDITED", "UPDATED", "CHANGED", "MISSING", "ADDED", "DELETED", "RENAMED", |
| @@ -361,16 +371,18 @@ | |
| 361 | "CONFLICT", "META", "UNMODIFIED", "EXTRA", "MERGE", "RELPATH", "SHA1SUM", |
| 362 | "HEADER", "VERBOSE", "CLASSIFY", |
| 363 | }; |
| 364 | #endif |
| 365 | |
| 366 | unsigned flags = 0; |
| 367 | int i; |
| 368 | |
| 369 | /* Load affirmative flag options. */ |
| 370 | for( i=0; i<count(flagDefs); ++i ){ |
| 371 | if( find_option(flagDefs[i].option, 0, 0) ){ |
| 372 | flags |= flagDefs[i].mask; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /* If no filter options are specified, enable defaults. */ |
| @@ -380,22 +392,25 @@ | |
| 380 | |
| 381 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 382 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 383 | * number masked by one less than itself is zero, it's either zero or a power |
| 384 | * of two. It's already known to not be zero because of the above defaults. |
| 385 | * Unlike --all, --changed is a single filter, i.e. it sets only one bit. */ |
| 386 | if( flags & (flags-1) & C_FILTER ){ |
| 387 | flags |= C_CLASSIFY; |
| 388 | } |
| 389 | |
| 390 | /* Negative flag options override defaults applied above. */ |
| 391 | for( i=0; i<count(noFlagDefs); ++i ){ |
| 392 | if( find_option(noFlagDefs[i].option, 0, 0) ){ |
| 393 | flags &= ~noFlagDefs[i].mask; |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | db_must_be_within_tree(); |
| 398 | |
| 399 | /* Relative path flag determination is done by a shared function. */ |
| 400 | if( determine_cwd_relative_option() ){ |
| 401 | flags |= C_RELPATH; |
| @@ -411,65 +426,31 @@ | |
| 411 | #endif |
| 412 | |
| 413 | /* We should be done with options. */ |
| 414 | verify_all_options(); |
| 415 | |
| 416 | print_changes(flags); |
| 417 | } |
| 418 | |
| 419 | /* |
| 420 | ** COMMAND: status |
| 421 | ** |
| 422 | ** Usage: %fossil status ?OPTIONS? |
| 423 | ** |
| 424 | ** Report on the status of the current checkout. |
| 425 | ** |
| 426 | ** Pathnames are displayed according to the "relative-paths" setting, |
| 427 | ** unless overridden by the --abs-paths or --rel-paths options. |
| 428 | ** |
| 429 | ** Options: |
| 430 | ** |
| 431 | ** --abs-paths Display absolute pathnames. |
| 432 | ** --rel-paths Display pathnames relative to the current working |
| 433 | ** directory. |
| 434 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 435 | ** than relying on file mtimes. |
| 436 | ** |
| 437 | ** See also: changes, extras, ls |
| 438 | */ |
| 439 | void status_cmd(void){ |
| 440 | int vid; |
| 441 | unsigned flags = C_DEFAULT; |
| 442 | |
| 443 | /* Check options. */ |
| 444 | db_must_be_within_tree(); |
| 445 | if( find_option("sha1sum", 0, 0) ){ |
| 446 | flags |= C_SHA1SUM; |
| 447 | } |
| 448 | if( find_option("header", 0, 0) ){ |
| 449 | flags |= C_HEADER; |
| 450 | } |
| 451 | if( find_option("verbose", "v", 0) ){ |
| 452 | flags |= C_VERBOSE; |
| 453 | } |
| 454 | if( determine_cwd_relative_option() ){ |
| 455 | flags |= C_RELPATH; |
| 456 | } |
| 457 | verify_all_options(); |
| 458 | |
| 459 | fossil_print("repository: %s\n", db_repository_filename()); |
| 460 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 461 | if( g.zConfigDbName ){ |
| 462 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 463 | } |
| 464 | vid = db_lget_int("checkout", 0); |
| 465 | if( vid ){ |
| 466 | show_common_info(vid, "checkout:", 1, 1); |
| 467 | } |
| 468 | db_record_repository_filename(0); |
| 469 | print_changes(flags); |
| 470 | leaf_ambiguity_warning(vid, vid); |
| 471 | } |
| 472 | |
| 473 | /* |
| 474 | ** Take care of -r version of ls command |
| 475 | */ |
| 476 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -266,14 +266,21 @@ | |
| 266 | blob_reset(&report); |
| 267 | } |
| 268 | |
| 269 | /* |
| 270 | ** COMMAND: changes |
| 271 | ** COMMAND: status |
| 272 | ** |
| 273 | ** Usage: %fossil changes|status ?OPTIONS? |
| 274 | ** |
| 275 | ** Report the change status of files in the current checkout. |
| 276 | ** |
| 277 | ** The status command is similar to the changes command, except it lacks |
| 278 | ** several of the options supported by changes and it has its own header |
| 279 | ** and footer information. The header information is a subset of that |
| 280 | ** shown by the info command, and the footer shows if there are any forks. |
| 281 | ** Change type classification is always enabled for the status command. |
| 282 | ** |
| 283 | ** Each line of output is the name of a changed file, with paths shown |
| 284 | ** according to the "relative-paths" setting, unless overridden by the |
| 285 | ** --abs-paths or --rel-paths options. |
| 286 | ** |
| @@ -311,10 +318,12 @@ | |
| 318 | ** --abs-paths Display absolute pathnames. |
| 319 | ** --rel-paths Display pathnames relative to the current working |
| 320 | ** directory. |
| 321 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| 322 | ** relying on file mtimes. |
| 323 | ** |
| 324 | ** Options specific to the changes command: |
| 325 | ** --header Identify the repository if report is non-empty. |
| 326 | ** -v|--verbose Say "(none)" if the change report is empty. |
| 327 | ** --classify Start each line with the file's change type. |
| 328 | ** --no-classify Do not print file change types. |
| 329 | ** |
| @@ -332,29 +341,30 @@ | |
| 341 | ** --all Display all managed files, i.e. all of the above. |
| 342 | ** --extra Display unmanaged files. |
| 343 | ** --merge Display merge contributors. |
| 344 | ** --no-merge Do not display merge contributors. |
| 345 | ** |
| 346 | ** See also: extras, ls |
| 347 | */ |
| 348 | void status_cmd(void){ |
| 349 | /* Affirmative and negative flag option tables. */ |
| 350 | static const struct { |
| 351 | const char *option; |
| 352 | unsigned mask; |
| 353 | int changesOnly; |
| 354 | } flagDefs[] = { |
| 355 | {"edited" , C_EDITED , 0}, {"updated" , C_UPDATED , 0}, |
| 356 | {"changed" , C_CHANGED, 0}, {"missing" , C_MISSING , 0}, |
| 357 | {"added" , C_ADDED , 0}, {"deleted" , C_DELETED , 0}, |
| 358 | {"renamed" , C_RENAMED, 0}, {"conflict" , C_CONFLICT , 0}, |
| 359 | {"meta" , C_META , 0}, {"unmodified" , C_UNMODIFIED, 0}, |
| 360 | {"all" , C_ALL , 0}, {"extra" , C_EXTRA , 0}, |
| 361 | {"merge" , C_MERGE , 0}, {"sha1sum" , C_SHA1SUM , 0}, |
| 362 | {"header" , C_HEADER , 1}, {"v" , C_VERBOSE , 1}, |
| 363 | {"verbose" , C_VERBOSE, 1}, {"classify" , C_CLASSIFY , 1}, |
| 364 | }, noFlagDefs[] = { |
| 365 | {"no-merge", C_MERGE , 0}, {"no-classify", C_CLASSIFY , 1}, |
| 366 | }; |
| 367 | |
| 368 | #ifdef FOSSIL_DEBUG |
| 369 | static const char *const bits[] = { |
| 370 | "EDITED", "UPDATED", "CHANGED", "MISSING", "ADDED", "DELETED", "RENAMED", |
| @@ -361,16 +371,18 @@ | |
| 371 | "CONFLICT", "META", "UNMODIFIED", "EXTRA", "MERGE", "RELPATH", "SHA1SUM", |
| 372 | "HEADER", "VERBOSE", "CLASSIFY", |
| 373 | }; |
| 374 | #endif |
| 375 | |
| 376 | int changes = g.argv[1][0]=='c'; |
| 377 | unsigned flags = 0; |
| 378 | int vid, i; |
| 379 | |
| 380 | /* Load affirmative flag options. */ |
| 381 | for( i=0; i<count(flagDefs); ++i ){ |
| 382 | if( (!flagDefs[i].changesOnly || changes) |
| 383 | && find_option(flagDefs[i].option, 0, 0) ){ |
| 384 | flags |= flagDefs[i].mask; |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | /* If no filter options are specified, enable defaults. */ |
| @@ -380,22 +392,25 @@ | |
| 392 | |
| 393 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 394 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 395 | * number masked by one less than itself is zero, it's either zero or a power |
| 396 | * of two. It's already known to not be zero because of the above defaults. |
| 397 | * Unlike --all, --changed is a single filter, i.e. it sets only one bit. |
| 398 | * Also force classification for the status command. */ |
| 399 | if( !changes || (flags & (flags-1) & C_FILTER) ){ |
| 400 | flags |= C_CLASSIFY; |
| 401 | } |
| 402 | |
| 403 | /* Negative flag options override defaults applied above. */ |
| 404 | for( i=0; i<count(noFlagDefs); ++i ){ |
| 405 | if( (!noFlagDefs[i].changesOnly || changes) |
| 406 | && find_option(noFlagDefs[i].option, 0, 0) ){ |
| 407 | flags &= ~noFlagDefs[i].mask; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | /* Confirm current working directory is within checkout. */ |
| 412 | db_must_be_within_tree(); |
| 413 | |
| 414 | /* Relative path flag determination is done by a shared function. */ |
| 415 | if( determine_cwd_relative_option() ){ |
| 416 | flags |= C_RELPATH; |
| @@ -411,65 +426,31 @@ | |
| 426 | #endif |
| 427 | |
| 428 | /* We should be done with options. */ |
| 429 | verify_all_options(); |
| 430 | |
| 431 | /* The status command prints general information before the change list. */ |
| 432 | if( !changes ){ |
| 433 | vid = db_lget_int("checkout", 0); |
| 434 | fossil_print("repository: %s\n", db_repository_filename()); |
| 435 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 436 | if( g.zConfigDbName ){ |
| 437 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 438 | } |
| 439 | if( vid ){ |
| 440 | show_common_info(vid, "checkout:", 1, 1); |
| 441 | } |
| 442 | db_record_repository_filename(0); |
| 443 | } |
| 444 | |
| 445 | /* Print all requested changes. */ |
| 446 | print_changes(flags); |
| 447 | |
| 448 | /* The status command ends with warnings about ambiguous leaves (forks). */ |
| 449 | if( !changes ){ |
| 450 | leaf_ambiguity_warning(vid, vid); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | /* |
| 455 | ** Take care of -r version of ls command |
| 456 | */ |
| 457 |