Fossil SCM

Auto-sync prior to running "fossil open". Add the --nosync flags to "fossil open" and "fossil up" to disable the auto-sync.

drh 2021-07-09 16:15 trunk
Commit dc97155ec768992c5e2c566c7985b412eb2c379ab84618288d1bf3da24cc7dc0
2 files changed +9 +20 -17
+9
--- src/db.c
+++ src/db.c
@@ -3503,10 +3503,11 @@
35033503
** -f|--force Continue with the open even if the working directory is
35043504
** not empty.
35053505
** --force-missing Force opening a repository with missing content
35063506
** --keep Only modify the manifest and manifest.uuid files
35073507
** --nested Allow opening a repository inside an opened checkout
3508
+** --nosync Do not auto-sync the repository prior to opening
35083509
** --repodir DIR If REPOSITORY is a URI that will be cloned, store
35093510
** the clone in DIR rather than in "."
35103511
** --setmtime Set timestamps of all files to match their SCM-side
35113512
** times (the timestamp of the last checkin which modified
35123513
** them).
@@ -3527,10 +3528,11 @@
35273528
const char *zRepo = 0; /* Name of the repository file */
35283529
const char *zRepoDir = 0; /* --repodir value */
35293530
char *zPwd; /* Initial working directory */
35303531
int isUri = 0; /* True if REPOSITORY is a URI */
35313532
int nLocal; /* Number of preexisting files in cwd */
3533
+ int bNosync = 0; /* --nosync. Omit auto-sync */
35323534
35333535
url_proxy_options();
35343536
emptyFlag = find_option("empty",0,0)!=0;
35353537
keepFlag = find_option("keep",0,0)!=0;
35363538
forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3537,10 +3539,11 @@
35373539
allowNested = find_option("nested",0,0)!=0;
35383540
setmtimeFlag = find_option("setmtime",0,0)!=0;
35393541
zWorkDir = find_option("workdir",0,1);
35403542
zRepoDir = find_option("repodir",0,1);
35413543
bForce = find_option("force","f",0)!=0;
3544
+ bNosync = find_option("nosync",0,0)!=0;
35423545
zPwd = file_getcwd(0,0);
35433546
35443547
35453548
/* We should be done with options.. */
35463549
verify_all_options();
@@ -3632,10 +3635,16 @@
36323635
if( g.argc==4 ){
36333636
g.zOpenRevision = g.argv[3];
36343637
}else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
36353638
g.zOpenRevision = db_get("main-branch", 0);
36363639
}
3640
+ if( !bNosync
3641
+ && autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1)
3642
+ && !bForce
3643
+ ){
3644
+ fossil_fatal("unable to auto-sync the repository");
3645
+ }
36373646
}
36383647
36393648
36403649
#if defined(_WIN32) || defined(__CYGWIN__)
36413650
# define LOCALDB_NAME "./_FOSSIL_"
36423651
--- src/db.c
+++ src/db.c
@@ -3503,10 +3503,11 @@
3503 ** -f|--force Continue with the open even if the working directory is
3504 ** not empty.
3505 ** --force-missing Force opening a repository with missing content
3506 ** --keep Only modify the manifest and manifest.uuid files
3507 ** --nested Allow opening a repository inside an opened checkout
 
3508 ** --repodir DIR If REPOSITORY is a URI that will be cloned, store
3509 ** the clone in DIR rather than in "."
3510 ** --setmtime Set timestamps of all files to match their SCM-side
3511 ** times (the timestamp of the last checkin which modified
3512 ** them).
@@ -3527,10 +3528,11 @@
3527 const char *zRepo = 0; /* Name of the repository file */
3528 const char *zRepoDir = 0; /* --repodir value */
3529 char *zPwd; /* Initial working directory */
3530 int isUri = 0; /* True if REPOSITORY is a URI */
3531 int nLocal; /* Number of preexisting files in cwd */
 
