Fossil SCM
Auto-sync prior to running "fossil open". Add the --nosync flags to "fossil open" and "fossil up" to disable the auto-sync.
Commit
dc97155ec768992c5e2c566c7985b412eb2c379ab84618288d1bf3da24cc7dc0
Parent
f0b08d071a6d359…
2 files changed
+9
+20
-17
M
src/db.c
+9
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -3503,10 +3503,11 @@ | ||
| 3503 | 3503 | ** -f|--force Continue with the open even if the working directory is |
| 3504 | 3504 | ** not empty. |
| 3505 | 3505 | ** --force-missing Force opening a repository with missing content |
| 3506 | 3506 | ** --keep Only modify the manifest and manifest.uuid files |
| 3507 | 3507 | ** --nested Allow opening a repository inside an opened checkout |
| 3508 | +** --nosync Do not auto-sync the repository prior to opening | |
| 3508 | 3509 | ** --repodir DIR If REPOSITORY is a URI that will be cloned, store |
| 3509 | 3510 | ** the clone in DIR rather than in "." |
| 3510 | 3511 | ** --setmtime Set timestamps of all files to match their SCM-side |
| 3511 | 3512 | ** times (the timestamp of the last checkin which modified |
| 3512 | 3513 | ** them). |
| @@ -3527,10 +3528,11 @@ | ||
| 3527 | 3528 | const char *zRepo = 0; /* Name of the repository file */ |
| 3528 | 3529 | const char *zRepoDir = 0; /* --repodir value */ |
| 3529 | 3530 | char *zPwd; /* Initial working directory */ |
| 3530 | 3531 | int isUri = 0; /* True if REPOSITORY is a URI */ |
| 3531 | 3532 | int nLocal; /* Number of preexisting files in cwd */ |
| 3533 | + int bNosync = 0; /* --nosync. Omit auto-sync */ | |
| 3532 | 3534 | |
| 3533 | 3535 | url_proxy_options(); |
| 3534 | 3536 | emptyFlag = find_option("empty",0,0)!=0; |
| 3535 | 3537 | keepFlag = find_option("keep",0,0)!=0; |
| 3536 | 3538 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| @@ -3537,10 +3539,11 @@ | ||
| 3537 | 3539 | allowNested = find_option("nested",0,0)!=0; |
| 3538 | 3540 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 3539 | 3541 | zWorkDir = find_option("workdir",0,1); |
| 3540 | 3542 | zRepoDir = find_option("repodir",0,1); |
| 3541 | 3543 | bForce = find_option("force","f",0)!=0; |
| 3544 | + bNosync = find_option("nosync",0,0)!=0; | |
| 3542 | 3545 | zPwd = file_getcwd(0,0); |
| 3543 | 3546 | |
| 3544 | 3547 | |
| 3545 | 3548 | /* We should be done with options.. */ |
| 3546 | 3549 | verify_all_options(); |
| @@ -3632,10 +3635,16 @@ | ||
| 3632 | 3635 | if( g.argc==4 ){ |
| 3633 | 3636 | g.zOpenRevision = g.argv[3]; |
| 3634 | 3637 | }else if( db_exists("SELECT 1 FROM event WHERE type='ci'") ){ |
| 3635 | 3638 | g.zOpenRevision = db_get("main-branch", 0); |
| 3636 | 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 | + } | |
| 3637 | 3646 | } |
| 3638 | 3647 | |
| 3639 | 3648 | |
| 3640 | 3649 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 3641 | 3650 | # define LOCALDB_NAME "./_FOSSIL_" |
| 3642 | 3651 |
| --- 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 @@ | ||
| 91 | 91 | ** |
| 92 | 92 | ** The -v or --verbose option prints status information about |
| 93 | 93 | ** unchanged files in addition to those file that actually do change. |
| 94 | 94 | ** |
| 95 | 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. | |
| 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). | |
| 112 | 113 | ** |
| 113 | 114 | ** See also: [[revert]] |
| 114 | 115 | */ |
| 115 | 116 | void update_cmd(void){ |
| 116 | 117 | int vid; /* Current version */ |
| @@ -127,10 +128,11 @@ | ||
| 127 | 128 | int *aChng; /* Array of file renames */ |
| 128 | 129 | int i; /* Loop counter */ |
| 129 | 130 | int nConflict = 0; /* Number of merge conflicts */ |
| 130 | 131 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 131 | 132 | int nUpdate = 0; /* Number of changes of any kind */ |
| 133 | + int bNosync = 0; /* --nosync. Omit the auto-sync */ | |
| 132 | 134 | int width; /* Width of printed comment lines */ |
| 133 | 135 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 134 | 136 | const char *zWidth; /* Width option string value */ |
| 135 | 137 | |
| 136 | 138 | if( !internalUpdate ){ |
| @@ -154,18 +156,19 @@ | ||
| 154 | 156 | verboseFlag = find_option("verbose","v",0)!=0; |
| 155 | 157 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 156 | 158 | debugFlag = find_option("debug",0,0)!=0; |
| 157 | 159 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 158 | 160 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 161 | + bNosync = find_option("nosync",0,0)!=0; | |
| 159 | 162 | |
| 160 | 163 | /* We should be done with options.. */ |
| 161 | 164 | verify_all_options(); |
| 162 | 165 | |
| 163 | 166 | db_must_be_within_tree(); |
| 164 | 167 | vid = db_lget_int("checkout", 0); |
| 165 | 168 | user_select(); |
| 166 | - if( !dryRunFlag && !internalUpdate ){ | |
| 169 | + if( !dryRunFlag && !internalUpdate && !bNosync ){ | |
| 167 | 170 | if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag, |
| 168 | 171 | db_get_int("autosync-tries", 1), 1) ){ |
| 169 | 172 | fossil_fatal("update abandoned due to sync failure"); |
| 170 | 173 | } |
| 171 | 174 | } |
| 172 | 175 |
| --- 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 |