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.

stephan 2025-10-21 14:38 trunk
Commit ae8a45c7a7feba799e889de25da5f2a6683d1f89f5b07dd8964ca1b2bd685516
2 files changed +12 +2
+12
--- src/db.c
+++ src/db.c
@@ -4260,10 +4260,13 @@
42604260
** them).
42614261
** --verbose If passed a URI then this flag is passed on to the clone
42624262
** operation, otherwise it has no effect
42634263
** --workdir DIR Use DIR as the working directory instead of ".". The DIR
42644264
** 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.
42654268
**
42664269
** See also: [[close]], [[clone]]
42674270
*/
42684271
void cmd_open(void){
42694272
int emptyFlag;
@@ -4274,14 +4277,23 @@
42744277
int bForce = 0; /* --force. Open even if non-empty dir */
42754278
static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0, 0 };
42764279
const char *zWorkDir; /* --workdir value */
42774280
const char *zRepo = 0; /* Name of the repository file */
42784281
const char *zRepoDir = 0; /* --repodir value */
4282
+ const char *zReopen = 0; /* --reopen REPOFILE */
42794283
char *zPwd; /* Initial working directory */
42804284
int isUri = 0; /* True if REPOSITORY is a URI */
42814285
int nLocal; /* Number of preexisting files in cwd */
42824286
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
+ }
42834295
42844296
url_proxy_options();
42854297
emptyFlag = find_option("empty",0,0)!=0;
42864298
keepFlag = find_option("keep","k",0)!=0;
42874299
forceMissingFlag = find_option("force-missing",0,0)!=0;
42884300
--- 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
--- www/changes.wiki
+++ www/changes.wiki
@@ -42,10 +42,12 @@
4242
circles appear, but no lines connecting them.
4343
([/timeline?ng|example]).
4444
</ol>
4545
<li> The [/help/timeline|timeline command] is enhanced with the new
4646
"<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.
4749
</ol>
4850
4951
<h2 id='v2_27'>Changes for version 2.27 (2025-09-30)</h2><ol>
5052
<li> Close a potential Denial-of-Service attack against any public-facing Fossil
5153
server involving exponential behavior in Fossil's regexp implementation.
5254
--- 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

Keyboard Shortcuts

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