Changes On Branch ben-changes-report
Not logged in

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

Changes In Branch ben-changes-report Excluding Merge-Ins

This is equivalent to a diff from 35ecc92b69 to 5de11ac6be

2011-07-20
08:37
Merge working directory relative file listings for changes and extras commands into ben-testing. check-in: 8320393b2f user: ben tags: ben-testing
08:34
Add help text to status command about --non-relative option. Closed-Leaf check-in: 5de11ac6be user: ben tags: ben-changes-report
2011-07-12
20:27
Be sure to flush g.httpOut at the end of cgi_reply(). check-in: 2cd0c7657f user: drh tags: trunk
2011-07-11
10:00
By default, the extras command lists all the uncontrolled files relative to the current working directory, unless the --non-relative option is used. check-in: b9a38cf367 user: ben tags: ben-changes-report
2011-07-10
13:01
When running the changes or status command from inside a sub-directory of the check out, only show the changes in or below the current directory unless the --show-all option is used. check-in: e0d2e1f9b8 user: ben tags: ben-changes-report
12:05
Don't show the cookie values on the test_env page, unless the fossil executable was built with FOSSIL_DEBUG. check-in: 35ecc92b69 user: ben tags: trunk
2011-07-09
16:12
Added ability to access repositories via CGI that are located in a path containing whitespaces. check-in: fc15fe0418 user: rimkojr tags: trunk

Changes to src/checkin.c.

    30     30   **
    31     31   ** If missingIsFatal is true, then any files that are missing or which
    32     32   ** are not true files results in a fatal error.
    33     33   */
    34     34   static void status_report(
    35     35     Blob *report,          /* Append the status report here */
    36     36     const char *zPrefix,   /* Prefix on each line of the report */
    37         -  int missingIsFatal     /* MISSING and NOT_A_FILE are fatal errors */
           37  +  int missingIsFatal,    /* MISSING and NOT_A_FILE are fatal errors */
           38  +  int cwdRelative        /* Report relative to the current working dir */ 
    38     39   ){
    39     40     Stmt q;
    40     41     int nPrefix = strlen(zPrefix);
    41     42     int nErr = 0;
           43  +  Blob rewrittenPathname;
    42     44     db_prepare(&q, 
    43     45       "SELECT pathname, deleted, chnged, rid, coalesce(origname!=pathname,0)"
    44     46       "  FROM vfile "
    45     47       " WHERE file_is_selected(id)"
    46     48       "   AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
    47     49     );
           50  +  blob_zero(&rewrittenPathname);
    48     51     while( db_step(&q)==SQLITE_ROW ){
    49     52       const char *zPathname = db_column_text(&q,0);
           53  +    const char *zDisplayName = zPathname;
    50     54       int isDeleted = db_column_int(&q, 1);
    51     55       int isChnged = db_column_int(&q,2);
    52     56       int isNew = db_column_int(&q,3)==0;
    53     57       int isRenamed = db_column_int(&q,4);
    54     58       char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
           59  +    if( cwdRelative ){
           60  +      file_relative_name(zFullName, &rewrittenPathname);
           61  +      zDisplayName = blob_str(&rewrittenPathname);
           62  +      if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
           63  +        zDisplayName += 2;  /* no unnecessary ./ prefix */
           64  +      }
           65  +    }
    55     66       blob_append(report, zPrefix, nPrefix);
    56     67       if( isDeleted ){
    57         -      blob_appendf(report, "DELETED    %s\n", zPathname);
           68  +      blob_appendf(report, "DELETED    %s\n", zDisplayName);
    58     69       }else if( !file_isfile(zFullName) ){
    59     70         if( file_access(zFullName, 0)==0 ){
    60         -        blob_appendf(report, "NOT_A_FILE %s\n", zPathname);
           71  +        blob_appendf(report, "NOT_A_FILE %s\n", zDisplayName);
    61     72           if( missingIsFatal ){
    62         -          fossil_warning("not a file: %s", zPathname);
           73  +          fossil_warning("not a file: %s", zDisplayName);
    63     74             nErr++;
    64     75           }
    65     76         }else{
    66         -        blob_appendf(report, "MISSING    %s\n", zPathname);
           77  +        blob_appendf(report, "MISSING    %s\n", zDisplayName);
    67     78           if( missingIsFatal ){
    68         -          fossil_warning("missing file: %s", zPathname);
           79  +          fossil_warning("missing file: %s", zDisplayName);
    69     80             nErr++;
    70     81           }
    71     82         }
    72     83       }else if( isNew ){
    73         -      blob_appendf(report, "ADDED      %s\n", zPathname);
           84  +      blob_appendf(report, "ADDED      %s\n", zDisplayName);
    74     85       }else if( isDeleted ){
    75         -      blob_appendf(report, "DELETED    %s\n", zPathname);
           86  +      blob_appendf(report, "DELETED    %s\n", zDisplayName);
    76     87       }else if( isChnged==2 ){
    77         -      blob_appendf(report, "UPDATED_BY_MERGE %s\n", zPathname);
           88  +      blob_appendf(report, "UPDATED_BY_MERGE %s\n", zDisplayName);
    78     89       }else if( isChnged==3 ){
    79         -      blob_appendf(report, "ADDED_BY_MERGE %s\n", zPathname);
           90  +      blob_appendf(report, "ADDED_BY_MERGE %s\n", zDisplayName);
    80     91       }else if( isChnged==1 ){
    81         -      blob_appendf(report, "EDITED     %s\n", zPathname);
           92  +      blob_appendf(report, "EDITED     %s\n", zDisplayName);
    82     93       }else if( isRenamed ){
    83         -      blob_appendf(report, "RENAMED    %s\n", zPathname);
           94  +      blob_appendf(report, "RENAMED    %s\n", zDisplayName);
    84     95       }
    85     96       free(zFullName);
    86     97     }
           98  +  blob_reset(&rewrittenPathname);
    87     99     db_finalize(&q);
    88    100     db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
    89    101                    " WHERE id=0");
    90    102     while( db_step(&q)==SQLITE_ROW ){
    91    103       blob_append(report, zPrefix, nPrefix);
    92    104       blob_appendf(report, "MERGED_WITH %s\n", db_column_text(&q, 0));
    93    105     }
