Fossil SCM
Add (open --reopen REPOFILE), based on a /chat discussion with Martin G., Brickviking, and Richard, and prompted by [forum:bac6213f6e59f1f9|forum post bac6213f6e59f1f9]. This simply forwards that usage to the test-move-repository command.
Commit
ae8a45c7a7feba799e889de25da5f2a6683d1f89f5b07dd8964ca1b2bd685516
Parent
20adff9572f49fa…
2 files changed
+12
+2
M
src/db.c
+12
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -4260,10 +4260,13 @@ | ||
| 4260 | 4260 | ** them). |
| 4261 | 4261 | ** --verbose If passed a URI then this flag is passed on to the clone |
| 4262 | 4262 | ** operation, otherwise it has no effect |
| 4263 | 4263 | ** --workdir DIR Use DIR as the working directory instead of ".". The DIR |
| 4264 | 4264 | ** directory is created if it does not exist. |
| 4265 | +** --reopen REPOFILE Changes the repository file used by the current checkout | |
| 4266 | +** to REPOFILE. Use this after moving a checkout's | |
| 4267 | +** repository. This may lose stash and bisect history. | |
| 4265 | 4268 | ** |
| 4266 | 4269 | ** See also: [[close]], [[clone]] |
| 4267 | 4270 | */ |
| 4268 | 4271 | void cmd_open(void){ |
| 4269 | 4272 | int emptyFlag; |
| @@ -4274,14 +4277,23 @@ | ||
| 4274 | 4277 | int bForce = 0; /* --force. Open even if non-empty dir */ |
| 4275 | 4278 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 4276 | 4279 | const char *zWorkDir; /* --workdir value */ |
| 4277 | 4280 | const char *zRepo = 0; /* Name of the repository file */ |
| 4278 | 4281 | const char *zRepoDir = 0; /* --repodir value */ |
| 4282 | + const char *zReopen = 0; /* --reopen REPOFILE */ | |
| 4279 | 4283 | char *zPwd; /* Initial working directory */ |
| 4280 | 4284 | int isUri = 0; /* True if REPOSITORY is a URI */ |
| 4281 | 4285 | int nLocal; /* Number of preexisting files in cwd */ |
| 4282 | 4286 | int bVerbose = 0; /* --verbose option for clone */ |
| 4287 | + | |
| 4288 | + zReopen = find_option("reopen",0,1); | |
| 4289 | + if( 0!=zReopen ){ | |
| 4290 | + g.argc = 3; | |
| 4291 | + g.argv[2] = (char*)zReopen; | |
| 4292 | + move_repo_cmd(); | |
| 4293 | + return; | |
| 4294 | + } | |
| 4283 | 4295 | |
| 4284 | 4296 | url_proxy_options(); |
| 4285 | 4297 | emptyFlag = find_option("empty",0,0)!=0; |
| 4286 | 4298 | keepFlag = find_option("keep","k",0)!=0; |
| 4287 | 4299 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 4288 | 4300 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4260,10 +4260,13 @@ | |
| 4260 | ** them). |
| 4261 | ** --verbose If passed a URI then this flag is passed on to the clone |
| 4262 | ** operation, otherwise it has no effect |
| 4263 | ** --workdir DIR Use DIR as the working directory instead of ".". The DIR |
| 4264 | ** directory is created if it does not exist. |
| 4265 | ** |
| 4266 | ** See also: [[close]], [[clone]] |
| 4267 | */ |
| 4268 | void cmd_open(void){ |
| 4269 | int emptyFlag; |
| @@ -4274,14 +4277,23 @@ | |
| 4274 | int bForce = 0; /* --force. Open even if non-empty dir */ |
| 4275 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 4276 | const char *zWorkDir; /* --workdir value */ |
| 4277 | const char *zRepo = 0; /* Name of the repository file */ |
| 4278 | const char *zRepoDir = 0; /* --repodir value */ |
| 4279 | char *zPwd; /* Initial working directory */ |
| 4280 | int isUri = 0; /* True if REPOSITORY is a URI */ |
| 4281 | int nLocal; /* Number of preexisting files in cwd */ |
| 4282 | int bVerbose = 0; /* --verbose option for clone */ |
| 4283 | |
| 4284 | url_proxy_options(); |
| 4285 | emptyFlag = find_option("empty",0,0)!=0; |
| 4286 | keepFlag = find_option("keep","k",0)!=0; |
| 4287 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 4288 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -4260,10 +4260,13 @@ | |
| 4260 | ** them). |
| 4261 | ** --verbose If passed a URI then this flag is passed on to the clone |
| 4262 | ** operation, otherwise it has no effect |
| 4263 | ** --workdir DIR Use DIR as the working directory instead of ".". The DIR |
| 4264 | ** directory is created if it does not exist. |
| 4265 | ** --reopen REPOFILE Changes the repository file used by the current checkout |
| 4266 | ** to REPOFILE. Use this after moving a checkout's |
| 4267 | ** repository. This may lose stash and bisect history. |
| 4268 | ** |
| 4269 | ** See also: [[close]], [[clone]] |
| 4270 | */ |
| 4271 | void cmd_open(void){ |
| 4272 | int emptyFlag; |
| @@ -4274,14 +4277,23 @@ | |
| 4277 | int bForce = 0; /* --force. Open even if non-empty dir */ |
| 4278 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 }; |
| 4279 | const char *zWorkDir; /* --workdir value */ |
| 4280 | const char *zRepo = 0; /* Name of the repository file */ |
| 4281 | const char *zRepoDir = 0; /* --repodir value */ |
| 4282 | const char *zReopen = 0; /* --reopen REPOFILE */ |
| 4283 | char *zPwd; /* Initial working directory */ |
| 4284 | int isUri = 0; /* True if REPOSITORY is a URI */ |
| 4285 | int nLocal; /* Number of preexisting files in cwd */ |
| 4286 | int bVerbose = 0; /* --verbose option for clone */ |
| 4287 | |
| 4288 | zReopen = find_option("reopen",0,1); |
| 4289 | if( 0!=zReopen ){ |
| 4290 | g.argc = 3; |
| 4291 | g.argv[2] = (char*)zReopen; |
| 4292 | move_repo_cmd(); |
| 4293 | return; |
| 4294 | } |
| 4295 | |
| 4296 | url_proxy_options(); |
| 4297 | emptyFlag = find_option("empty",0,0)!=0; |
| 4298 | keepFlag = find_option("keep","k",0)!=0; |
| 4299 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 4300 |
+2
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -42,10 +42,12 @@ | ||
| 42 | 42 | circles appear, but no lines connecting them. |
| 43 | 43 | ([/timeline?ng|example]). |
| 44 | 44 | </ol> |
| 45 | 45 | <li> The [/help/timeline|timeline command] is enhanced with the new |
| 46 | 46 | "<tt>-u|--for-user</tt>" option. |
| 47 | + <li> The [/help/open|the open command]'s new "<tt>--reopen REPOFILE</tt>" flag | |
| 48 | + can be used to fix a checkout after moving its repository file. | |
| 47 | 49 | </ol> |
| 48 | 50 | |
| 49 | 51 | <h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol> |
| 50 | 52 | <li> Close a potential Denial-of-Service attack against any public-facing Fossil |
| 51 | 53 | server involving exponential behavior in Fossil's regexp implementation. |
| 52 | 54 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -42,10 +42,12 @@ | |
| 42 | circles appear, but no lines connecting them. |
| 43 | ([/timeline?ng|example]). |
| 44 | </ol> |
| 45 | <li> The [/help/timeline|timeline command] is enhanced with the new |
| 46 | "<tt>-u|--for-user</tt>" option. |
| 47 | </ol> |
| 48 | |
| 49 | <h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol> |
| 50 | <li> Close a potential Denial-of-Service attack against any public-facing Fossil |
| 51 | server involving exponential behavior in Fossil's regexp implementation. |
| 52 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -42,10 +42,12 @@ | |
| 42 | circles appear, but no lines connecting them. |
| 43 | ([/timeline?ng|example]). |
| 44 | </ol> |
| 45 | <li> The [/help/timeline|timeline command] is enhanced with the new |
| 46 | "<tt>-u|--for-user</tt>" option. |
| 47 | <li> The [/help/open|the open command]'s new "<tt>--reopen REPOFILE</tt>" flag |
| 48 | can be used to fix a checkout after moving its repository file. |
| 49 | </ol> |
| 50 | |
| 51 | <h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol> |
| 52 | <li> Close a potential Denial-of-Service attack against any public-facing Fossil |
| 53 | server involving exponential behavior in Fossil's regexp implementation. |
| 54 |