Fossil SCM

By default, the extras command lists all the uncontrolled files relative to the current working directory, unless the --non-relative option is used.

ben 2011-07-11 10:00 ben-changes-report
Commit b9a38cf3673ccab549547e0bee0b9ad101eaaf56
1 file changed +19 -1
+19 -1
--- src/checkin.c
+++ src/checkin.c
@@ -228,20 +228,26 @@
228228
** ignored but can be included by adding the --dotfiles option.
229229
**
230230
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
231231
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
232232
** is used if the --ignore option is omitted.
233
+**
234
+** Filenames are displayed relative to the current working directory
235
+** unless the --non-relative option is used.
233236
*/
234237
void extra_cmd(void){
235238
Blob path;
236239
Blob repo;
237240
Stmt q;
238241
int n;
239242
const char *zIgnoreFlag = find_option("ignore",0,1);
240243
int allFlag = find_option("dotfiles",0,0)!=0;
244
+ int cwdRelative = !(find_option("non-relative", 0, 0)!=0);
241245
int outputManifest;
242246
Glob *pIgnore;
247
+ Blob rewrittenPathname;
248
+ const char *zPathname, *zDisplayName;
243249
244250
db_must_be_within_tree();
245251
outputManifest = db_get_boolean("manifest",0);
246252
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
247253
n = strlen(g.zLocalRoot);
@@ -259,13 +265,25 @@
259265
fossil_all_reserved_names()
260266
);
261267
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
262268
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
263269
}
270
+ blob_zero(&rewrittenPathname);
264271
while( db_step(&q)==SQLITE_ROW ){
265
- fossil_print("%s\n", db_column_text(&q, 0));
272
+ zDisplayName = zPathname = db_column_text(&q, 0);
273
+ if( cwdRelative ) {
274
+ char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
275
+ file_relative_name(zFullName, &rewrittenPathname);
276
+ free(zFullName);
277
+ zDisplayName = blob_str(&rewrittenPathname);
278
+ if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
279
+ zDisplayName += 2; /* no unnecessary ./ prefix */
280
+ }
281
+ }
282
+ fossil_print("%s\n", zDisplayName);
266283
}
284
+ blob_reset(&rewrittenPathname);
267285
db_finalize(&q);
268286
}
269287
270288
/*
271289
** COMMAND: clean
272290
--- src/checkin.c
+++ src/checkin.c
@@ -228,20 +228,26 @@
228 ** ignored but can be included by adding the --dotfiles option.
229 **
230 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
231 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
232 ** is used if the --ignore option is omitted.
 
 
 
233 */
234 void extra_cmd(void){
235 Blob path;
236 Blob repo;
237 Stmt q;
238 int n;
239 const char *zIgnoreFlag = find_option("ignore",0,1);
240 int allFlag = find_option("dotfiles",0,0)!=0;
 
241 int outputManifest;
242 Glob *pIgnore;
 
 
243
244 db_must_be_within_tree();
245 outputManifest = db_get_boolean("manifest",0);
246 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
247 n = strlen(g.zLocalRoot);
@@ -259,13 +265,25 @@
259 fossil_all_reserved_names()
260 );
261 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
262 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
263 }
 
264 while( db_step(&q)==SQLITE_ROW ){
265 fossil_print("%s\n", db_column_text(&q, 0));
 
 
 
 
 
 
 
 
 
 
266 }
 
267 db_finalize(&q);
268 }
269
270 /*
271 ** COMMAND: clean
272
--- src/checkin.c
+++ src/checkin.c
@@ -228,20 +228,26 @@
228 ** ignored but can be included by adding the --dotfiles option.
229 **
230 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
231 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
232 ** is used if the --ignore option is omitted.
233 **
234 ** Filenames are displayed relative to the current working directory
235 ** unless the --non-relative option is used.
236 */
237 void extra_cmd(void){
238 Blob path;
239 Blob repo;
240 Stmt q;
241 int n;
242 const char *zIgnoreFlag = find_option("ignore",0,1);
243 int allFlag = find_option("dotfiles",0,0)!=0;
244 int cwdRelative = !(find_option("non-relative", 0, 0)!=0);
245 int outputManifest;
246 Glob *pIgnore;
247 Blob rewrittenPathname;
248 const char *zPathname, *zDisplayName;
249
250 db_must_be_within_tree();
251 outputManifest = db_get_boolean("manifest",0);
252 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
253 n = strlen(g.zLocalRoot);
@@ -259,13 +265,25 @@
265 fossil_all_reserved_names()
266 );
267 if( file_tree_name(g.zRepositoryName, &repo, 0) ){
268 db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
269 }
270 blob_zero(&rewrittenPathname);
271 while( db_step(&q)==SQLITE_ROW ){
272 zDisplayName = zPathname = db_column_text(&q, 0);
273 if( cwdRelative ) {
274 char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname);
275 file_relative_name(zFullName, &rewrittenPathname);
276 free(zFullName);
277 zDisplayName = blob_str(&rewrittenPathname);
278 if( zDisplayName[0]=='.' && zDisplayName[1]=='/' ){
279 zDisplayName += 2; /* no unnecessary ./ prefix */
280 }
281 }
282 fossil_print("%s\n", zDisplayName);
283 }
284 blob_reset(&rewrittenPathname);
285 db_finalize(&q);
286 }
287
288 /*
289 ** COMMAND: clean
290

Keyboard Shortcuts

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