Fossil

Diff
Login

Diff

Differences From Artifact [f8b3aad318]:

To Artifact [13d601ab02]:


145
146
147
148
149
150
151

152
153
154
155
156
157
158
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159







+







**
** See also: clone, push, sync, remote-url
*/
void pull_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PULL;
  process_sync_args(&configFlags, &syncFlags);
  sync_ssh_options();
  client_sync(syncFlags, configFlags, 0);
}

/*
** COMMAND: push
**
** Usage: %fossil push ?URL? ?options?
174
175
176
177
178
179
180

181
182
183
184
185
186
187
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189







+







**
** See also: clone, pull, sync, remote-url
*/
void push_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PUSH;
  process_sync_args(&configFlags, &syncFlags);
  sync_ssh_options();
  if( db_get_boolean("dont-push",0) ){
    fossil_fatal("pushing is prohibited: the 'dont-push' option is set");
  }
  client_sync(syncFlags, 0, 0);
}


212
213
214
215
216
217
218

219

220
221
222
223
224
225
226
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230







+

+







**
** See also:  clone, push, pull, remote-url
*/
void sync_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
  process_sync_args(&configFlags, &syncFlags);
  sync_ssh_options();
  if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
  sync_ssh_db_options();
  client_sync(syncFlags, configFlags, 0);
  if( (syncFlags & SYNC_PUSH)==0 ){
    fossil_warning("pull only: the 'dont-push' option is set");
  }
}

/*
255
256
257
258
259
260
261






































259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
    fossil_print("off\n");
    return;
  }else{
    url_parse(zUrl, 0);
    fossil_print("%s\n", g.urlCanonical);
  }
}

void sync_ssh_options(void){
  const char *zSshFossilCmd;  /* Path to remote fossil command for SSH */
  const char *zSshHttpCmd;    /* Name of remote HTTP command for SSH */
  const char *zSshCmd;        /* Name of remote HTTP command for SSH */

  zSshFossilCmd = find_option("sshfossilcmd","f",1);
  if( zSshFossilCmd && zSshFossilCmd[0] ){
    g.fSshFossilCmd = mprintf("%s", zSshFossilCmd);
  }
  zSshHttpCmd = find_option("sshhttpcmd","h",1);
  if( zSshHttpCmd && zSshHttpCmd[0] ){
    g.fSshHttpCmd = mprintf("%s", zSshHttpCmd);
    if( zSshFossilCmd==0 ){
      g.fSshFossilCmd = "fossil";
    }
  }
  zSshCmd = find_option("sshcmd","s",1);
  if( zSshCmd && zSshCmd[0] ){
    g.fSshCmd = mprintf("%s", zSshCmd);
  }
}

void sync_ssh_db_options(void){
  if( g.fSshFossilCmd && g.fSshFossilCmd[0] ){
    db_set("last-ssh-fossil-cmd", g.fSshFossilCmd, 0);
  }else{
    g.fSshFossilCmd = db_get("last-ssh-fossil-cmd", 0);
  }
  if( g.fSshHttpCmd && g.fSshHttpCmd[0] ){
    db_set("last-ssh-http-cmd", g.fSshHttpCmd, 0);
  }else{
    g.fSshHttpCmd = db_get("last-ssh-http-cmd", "test-http");
  }
  if( g.fSshCmd && g.fSshCmd[0] ){
    db_set("ssh-command", g.fSshCmd, 0);
  }
}