Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | less abstract, closer to affected (clone, init/new) subcommands |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | clobber_fixer |
| Files: | files | file ages | folders |
| SHA1: |
b0a3bfb03850dd07ab5e94ce6e848e55 |
| User & Date: | bch 2015-01-29 20:54:36.320 |
Context
|
2015-01-29
| ||
| 20:54 | less abstract, closer to affected (clone, init/new) subcommands Closed-Leaf check-in: b0a3bfb038 user: bch tags: clobber_fixer | |
| 20:21 | proposed fix for clobbering existing files [5ba427be8809342c6fbdcf48c9c8365467048d28] check-in: bb15d408a4 user: bch tags: clobber_fixer | |
Changes
Changes to src/clone.c.
| ︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
const char *zHttpAuth; /* HTTP Authorization user:pass information */
int nErr = 0;
int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
int syncFlags = SYNC_CLONE;
/* Also clone private branches */
if( find_option("private",0,0)!=0 ) syncFlags |= SYNC_PRIVATE;
if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
if( find_option("verbose",0,0)!=0) syncFlags |= SYNC_VERBOSE;
zHttpAuth = find_option("httpauth","B",1);
zDefaultUser = find_option("admin-user","A",1);
| > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
const char *zHttpAuth; /* HTTP Authorization user:pass information */
int nErr = 0;
int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
int syncFlags = SYNC_CLONE;
struct stat sb;
/* Also clone private branches */
if( find_option("private",0,0)!=0 ) syncFlags |= SYNC_PRIVATE;
if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
if( find_option("verbose",0,0)!=0) syncFlags |= SYNC_VERBOSE;
zHttpAuth = find_option("httpauth","B",1);
zDefaultUser = find_option("admin-user","A",1);
|
| ︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
}
db_open_config(0);
if( file_size(g.argv[3])>0 ){
fossil_fatal("file already exists: %s", g.argv[3]);
}
url_parse(g.argv[2], urlFlags);
if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
if( g.url.isFile ){
file_copy(g.url.name, g.argv[3]);
db_close(1);
db_open_repository(g.argv[3]);
db_record_repository_filename(g.argv[3]);
url_remember();
| > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
}
db_open_config(0);
if( file_size(g.argv[3])>0 ){
fossil_fatal("file already exists: %s", g.argv[3]);
}
url_parse(g.argv[2], urlFlags);
if (0 == stat(zDbName, &sb)) {
db_err("[%s]: %s", zDbName, "File already exists.");
}
if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
if( g.url.isFile ){
file_copy(g.url.name, g.argv[3]);
db_close(1);
db_open_repository(g.argv[3]);
db_record_repository_filename(g.argv[3]);
url_remember();
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
815 816 817 818 819 820 821 |
/*
** Open a database file. Return a pointer to the new database
** connection. An error results in process abort.
*/
LOCAL sqlite3 *db_open(const char *zDbName){
int rc;
sqlite3 *db;
| < < < < < < | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 |
/*
** Open a database file. Return a pointer to the new database
** connection. An error results in process abort.
*/
LOCAL sqlite3 *db_open(const char *zDbName){
int rc;
sqlite3 *db;
if( g.fSqlTrace ) fossil_trace("-- sqlite3_open: [%s]\n", zDbName);
rc = sqlite3_open_v2(
zDbName, &db,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
g.zVfsName
);
if( rc!=SQLITE_OK ){
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
|
| ︙ | ︙ | |||
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 |
*/
void create_repository_cmd(void){
char *zPassword;
const char *zTemplate; /* Repository from which to copy settings */
const char *zDate; /* Date of the initial check-in */
const char *zDefaultUser; /* Optional name of the default user */
int makeServerCodes;
zTemplate = find_option("template",0,1);
zDate = find_option("date-override",0,1);
zDefaultUser = find_option("admin-user","A",1);
makeServerCodes = find_option("docker", 0, 0)==0;
find_option("empty", 0, 0); /* deprecated */
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ){
usage("REPOSITORY-NAME");
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_transaction();
db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes);
db_end_transaction(0);
| > > > > > > | 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 |
*/
void create_repository_cmd(void){
char *zPassword;
const char *zTemplate; /* Repository from which to copy settings */
const char *zDate; /* Date of the initial check-in */
const char *zDefaultUser; /* Optional name of the default user */
int makeServerCodes;
struct stat sb;
zTemplate = find_option("template",0,1);
zDate = find_option("date-override",0,1);
zDefaultUser = find_option("admin-user","A",1);
makeServerCodes = find_option("docker", 0, 0)==0;
find_option("empty", 0, 0); /* deprecated */
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ){
usage("REPOSITORY-NAME");
}
if (0 == stat(zDbName, &sb)) {
db_err("[%s]: %s", zDbName, "File already exists.");
}
db_create_repository(g.argv[2]);
db_open_repository(g.argv[2]);
db_open_config(0);
if( zTemplate ) db_attach(zTemplate, "settingSrc");
db_begin_transaction();
db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes);
db_end_transaction(0);
|
| ︙ | ︙ |