Fossil

Check-in [5775d376]
Login

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

Overview
Comment:Change -unmodified/UNMODIFIED to -unchanged/UNCHANGED in status_report() for consistency with the ls -v command
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | andygoth-changes
Files: files | file ages | folders
SHA1: 5775d3761f5180c1b582fc2ea416be42059efaab
User & Date: andygoth 2016-11-06 04:17:15.366
Context
2016-11-06
04:23
Remove stale TODO comment. May still want to implement ls in terms of status_report() though. ... (check-in: bfb7dd2a user: andygoth tags: andygoth-changes)
04:17
Change -unmodified/UNMODIFIED to -unchanged/UNCHANGED in status_report() for consistency with the ls -v command ... (check-in: 5775d376 user: andygoth tags: andygoth-changes)
04:13
Minor optimization to status_report() to avoid building list of managed files if only unmanaged files are requested. Move unmanaged file reserved name filtering to status_report(). Ensure db_get*() calls happen after db_must_be_within_tree(). Implement extras_cmd() in terms of status_report(). ... (check-in: d52fd185 user: andygoth tags: andygoth-changes)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
23
24
25
26
27
28
29
30
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
59
60
#include <assert.h>

/*
** Change filter options.
*/
enum {
  /* Zero-based bit indexes. */
  CB_EDITED , CB_UPDATED , CB_CHANGED, CB_MISSING   , CB_ADDED, CB_DELETED,
  CB_RENAMED, CB_CONFLICT, CB_META   , CB_UNMODIFIED, CB_EXTRA, CB_MERGE  ,
  CB_RELPATH, 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_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. */
  C_COMMENT    = 1 << CB_COMMENT,   /* Precede each line with "# ". */
};

/*
** Create a TEMP table named SFILE and add all unmanaged files named on
** the command-line to that table.  If directories are named, then add







|
|
|











|



|




|







23
24
25
26
27
28
29
30
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
59
60
#include <assert.h>

/*
** Change filter options.
*/
enum {
  /* Zero-based bit indexes. */
  CB_EDITED , CB_UPDATED , CB_CHANGED, CB_MISSING  , CB_ADDED, CB_DELETED,
  CB_RENAMED, CB_CONFLICT, CB_META   , CB_UNCHANGED, CB_EXTRA, CB_MERGE  ,
  CB_RELPATH, 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_UNCHANGED  = 1 << CB_UNCHANGED, /* Unchanged 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_UNCHANGED
               | C_EXTRA   | C_MERGE,
  C_ALL        = C_FILTER & ~(C_EXTRA | C_MERGE),
  C_RELPATH    = 1 << CB_RELPATH,   /* Show relative paths. */
  C_CLASSIFY   = 1 << CB_CLASSIFY,  /* Show file change types. */
  C_DEFAULT    = (C_ALL & ~C_UNCHANGED) | C_MERGE | C_CLASSIFY,
  C_FATAL      = (1 << CB_FATAL) | C_MISSING, /* Fail on MISSING/NOT_A_FILE. */
  C_COMMENT    = 1 << CB_COMMENT,   /* Precede each line with "# ". */
};

