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"

drh 2009-12-17 14:27 trunk
Commit 9c06ea312083459c5f73298a0eb457d8f8ee3d00
1 file changed +8 -3
+8 -3
--- src/checkin.c
+++ src/checkin.c
@@ -121,18 +121,21 @@
121121
}
122122
123123
/*
124124
** COMMAND: ls
125125
**
126
-** Usage: %fossil ls
126
+** Usage: %fossil ls [-l]
127127
**
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.
129130
*/
130131
void ls_cmd(void){
131132
int vid;
132133
Stmt q;
134
+ int isBrief;
133135
136
+ isBrief = find_option("l","l", 0)==0;
134137
db_must_be_within_tree();
135138
vid = db_lget_int("checkout", 0);
136139
vfile_check_signature(vid);
137140
db_prepare(&q,
138141
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
@@ -144,11 +147,13 @@
144147
int isDeleted = db_column_int(&q, 1);
145148
int isNew = db_column_int(&q,2)==0;
146149
int chnged = db_column_int(&q,3);
147150
int renamed = db_column_int(&q,4);
148151
char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname);
149
- if( isNew ){
152
+ if( isBrief ){
153
+ printf("%s\n", zPathname);
154
+ }else if( isNew ){
150155
printf("ADDED %s\n", zPathname);
151156
}else if( access(zFullName, 0) ){
152157
printf("MISSING %s\n", zPathname);
153158
}else if( isDeleted ){
154159
printf("DELETED %s\n", zPathname);
155160
--- 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

Keyboard Shortcuts

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