3532
3533 url_proxy_options();
3534 emptyFlag = find_option("empty",0,0)!=0;
3535 keepFlag = find_option("keep",0,0)!=0;
3536 forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3537,10 +3539,11 @@
3537 allowNested = find_option("nested",0,0)!=0;
3538 setmtimeFlag = find_option("setmtime",0,0)!=0;
3539 zWorkDir = find_option("workdir",0,1);
3540 zRepoDir = find_option("repodir",0,1);
3541 bForce = find_option("force","f",0)!=0;
 
3542 zPwd = file_getcwd(0,0);
3543
3544
3545 /* We should be done with options.. */
3546 verify_all_options();
@@ -3632,10 +3635,16 @@
3632 if( g.argc==4 ){
3633 g.zOpenRevision = g.argv[3];
3634 }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
3635 g.zOpenRevision = db_get("main-branch", 0);
3636 }
 
 
 
 
 
 
3637 }
3638
3639
3640 #if defined(_WIN32) || defined(__CYGWIN__)
3641 # define LOCALDB_NAME "./_FOSSIL_"
3642
--- src/db.c
+++ src/db.c
@@ -3503,10 +3503,11 @@
3503 ** -f|--force Continue with the open even if the working directory is
3504 ** not empty.
3505 ** --force-missing Force opening a repository with missing content
3506 ** --keep Only modify the manifest and manifest.uuid files
3507 ** --nested Allow opening a repository inside an opened checkout
3508 ** --nosync Do not auto-sync the repository prior to opening
3509 ** --repodir DIR If REPOSITORY is a URI that will be cloned, store
3510 ** the clone in DIR rather than in "."
3511 ** --setmtime Set timestamps of all files to match their SCM-side
3512 ** times (the timestamp of the last checkin which modified
3513 ** them).
@@ -3527,10 +3528,11 @@
3528 const char *zRepo = 0; /* Name of the repository file */
3529 const char *zRepoDir = 0; /* --repodir value */
3530 char *zPwd; /* Initial working directory */
3531 int isUri = 0; /* True if REPOSITORY is a URI */
3532 int nLocal; /* Number of preexisting files in cwd */
3533 int bNosync = 0; /* --nosync. Omit auto-sync */
3534
3535 url_proxy_options();
3536 emptyFlag = find_option("empty",0,0)!=0;
3537 keepFlag = find_option("keep",0,0)!=0;
3538 forceMissingFlag = find_option("force-missing",0,0)!=0;
@@ -3537,10 +3539,11 @@
3539 allowNested = find_option("nested",0,0)!=0;
3540 setmtimeFlag = find_option("setmtime",0,0)!=0;
3541 zWorkDir = find_option("workdir",0,1);
3542 zRepoDir = find_option("repodir",0,1);
3543 bForce = find_option("force","f",0)!=0;
3544 bNosync = find_option("nosync",0,0)!=0;
3545 zPwd = file_getcwd(0,0);
3546
3547
3548 /* We should be done with options.. */
3549 verify_all_options();
@@ -3632,10 +3635,16 @@
3635 if( g.argc==4 ){
3636 g.zOpenRevision = g.argv[3];
3637 }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){
3638 g.zOpenRevision = db_get("main-branch", 0);
3639 }
3640 if( !bNosync
3641 && autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1)
3642 && !bForce
3643 ){
3644 fossil_fatal("unable to auto-sync the repository");
3645 }
3646 }
3647
3648
3649 #if defined(_WIN32) || defined(__CYGWIN__)
3650 # define LOCALDB_NAME "./_FOSSIL_"
3651
+20 -17
--- src/update.c
+++ src/update.c
@@ -91,26 +91,27 @@
9191
**
9292
** The -v or --verbose option prints status information about
9393
** unchanged files in addition to those file that actually do change.
9494
**
9595
** Options:
96
-** --case-sensitive BOOL Override case-sensitive setting
97
-** --debug Print debug information on stdout
98
-** --latest Acceptable in place of VERSION, update to
99
-** latest version
100
-** --force-missing Force update if missing content after sync
101
-** -n|--dry-run If given, display instead of run actions
102
-** -v|--verbose Print status information about all files
103
-** -W|--width WIDTH Width of lines (default is to auto-detect).
104
-** Must be more than 20 or 0 (= no limit,
105
-** resulting in a single line per entry).
106
-** --setmtime Set timestamps of all files to match their
107
-** SCM-side times (the timestamp of the last
108
-** checkin which modified them).
109
-** -K|--keep-merge-files On merge conflict, retain the temporary files
110
-** used for merging, named *-baseline, *-original,
111
-** and *-merge.
96
+** --case-sensitive BOOL Override case-sensitive setting
97
+** --debug Print debug information on stdout
98
+** -n|--dry-run If given, display instead of run actions
99
+** --force-missing Force update if missing content after sync
100
+** -K|--keep-merge-files On merge conflict, retain the temporary files
101
+** used for merging, named *-baseline, *-original,
102
+** and *-merge.
103
+** --latest Acceptable in place of VERSION, update to
104
+** latest version
105
+** --nosync Do not auto-sync prior to update
106
+** --setmtime Set timestamps of all files to match their
107
+** SCM-side times (the timestamp of the last
108
+** checkin which modified them).
109
+** -v|--verbose Print status information about all files
110
+** -W|--width WIDTH Width of lines (default is to auto-detect).
111
+** Must be more than 20 or 0 (= no limit,
112
+** resulting in a single line per entry).
112113
**
113114
** See also: [[revert]]
114115
*/
115116
void update_cmd(void){
116117
int vid; /* Current version */
@@ -127,10 +128,11 @@
127128
int *aChng; /* Array of file renames */
128129
int i; /* Loop counter */
129130
int nConflict = 0; /* Number of merge conflicts */
130131
int nOverwrite = 0; /* Number of unmanaged files overwritten */
131132
int nUpdate = 0; /* Number of changes of any kind */
133
+ int bNosync = 0; /* --nosync. Omit the auto-sync */
132134
int width; /* Width of printed comment lines */
133135
Stmt mtimeXfer; /* Statement to transfer mtimes */
134136
const char *zWidth; /* Width option string value */
135137
136138
if( !internalUpdate ){
@@ -154,18 +156,19 @@
154156
verboseFlag = find_option("verbose","v",0)!=0;
155157
forceMissingFlag = find_option("force-missing",0,0)!=0;
156158
debugFlag = find_option("debug",0,0)!=0;
157159
setmtimeFlag = find_option("setmtime",0,0)!=0;
158160
keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
161
+ bNosync = find_option("nosync",0,0)!=0;
159162
160163
/* We should be done with options.. */
161164
verify_all_options();
162165
163166
db_must_be_within_tree();
164167
vid = db_lget_int("checkout", 0);
165168
user_select();
166
- if( !dryRunFlag && !internalUpdate ){
169
+ if( !dryRunFlag && !internalUpdate && !bNosync ){
167170
if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
168171
db_get_int("autosync-tries", 1), 1) ){
169172
fossil_fatal("update abandoned due to sync failure");
170173
}
171174
}
172175
--- src/update.c
+++ src/update.c
@@ -91,26 +91,27 @@
91 **
92 ** The -v or --verbose option prints status information about
93 ** unchanged files in addition to those file that actually do change.
94 **
95 ** Options:
96 ** --case-sensitive BOOL Override case-sensitive setting
97 ** --debug Print debug information on stdout
98 ** --latest Acceptable in place of VERSION, update to
99 ** latest version
100 ** --force-missing Force update if missing content after sync
101 ** -n|--dry-run If given, display instead of run actions
102 ** -v|--verbose Print status information about all files
103 ** -W|--width WIDTH Width of lines (default is to auto-detect).
104 ** Must be more than 20 or 0 (= no limit,
105 ** resulting in a single line per entry).
106 ** --setmtime Set timestamps of all files to match their
107 ** SCM-side times (the timestamp of the last
108 ** checkin which modified them).
109 ** -K|--keep-merge-files On merge conflict, retain the temporary files
110 ** used for merging, named *-baseline, *-original,
111 ** and *-merge.
 
112 **
113 ** See also: [[revert]]
114 */
115 void update_cmd(void){
116 int vid; /* Current version */
@@ -127,10 +128,11 @@
127 int *aChng; /* Array of file renames */
128 int i; /* Loop counter */
129 int nConflict = 0; /* Number of merge conflicts */
130 int nOverwrite = 0; /* Number of unmanaged files overwritten */
131 int nUpdate = 0; /* Number of changes of any kind */
 
132 int width; /* Width of printed comment lines */
133 Stmt mtimeXfer; /* Statement to transfer mtimes */
134 const char *zWidth; /* Width option string value */
135
136 if( !internalUpdate ){
@@ -154,18 +156,19 @@
154 verboseFlag = find_option("verbose","v",0)!=0;
155 forceMissingFlag = find_option("force-missing",0,0)!=0;
156 debugFlag = find_option("debug",0,0)!=0;
157 setmtimeFlag = find_option("setmtime",0,0)!=0;
158 keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
 
159
160 /* We should be done with options.. */
161 verify_all_options();
162
163 db_must_be_within_tree();
164 vid = db_lget_int("checkout", 0);
165 user_select();
166 if( !dryRunFlag && !internalUpdate ){
167 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
168 db_get_int("autosync-tries", 1), 1) ){
169 fossil_fatal("update abandoned due to sync failure");
170 }
171 }
172
--- src/update.c
+++ src/update.c
@@ -91,26 +91,27 @@
91 **
92 ** The -v or --verbose option prints status information about
93 ** unchanged files in addition to those file that actually do change.
94 **
95 ** Options:
96 ** --case-sensitive BOOL Override case-sensitive setting
97 ** --debug Print debug information on stdout
98 ** -n|--dry-run If given, display instead of run actions
99 ** --force-missing Force update if missing content after sync
100 ** -K|--keep-merge-files On merge conflict, retain the temporary files
101 ** used for merging, named *-baseline, *-original,
102 ** and *-merge.
103 ** --latest Acceptable in place of VERSION, update to
104 ** latest version
105 ** --nosync Do not auto-sync prior to update
106 ** --setmtime Set timestamps of all files to match their
107 ** SCM-side times (the timestamp of the last
108 ** checkin which modified them).
109 ** -v|--verbose Print status information about all files
110 ** -W|--width WIDTH Width of lines (default is to auto-detect).
111 ** Must be more than 20 or 0 (= no limit,
112 ** resulting in a single line per entry).
113 **
114 ** See also: [[revert]]
115 */
116 void update_cmd(void){
117 int vid; /* Current version */
@@ -127,10 +128,11 @@
128 int *aChng; /* Array of file renames */
129 int i; /* Loop counter */
130 int nConflict = 0; /* Number of merge conflicts */
131 int nOverwrite = 0; /* Number of unmanaged files overwritten */
132 int nUpdate = 0; /* Number of changes of any kind */
133 int bNosync = 0; /* --nosync. Omit the auto-sync */
134 int width; /* Width of printed comment lines */
135 Stmt mtimeXfer; /* Statement to transfer mtimes */
136 const char *zWidth; /* Width option string value */
137
138 if( !internalUpdate ){
@@ -154,18 +156,19 @@
156 verboseFlag = find_option("verbose","v",0)!=0;
157 forceMissingFlag = find_option("force-missing",0,0)!=0;
158 debugFlag = find_option("debug",0,0)!=0;
159 setmtimeFlag = find_option("setmtime",0,0)!=0;
160 keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
161 bNosync = find_option("nosync",0,0)!=0;
162
163 /* We should be done with options.. */
164 verify_all_options();
165
166 db_must_be_within_tree();
167 vid = db_lget_int("checkout", 0);
168 user_select();
169 if( !dryRunFlag && !internalUpdate && !bNosync ){
170 if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
171 db_get_int("autosync-tries", 1), 1) ){
172 fossil_fatal("update abandoned due to sync failure");
173 }
174 }
175

Keyboard Shortcuts

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