Overview
SHA1 Hash: | 2bd0690fe8d58ec4a0cbca48f76c1e1f6fc9e9d9 |
---|---|
Date: | 2008-10-17 12:31:26 |
User: | drh |
Comment: | Add the "all rebuild" subcommand. Be more aggressive about adding repositories to the repository list. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/allrepo.c from [d823b159bc] to [1ebb23105f].
@@ -62,17 +62,23 @@ ** The ~/.fossil file records the location of all repositories for a ** user. This command performs certain operations on all repositories ** that can be useful before or after a period of disconnection operation. ** Available operations are: ** -** list Display the location of all repositories +** list Display the location of all repositories +** +** pull Run a "pull" operation on all repositories +** +** push Run a "push" on all repositories ** -** pull Run a "pull" operation on all repositories +** rebuild Rebuild on all repositories ** -** push Run a "push" on all repositories +** sync Run a "sync" on all repositories ** -** sync Run a "sync" on all repositories +** Respositories are automatically added to the set of known repositories +** when one of the following commands against the repository: clone, info, +** pull, push, or sync */ void all_cmd(void){ int n; Stmt q; const char *zCmd; @@ -80,31 +86,33 @@ char *zFossil; char *zQFilename; int nMissing; if( g.argc<3 ){ - usage("list|pull|push|sync"); + usage("list|pull|push|rebuild|sync"); } n = strlen(g.argv[2]); db_open_config(); - db_prepare(&q, "SELECT substr(name, 6) FROM global_config" - " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"); zCmd = g.argv[2]; if( strncmp(zCmd, "list", n)==0 ){ zCmd = "list"; }else if( strncmp(zCmd, "push", n)==0 ){ - zCmd = "push"; + zCmd = "push -autourl -R"; }else if( strncmp(zCmd, "pull", n)==0 ){ - zCmd = "pull"; + zCmd = "pull -autourl -R"; + }else if( strncmp(zCmd, "rebuild", n)==0 ){ + zCmd = "rebuild"; }else if( strncmp(zCmd, "sync", n)==0 ){ - zCmd = "sync"; + zCmd = "sync -autourl -R"; }else{ fossil_fatal("\"all\" subcommand should be one of: " "list push pull sync"); } zFossil = quoteFilename(g.argv[0]); nMissing = 0; + db_prepare(&q, "SELECT substr(name, 6) FROM global_config" + " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"); while( db_step(&q)==SQLITE_ROW ){ const char *zFilename = db_column_text(&q, 0); if( access(zFilename, 0) ){ nMissing++; continue; @@ -112,12 +120,11 @@ if( zCmd[0]=='l' ){ printf("%s\n", zFilename); continue; } zQFilename = quoteFilename(zFilename); - zSyscmd = mprintf("%s %s -R %s -autourl", - zFossil, zCmd, zQFilename); + zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename); printf("%s\n", zSyscmd); fflush(stdout); system(zSyscmd); free(zSyscmd); free(zQFilename); @@ -135,9 +142,10 @@ char *zRepo = mprintf("repo:%s", zFilename); db_unset(zRepo, 1); free(zRepo); } } - db_finalize(&q); + db_reset(&q); db_end_transaction(0); } + db_finalize(&q); }
Modified src/clone.c from [effa624f67] to [2daa17c5f0].
@@ -49,19 +49,21 @@ url_parse(g.argv[2]); if( g.urlIsFile ){ file_copy(g.urlName, g.argv[3]); db_close(); db_open_repository(g.argv[3]); + db_record_repository_filename(g.argv[3]); db_multi_exec( "REPLACE INTO config(name,value)" " VALUES('server-code', lower(hex(randomblob(20))));" ); printf("Repository cloned into %s\n", g.argv[3]); }else{ db_create_repository(g.argv[3]); db_open_repository(g.argv[3]); db_begin_transaction(); + db_record_repository_filename(g.argv[3]); db_initial_setup(0, 0); user_select(); db_set("content-schema", CONTENT_SCHEMA, 0); db_set("aux-schema", AUX_SCHEMA, 0); db_set("last-sync-url", g.argv[2], 0);
Modified src/db.c from [d2615a7db8] to [ba60d648a5].
@@ -1129,19 +1129,22 @@ ** repo:%s ** ** The value field is set to 1. */ void db_record_repository_filename(const char *zName){ + Blob full; if( zName==0 ){ if( !g.localOpen ) return; zName = db_lget("repository", 0); } + file_canonical_name(zName, &full); db_multi_exec( "INSERT OR IGNORE INTO global_config(name,value)" "VALUES('repo:%q',1)", - zName + blob_str(&full) ); + blob_reset(&full); } /* ** COMMAND: open **
Modified src/info.c from [33a76dcbd4] to [93f0a4da21].
@@ -86,10 +86,11 @@ } db_must_be_within_tree(); if( g.argc==2 ){ int vid; /* 012345678901234 */ + db_record_repository_filename(0); printf("repository: %s\n", db_lget("repository", "")); printf("local-root: %s\n", g.zLocalRoot); printf("project-code: %s\n", db_get("project-code", "")); printf("server-code: %s\n", db_get("server-code", "")); vid = db_lget_int("checkout", 0);
Modified src/xfer.c from [cdde3a92c3] to [35dc0c6452].
@@ -818,13 +818,11 @@ assert( pushFlag || pullFlag || cloneFlag || configMask ); assert( !g.urlIsFile ); /* This only works for networking */ db_begin_transaction(); - if( pullFlag || cloneFlag ){ - db_record_repository_filename(0); - } + db_record_repository_filename(0); db_multi_exec( "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" ); blobarray_zero(xfer.aToken, count(xfer.aToken)); blob_zero(&send);