Fossil SCM
Add the --once command-line option to push, pull, and sync. Ticket [2aaa8042caec]
Commit
5153d618937eb274b06a5cb2ae93fa0832157575
Parent
fe8bb01d38d17c4…
1 file changed
+28
-4
+28
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -71,10 +71,11 @@ | ||
| 71 | 71 | ** most recently synced URL. Remember the current URL for next time. |
| 72 | 72 | */ |
| 73 | 73 | void process_sync_args(void){ |
| 74 | 74 | const char *zUrl = 0; |
| 75 | 75 | int urlOptional = find_option("autourl",0,0)!=0; |
| 76 | + int dontKeepUrl = find_option("once",0,0)!=0; | |
| 76 | 77 | url_proxy_options(); |
| 77 | 78 | db_find_and_open_repository(1); |
| 78 | 79 | if( g.argc==2 ){ |
| 79 | 80 | zUrl = db_get("last-sync-url", 0); |
| 80 | 81 | }else if( g.argc==3 ){ |
| @@ -83,11 +84,13 @@ | ||
| 83 | 84 | if( zUrl==0 ){ |
| 84 | 85 | if( urlOptional ) exit(0); |
| 85 | 86 | usage("URL"); |
| 86 | 87 | } |
| 87 | 88 | url_parse(zUrl); |
| 88 | - db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0); | |
| 89 | + if( !dontKeepUrl ){ | |
| 90 | + db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0); | |
| 91 | + } | |
| 89 | 92 | user_select(); |
| 90 | 93 | if( g.argc==2 ){ |
| 91 | 94 | if( g.urlPort!=g.urlDfltPort ){ |
| 92 | 95 | printf("Server: %s://%s:%d%s\n", |
| 93 | 96 | g.urlProtocol, g.urlName, g.urlPort, g.urlPath); |
| @@ -99,16 +102,23 @@ | ||
| 99 | 102 | } |
| 100 | 103 | |
| 101 | 104 | /* |
| 102 | 105 | ** COMMAND: pull |
| 103 | 106 | ** |
| 104 | -** Usage: %fossil pull ?URL? ?-R|--respository REPOSITORY? | |
| 107 | +** Usage: %fossil pull ?URL? ?options? | |
| 105 | 108 | ** |
| 106 | 109 | ** Pull changes from a remote repository into the local repository. |
| 110 | +** Use the "-R REPO" or "--repository REPO" command-line options | |
| 111 | +** to specify an alternative repository file. | |
| 107 | 112 | ** |
| 108 | 113 | ** If the URL is not specified, then the URL from the most recent |
| 109 | 114 | ** clone, push, pull, remote-url, or sync command is used. |
| 115 | +** | |
| 116 | +** The URL specified normally becomes the new "remote-url" used for | |
| 117 | +** subsequent push, pull, and sync operations. However, the "--once" | |
| 118 | +** command-line option makes the URL a one-time-use URL that is not | |
| 119 | +** saved. | |
| 110 | 120 | ** |
| 111 | 121 | ** See also: clone, push, sync, remote-url |
| 112 | 122 | */ |
| 113 | 123 | void pull_cmd(void){ |
| 114 | 124 | process_sync_args(); |
| @@ -116,16 +126,23 @@ | ||
| 116 | 126 | } |
| 117 | 127 | |
| 118 | 128 | /* |
| 119 | 129 | ** COMMAND: push |
| 120 | 130 | ** |
| 121 | -** Usage: %fossil push ?URL? ?-R|--repository REPOSITORY? | |
| 131 | +** Usage: %fossil push ?URL? ?options? | |
| 122 | 132 | ** |
| 123 | 133 | ** Push changes in the local repository over into a remote repository. |
| 134 | +** Use the "-R REPO" or "--repository REPO" command-line options | |
| 135 | +** to specify an alternative repository file. | |
| 124 | 136 | ** |
| 125 | 137 | ** If the URL is not specified, then the URL from the most recent |
| 126 | 138 | ** clone, push, pull, remote-url, or sync command is used. |
| 139 | +** | |
| 140 | +** The URL specified normally becomes the new "remote-url" used for | |
| 141 | +** subsequent push, pull, and sync operations. However, the "--once" | |
| 142 | +** command-line option makes the URL a one-time-use URL that is not | |
| 143 | +** saved. | |
| 127 | 144 | ** |
| 128 | 145 | ** See also: clone, pull, sync, remote-url |
| 129 | 146 | */ |
| 130 | 147 | void push_cmd(void){ |
| 131 | 148 | process_sync_args(); |
| @@ -134,21 +151,28 @@ | ||
| 134 | 151 | |
| 135 | 152 | |
| 136 | 153 | /* |
| 137 | 154 | ** COMMAND: sync |
| 138 | 155 | ** |
| 139 | -** Usage: %fossil sync ?URL? ?-R|--repository REPOSITORY? | |
| 156 | +** Usage: %fossil sync ?URL? ?options? | |
| 140 | 157 | ** |
| 141 | 158 | ** Synchronize the local repository with a remote repository. This is |
| 142 | 159 | ** the equivalent of running both "push" and "pull" at the same time. |
| 160 | +** Use the "-R REPO" or "--repository REPO" command-line options | |
| 161 | +** to specify an alternative repository file. | |
| 143 | 162 | ** |
| 144 | 163 | ** If a user-id and password are required, specify them as follows: |
| 145 | 164 | ** |
| 146 | 165 | ** http://userid:[email protected]:1234/path |
| 147 | 166 | ** |
| 148 | 167 | ** If the URL is not specified, then the URL from the most recent successful |
| 149 | 168 | ** clone, push, pull, remote-url, or sync command is used. |
| 169 | +** | |
| 170 | +** The URL specified normally becomes the new "remote-url" used for | |
| 171 | +** subsequent push, pull, and sync operations. However, the "--once" | |
| 172 | +** command-line option makes the URL a one-time-use URL that is not | |
| 173 | +** saved. | |
| 150 | 174 | ** |
| 151 | 175 | ** See also: clone, push, pull, remote-url |
| 152 | 176 | */ |
| 153 | 177 | void sync_cmd(void){ |
| 154 | 178 | process_sync_args(); |
| 155 | 179 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -71,10 +71,11 @@ | |
| 71 | ** most recently synced URL. Remember the current URL for next time. |
| 72 | */ |
| 73 | void process_sync_args(void){ |
| 74 | const char *zUrl = 0; |
| 75 | int urlOptional = find_option("autourl",0,0)!=0; |
| 76 | url_proxy_options(); |
| 77 | db_find_and_open_repository(1); |
| 78 | if( g.argc==2 ){ |
| 79 | zUrl = db_get("last-sync-url", 0); |
| 80 | }else if( g.argc==3 ){ |
| @@ -83,11 +84,13 @@ | |
| 83 | if( zUrl==0 ){ |
| 84 | if( urlOptional ) exit(0); |
| 85 | usage("URL"); |
| 86 | } |
| 87 | url_parse(zUrl); |
| 88 | db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0); |
| 89 | user_select(); |
| 90 | if( g.argc==2 ){ |
| 91 | if( g.urlPort!=g.urlDfltPort ){ |
| 92 | printf("Server: %s://%s:%d%s\n", |
| 93 | g.urlProtocol, g.urlName, g.urlPort, g.urlPath); |
| @@ -99,16 +102,23 @@ | |
| 99 | } |
| 100 | |
| 101 | /* |
| 102 | ** COMMAND: pull |
| 103 | ** |
| 104 | ** Usage: %fossil pull ?URL? ?-R|--respository REPOSITORY? |
| 105 | ** |
| 106 | ** Pull changes from a remote repository into the local repository. |
| 107 | ** |
| 108 | ** If the URL is not specified, then the URL from the most recent |
| 109 | ** clone, push, pull, remote-url, or sync command is used. |
| 110 | ** |
| 111 | ** See also: clone, push, sync, remote-url |
| 112 | */ |
| 113 | void pull_cmd(void){ |
| 114 | process_sync_args(); |
| @@ -116,16 +126,23 @@ | |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | ** COMMAND: push |
| 120 | ** |
| 121 | ** Usage: %fossil push ?URL? ?-R|--repository REPOSITORY? |
| 122 | ** |
| 123 | ** Push changes in the local repository over into a remote repository. |
| 124 | ** |
| 125 | ** If the URL is not specified, then the URL from the most recent |
| 126 | ** clone, push, pull, remote-url, or sync command is used. |
| 127 | ** |
| 128 | ** See also: clone, pull, sync, remote-url |
| 129 | */ |
| 130 | void push_cmd(void){ |
| 131 | process_sync_args(); |
| @@ -134,21 +151,28 @@ | |
| 134 | |
| 135 | |
| 136 | /* |
| 137 | ** COMMAND: sync |
| 138 | ** |
| 139 | ** Usage: %fossil sync ?URL? ?-R|--repository REPOSITORY? |
| 140 | ** |
| 141 | ** Synchronize the local repository with a remote repository. This is |
| 142 | ** the equivalent of running both "push" and "pull" at the same time. |
| 143 | ** |
| 144 | ** If a user-id and password are required, specify them as follows: |
| 145 | ** |
| 146 | ** http://userid:[email protected]:1234/path |
| 147 | ** |
| 148 | ** If the URL is not specified, then the URL from the most recent successful |
| 149 | ** clone, push, pull, remote-url, or sync command is used. |
| 150 | ** |
| 151 | ** See also: clone, push, pull, remote-url |
| 152 | */ |
| 153 | void sync_cmd(void){ |
| 154 | process_sync_args(); |
| 155 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -71,10 +71,11 @@ | |
| 71 | ** most recently synced URL. Remember the current URL for next time. |
| 72 | */ |
| 73 | void process_sync_args(void){ |
| 74 | const char *zUrl = 0; |
| 75 | int urlOptional = find_option("autourl",0,0)!=0; |
| 76 | int dontKeepUrl = find_option("once",0,0)!=0; |
| 77 | url_proxy_options(); |
| 78 | db_find_and_open_repository(1); |
| 79 | if( g.argc==2 ){ |
| 80 | zUrl = db_get("last-sync-url", 0); |
| 81 | }else if( g.argc==3 ){ |
| @@ -83,11 +84,13 @@ | |
| 84 | if( zUrl==0 ){ |
| 85 | if( urlOptional ) exit(0); |
| 86 | usage("URL"); |
| 87 | } |
| 88 | url_parse(zUrl); |
| 89 | if( !dontKeepUrl ){ |
| 90 | db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0); |
| 91 | } |
| 92 | user_select(); |
| 93 | if( g.argc==2 ){ |
| 94 | if( g.urlPort!=g.urlDfltPort ){ |
| 95 | printf("Server: %s://%s:%d%s\n", |
| 96 | g.urlProtocol, g.urlName, g.urlPort, g.urlPath); |
| @@ -99,16 +102,23 @@ | |
| 102 | } |
| 103 | |
| 104 | /* |
| 105 | ** COMMAND: pull |
| 106 | ** |
| 107 | ** Usage: %fossil pull ?URL? ?options? |
| 108 | ** |
| 109 | ** Pull changes from a remote repository into the local repository. |
| 110 | ** Use the "-R REPO" or "--repository REPO" command-line options |
| 111 | ** to specify an alternative repository file. |
| 112 | ** |
| 113 | ** If the URL is not specified, then the URL from the most recent |
| 114 | ** clone, push, pull, remote-url, or sync command is used. |
| 115 | ** |
| 116 | ** The URL specified normally becomes the new "remote-url" used for |
| 117 | ** subsequent push, pull, and sync operations. However, the "--once" |
| 118 | ** command-line option makes the URL a one-time-use URL that is not |
| 119 | ** saved. |
| 120 | ** |
| 121 | ** See also: clone, push, sync, remote-url |
| 122 | */ |
| 123 | void pull_cmd(void){ |
| 124 | process_sync_args(); |
| @@ -116,16 +126,23 @@ | |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | ** COMMAND: push |
| 130 | ** |
| 131 | ** Usage: %fossil push ?URL? ?options? |
| 132 | ** |
| 133 | ** Push changes in the local repository over into a remote repository. |
| 134 | ** Use the "-R REPO" or "--repository REPO" command-line options |
| 135 | ** to specify an alternative repository file. |
| 136 | ** |
| 137 | ** If the URL is not specified, then the URL from the most recent |
| 138 | ** clone, push, pull, remote-url, or sync command is used. |
| 139 | ** |
| 140 | ** The URL specified normally becomes the new "remote-url" used for |
| 141 | ** subsequent push, pull, and sync operations. However, the "--once" |
| 142 | ** command-line option makes the URL a one-time-use URL that is not |
| 143 | ** saved. |
| 144 | ** |
| 145 | ** See also: clone, pull, sync, remote-url |
| 146 | */ |
| 147 | void push_cmd(void){ |
| 148 | process_sync_args(); |
| @@ -134,21 +151,28 @@ | |
| 151 | |
| 152 | |
| 153 | /* |
| 154 | ** COMMAND: sync |
| 155 | ** |
| 156 | ** Usage: %fossil sync ?URL? ?options? |
| 157 | ** |
| 158 | ** Synchronize the local repository with a remote repository. This is |
| 159 | ** the equivalent of running both "push" and "pull" at the same time. |
| 160 | ** Use the "-R REPO" or "--repository REPO" command-line options |
| 161 | ** to specify an alternative repository file. |
| 162 | ** |
| 163 | ** If a user-id and password are required, specify them as follows: |
| 164 | ** |
| 165 | ** http://userid:[email protected]:1234/path |
| 166 | ** |
| 167 | ** If the URL is not specified, then the URL from the most recent successful |
| 168 | ** clone, push, pull, remote-url, or sync command is used. |
| 169 | ** |
| 170 | ** The URL specified normally becomes the new "remote-url" used for |
| 171 | ** subsequent push, pull, and sync operations. However, the "--once" |
| 172 | ** command-line option makes the URL a one-time-use URL that is not |
| 173 | ** saved. |
| 174 | ** |
| 175 | ** See also: clone, push, pull, remote-url |
| 176 | */ |
| 177 | void sync_cmd(void){ |
| 178 | process_sync_args(); |
| 179 |