Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The push, pull, and sync commands remember the last server and reuse it if the URL argument is omitted. Sync via network only now. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
8dbee6731d9b779a2e47b873467584f5 |
| User & Date: | drh 2007-07-31 01:34:45.000 |
Context
|
2007-07-31
| ||
| 10:10 | Remove one to-do item. Add another. check-in: 7fe1e734e9 user: drh tags: trunk | |
| 01:34 | The push, pull, and sync commands remember the last server and reuse it if the URL argument is omitted. Sync via network only now. check-in: 8dbee6731d user: drh tags: trunk | |
| 00:06 | More additions to the todo.txt list. check-in: 9c28ba4956 user: drh tags: trunk | |
Changes
Changes to src/clone.c.
| ︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
}
url_parse(g.argv[2]);
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
user_select();
db_set("content-schema", CONTENT_SCHEMA);
db_set("aux-schema", AUX_SCHEMA);
db_multi_exec(
"INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
);
if( g.urlIsFile ){
Stmt q;
db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName);
db_begin_transaction();
| > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
}
url_parse(g.argv[2]);
db_create_repository(g.argv[3]);
db_open_repository(g.argv[3]);
user_select();
db_set("content-schema", CONTENT_SCHEMA);
db_set("aux-schema", AUX_SCHEMA);
if( !g.urlIsFile ){
db_set("last-sync-url", g.argv[2]);
}
db_multi_exec(
"INSERT INTO config(name,value) VALUES('server-code', hex(randomblob(20)));"
);
if( g.urlIsFile ){
Stmt q;
db_multi_exec("ATTACH DATABASE %Q AS orig", g.urlName);
db_begin_transaction();
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
584 585 586 587 588 589 590 |
** Try to find the repository and open it. If we are in a local
** tree, then use the repository of the local tree. Otherwise,
** fall back to the -R or --repository option.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(void){
| | | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
** Try to find the repository and open it. If we are in a local
** tree, then use the repository of the local tree. Otherwise,
** fall back to the -R or --repository option.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(void){
const char *zRep = find_option("repository", "R", 1);
if( zRep==0 ){
if( db_open_local()==0 ){
goto rep_not_found;
}
zRep = db_lget("repository", 0);
if( zRep==0 ){
goto rep_not_found;
|
| ︙ | ︙ |
Changes to src/sync.c.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
*******************************************************************************
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>
/*
** COMMAND: pull
**
** Pull changes in a remote repository into the local repository
*/
void pull_cmd(void){
| > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < | < < < | < < < < < < | < < < < | < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
*******************************************************************************
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>
/*
** This routine processes the command-line argument for push, pull,
** and sync. If a command-line argument is given, that is the URL
** of a server to sync against. If no argument is given, use the
** most recently synced URL. Remember the current URL for next time.
*/
static void process_sync_args(void){
const char *zUrl = 0;
db_find_and_open_repository();
if( g.argc==2 ){
zUrl = db_get("last-sync-url", 0);
}else if( g.argc==3 ){
zUrl = g.argv[2];
}
if( zUrl==0 ){
usage("URL");
}
url_parse(zUrl);
if( g.urlIsFile ){
fossil_fatal("network sync only");
}
db_set("last-sync-url", zUrl);
user_select();
}
/*
** COMMAND: pull
**
** Pull changes in a remote repository into the local repository
*/
void pull_cmd(void){
process_sync_args();
client_sync(0,1,0);
}
/*
** COMMAND: push
**
** Push changes in the local repository over into a remote repository
*/
void push_cmd(void){
process_sync_args();
client_sync(1,0,0);
}
/*
** COMMAND: sync
**
** Synchronize the local repository with a remote repository
*/
void sync_cmd(void){
process_sync_args();
client_sync(1,1,0);
}
|