Fossil

Check-in [2408fd1c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | andygoth-changes
Files: files | file ages | folders
SHA1:2408fd1c2cb56cdf618bb3a5d8a534df611cf7ed
User & Date: andygoth 2016-11-05 22:40:00
Context
2016-11-05
22:41
Add TODO: reimplement ls and extras in terms of status_report() check-in: 442a3cd5 user: andygoth tags: andygoth-changes
22:40
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. check-in: 2408fd1c user: andygoth tags: andygoth-changes
22:22
Implement most of the new changes command, still need to do --all, --unmodified, and --extra check-in: 7595bdfb user: andygoth tags: andygoth-changes
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
294
295
296
297
298
299
300








301
302
303
304
305
306
307
...
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
  CB_RENAMED, CB_CONFLICT, CB_META   , CB_UNMODIFIED, CB_EXTRA   , CB_MERGE  ,
  CB_RELPATH, CB_SHA1SUM , CB_HEADER , CB_VERBOSE   , CB_CLASSIFY, CB_FATAL  ,
  CB_COMMENT,

  /* Bitmask values. */
  C_EDITED     = 1 << CB_EDITED,    /* Edited, merged, and conflicted files. */
  C_UPDATED    = 1 << CB_UPDATED,   /* Files updated by merge/integrate. */
  C_CHANGED    = 1 << CB_CHANGED,   /* Becomes CB_EDITED|CB_UPDATED. */
  C_MISSING    = 1 << CB_MISSING,   /* Missing and non- files. */
  C_ADDED      = 1 << CB_ADDED,     /* Added files. */
  C_DELETED    = 1 << CB_DELETED,   /* Deleted files. */
  C_RENAMED    = 1 << CB_RENAMED,   /* Renamed files. */
  C_CONFLICT   = 1 << CB_CONFLICT,  /* Files having merge conflicts. */
  C_META       = 1 << CB_META,      /* Files with metadata changes. */
  C_UNMODIFIED = 1 << CB_UNMODIFIED,/* Unmodified files. */
  C_EXTRA      = 1 << CB_EXTRA,     /* Unmanaged files. */
  C_MERGE      = 1 << CB_MERGE,     /* Merge contributors. */
  C_FILTER     = C_EDITED  | C_UPDATED | C_CHANGED  | C_MISSING | C_ADDED
               | C_DELETED | C_RENAMED | C_CONFLICT | C_META    | C_UNMODIFIED
               | C_EXTRA   | C_MERGE,
  C_ALL        = C_FILTER & ~(C_CHANGED | C_EXTRA | C_MERGE),
  C_RELPATH    = 1 << CB_RELPATH,   /* Show relative paths. */
  C_SHA1SUM    = 1 << CB_SHA1SUM,   /* Use SHA1 checksums not mtimes. */
  C_HEADER     = 1 << CB_HEADER,    /* Display repository name if non-empty. */
  C_VERBOSE    = 1 << CB_VERBOSE,   /* Display "(none)" if empty. */
  C_CLASSIFY   = 1 << CB_CLASSIFY,  /* Show file change types. */
  C_DEFAULT    = (C_ALL & ~C_UNMODIFIED) | C_MERGE | C_CLASSIFY,
  C_FATAL      = (1 << CB_FATAL) | C_MISSING, /* Fail on MISSING/NOT_A_FILE. */
................................................................................
        if( flags & C_FATAL ){
          fossil_warning("missing file: %s", zFullName);
          nErr++;
        }
      }
    }else if( (flags & C_ADDED) && isNew ){
      zClass = "ADDED";
    }else if( (flags & C_UPDATED) && isChnged==2 ){
      zClass = "UPDATED_BY_MERGE";
    }else if( (flags & C_ADDED) && isChnged==3 ){
      zClass = "ADDED_BY_MERGE";
    }else if( (flags & C_UPDATED) && isChnged==4 ){
      zClass = "UPDATED_BY_INTEGRATE";
    }else if( (flags & C_ADDED) && isChnged==5 ){
      zClass = "ADDED_BY_INTEGRATE";
    }else if( (flags & C_META) && isChnged==6 ){
      zClass = "EXECUTABLE";
    }else if( (flags & C_META) && isChnged==7 ){
      zClass = "SYMLINK";
................................................................................
    }else if( (flags & C_META) && isChnged==8 ){
      zClass = "UNEXEC";
    }else if( (flags & C_META) && isChnged==9 ){
      zClass = "UNLINK";
    }else if( (flags & C_CONFLICT) && isChnged && !isLink
           && file_contains_merge_marker(zFullName) ){
      zClass = "CONFLICT";
    }else if( (flags & C_EDITED) && isChnged ){
      zClass = "EDITED";
    }else if( (flags & C_RENAMED) && isRenamed ){
      zClass = "RENAMED";
    }else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew
                                     && !isChnged  && !isRenamed ){
      /* TODO: never gets executed because query only yields modified files. */
      zClass = "UNMODIFIED";
................................................................................
** --no-classify options.
**
** If both --merge and --no-merge are used, --no-merge has priority.  The
** same is true of --classify and --no-classify.
**
** The "fossil changes --extra" command is equivalent to "fossil extras".
**








** General options:
**    --abs-paths       Display absolute pathnames.
**    --rel-paths       Display pathnames relative to the current working
**                      directory.
**    --sha1sum         Verify file status using SHA1 hashing rather than
**                      relying on file mtimes.
**    --header          Identify the repository if report is non-empty.
................................................................................
    flags |= C_DEFAULT;
  }

  /* If more than one filter is enabled, enable classification.  This is tricky.
   * Having one filter means flags masked by C_FILTER is a power of two.  If a
   * number masked by one less than itself is zero, it's either zero or a power
   * of two.  It's already known to not be zero because of the above defaults.
   * Unlike --all, at this point in the code, --changed is treated as a single
   * filter, i.e. it only sets one bit.  If masking flags against itself less
   * one and C_FILTER yields nonzero, it has more than one C_FILTER bit set, so
   * classification should be turned on. */
  if( flags & (flags-1) & C_FILTER ){
    flags |= C_CLASSIFY;
  }

  /* Now that the --classify default is decided, convert --changed to be
   * --edited plus --updated. */
  if( flags & C_CHANGED ){
    flags = (flags | C_EDITED | C_UPDATED) & ~C_CHANGED;
  }

  /* Negative flag options override defaults applied above. */
  for( i=0; i<count(noFlagDefs); ++i ){
    if( find_option(noFlagDefs[i].option, 0, 0) ){
      flags &= ~noFlagDefs[i].mask;
    }
  }








