Fossil SCM

Add the --once command-line option to push, pull, and sync. Ticket [2aaa8042caec]

drh 2009-11-06 14:15 trunk
Commit 5153d618937eb274b06a5cb2ae93fa0832157575
1 file changed +28 -4
+28 -4
--- src/sync.c
+++ src/sync.c
@@ -71,10 +71,11 @@
7171
** most recently synced URL. Remember the current URL for next time.
7272
*/
7373
void process_sync_args(void){
7474
const char *zUrl = 0;
7575
int urlOptional = find_option("autourl",0,0)!=0;
76
+ int dontKeepUrl = find_option("once",0,0)!=0;
7677
url_proxy_options();
7778
db_find_and_open_repository(1);
7879
if( g.argc==2 ){
7980
zUrl = db_get("last-sync-url", 0);
8081
}else if( g.argc==3 ){
@@ -83,11 +84,13 @@
8384
if( zUrl==0 ){
8485
if( urlOptional ) exit(0);
8586
usage("URL");
8687
}
8788
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
+ }
8992
user_select();
9093
if( g.argc==2 ){
9194
if( g.urlPort!=g.urlDfltPort ){
9295
printf("Server: %s://%s:%d%s\n",
9396
g.urlProtocol, g.urlName, g.urlPort, g.urlPath);
@@ -99,16 +102,23 @@
99102
}
100103
101104
/*
102105
** COMMAND: pull
103106
**
104
-** Usage: %fossil pull ?URL? ?-R|--respository REPOSITORY?
107
+** Usage: %fossil pull ?URL? ?options?
105108
**
106109
** 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.
107112
**
108113
** If the URL is not specified, then the URL from the most recent
109114
** 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.
110120
**
111121
** See also: clone, push, sync, remote-url
112122
*/
113123
void pull_cmd(void){
114124
process_sync_args();
@@ -116,16 +126,23 @@
116126
}
117127
118128
/*
119129
** COMMAND: push
120130
**
121
-** Usage: %fossil push ?URL? ?-R|--repository REPOSITORY?
131
+** Usage: %fossil push ?URL? ?options?
122132
**
123133
** 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.
124136
**
125137
** If the URL is not specified, then the URL from the most recent
126138
** 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.
127144
**
128145
** See also: clone, pull, sync, remote-url
129146
*/
130147
void push_cmd(void){
131148
process_sync_args();
@@ -134,21 +151,28 @@
134151
135152
136153
/*
137154
** COMMAND: sync
138155
**
139
-** Usage: %fossil sync ?URL? ?-R|--repository REPOSITORY?
156
+** Usage: %fossil sync ?URL? ?options?
140157
**
141158
** Synchronize the local repository with a remote repository. This is
142159
** 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.
143162
**
144163
** If a user-id and password are required, specify them as follows:
145164
**
146165
** http://userid:[email protected]:1234/path
147166
**
148167
** If the URL is not specified, then the URL from the most recent successful
149168
** 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.
150174
**
151175
** See also: clone, push, pull, remote-url
152176
*/
153177
void sync_cmd(void){
154178
process_sync_args();
155179
--- 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

Keyboard Shortcuts

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