Fossil SCM

Implicitly set "fossil open --nosync" when the autosync setting is off, either globally or on the just-opened repo. This is on a branch because I don't know whether the dance involving global versus repo settings is overly complicated or *just complicated enough*. The current formulation seems both necessary and sufficient in my local testing here, but I'm hoping there's a shorter formulation that does the same thing.

wyoung 2022-04-15 11:34 trunk
Commit 9f42fc44c6719f099d8f422a384e99ff7202364e1a9dabab5ba41f1d3590e2bc
1 file changed +7 -1
+7 -1
--- src/db.c
+++ src/db.c
@@ -3624,11 +3624,12 @@
36243624
** -f|--force Continue with the open even if the working directory is
36253625
** not empty.
36263626
** --force-missing Force opening a repository with missing content
36273627
** -k|--keep Only modify the manifest and manifest.uuid files
36283628
** --nested Allow opening a repository inside an opened checkout
3629
-** --nosync Do not auto-sync the repository prior to opening
3629
+** --nosync If autosync is on or set to pullonly, skip that step
3630
+** prior to opening the repository
36303631
** --repodir DIR If REPOSITORY is a URI that will be cloned, store
36313632
** the clone in DIR rather than in "."
36323633
** --setmtime Set timestamps of all files to match their SCM-side
36333634
** times (the timestamp of the last checkin which modified
36343635
** them).
@@ -3653,10 +3654,11 @@
36533654
char *zPwd; /* Initial working directory */
36543655
int isUri = 0; /* True if REPOSITORY is a URI */
36553656
int nLocal; /* Number of preexisting files in cwd */
36563657
int bNosync = 0; /* --nosync. Omit auto-sync */
36573658
int bVerbose = 0; /* --verbose option for clone */
3659
+ const char *zGAutosync; /* global (pre-open) autosync setting */
36583660
36593661
url_proxy_options();
36603662
emptyFlag = find_option("empty",0,0)!=0;
36613663
keepFlag = find_option("keep","k",0)!=0;
36623664
forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3756,20 +3758,24 @@
37563758
fossil_fatal("the --repodir option only makes sense if the REPOSITORY "
37573759
"argument is a URI that begins with http:, https:, ssh:, "
37583760
"or file:");
37593761
}
37603762
3763
+ db_open_config(0, 0);
3764
+ zGAutosync = db_get("autosync", 0);
37613765
db_open_repository(zRepo);
37623766
37633767
/* Figure out which revision to open. */
37643768
if( !emptyFlag ){
3769
+ const char *zAutosync = db_get("autosync", zGAutosync);
37653770
if( g.argc==4 ){
37663771
g.zOpenRevision = g.argv[3];
37673772
}else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
37683773
g.zOpenRevision = db_get("main-branch", 0);
37693774
}
37703775
if( !bNosync
3776
+ && (!zAutosync || !is_false(zAutosync))
37713777
&& autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1)
37723778
&& !bForce
37733779
){
37743780
fossil_fatal("unable to auto-sync the repository");
37753781
}
37763782
--- src/db.c
+++ src/db.c
@@ -3624,11 +3624,12 @@
3624 ** -f|--force Continue with the open even if the working directory is
3625 ** not empty.
3626 ** --force-missing Force opening a repository with missing content
3627 ** -k|--keep Only modify the manifest and manifest.uuid files
3628 ** --nested Allow opening a repository inside an opened checkout
3629 ** --nosync Do not auto-sync the repository prior to opening
 
3630 ** --repodir DIR If REPOSITORY is a URI that will be cloned, store
3631 ** the clone in DIR rather than in "."
3632 ** --setmtime Set timestamps of all files to match their SCM-side
3633 ** times (the timestamp of the last checkin which modified
3634 ** them).
@@ -3653,10 +3654,11 @@
3653 char *zPwd; /* Initial working directory */
3654 int isUri = 0; /* True if REPOSITORY is a URI */
3655 int nLocal; /* Number of preexisting files in cwd */
3656 int bNosync = 0; /* --nosync. Omit auto-sync */
3657 int bVerbose = 0; /* --verbose option for clone */
 
3658
3659 url_proxy_options();
3660 emptyFlag = find_option("empty",0,0)!=0;
3661 keepFlag = find_option("keep","k",0)!=0;
3662 forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3756,20 +3758,24 @@
3756 fossil_fatal("the --repodir option only makes sense if the REPOSITORY "
3757 "argument is a URI that begins with http:, https:, ssh:, "
3758 "or file:");
3759 }
3760
 
 
3761 db_open_repository(zRepo);
3762
3763 /* Figure out which revision to open. */
3764 if( !emptyFlag ){
 
3765 if( g.argc==4 ){
3766 g.zOpenRevision = g.argv[3];
3767 }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
3768 g.zOpenRevision = db_get("main-branch", 0);
3769 }
3770 if( !bNosync
 
3771 && autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1)
3772 && !bForce
3773 ){
3774 fossil_fatal("unable to auto-sync the repository");
3775 }
3776
--- src/db.c
+++ src/db.c
@@ -3624,11 +3624,12 @@
3624 ** -f|--force Continue with the open even if the working directory is
3625 ** not empty.
3626 ** --force-missing Force opening a repository with missing content
3627 ** -k|--keep Only modify the manifest and manifest.uuid files
3628 ** --nested Allow opening a repository inside an opened checkout
3629 ** --nosync If autosync is on or set to pullonly, skip that step
3630 ** prior to opening the repository
3631 ** --repodir DIR If REPOSITORY is a URI that will be cloned, store
3632 ** the clone in DIR rather than in "."
3633 ** --setmtime Set timestamps of all files to match their SCM-side
3634 ** times (the timestamp of the last checkin which modified
3635 ** them).
@@ -3653,10 +3654,11 @@
3654 char *zPwd; /* Initial working directory */
3655 int isUri = 0; /* True if REPOSITORY is a URI */
3656 int nLocal; /* Number of preexisting files in cwd */
3657 int bNosync = 0; /* --nosync. Omit auto-sync */
3658 int bVerbose = 0; /* --verbose option for clone */
3659 const char *zGAutosync; /* global (pre-open) autosync setting */
3660
3661 url_proxy_options();
3662 emptyFlag = find_option("empty",0,0)!=0;
3663 keepFlag = find_option("keep","k",0)!=0;
3664 forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3756,20 +3758,24 @@
3758 fossil_fatal("the --repodir option only makes sense if the REPOSITORY "
3759 "argument is a URI that begins with http:, https:, ssh:, "
3760 "or file:");
3761 }
3762
3763 db_open_config(0, 0);
3764 zGAutosync = db_get("autosync", 0);
3765 db_open_repository(zRepo);
3766
3767 /* Figure out which revision to open. */
3768 if( !emptyFlag ){
3769 const char *zAutosync = db_get("autosync", zGAutosync);
3770 if( g.argc==4 ){
3771 g.zOpenRevision = g.argv[3];
3772 }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
3773 g.zOpenRevision = db_get("main-branch", 0);
3774 }
3775 if( !bNosync
3776 && (!zAutosync || !is_false(zAutosync))
3777 && autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1)
3778 && !bForce
3779 ){
3780 fossil_fatal("unable to auto-sync the repository");
3781 }
3782

Keyboard Shortcuts

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