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.
Commit
cdd298f526afae444b6bbc5210005ec1943cbc58
Parent
3eb07708b116072…
2 files changed
+49
-9
+4
+49
-9
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -106,37 +106,59 @@ | ||
| 106 | 106 | db_finalize(&q); |
| 107 | 107 | if( nErr ){ |
| 108 | 108 | fossil_fatal("aborting due to prior errors"); |
| 109 | 109 | } |
| 110 | 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 | +} | |
| 111 | 127 | |
| 112 | 128 | /* |
| 113 | 129 | ** COMMAND: changes |
| 114 | 130 | ** |
| 115 | 131 | ** Usage: %fossil changes |
| 116 | 132 | ** |
| 117 | 133 | ** Report on the edit status of all files in the current checkout. |
| 118 | 134 | ** See also the "status" and "extra" commands. |
| 119 | 135 | ** |
| 136 | +** Pathnames are displayed according to the "relative-paths" setting, | |
| 137 | +** unless overridden by the --abs-paths or --rel-paths options. | |
| 138 | +** | |
| 120 | 139 | ** Options: |
| 121 | 140 | ** |
| 122 | 141 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 123 | 142 | ** than relying on file mtimes. |
| 124 | 143 | ** |
| 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. | |
| 127 | 148 | */ |
| 128 | 149 | void changes_cmd(void){ |
| 129 | 150 | Blob report; |
| 130 | 151 | int vid; |
| 131 | 152 | int useSha1sum = find_option("sha1sum", 0, 0)!=0; |
| 132 | - int nonRelative = find_option("non-relative", 0, 0)!=0; | |
| 153 | + int cwdRelative = 0; | |
| 133 | 154 | db_must_be_within_tree(); |
| 155 | + cwdRelative = determine_cwd_relative_option(); | |
| 134 | 156 | blob_zero(&report); |
| 135 | 157 | vid = db_lget_int("checkout", 0); |
| 136 | 158 | vfile_check_signature(vid, 0, useSha1sum); |
| 137 | - status_report(&report, "", 0, !nonRelative); | |
| 159 | + status_report(&report, "", 0, cwdRelative); | |
| 138 | 160 | blob_write_to_file(&report, "-"); |
| 139 | 161 | } |
| 140 | 162 | |
| 141 | 163 | /* |
| 142 | 164 | ** COMMAND: status |
| @@ -143,17 +165,22 @@ | ||
| 143 | 165 | ** |
| 144 | 166 | ** Usage: %fossil status |
| 145 | 167 | ** |
| 146 | 168 | ** Report on the status of the current checkout. |
| 147 | 169 | ** |
| 170 | +** Pathnames are displayed according to the "relative-paths" setting, | |
| 171 | +** unless overridden by the --abs-paths or --rel-paths options. | |
| 172 | +** | |
| 148 | 173 | ** Options: |
| 149 | 174 | ** |
| 150 | 175 | ** --sha1sum Verify file status using SHA1 hashing rather |
| 151 | 176 | ** than relying on file mtimes. |
| 152 | 177 | ** |
| 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. | |
| 155 | 182 | */ |
| 156 | 183 | void status_cmd(void){ |
| 157 | 184 | int vid; |
| 158 | 185 | db_must_be_within_tree(); |
| 159 | 186 | /* 012345678901234 */ |
| @@ -232,27 +259,40 @@ | ||
| 232 | 259 | ** |
| 233 | 260 | ** The GLOBPATTERN is a comma-separated list of GLOB expressions for |
| 234 | 261 | ** files that are ignored. The GLOBPATTERN specified by the "ignore-glob" |
| 235 | 262 | ** is used if the --ignore option is omitted. |
| 236 | 263 | ** |
| 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. | |
| 239 | 278 | */ |
| 240 | 279 | void extra_cmd(void){ |
| 241 | 280 | Blob path; |
| 242 | 281 | Blob repo; |
| 243 | 282 | Stmt q; |
| 244 | 283 | int n; |
| 245 | 284 | const char *zIgnoreFlag = find_option("ignore",0,1); |
| 246 | 285 | int allFlag = find_option("dotfiles",0,0)!=0; |
| 247 | - int cwdRelative = !(find_option("non-relative", 0, 0)!=0); | |
| 286 | + int cwdRelative = 0; | |
| 248 | 287 | int outputManifest; |
| 249 | 288 | Glob *pIgnore; |
| 250 | 289 | Blob rewrittenPathname; |
| 251 | 290 | const char *zPathname, *zDisplayName; |
| 252 | 291 | |
| 253 | 292 | db_must_be_within_tree(); |
| 293 | + cwdRelative = determine_cwd_relative_option(); | |
| 254 | 294 | outputManifest = db_get_versionable_setting_boolean("manifest",0); |
| 255 | 295 | db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); |
| 256 | 296 | n = strlen(g.zLocalRoot); |
| 257 | 297 | blob_init(&path, g.zLocalRoot, n-1); |
| 258 | 298 | if( zIgnoreFlag==0 ){ |
| 259 | 299 |
| --- 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 |
M
src/db.c
+4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1741,10 +1741,11 @@ | ||
| 1741 | 1741 | { "manifest", 0, 0, 1, "off" }, |
| 1742 | 1742 | { "max-upload", 0, 25, 0, "250000" }, |
| 1743 | 1743 | { "mtime-changes", 0, 0, 0, "on" }, |
| 1744 | 1744 | { "pgp-command", 0, 32, 0, "gpg --clearsign -o " }, |
| 1745 | 1745 | { "proxy", 0, 32, 0, "off" }, |
| 1746 | + { "relative-paths",0, 0, 0, "off" }, | |
| 1746 | 1747 | { "repo-cksum", 0, 0, 0, "on" }, |
| 1747 | 1748 | { "self-register", 0, 0, 0, "off" }, |
| 1748 | 1749 | { "ssl-ca-location",0, 40, 0, "" }, |
| 1749 | 1750 | { "ssl-identity", 0, 40, 0, "" }, |
| 1750 | 1751 | { "ssh-command", 0, 32, 0, "" }, |
| @@ -1854,10 +1855,13 @@ | ||
| 1854 | 1855 | ** |
| 1855 | 1856 | ** proxy URL of the HTTP proxy. If undefined or "off" then |
| 1856 | 1857 | ** the "http_proxy" environment variable is consulted. |
| 1857 | 1858 | ** If the http_proxy environment variable is undefined |
| 1858 | 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" | |
| 1859 | 1863 | ** |
| 1860 | 1864 | ** repo-cksum Compute checksums over all files in each checkout |
| 1861 | 1865 | ** as a double-check of correctness. Defaults to "on". |
| 1862 | 1866 | ** Disable on large repositories for a performance |
| 1863 | 1867 | ** improvement. |
| 1864 | 1868 |
| --- 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 |