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.

andygoth 2016-11-05 22:40 UTC andygoth-changes
Commit 2408fd1c2cb56cdf618bb3a5d8a534df611cf7ed
1 file changed +14 -15
+14 -15
--- src/checkin.c
+++ src/checkin.c
@@ -33,11 +33,11 @@
3333
CB_COMMENT,
3434
3535
/* Bitmask values. */
3636
C_EDITED = 1 << CB_EDITED, /* Edited, merged, and conflicted files. */
3737
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. */
3939
C_MISSING = 1 << CB_MISSING, /* Missing and non- files. */
4040
C_ADDED = 1 << CB_ADDED, /* Added files. */
4141
C_DELETED = 1 << CB_DELETED, /* Deleted files. */
4242
C_RENAMED = 1 << CB_RENAMED, /* Renamed files. */
4343
C_CONFLICT = 1 << CB_CONFLICT, /* Files having merge conflicts. */
@@ -46,11 +46,11 @@
4646
C_EXTRA = 1 << CB_EXTRA, /* Unmanaged files. */
4747
C_MERGE = 1 << CB_MERGE, /* Merge contributors. */
4848
C_FILTER = C_EDITED | C_UPDATED | C_CHANGED | C_MISSING | C_ADDED
4949
| C_DELETED | C_RENAMED | C_CONFLICT | C_META | C_UNMODIFIED
5050
| C_EXTRA | C_MERGE,
51
- C_ALL = C_FILTER & ~(C_CHANGED | C_EXTRA | C_MERGE),
51
+ C_ALL = C_FILTER & ~(C_EXTRA | C_MERGE),
5252
C_RELPATH = 1 << CB_RELPATH, /* Show relative paths. */
5353
C_SHA1SUM = 1 << CB_SHA1SUM, /* Use SHA1 checksums not mtimes. */
5454
C_HEADER = 1 << CB_HEADER, /* Display repository name if non-empty. */
5555
C_VERBOSE = 1 << CB_VERBOSE, /* Display "(none)" if empty. */
5656
C_CLASSIFY = 1 << CB_CLASSIFY, /* Show file change types. */
@@ -131,15 +131,15 @@
131131
nErr++;
132132
}
133133
}
134134
}else if( (flags & C_ADDED) && isNew ){
135135
zClass = "ADDED";
136
- }else if( (flags & C_UPDATED) && isChnged==2 ){
136
+ }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==2 ){
137137
zClass = "UPDATED_BY_MERGE";
138138
}else if( (flags & C_ADDED) && isChnged==3 ){
139139
zClass = "ADDED_BY_MERGE";
140
- }else if( (flags & C_UPDATED) && isChnged==4 ){
140
+ }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==4 ){
141141
zClass = "UPDATED_BY_INTEGRATE";
142142
}else if( (flags & C_ADDED) && isChnged==5 ){
143143
zClass = "ADDED_BY_INTEGRATE";
144144
}else if( (flags & C_META) && isChnged==6 ){
145145
zClass = "EXECUTABLE";
@@ -150,11 +150,11 @@
150150
}else if( (flags & C_META) && isChnged==9 ){
151151
zClass = "UNLINK";
152152
}else if( (flags & C_CONFLICT) && isChnged && !isLink
153153
&& file_contains_merge_marker(zFullName) ){
154154
zClass = "CONFLICT";
155
- }else if( (flags & C_EDITED) && isChnged ){
155
+ }else if( (flags & (C_EDITED | C_CHANGED)) && (isChnged<2 || isChnged>9) ){
156156
zClass = "EDITED";
157157
}else if( (flags & C_RENAMED) && isRenamed ){
158158
zClass = "RENAMED";
159159
}else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew
160160
&& !isChnged && !isRenamed ){
@@ -296,10 +296,18 @@
296296
** If both --merge and --no-merge are used, --no-merge has priority. The
297297
** same is true of --classify and --no-classify.
298298
**
299299
** The "fossil changes --extra" command is equivalent to "fossil extras".
300300
**
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
+**
301309
** General options:
302310
** --abs-paths Display absolute pathnames.
303311
** --rel-paths Display pathnames relative to the current working
304312
** directory.
305313
** --sha1sum Verify file status using SHA1 hashing rather than
@@ -371,24 +379,15 @@
371379
372380
/* If more than one filter is enabled, enable classification. This is tricky.
373381
* Having one filter means flags masked by C_FILTER is a power of two. If a
374382
* number masked by one less than itself is zero, it's either zero or a power
375383
* 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. */
380385
if( flags & (flags-1) & C_FILTER ){
381386
flags |= C_CLASSIFY;
382387
}
383388
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
-
390389
/* Negative flag options override defaults applied above. */
391390
for( i=0; i<count(noFlagDefs); ++i ){
392391
if( find_option(noFlagDefs[i].option, 0, 0) ){
393392
flags &= ~noFlagDefs[i].mask;
394393
}
395394
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button