................................................................................
   105    117   ** Report on the edit status of all files in the current checkout.
   106    118   ** See also the "status" and "extra" commands.
   107    119   **
   108    120   ** Options:
   109    121   **
   110    122   **    --sha1sum         Verify file status using SHA1 hashing rather
   111    123   **                      than relying on file mtimes.
          124  +**
          125  +**    --non-relative    Don't display filenames relative to the current
          126  +**                      working directory.
   112    127   */
   113    128   void changes_cmd(void){
   114    129     Blob report;
   115    130     int vid;
   116    131     int useSha1sum = find_option("sha1sum", 0, 0)!=0;
          132  +  int nonRelative = find_option("non-relative", 0, 0)!=0;
   117    133     db_must_be_within_tree();
   118    134     blob_zero(&report);
   119    135     vid = db_lget_int("checkout", 0);
   120    136     vfile_check_signature(vid, 0, useSha1sum);
   121         -  status_report(&report, "", 0);
          137  +  status_report(&report, "", 0, !nonRelative);
   122    138     blob_write_to_file(&report, "-");
   123    139   }
   124    140   
   125    141   /*
   126    142   ** COMMAND: status
   127    143   **
   128    144   ** Usage: %fossil status
................................................................................
   129    145   **
   130    146   ** Report on the status of the current checkout.
   131    147   **
   132    148   ** Options:
   133    149   **
   134    150   **    --sha1sum         Verify file status using SHA1 hashing rather
   135    151   **                      than relying on file mtimes.
          152  +**
          153  +**    --non-relative    Don't display filenames relative to the current
          154  +**                      working directory.
   136    155   */
   137    156   void status_cmd(void){
   138    157     int vid;
   139    158     db_must_be_within_tree();
   140    159          /* 012345678901234 */
   141    160     fossil_print("repository:   %s\n", db_lget("repository",""));
   142    161     fossil_print("local-root:   %s\n", g.zLocalRoot);
................................................................................
   210    229   **
   211    230   ** Files and subdirectories whose names begin with "." are normally
   212    231   ** ignored but can be included by adding the --dotfiles option.
   213    232   **
   214    233   ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
   215    234   ** files that are ignored.  The GLOBPATTERN specified by the "ignore-glob"
   216    235   ** is used if the --ignore option is omitted.
          236  +**
          237  +** Filenames are displayed relative to the current working directory
          238  +** unless the --non-relative option is used.
   217    239   */
   218    240   void extra_cmd(void){
   219    241     Blob path;
   220    242     Blob repo;
   221    243     Stmt q;
   222    244     int n;
   223    245     const char *zIgnoreFlag = find_option("ignore",0,1);
   224    246     int allFlag = find_option("dotfiles",0,0)!=0;
          247  +  int cwdRelative = !(find_option("non-relative", 0, 0)!=0);
   225    248     int outputManifest;
   226    249     Glob *pIgnore;
          250  +  Blob rewrittenPathname;
          251  +  const char *zPathname, *zDisplayName;
   227    252   
   228    253     db_must_be_within_tree();
   229    254     outputManifest = db_get_boolean("manifest",0);
   230    255     db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
   231    256     n = strlen(g.zLocalRoot);
   232    257     blob_init(&path, g.zLocalRoot, n-1);
   233    258     if( zIgnoreFlag==0 ){
................................................................................
   241    266         " WHERE x NOT IN (%s)"
   242    267         " ORDER BY 1",
   243    268         fossil_all_reserved_names()
   244    269     );
   245    270     if( file_tree_name(g.zRepositoryName, &repo, 0) ){
   246    271       db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
   247    272     }
          273  +  blob_zero(&rewrittenPathname);
   248    274     while( db_step(&q)==SQLITE_ROW ){
   249         -    fossil_print("%s\n", db_column_text(&q, 0));
          275  +    zDisplayName = zPathname = db_column_text(&q, 0);
          276  +    if( cwdRelative ) {
          277  +      char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
          278  +      file_relative_name(zFullName, &rewrittenPathname);
          279  +      free(zFullName);
          280  +      zDisplayName = blob_str(&rewrittenPathname);
          281  +      if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
          282  +        zDisplayName += 2;  /* no unnecessary ./ prefix */
          283  +      }
          284  +    }
          285  +    fossil_print("%s\n", zDisplayName);
   250    286     }
          287  +  blob_reset(&rewrittenPathname);
   251    288     db_finalize(&q);
   252    289   }
   253    290   
   254    291   /*
   255    292   ** COMMAND: clean
   256    293   ** Usage: %fossil clean ?--force? ?--dotfiles? ?--ignore GLOBPATTERN?
   257    294   **
................................................................................
   365    402     if( g.markPrivate ){
   366    403       blob_append(&text,
   367    404         "# PRIVATE BRANCH: This check-in will be private and will not sync to\n"
   368    405         "# repositories.\n"
   369    406         "#\n", -1
   370    407       );
   371    408     }
   372         -  status_report(&text, "# ", 1);
          409  +  status_report(&text, "# ", 1, 0);
   373    410     zEditor = db_get("editor", 0);
   374    411     if( zEditor==0 ){
   375    412       zEditor = getenv("VISUAL");
   376    413     }
   377    414     if( zEditor==0 ){
   378    415       zEditor = getenv("EDITOR");
   379    416     }