Fossil SCM
Adjust the way --changed is implemented. Improve documentation. Avoid saying EDITED for files with other types of changes if those change types were not selected for display.
Commit
2408fd1c2cb56cdf618bb3a5d8a534df611cf7ed
Parent
7595bdfbf099418…
1 file changed
+14
-15
+14
-15
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -33,11 +33,11 @@ | ||
| 33 | 33 | CB_COMMENT, |
| 34 | 34 | |
| 35 | 35 | /* Bitmask values. */ |
| 36 | 36 | C_EDITED = 1 << CB_EDITED, /* Edited, merged, and conflicted files. */ |
| 37 | 37 | C_UPDATED = 1 << CB_UPDATED, /* Files updated by merge/integrate. */ |
| 38 | - C_CHANGED = 1 << CB_CHANGED, /* Becomes CB_EDITED|CB_UPDATED. */ | |
| 38 | + C_CHANGED = 1 << CB_CHANGED, /* Treated the same as the above two. */ | |
| 39 | 39 | C_MISSING = 1 << CB_MISSING, /* Missing and non- files. */ |
| 40 | 40 | C_ADDED = 1 << CB_ADDED, /* Added files. */ |
| 41 | 41 | C_DELETED = 1 << CB_DELETED, /* Deleted files. */ |
| 42 | 42 | C_RENAMED = 1 << CB_RENAMED, /* Renamed files. */ |
| 43 | 43 | C_CONFLICT = 1 << CB_CONFLICT, /* Files having merge conflicts. */ |
| @@ -46,11 +46,11 @@ | ||
| 46 | 46 | C_EXTRA = 1 << CB_EXTRA, /* Unmanaged files. */ |
| 47 | 47 | C_MERGE = 1 << CB_MERGE, /* Merge contributors. */ |
| 48 | 48 | C_FILTER = C_EDITED | C_UPDATED | C_CHANGED | C_MISSING | C_ADDED |
| 49 | 49 | | C_DELETED | C_RENAMED | C_CONFLICT | C_META | C_UNMODIFIED |
| 50 | 50 | | C_EXTRA | C_MERGE, |
| 51 | - C_ALL = C_FILTER & ~(C_CHANGED | C_EXTRA | C_MERGE), | |
| 51 | + C_ALL = C_FILTER & ~(C_EXTRA | C_MERGE), | |
| 52 | 52 | C_RELPATH = 1 << CB_RELPATH, /* Show relative paths. */ |
| 53 | 53 | C_SHA1SUM = 1 << CB_SHA1SUM, /* Use SHA1 checksums not mtimes. */ |
| 54 | 54 | C_HEADER = 1 << CB_HEADER, /* Display repository name if non-empty. */ |
| 55 | 55 | C_VERBOSE = 1 << CB_VERBOSE, /* Display "(none)" if empty. */ |
| 56 | 56 | C_CLASSIFY = 1 << CB_CLASSIFY, /* Show file change types. */ |
| @@ -131,15 +131,15 @@ | ||
| 131 | 131 | nErr++; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | }else if( (flags & C_ADDED) && isNew ){ |
| 135 | 135 | zClass = "ADDED"; |
| 136 | - }else if( (flags & C_UPDATED) && isChnged==2 ){ | |
| 136 | + }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==2 ){ | |
| 137 | 137 | zClass = "UPDATED_BY_MERGE"; |
| 138 | 138 | }else if( (flags & C_ADDED) && isChnged==3 ){ |
| 139 | 139 | zClass = "ADDED_BY_MERGE"; |
| 140 | - }else if( (flags & C_UPDATED) && isChnged==4 ){ | |
| 140 | + }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==4 ){ | |
| 141 | 141 | zClass = "UPDATED_BY_INTEGRATE"; |
| 142 | 142 | }else if( (flags & C_ADDED) && isChnged==5 ){ |
| 143 | 143 | zClass = "ADDED_BY_INTEGRATE"; |
| 144 | 144 | }else if( (flags & C_META) && isChnged==6 ){ |
| 145 | 145 | zClass = "EXECUTABLE"; |
| @@ -150,11 +150,11 @@ | ||
| 150 | 150 | }else if( (flags & C_META) && isChnged==9 ){ |
| 151 | 151 | zClass = "UNLINK"; |
| 152 | 152 | }else if( (flags & C_CONFLICT) && isChnged && !isLink |
| 153 | 153 | && file_contains_merge_marker(zFullName) ){ |
| 154 | 154 | zClass = "CONFLICT"; |
| 155 | - }else if( (flags & C_EDITED) && isChnged ){ | |
| 155 | + }else if( (flags & (C_EDITED | C_CHANGED)) && (isChnged<2 || isChnged>9) ){ | |
| 156 | 156 | zClass = "EDITED"; |
| 157 | 157 | }else if( (flags & C_RENAMED) && isRenamed ){ |
| 158 | 158 | zClass = "RENAMED"; |
| 159 | 159 | }else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew |
| 160 | 160 | && !isChnged && !isRenamed ){ |
| @@ -296,10 +296,18 @@ | ||
| 296 | 296 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 297 | 297 | ** same is true of --classify and --no-classify. |
| 298 | 298 | ** |
| 299 | 299 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 300 | 300 | ** |
| 301 | +** --edited and --updated produce disjoint sets. --updated shows a file | |
| 302 | +** only when it is identical to that of its merge contributor, and the | |
| 303 | +** change type classification is UPDATED_BY_MERGE or UPDATED_BY_INTEGRATE. | |
| 304 | +** If the file had to be merged with any other changes, it is considered | |
| 305 | +** to be merged or conflicted and therefore will be shown by --edited, not | |
| 306 | +** --updated, with types EDITED or CONFLICT. The --changed option can be | |
| 307 | +** used to display the union of --edited and --updated. | |
| 308 | +** | |
| 301 | 309 | ** General options: |
| 302 | 310 | ** --abs-paths Display absolute pathnames. |
| 303 | 311 | ** --rel-paths Display pathnames relative to the current working |
| 304 | 312 | ** directory. |
| 305 | 313 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| @@ -371,24 +379,15 @@ | ||
| 371 | 379 | |
| 372 | 380 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 373 | 381 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 374 | 382 | * number masked by one less than itself is zero, it's either zero or a power |
| 375 | 383 | * of two. It's already known to not be zero because of the above defaults. |
| 376 | - * Unlike --all, at this point in the code, --changed is treated as a single | |
| 377 | - * filter, i.e. it only sets one bit. If masking flags against itself less | |
| 378 | - * one and C_FILTER yields nonzero, it has more than one C_FILTER bit set, so | |
| 379 | - * classification should be turned on. */ | |
| 384 | + * Unlike --all, --changed is a single filter, i.e. it sets only one bit. */ | |
| 380 | 385 | if( flags & (flags-1) & C_FILTER ){ |
| 381 | 386 | flags |= C_CLASSIFY; |
| 382 | 387 | } |
| 383 | 388 | |
| 384 | - /* Now that the --classify default is decided, convert --changed to be | |
| 385 | - * --edited plus --updated. */ | |
| 386 | - if( flags & C_CHANGED ){ | |
| 387 | - flags = (flags | C_EDITED | C_UPDATED) & ~C_CHANGED; | |
| 388 | - } | |
| 389 | - | |
| 390 | 389 | /* Negative flag options override defaults applied above. */ |
| 391 | 390 | for( i=0; i<count(noFlagDefs); ++i ){ |
| 392 | 391 | if( find_option(noFlagDefs[i].option, 0, 0) ){ |
| 393 | 392 | flags &= ~noFlagDefs[i].mask; |
| 394 | 393 | } |
| 395 | 394 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | CB_COMMENT, |
| 34 | |
| 35 | /* Bitmask values. */ |
| 36 | C_EDITED = 1 << CB_EDITED, /* Edited, merged, and conflicted files. */ |
| 37 | C_UPDATED = 1 << CB_UPDATED, /* Files updated by merge/integrate. */ |
| 38 | C_CHANGED = 1 << CB_CHANGED, /* Becomes CB_EDITED|CB_UPDATED. */ |
| 39 | C_MISSING = 1 << CB_MISSING, /* Missing and non- files. */ |
| 40 | C_ADDED = 1 << CB_ADDED, /* Added files. */ |
| 41 | C_DELETED = 1 << CB_DELETED, /* Deleted files. */ |
| 42 | C_RENAMED = 1 << CB_RENAMED, /* Renamed files. */ |
| 43 | C_CONFLICT = 1 << CB_CONFLICT, /* Files having merge conflicts. */ |
| @@ -46,11 +46,11 @@ | |
| 46 | C_EXTRA = 1 << CB_EXTRA, /* Unmanaged files. */ |
| 47 | C_MERGE = 1 << CB_MERGE, /* Merge contributors. */ |
| 48 | C_FILTER = C_EDITED | C_UPDATED | C_CHANGED | C_MISSING | C_ADDED |
| 49 | | C_DELETED | C_RENAMED | C_CONFLICT | C_META | C_UNMODIFIED |
| 50 | | C_EXTRA | C_MERGE, |
| 51 | C_ALL = C_FILTER & ~(C_CHANGED | C_EXTRA | C_MERGE), |
| 52 | C_RELPATH = 1 << CB_RELPATH, /* Show relative paths. */ |
| 53 | C_SHA1SUM = 1 << CB_SHA1SUM, /* Use SHA1 checksums not mtimes. */ |
| 54 | C_HEADER = 1 << CB_HEADER, /* Display repository name if non-empty. */ |
| 55 | C_VERBOSE = 1 << CB_VERBOSE, /* Display "(none)" if empty. */ |
| 56 | C_CLASSIFY = 1 << CB_CLASSIFY, /* Show file change types. */ |
| @@ -131,15 +131,15 @@ | |
| 131 | nErr++; |
| 132 | } |
| 133 | } |
| 134 | }else if( (flags & C_ADDED) && isNew ){ |
| 135 | zClass = "ADDED"; |
| 136 | }else if( (flags & C_UPDATED) && isChnged==2 ){ |
| 137 | zClass = "UPDATED_BY_MERGE"; |
| 138 | }else if( (flags & C_ADDED) && isChnged==3 ){ |
| 139 | zClass = "ADDED_BY_MERGE"; |
| 140 | }else if( (flags & C_UPDATED) && isChnged==4 ){ |
| 141 | zClass = "UPDATED_BY_INTEGRATE"; |
| 142 | }else if( (flags & C_ADDED) && isChnged==5 ){ |
| 143 | zClass = "ADDED_BY_INTEGRATE"; |
| 144 | }else if( (flags & C_META) && isChnged==6 ){ |
| 145 | zClass = "EXECUTABLE"; |
| @@ -150,11 +150,11 @@ | |
| 150 | }else if( (flags & C_META) && isChnged==9 ){ |
| 151 | zClass = "UNLINK"; |
| 152 | }else if( (flags & C_CONFLICT) && isChnged && !isLink |
| 153 | && file_contains_merge_marker(zFullName) ){ |
| 154 | zClass = "CONFLICT"; |
| 155 | }else if( (flags & C_EDITED) && isChnged ){ |
| 156 | zClass = "EDITED"; |
| 157 | }else if( (flags & C_RENAMED) && isRenamed ){ |
| 158 | zClass = "RENAMED"; |
| 159 | }else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew |
| 160 | && !isChnged && !isRenamed ){ |
| @@ -296,10 +296,18 @@ | |
| 296 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 297 | ** same is true of --classify and --no-classify. |
| 298 | ** |
| 299 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 300 | ** |
| 301 | ** General options: |
| 302 | ** --abs-paths Display absolute pathnames. |
| 303 | ** --rel-paths Display pathnames relative to the current working |
| 304 | ** directory. |
| 305 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| @@ -371,24 +379,15 @@ | |
| 371 | |
| 372 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 373 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 374 | * number masked by one less than itself is zero, it's either zero or a power |
| 375 | * of two. It's already known to not be zero because of the above defaults. |
| 376 | * Unlike --all, at this point in the code, --changed is treated as a single |
| 377 | * filter, i.e. it only sets one bit. If masking flags against itself less |
| 378 | * one and C_FILTER yields nonzero, it has more than one C_FILTER bit set, so |
| 379 | * classification should be turned on. */ |
| 380 | if( flags & (flags-1) & C_FILTER ){ |
| 381 | flags |= C_CLASSIFY; |
| 382 | } |
| 383 | |
| 384 | /* Now that the --classify default is decided, convert --changed to be |
| 385 | * --edited plus --updated. */ |
| 386 | if( flags & C_CHANGED ){ |
| 387 | flags = (flags | C_EDITED | C_UPDATED) & ~C_CHANGED; |
| 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 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -33,11 +33,11 @@ | |
| 33 | CB_COMMENT, |
| 34 | |
| 35 | /* Bitmask values. */ |
| 36 | C_EDITED = 1 << CB_EDITED, /* Edited, merged, and conflicted files. */ |
| 37 | C_UPDATED = 1 << CB_UPDATED, /* Files updated by merge/integrate. */ |
| 38 | C_CHANGED = 1 << CB_CHANGED, /* Treated the same as the above two. */ |
| 39 | C_MISSING = 1 << CB_MISSING, /* Missing and non- files. */ |
| 40 | C_ADDED = 1 << CB_ADDED, /* Added files. */ |
| 41 | C_DELETED = 1 << CB_DELETED, /* Deleted files. */ |
| 42 | C_RENAMED = 1 << CB_RENAMED, /* Renamed files. */ |
| 43 | C_CONFLICT = 1 << CB_CONFLICT, /* Files having merge conflicts. */ |
| @@ -46,11 +46,11 @@ | |
| 46 | C_EXTRA = 1 << CB_EXTRA, /* Unmanaged files. */ |
| 47 | C_MERGE = 1 << CB_MERGE, /* Merge contributors. */ |
| 48 | C_FILTER = C_EDITED | C_UPDATED | C_CHANGED | C_MISSING | C_ADDED |
| 49 | | C_DELETED | C_RENAMED | C_CONFLICT | C_META | C_UNMODIFIED |
| 50 | | C_EXTRA | C_MERGE, |
| 51 | C_ALL = C_FILTER & ~(C_EXTRA | C_MERGE), |
| 52 | C_RELPATH = 1 << CB_RELPATH, /* Show relative paths. */ |
| 53 | C_SHA1SUM = 1 << CB_SHA1SUM, /* Use SHA1 checksums not mtimes. */ |
| 54 | C_HEADER = 1 << CB_HEADER, /* Display repository name if non-empty. */ |
| 55 | C_VERBOSE = 1 << CB_VERBOSE, /* Display "(none)" if empty. */ |
| 56 | C_CLASSIFY = 1 << CB_CLASSIFY, /* Show file change types. */ |
| @@ -131,15 +131,15 @@ | |
| 131 | nErr++; |
| 132 | } |
| 133 | } |
| 134 | }else if( (flags & C_ADDED) && isNew ){ |
| 135 | zClass = "ADDED"; |
| 136 | }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==2 ){ |
| 137 | zClass = "UPDATED_BY_MERGE"; |
| 138 | }else if( (flags & C_ADDED) && isChnged==3 ){ |
| 139 | zClass = "ADDED_BY_MERGE"; |
| 140 | }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==4 ){ |
| 141 | zClass = "UPDATED_BY_INTEGRATE"; |
| 142 | }else if( (flags & C_ADDED) && isChnged==5 ){ |
| 143 | zClass = "ADDED_BY_INTEGRATE"; |
| 144 | }else if( (flags & C_META) && isChnged==6 ){ |
| 145 | zClass = "EXECUTABLE"; |
| @@ -150,11 +150,11 @@ | |
| 150 | }else if( (flags & C_META) && isChnged==9 ){ |
| 151 | zClass = "UNLINK"; |
| 152 | }else if( (flags & C_CONFLICT) && isChnged && !isLink |
| 153 | && file_contains_merge_marker(zFullName) ){ |
| 154 | zClass = "CONFLICT"; |
| 155 | }else if( (flags & (C_EDITED | C_CHANGED)) && (isChnged<2 || isChnged>9) ){ |
| 156 | zClass = "EDITED"; |
| 157 | }else if( (flags & C_RENAMED) && isRenamed ){ |
| 158 | zClass = "RENAMED"; |
| 159 | }else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew |
| 160 | && !isChnged && !isRenamed ){ |
| @@ -296,10 +296,18 @@ | |
| 296 | ** If both --merge and --no-merge are used, --no-merge has priority. The |
| 297 | ** same is true of --classify and --no-classify. |
| 298 | ** |
| 299 | ** The "fossil changes --extra" command is equivalent to "fossil extras". |
| 300 | ** |
| 301 | ** --edited and --updated produce disjoint sets. --updated shows a file |
| 302 | ** only when it is identical to that of its merge contributor, and the |
| 303 | ** change type classification is UPDATED_BY_MERGE or UPDATED_BY_INTEGRATE. |
| 304 | ** If the file had to be merged with any other changes, it is considered |
| 305 | ** to be merged or conflicted and therefore will be shown by --edited, not |
| 306 | ** --updated, with types EDITED or CONFLICT. The --changed option can be |
| 307 | ** used to display the union of --edited and --updated. |
| 308 | ** |
| 309 | ** General options: |
| 310 | ** --abs-paths Display absolute pathnames. |
| 311 | ** --rel-paths Display pathnames relative to the current working |
| 312 | ** directory. |
| 313 | ** --sha1sum Verify file status using SHA1 hashing rather than |
| @@ -371,24 +379,15 @@ | |
| 379 | |
| 380 | /* If more than one filter is enabled, enable classification. This is tricky. |
| 381 | * Having one filter means flags masked by C_FILTER is a power of two. If a |
| 382 | * number masked by one less than itself is zero, it's either zero or a power |
| 383 | * of two. It's already known to not be zero because of the above defaults. |
| 384 | * Unlike --all, --changed is a single filter, i.e. it sets only one bit. */ |
| 385 | if( flags & (flags-1) & C_FILTER ){ |
| 386 | flags |= C_CLASSIFY; |
| 387 | } |
| 388 | |
| 389 | /* Negative flag options override defaults applied above. */ |
| 390 | for( i=0; i<count(noFlagDefs); ++i ){ |
| 391 | if( find_option(noFlagDefs[i].option, 0, 0) ){ |
| 392 | flags &= ~noFlagDefs[i].mask; |
| 393 | } |
| 394 |