Fossil SCM

Display of pathnames relative to working directory for status, changes and extras commands now controlled by 'relative-paths' setting (default: off) and --abs-paths and --rel-paths options.

ben 2011-08-10 18:53 ben-testing
Commit cdd298f526afae444b6bbc5210005ec1943cbc58
2 files changed +49 -9 +4
+49 -9
--- src/checkin.c
+++ src/checkin.c
@@ -106,37 +106,59 @@
106106
db_finalize(&q);
107107
if( nErr ){
108108
fossil_fatal("aborting due to prior errors");
109109
}
110110
}
111
+
112
+/*
113
+** Use the "relative-paths" setting and the --abs-paths and
114
+** --rel-paths command line options to determine whether the
115
+** status report should be shown relative to the current
116
+** working directory.
117
+*/
118
+static int determine_cwd_relative_option()
119
+{
120
+ int relativePaths = db_get_boolean("relative-paths", 0);
121
+ int absPathOption = find_option("abs-paths", 0, 0)!=0;
122
+ int relPathOption = find_option("rel-paths", 0, 0)!=0;
123
+ if( absPathOption ){ relativePaths = 0; }
124
+ if( relPathOption ){ relativePaths = 1; }
125
+ return relativePaths;
126
+}
111127
112128
/*
113129
** COMMAND: changes
114130
**
115131
** Usage: %fossil changes
116132
**
117133
** Report on the edit status of all files in the current checkout.
118134
** See also the "status" and "extra" commands.
119135
**
136
+** Pathnames are displayed according to the "relative-paths" setting,
137
+** unless overridden by the --abs-paths or --rel-paths options.
138
+**
120139
** Options:
121140
**
122141
** --sha1sum Verify file status using SHA1 hashing rather
123142
** than relying on file mtimes.
124143
**
125
-** --non-relative Don't display filenames relative to the current
126
-** working directory.
144
+** --abs-paths Display absolute pathnames.
145
+**
146
+** --rel-paths Display pathnames relative to the current working
147
+** directory.
127148
*/
128149
void changes_cmd(void){
129150
Blob report;
130151
int vid;
131152
int useSha1sum = find_option("sha1sum", 0, 0)!=0;
132
- int nonRelative = find_option("non-relative", 0, 0)!=0;
153
+ int cwdRelative = 0;
133154
db_must_be_within_tree();
155
+ cwdRelative = determine_cwd_relative_option();
134156
blob_zero(&report);
135157
vid = db_lget_int("checkout", 0);
136158
vfile_check_signature(vid, 0, useSha1sum);
137
- status_report(&report, "", 0, !nonRelative);
159
+ status_report(&report, "", 0, cwdRelative);
138160
blob_write_to_file(&report, "-");
139161
}
140162
141163
/*
142164
** COMMAND: status
@@ -143,17 +165,22 @@
143165
**
144166
** Usage: %fossil status
145167
**
146168
** Report on the status of the current checkout.
147169
**
170
+** Pathnames are displayed according to the "relative-paths" setting,
171
+** unless overridden by the --abs-paths or --rel-paths options.
172
+**
148173
** Options:
149174
**
150175
** --sha1sum Verify file status using SHA1 hashing rather
151176
** than relying on file mtimes.
152177
**
153
-** --non-relative Don't display filenames relative to the current
154
-** working directory.
178
+** --abs-paths Display absolute pathnames.
179
+**
180
+** --rel-paths Display pathnames relative to the current working
181
+** directory.
155182
*/
156183
void status_cmd(void){
157184
int vid;
158185
db_must_be_within_tree();
159186
/* 012345678901234 */
@@ -232,27 +259,40 @@
232259
**
233260
** The GLOBPATTERN is a comma-separated list of GLOB expressions for
234261
** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
235262
** is used if the --ignore option is omitted.
236263
**
237
-** Filenames are displayed relative to the current working directory
238
-** unless the --non-relative option is used.
264
+** Pathnames are displayed according to the "relative-paths" setting,
265
+** unless overridden by the --abs-paths or --rel-paths options.
266
+**
267
+** Options:
268
+**
269
+** --dotfiles Include files with names beginning with "."
270
+**
271
+** --ignore GLOBPATTERN
272
+** Override the "ignore-glob" setting.
273
+**
274
+** --abs-paths Display absolute pathnames.
275
+**
276
+** --rel-paths Display pathnames relative to the current working
277
+** directory.
239278
*/
240279
void extra_cmd(void){
241280
Blob path;
242281
Blob repo;
243282
Stmt q;
244283
int n;
245284
const char *zIgnoreFlag = find_option("ignore",0,1);
246285
int allFlag = find_option("dotfiles",0,0)!=0;
247
- int cwdRelative = !(find_option("non-relative", 0, 0)!=0);
286
+ int cwdRelative = 0;
248287
int outputManifest;
249288
Glob *pIgnore;
250289
Blob rewrittenPathname;
251290
const char *zPathname, *zDisplayName;
252291
253292
db_must_be_within_tree();
293
+ cwdRelative = determine_cwd_relative_option();
254294
outputManifest = db_get_versionable_setting_boolean("manifest",0);
255295
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
256296
n = strlen(g.zLocalRoot);
257297
blob_init(&path, g.zLocalRoot, n-1);
258298
if( zIgnoreFlag==0 ){
259299
--- src/checkin.c
+++ src/checkin.c
@@ -106,37 +106,59 @@
106 db_finalize(&q);
107 if( nErr ){
108 fossil_fatal("aborting due to prior errors");
109 }
110 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
112 /*
113 ** COMMAND: changes
114 **
115 ** Usage: %fossil changes
116 **
117 ** Report on the edit status of all files in the current checkout.
118 ** See also the "status" and "extra" commands.
119 **
 
 
 
120 ** Options:
121 **
122 ** --sha1sum Verify file status using SHA1 hashing rather
123 ** than relying on file mtimes.
124 **
125 ** --non-relative Don't display filenames relative to the current
126 ** working directory.
 
 
127 */
128 void changes_cmd(void){
129 Blob report;
130 int vid;
131 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
132 int nonRelative = find_option("non-relative", 0, 0)!=0;
133 db_must_be_within_tree();
 
134 blob_zero(&report);
135 vid = db_lget_int("checkout", 0);
136 vfile_check_signature(vid, 0, useSha1sum);
137 status_report(&report, "", 0, !nonRelative);
138 blob_write_to_file(&report, "-");
139 }
140
141 /*
142 ** COMMAND: status
@@ -143,17 +165,22 @@
143 **
144 ** Usage: %fossil status
145 **
146 ** Report on the status of the current checkout.
147 **
 
 
 
148 ** Options:
149 **
150 ** --sha1sum Verify file status using SHA1 hashing rather
151 ** than relying on file mtimes.
152 **
153 ** --non-relative Don't display filenames relative to the current
154 ** working directory.
 
 
155 */
156 void status_cmd(void){
157 int vid;
158 db_must_be_within_tree();
159 /* 012345678901234 */
@@ -232,27 +259,40 @@
232 **
233 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
234 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
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.
 
 
 
 
 
 
 
 
 
 
 
 
239 */
240 void extra_cmd(void){
241 Blob path;
242 Blob repo;
243 Stmt q;
244 int n;
245 const char *zIgnoreFlag = find_option("ignore",0,1);
246 int allFlag = find_option("dotfiles",0,0)!=0;
247 int cwdRelative = !(find_option("non-relative", 0, 0)!=0);
248 int outputManifest;
249 Glob *pIgnore;
250 Blob rewrittenPathname;
251 const char *zPathname, *zDisplayName;
252
253 db_must_be_within_tree();
 
254 outputManifest = db_get_versionable_setting_boolean("manifest",0);
255 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
256 n = strlen(g.zLocalRoot);
257 blob_init(&path, g.zLocalRoot, n-1);
258 if( zIgnoreFlag==0 ){
259
--- src/checkin.c
+++ src/checkin.c
@@ -106,37 +106,59 @@
106 db_finalize(&q);
107 if( nErr ){
108 fossil_fatal("aborting due to prior errors");
109 }
110 }
111
112 /*
113 ** Use the "relative-paths" setting and the --abs-paths and
114 ** --rel-paths command line options to determine whether the
115 ** status report should be shown relative to the current
116 ** working directory.
117 */
118 static int determine_cwd_relative_option()
119 {
120 int relativePaths = db_get_boolean("relative-paths", 0);
121 int absPathOption = find_option("abs-paths", 0, 0)!=0;
122 int relPathOption = find_option("rel-paths", 0, 0)!=0;
123 if( absPathOption ){ relativePaths = 0; }
124 if( relPathOption ){ relativePaths = 1; }
125 return relativePaths;
126 }
127
128 /*
129 ** COMMAND: changes
130 **
131 ** Usage: %fossil changes
132 **
133 ** Report on the edit status of all files in the current checkout.
134 ** See also the "status" and "extra" commands.
135 **
136 ** Pathnames are displayed according to the "relative-paths" setting,
137 ** unless overridden by the --abs-paths or --rel-paths options.
138 **
139 ** Options:
140 **
141 ** --sha1sum Verify file status using SHA1 hashing rather
142 ** than relying on file mtimes.
143 **
144 ** --abs-paths Display absolute pathnames.
145 **
146 ** --rel-paths Display pathnames relative to the current working
147 ** directory.
148 */
149 void changes_cmd(void){
150 Blob report;
151 int vid;
152 int useSha1sum = find_option("sha1sum", 0, 0)!=0;
153 int cwdRelative = 0;
154 db_must_be_within_tree();
155 cwdRelative = determine_cwd_relative_option();
156 blob_zero(&report);
157 vid = db_lget_int("checkout", 0);
158 vfile_check_signature(vid, 0, useSha1sum);
159 status_report(&report, "", 0, cwdRelative);
160 blob_write_to_file(&report, "-");
161 }
162
163 /*
164 ** COMMAND: status
@@ -143,17 +165,22 @@
165 **
166 ** Usage: %fossil status
167 **
168 ** Report on the status of the current checkout.
169 **
170 ** Pathnames are displayed according to the "relative-paths" setting,
171 ** unless overridden by the --abs-paths or --rel-paths options.
172 **
173 ** Options:
174 **
175 ** --sha1sum Verify file status using SHA1 hashing rather
176 ** than relying on file mtimes.
177 **
178 ** --abs-paths Display absolute pathnames.
179 **
180 ** --rel-paths Display pathnames relative to the current working
181 ** directory.
182 */
183 void status_cmd(void){
184 int vid;
185 db_must_be_within_tree();
186 /* 012345678901234 */
@@ -232,27 +259,40 @@
259 **
260 ** The GLOBPATTERN is a comma-separated list of GLOB expressions for
261 ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob"
262 ** is used if the --ignore option is omitted.
263 **
264 ** Pathnames are displayed according to the "relative-paths" setting,
265 ** unless overridden by the --abs-paths or --rel-paths options.
266 **
267 ** Options:
268 **
269 ** --dotfiles Include files with names beginning with "."
270 **
271 ** --ignore GLOBPATTERN
272 ** Override the "ignore-glob" setting.
273 **
274 ** --abs-paths Display absolute pathnames.
275 **
276 ** --rel-paths Display pathnames relative to the current working
277 ** directory.
278 */
279 void extra_cmd(void){
280 Blob path;
281 Blob repo;
282 Stmt q;
283 int n;
284 const char *zIgnoreFlag = find_option("ignore",0,1);
285 int allFlag = find_option("dotfiles",0,0)!=0;
286 int cwdRelative = 0;
287 int outputManifest;
288 Glob *pIgnore;
289 Blob rewrittenPathname;
290 const char *zPathname, *zDisplayName;
291
292 db_must_be_within_tree();
293 cwdRelative = determine_cwd_relative_option();
294 outputManifest = db_get_versionable_setting_boolean("manifest",0);
295 db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
296 n = strlen(g.zLocalRoot);
297 blob_init(&path, g.zLocalRoot, n-1);
298 if( zIgnoreFlag==0 ){
299
+4
--- src/db.c
+++ src/db.c
@@ -1741,10 +1741,11 @@
17411741
{ "manifest", 0, 0, 1, "off" },
17421742
{ "max-upload", 0, 25, 0, "250000" },
17431743
{ "mtime-changes", 0, 0, 0, "on" },
17441744
{ "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
17451745
{ "proxy", 0, 32, 0, "off" },
1746
+ { "relative-paths",0, 0, 0, "off" },
17461747
{ "repo-cksum", 0, 0, 0, "on" },
17471748
{ "self-register", 0, 0, 0, "off" },
17481749
{ "ssl-ca-location",0, 40, 0, "" },
17491750
{ "ssl-identity", 0, 40, 0, "" },
17501751
{ "ssh-command", 0, 32, 0, "" },
@@ -1854,10 +1855,13 @@
18541855
**
18551856
** proxy URL of the HTTP proxy. If undefined or "off" then
18561857
** the "http_proxy" environment variable is consulted.
18571858
** If the http_proxy environment variable is undefined
18581859
** then a direct HTTP connection is used.
1860
+**
1861
+** relative-paths When showing changes and extras, report paths relative
1862
+** to the current working directory. Default: "off"
18591863
**
18601864
** repo-cksum Compute checksums over all files in each checkout
18611865
** as a double-check of correctness. Defaults to "on".
18621866
** Disable on large repositories for a performance
18631867
** improvement.
18641868
--- src/db.c
+++ src/db.c
@@ -1741,10 +1741,11 @@
1741 { "manifest", 0, 0, 1, "off" },
1742 { "max-upload", 0, 25, 0, "250000" },
1743 { "mtime-changes", 0, 0, 0, "on" },
1744 { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1745 { "proxy", 0, 32, 0, "off" },
 
1746 { "repo-cksum", 0, 0, 0, "on" },
1747 { "self-register", 0, 0, 0, "off" },
1748 { "ssl-ca-location",0, 40, 0, "" },
1749 { "ssl-identity", 0, 40, 0, "" },
1750 { "ssh-command", 0, 32, 0, "" },
@@ -1854,10 +1855,13 @@
1854 **
1855 ** proxy URL of the HTTP proxy. If undefined or "off" then
1856 ** the "http_proxy" environment variable is consulted.
1857 ** If the http_proxy environment variable is undefined
1858 ** then a direct HTTP connection is used.
 
 
 
1859 **
1860 ** repo-cksum Compute checksums over all files in each checkout
1861 ** as a double-check of correctness. Defaults to "on".
1862 ** Disable on large repositories for a performance
1863 ** improvement.
1864
--- src/db.c
+++ src/db.c
@@ -1741,10 +1741,11 @@
1741 { "manifest", 0, 0, 1, "off" },
1742 { "max-upload", 0, 25, 0, "250000" },
1743 { "mtime-changes", 0, 0, 0, "on" },
1744 { "pgp-command", 0, 32, 0, "gpg --clearsign -o " },
1745 { "proxy", 0, 32, 0, "off" },
1746 { "relative-paths",0, 0, 0, "off" },
1747 { "repo-cksum", 0, 0, 0, "on" },
1748 { "self-register", 0, 0, 0, "off" },
1749 { "ssl-ca-location",0, 40, 0, "" },
1750 { "ssl-identity", 0, 40, 0, "" },
1751 { "ssh-command", 0, 32, 0, "" },
@@ -1854,10 +1855,13 @@
1855 **
1856 ** proxy URL of the HTTP proxy. If undefined or "off" then
1857 ** the "http_proxy" environment variable is consulted.
1858 ** If the http_proxy environment variable is undefined
1859 ** then a direct HTTP connection is used.
1860 **
1861 ** relative-paths When showing changes and extras, report paths relative
1862 ** to the current working directory. Default: "off"
1863 **
1864 ** repo-cksum Compute checksums over all files in each checkout
1865 ** as a double-check of correctness. Defaults to "on".
1866 ** Disable on large repositories for a performance
1867 ** improvement.
1868

Keyboard Shortcuts

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