|












|







 







|



|







 







|







 







>
>
>
>
>
>
>
>







 







|
<
<
<




<
<
<
<
<
<







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
...
377
378
379
380
381
382
383
384



385
386
387
388






389
390
391
392
393
394
395
  CB_RENAMED, CB_CONFLICT, CB_META   , CB_UNMODIFIED, CB_EXTRA   , CB_MERGE  ,
  CB_RELPATH, CB_SHA1SUM , CB_HEADER , CB_VERBOSE   , CB_CLASSIFY, CB_FATAL  ,
  CB_COMMENT,

  /* Bitmask values. */
  C_EDITED     = 1 << CB_EDITED,    /* Edited, merged, and conflicted files. */
  C_UPDATED    = 1 << CB_UPDATED,   /* Files updated by merge/integrate. */
  C_CHANGED    = 1 << CB_CHANGED,   /* Treated the same as the above two. */
  C_MISSING    = 1 << CB_MISSING,   /* Missing and non- files. */
  C_ADDED      = 1 << CB_ADDED,     /* Added files. */
  C_DELETED    = 1 << CB_DELETED,   /* Deleted files. */
  C_RENAMED    = 1 << CB_RENAMED,   /* Renamed files. */
  C_CONFLICT   = 1 << CB_CONFLICT,  /* Files having merge conflicts. */
  C_META       = 1 << CB_META,      /* Files with metadata changes. */
  C_UNMODIFIED = 1 << CB_UNMODIFIED,/* Unmodified files. */
  C_EXTRA      = 1 << CB_EXTRA,     /* Unmanaged files. */
  C_MERGE      = 1 << CB_MERGE,     /* Merge contributors. */
  C_FILTER     = C_EDITED  | C_UPDATED | C_CHANGED  | C_MISSING | C_ADDED
               | C_DELETED | C_RENAMED | C_CONFLICT | C_META    | C_UNMODIFIED
               | C_EXTRA   | C_MERGE,
  C_ALL        = C_FILTER & ~(C_EXTRA | C_MERGE),
  C_RELPATH    = 1 << CB_RELPATH,   /* Show relative paths. */
  C_SHA1SUM    = 1 << CB_SHA1SUM,   /* Use SHA1 checksums not mtimes. */
  C_HEADER     = 1 << CB_HEADER,    /* Display repository name if non-empty. */
  C_VERBOSE    = 1 << CB_VERBOSE,   /* Display "(none)" if empty. */
  C_CLASSIFY   = 1 << CB_CLASSIFY,  /* Show file change types. */
  C_DEFAULT    = (C_ALL & ~C_UNMODIFIED) | C_MERGE | C_CLASSIFY,
  C_FATAL      = (1 << CB_FATAL) | C_MISSING, /* Fail on MISSING/NOT_A_FILE. */
