Fossil SCM
Change the "ls" command so that it only shows the filenames by default. To see the extra information about the status of each file, add the -l option. Ex: "fossil ls -l"
Commit
9c06ea312083459c5f73298a0eb457d8f8ee3d00
Parent
353297a149b4996…
1 file changed
+8
-3
+8
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -121,18 +121,21 @@ | ||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /* |
| 124 | 124 | ** COMMAND: ls |
| 125 | 125 | ** |
| 126 | -** Usage: %fossil ls | |
| 126 | +** Usage: %fossil ls [-l] | |
| 127 | 127 | ** |
| 128 | -** Show the names of all files in the current checkout | |
| 128 | +** Show the names of all files in the current checkout. The -l provides | |
| 129 | +** extra information about each file. | |
| 129 | 130 | */ |
| 130 | 131 | void ls_cmd(void){ |
| 131 | 132 | int vid; |
| 132 | 133 | Stmt q; |
| 134 | + int isBrief; | |
| 133 | 135 | |
| 136 | + isBrief = find_option("l","l", 0)==0; | |
| 134 | 137 | db_must_be_within_tree(); |
| 135 | 138 | vid = db_lget_int("checkout", 0); |
| 136 | 139 | vfile_check_signature(vid); |
| 137 | 140 | db_prepare(&q, |
| 138 | 141 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| @@ -144,11 +147,13 @@ | ||
| 144 | 147 | int isDeleted = db_column_int(&q, 1); |
| 145 | 148 | int isNew = db_column_int(&q,2)==0; |
| 146 | 149 | int chnged = db_column_int(&q,3); |
| 147 | 150 | int renamed = db_column_int(&q,4); |
| 148 | 151 | char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 149 | - if( isNew ){ | |
| 152 | + if( isBrief ){ | |
| 153 | + printf("%s\n", zPathname); | |
| 154 | + }else if( isNew ){ | |
| 150 | 155 | printf("ADDED %s\n", zPathname); |
| 151 | 156 | }else if( access(zFullName, 0) ){ |
| 152 | 157 | printf("MISSING %s\n", zPathname); |
| 153 | 158 | }else if( isDeleted ){ |
| 154 | 159 | printf("DELETED %s\n", zPathname); |
| 155 | 160 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -121,18 +121,21 @@ | |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | ** COMMAND: ls |
| 125 | ** |
| 126 | ** Usage: %fossil ls |
| 127 | ** |
| 128 | ** Show the names of all files in the current checkout |
| 129 | */ |
| 130 | void ls_cmd(void){ |
| 131 | int vid; |
| 132 | Stmt q; |
| 133 | |
| 134 | db_must_be_within_tree(); |
| 135 | vid = db_lget_int("checkout", 0); |
| 136 | vfile_check_signature(vid); |
| 137 | db_prepare(&q, |
| 138 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| @@ -144,11 +147,13 @@ | |
| 144 | int isDeleted = db_column_int(&q, 1); |
| 145 | int isNew = db_column_int(&q,2)==0; |
| 146 | int chnged = db_column_int(&q,3); |
| 147 | int renamed = db_column_int(&q,4); |
| 148 | char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 149 | if( isNew ){ |
| 150 | printf("ADDED %s\n", zPathname); |
| 151 | }else if( access(zFullName, 0) ){ |
| 152 | printf("MISSING %s\n", zPathname); |
| 153 | }else if( isDeleted ){ |
| 154 | printf("DELETED %s\n", zPathname); |
| 155 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -121,18 +121,21 @@ | |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | ** COMMAND: ls |
| 125 | ** |
| 126 | ** Usage: %fossil ls [-l] |
| 127 | ** |
| 128 | ** Show the names of all files in the current checkout. The -l provides |
| 129 | ** extra information about each file. |
| 130 | */ |
| 131 | void ls_cmd(void){ |
| 132 | int vid; |
| 133 | Stmt q; |
| 134 | int isBrief; |
| 135 | |
| 136 | isBrief = find_option("l","l", 0)==0; |
| 137 | db_must_be_within_tree(); |
| 138 | vid = db_lget_int("checkout", 0); |
| 139 | vfile_check_signature(vid); |
| 140 | db_prepare(&q, |
| 141 | "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)" |
| @@ -144,11 +147,13 @@ | |
| 147 | int isDeleted = db_column_int(&q, 1); |
| 148 | int isNew = db_column_int(&q,2)==0; |
| 149 | int chnged = db_column_int(&q,3); |
| 150 | int renamed = db_column_int(&q,4); |
| 151 | char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 152 | if( isBrief ){ |
| 153 | printf("%s\n", zPathname); |
| 154 | }else if( isNew ){ |
| 155 | printf("ADDED %s\n", zPathname); |
| 156 | }else if( access(zFullName, 0) ){ |
| 157 | printf("MISSING %s\n", zPathname); |
| 158 | }else if( isDeleted ){ |
| 159 | printf("DELETED %s\n", zPathname); |
| 160 |