Fossil SCM
Add http authorisation to UPDATE command
Commit
4e4ae18fc5d87f2e7842757f13e0a20c83f4d1cfc6bafc7bc498b77766c8b9c2
Parent
f815d4820d389dd…
2 files changed
+1
-1
+5
+1
-1
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -186,11 +186,11 @@ | ||
| 186 | 186 | if( g.url.user!=0 && g.url.passwd==0 ){ |
| 187 | 187 | g.url.passwd = unobscure(db_get("last-sync-pw", 0)); |
| 188 | 188 | g.url.flags |= URL_PROMPT_PW; |
| 189 | 189 | url_prompt_for_password(); |
| 190 | 190 | } |
| 191 | - g.zHttpAuth = get_httpauth(); | |
| 191 | + if( g.zHttpAuth==0 ) g.zHttpAuth = get_httpauth(); | |
| 192 | 192 | if( sqlite3_strglob("*all*", zAutosync)==0 ){ |
| 193 | 193 | rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0); |
| 194 | 194 | }else{ |
| 195 | 195 | url_remember(); |
| 196 | 196 | sync_explain(flags); |
| 197 | 197 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -186,11 +186,11 @@ | |
| 186 | if( g.url.user!=0 && g.url.passwd==0 ){ |
| 187 | g.url.passwd = unobscure(db_get("last-sync-pw", 0)); |
| 188 | g.url.flags |= URL_PROMPT_PW; |
| 189 | url_prompt_for_password(); |
| 190 | } |
| 191 | g.zHttpAuth = get_httpauth(); |
| 192 | if( sqlite3_strglob("*all*", zAutosync)==0 ){ |
| 193 | rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0); |
| 194 | }else{ |
| 195 | url_remember(); |
| 196 | sync_explain(flags); |
| 197 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -186,11 +186,11 @@ | |
| 186 | if( g.url.user!=0 && g.url.passwd==0 ){ |
| 187 | g.url.passwd = unobscure(db_get("last-sync-pw", 0)); |
| 188 | g.url.flags |= URL_PROMPT_PW; |
| 189 | url_prompt_for_password(); |
| 190 | } |
| 191 | if( g.zHttpAuth==0 ) g.zHttpAuth = get_httpauth(); |
| 192 | if( sqlite3_strglob("*all*", zAutosync)==0 ){ |
| 193 | rc = client_sync_all_urls(flags|SYNC_ALLURL, configSync, 0, 0); |
| 194 | }else{ |
| 195 | url_remember(); |
| 196 | sync_explain(flags); |
| 197 |
+5
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -91,10 +91,12 @@ | ||
| 91 | 91 | ** |
| 92 | 92 | ** The -v or --verbose option prints status information about |
| 93 | 93 | ** unchanged files in addition to those files that actually do change. |
| 94 | 94 | ** |
| 95 | 95 | ** Options: |
| 96 | +** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol, | |
| 97 | +** if required by the remote site | |
| 96 | 98 | ** --case-sensitive BOOL Override case-sensitive setting |
| 97 | 99 | ** --debug Print debug information on stdout |
| 98 | 100 | ** -n|--dry-run If given, display instead of run actions |
| 99 | 101 | ** --force-missing Force update if missing content after sync |
| 100 | 102 | ** -K|--keep-merge-files On merge conflict, retain the temporary files |
| @@ -133,10 +135,11 @@ | ||
| 133 | 135 | int nUpdate = 0; /* Number of changes of any kind */ |
| 134 | 136 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 135 | 137 | int width; /* Width of printed comment lines */ |
| 136 | 138 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 137 | 139 | const char *zWidth; /* Width option string value */ |
| 140 | + const char *zHttpAuth; /* --httpauth USER:PASS for the autosync */ | |
| 138 | 141 | const char *zCurBrName; /* Current branch name */ |
| 139 | 142 | const char *zNewBrName; /* New branch name */ |
| 140 | 143 | const char *zBrChgMsg = ""; /* Message to display if branch changes */ |
| 141 | 144 | |
| 142 | 145 | if( !internalUpdate ){ |
| @@ -161,10 +164,12 @@ | ||
| 161 | 164 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 162 | 165 | debugFlag = find_option("debug",0,0)!=0; |
| 163 | 166 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 164 | 167 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 165 | 168 | bNosync = find_option("nosync",0,0)!=0; |
| 169 | + zHttpAuth = find_option("httpauth","B",1); | |
| 170 | + if( zHttpAuth && zHttpAuth[0] ) g.zHttpAuth = fossil_strdup(zHttpAuth); | |
| 166 | 171 | |
| 167 | 172 | /* We should be done with options.. */ |
| 168 | 173 | verify_all_options(); |
| 169 | 174 | |
| 170 | 175 | db_must_be_within_tree(); |
| 171 | 176 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -91,10 +91,12 @@ | |
| 91 | ** |
| 92 | ** The -v or --verbose option prints status information about |
| 93 | ** unchanged files in addition to those files 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 |
| @@ -133,10 +135,11 @@ | |
| 133 | int nUpdate = 0; /* Number of changes of any kind */ |
| 134 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 135 | int width; /* Width of printed comment lines */ |
| 136 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 137 | const char *zWidth; /* Width option string value */ |
| 138 | const char *zCurBrName; /* Current branch name */ |
| 139 | const char *zNewBrName; /* New branch name */ |
| 140 | const char *zBrChgMsg = ""; /* Message to display if branch changes */ |
| 141 | |
| 142 | if( !internalUpdate ){ |
| @@ -161,10 +164,12 @@ | |
| 161 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 162 | debugFlag = find_option("debug",0,0)!=0; |
| 163 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 164 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 165 | bNosync = find_option("nosync",0,0)!=0; |
| 166 | |
| 167 | /* We should be done with options.. */ |
| 168 | verify_all_options(); |
| 169 | |
| 170 | db_must_be_within_tree(); |
| 171 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -91,10 +91,12 @@ | |
| 91 | ** |
| 92 | ** The -v or --verbose option prints status information about |
| 93 | ** unchanged files in addition to those files that actually do change. |
| 94 | ** |
| 95 | ** Options: |
| 96 | ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol, |
| 97 | ** if required by the remote site |
| 98 | ** --case-sensitive BOOL Override case-sensitive setting |
| 99 | ** --debug Print debug information on stdout |
| 100 | ** -n|--dry-run If given, display instead of run actions |
| 101 | ** --force-missing Force update if missing content after sync |
| 102 | ** -K|--keep-merge-files On merge conflict, retain the temporary files |
| @@ -133,10 +135,11 @@ | |
| 135 | int nUpdate = 0; /* Number of changes of any kind */ |
| 136 | int bNosync = 0; /* --nosync. Omit the auto-sync */ |
| 137 | int width; /* Width of printed comment lines */ |
| 138 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 139 | const char *zWidth; /* Width option string value */ |
| 140 | const char *zHttpAuth; /* --httpauth USER:PASS for the autosync */ |
| 141 | const char *zCurBrName; /* Current branch name */ |
| 142 | const char *zNewBrName; /* New branch name */ |
| 143 | const char *zBrChgMsg = ""; /* Message to display if branch changes */ |
| 144 | |
| 145 | if( !internalUpdate ){ |
| @@ -161,10 +164,12 @@ | |
| 164 | forceMissingFlag = find_option("force-missing",0,0)!=0; |
| 165 | debugFlag = find_option("debug",0,0)!=0; |
| 166 | setmtimeFlag = find_option("setmtime",0,0)!=0; |
| 167 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 168 | bNosync = find_option("nosync",0,0)!=0; |
| 169 | zHttpAuth = find_option("httpauth","B",1); |
| 170 | if( zHttpAuth && zHttpAuth[0] ) g.zHttpAuth = fossil_strdup(zHttpAuth); |
| 171 | |
| 172 | /* We should be done with options.. */ |
| 173 | verify_all_options(); |
| 174 | |
| 175 | db_must_be_within_tree(); |
| 176 |