................................................................................
        if( flags & C_FATAL ){
          fossil_warning("missing file: %s", zFullName);
          nErr++;
        }
      }
    }else if( (flags & C_ADDED) && isNew ){
      zClass = "ADDED";
    }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==2 ){
      zClass = "UPDATED_BY_MERGE";
    }else if( (flags & C_ADDED) && isChnged==3 ){
      zClass = "ADDED_BY_MERGE";
    }else if( (flags & (C_UPDATED | C_CHANGED)) && isChnged==4 ){
      zClass = "UPDATED_BY_INTEGRATE";
    }else if( (flags & C_ADDED) && isChnged==5 ){
      zClass = "ADDED_BY_INTEGRATE";
    }else if( (flags & C_META) && isChnged==6 ){
      zClass = "EXECUTABLE";
    }else if( (flags & C_META) && isChnged==7 ){
      zClass = "SYMLINK";
................................................................................
    }else if( (flags & C_META) && isChnged==8 ){
      zClass = "UNEXEC";
    }else if( (flags & C_META) && isChnged==9 ){
      zClass = "UNLINK";
    }else if( (flags & C_CONFLICT) && isChnged && !isLink
           && file_contains_merge_marker(zFullName) ){
      zClass = "CONFLICT";
    }else if( (flags & (C_EDITED | C_CHANGED)) && (isChnged<2 || isChnged>9) ){
      zClass = "EDITED";
    }else if( (flags & C_RENAMED) && isRenamed ){
      zClass = "RENAMED";
    }else if( (flags & C_UNMODIFIED) && !isDeleted && !isMissing && !isNew
                                     && !isChnged  && !isRenamed ){
      /* TODO: never gets executed because query only yields modified files. */
      zClass = "UNMODIFIED";
................................................................................
** --no-classify options.
**
** If both --merge and --no-merge are used, --no-merge has priority.  The
** same is true of --classify and --no-classify.
**
** The "fossil changes --extra" command is equivalent to "fossil extras".
**
** --edited and --updated produce disjoint sets.  --updated shows a file
** only when it is identical to that of its merge contributor, and the
** change type classification is UPDATED_BY_MERGE or UPDATED_BY_INTEGRATE.
** If the file had to be merged with any other changes, it is considered
** to be merged or conflicted and therefore will be shown by --edited, not
** --updated, with types EDITED or CONFLICT.  The --changed option can be
** used to display the union of --edited and --updated.
**
** General options:
**    --abs-paths       Display absolute pathnames.
**    --rel-paths       Display pathnames relative to the current working
**                      directory.
**    --sha1sum         Verify file status using SHA1 hashing rather than
**                      relying on file mtimes.
**    --header          Identify the repository if report is non-empty.
................................................................................
    flags |= C_DEFAULT;
  }

  /* If more than one filter is enabled, enable classification.  This is tricky.
   * Having one filter means flags masked by C_FILTER is a power of two.  If a
   * number masked by one less than itself is zero, it's either zero or a power
   * of two.  It's already known to not be zero because of the above defaults.
   * Unlike --all, --changed is a single filter, i.e. it sets only one bit. */



  if( flags & (flags-1) & C_FILTER ){
    flags |= C_CLASSIFY;
  }







  /* Negative flag options override defaults applied above. */
  for( i=0; i<count(noFlagDefs); ++i ){
    if( find_option(noFlagDefs[i].option, 0, 0) ){
      flags &= ~noFlagDefs[i].mask;
    }
  }