/*
** Create a TEMP table named SFILE and add all unmanaged files named on
** the command-line to that table.  If directories are named, then add
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    /* Start with a list of all managed files. */
    blob_append_sql(&sql,
      "SELECT pathname, deleted, chnged, rid,"
      "       coalesce(origname!=pathname,0) AS renamed, islink, 1 AS managed"
      "  FROM vfile"
      " WHERE is_selected(id)%s", blob_sql_text(&where));

    /* Exclude unmodified files unless requested. */
    if( !(flags & C_UNMODIFIED) ){
      blob_append_sql(&sql,
          " AND (chnged OR deleted OR rid=0 OR pathname!=origname)");
    }
  }

  /* If C_EXTRA, add unmanaged files to the query result too. */
  if( flags & C_EXTRA ){







|
|







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
    /* Start with a list of all managed files. */
    blob_append_sql(&sql,
      "SELECT pathname, deleted, chnged, rid,"
      "       coalesce(origname!=pathname,0) AS renamed, islink, 1 AS managed"
      "  FROM vfile"
      " WHERE is_selected(id)%s", blob_sql_text(&where));

    /* Exclude unchanged files unless requested. */
    if( !(flags & C_UNCHANGED) ){
      blob_append_sql(&sql,
          " AND (chnged OR deleted OR rid=0 OR pathname!=origname)");
    }
  }

  /* If C_EXTRA, add unmanaged files to the query result too. */
  if( flags & C_EXTRA ){
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
           && file_contains_merge_marker(zFullName) ){
      zClass = "CONFLICT";
    }else if( (flags & (C_EDITED | C_CHANGED)) && isChnged
           && (isChnged<2 || isChnged>9) ){
      zClass = "EDITED";
    }else if( (flags & C_RENAMED) && isRenamed ){
      zClass = "RENAMED";
    }else if( (flags & C_UNMODIFIED) && isManaged && !isDeleted && !isMissing
                                     && !isNew    && !isChnged  && !isRenamed ){
      zClass = "UNMODIFIED";
    }else if( (flags & C_EXTRA) && !isManaged ){
      zClass = "EXTRA";
    }
    /* TODO: reimplement ls and extras in terms of this function. */

    /* Only report files for which a change classification was determined. */
    if( zClass ){







|
|
|







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
           && file_contains_merge_marker(zFullName) ){
      zClass = "CONFLICT";
    }else if( (flags & (C_EDITED | C_CHANGED)) && isChnged
           && (isChnged<2 || isChnged>9) ){
      zClass = "EDITED";
    }else if( (flags & C_RENAMED) && isRenamed ){
      zClass = "RENAMED";
    }else if( (flags & C_UNCHANGED) && isManaged && !isDeleted && !isMissing
                                    && !isNew    && !isChnged  && !isRenamed ){
      zClass = "UNCHANGED";
    }else if( (flags & C_EXTRA) && !isManaged ){
      zClass = "EXTRA";
    }
    /* TODO: reimplement ls and extras in terms of this function. */

    /* Only report files for which a change classification was determined. */
    if( zClass ){
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
**    --changed         Combination of the above two options.
**    --missing         Display missing files.
**    --added           Display added files.
**    --deleted         Display deleted files.
**    --renamed         Display renamed files.
**    --conflict        Display files having merge conflicts.
**    --meta            Display files with metadata changes.
**    --unmodified      Display unmodified files.
**    --all             Display all managed files, i.e. all of the above.
**    --extra           Display unmanaged files.
**    --merge           Display merge contributors.
**    --no-merge        Do not display merge contributors.
**
** See also: extras, ls
*/
void status_cmd(void){
  /* Affirmative and negative flag option tables. */
  static const struct {
    const char *option;
    unsigned mask;
    int changesOnly;
  } flagDefs[] = {
    {"edited"  , C_EDITED , 0}, {"updated"    , C_UPDATED   , 0},
    {"changed" , C_CHANGED, 0}, {"missing"    , C_MISSING   , 0},
    {"added"   , C_ADDED  , 0}, {"deleted"    , C_DELETED   , 0},
    {"renamed" , C_RENAMED, 0}, {"conflict"   , C_CONFLICT  , 0},
    {"meta"    , C_META   , 0}, {"unmodified" , C_UNMODIFIED, 0},
    {"all"     , C_ALL    , 0}, {"extra"      , C_EXTRA     , 0},
    {"merge"   , C_MERGE  , 0}, {"classify"   , C_CLASSIFY  , 1},
  }, noFlagDefs[] = {
    {"no-merge", C_MERGE  , 0}, {"no-classify", C_CLASSIFY  , 1},
  };

  Blob report = BLOB_INITIALIZER;







|


















|







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
**    --changed         Combination of the above two options.
**    --missing         Display missing files.
**    --added           Display added files.
**    --deleted         Display deleted files.
**    --renamed         Display renamed files.
**    --conflict        Display files having merge conflicts.
**    --meta            Display files with metadata changes.
**    --unchanged       Display unchanged files.
**    --all             Display all managed files, i.e. all of the above.
**    --extra           Display unmanaged files.
**    --merge           Display merge contributors.
**    --no-merge        Do not display merge contributors.
**
** See also: extras, ls
*/
void status_cmd(void){
  /* Affirmative and negative flag option tables. */
  static const struct {
    const char *option;
    unsigned mask;
    int changesOnly;
  } flagDefs[] = {
    {"edited"  , C_EDITED , 0}, {"updated"    , C_UPDATED   , 0},
    {"changed" , C_CHANGED, 0}, {"missing"    , C_MISSING   , 0},
    {"added"   , C_ADDED  , 0}, {"deleted"    , C_DELETED   , 0},
    {"renamed" , C_RENAMED, 0}, {"conflict"   , C_CONFLICT  , 0},
    {"meta"    , C_META   , 0}, {"unchanged"  , C_UNCHANGED , 0},
    {"all"     , C_ALL    , 0}, {"extra"      , C_EXTRA     , 0},
    {"merge"   , C_MERGE  , 0}, {"classify"   , C_CLASSIFY  , 1},
  }, noFlagDefs[] = {
    {"no-merge", C_MERGE  , 0}, {"no-classify", C_CLASSIFY  , 1},
  };

  Blob report = BLOB_INITIALIZER;