Fossil SCM

enable importing multiple git repos into one fsl repo This fixes an issue reported by James Cook in [forum:d162b6e2dc]. Previously, we assumed the fx_git table does not exist when creating a new import, thus the previously untested use case of importing multiple new (read: not incremental) git repos into the same fossil repo failed at this assumption. While here, document the persistent nature of attributions in the import cmd help text; previously, this was only in the online docs: [src:/doc/trunk/www/inout.wiki]

mark 2023-06-22 13:49 trunk
Commit 47fb3ddc5a9100f56ca7dfb39a055a8c70d7709cbc8317b6b3de21f47aacad38
1 file changed +11 -5
+11 -5
--- src/import.c
+++ src/import.c
@@ -1701,11 +1701,11 @@
17011701
** --no-rebuild Skip the "rebuilding metadata" step
17021702
** --no-vacuum Skip the final VACUUM of the database file
17031703
** --rename-trunk NAME Use NAME as name of imported trunk branch
17041704
** --rename-branch PAT Rename all branch names using PAT pattern
17051705
** --rename-tag PAT Rename all tag names using PAT pattern
1706
-** -A|--admin-user NAME Use NAME for the admin user
1706
+** -A|--admin-user NAME Use NAME for the admin user
17071707
**
17081708
** The --incremental option allows an existing repository to be extended
17091709
** with new content. The --rename-* options may be useful to avoid name
17101710
** conflicts when using the --incremental option. The --admin-user
17111711
** option is ignored if --incremental is specified.
@@ -1719,11 +1719,15 @@
17191719
** deleting them. It can be supplied multiple times if necessary.
17201720
**
17211721
** The --attribute option takes a quoted string argument comprised of a
17221722
** Git committer email and the username to be attributed to corresponding
17231723
** check-ins in the Fossil repository. This option can be repeated. For
1724
-** example, --attribute "[email protected] drh" --attribute "[email protected] X"
1724
+** example, --attribute "[email protected] drh" --attribute "[email protected] X".
1725
+** Attributions are persisted to the repository so that subsequent
1726
+** 'fossil git export' operations attribute Fossil commits to corresponding
1727
+** 'Git Committer <[email protected]>' users, and incremental imports with
1728
+** 'fossil import --git --incremental' use previous --attribute records.
17251729
**
17261730
** See also: export
17271731
*/
17281732
void import_cmd(void){
17291733
char *zPassword;
@@ -1955,13 +1959,15 @@
19551959
** to either a desired username or full contact information string.
19561960
*/
19571961
if(ggit.nGitAttr > 0) {
19581962
int idx;
19591963
db_unprotect(PROTECT_ALL);
1960
- db_multi_exec(
1961
- "CREATE TABLE fx_git(user TEXT, email TEXT UNIQUE);"
1962
- );
1964
+ if( !db_table_exists("repository", "fx_git") ){
1965
+ db_multi_exec(
1966
+ "CREATE TABLE fx_git(user TEXT, email TEXT UNIQUE);"
1967
+ );
1968
+ }
19631969
for(idx = 0; idx < ggit.nGitAttr; ++idx ){
19641970
db_multi_exec(
19651971
"INSERT OR IGNORE INTO fx_git(user, email) VALUES(%Q, %Q)",
19661972
ggit.gitUserInfo[idx].zUser, ggit.gitUserInfo[idx].zEmail
19671973
);
19681974
--- src/import.c
+++ src/import.c
@@ -1701,11 +1701,11 @@
1701 ** --no-rebuild Skip the "rebuilding metadata" step
1702 ** --no-vacuum Skip the final VACUUM of the database file
1703 ** --rename-trunk NAME Use NAME as name of imported trunk branch
1704 ** --rename-branch PAT Rename all branch names using PAT pattern
1705 ** --rename-tag PAT Rename all tag names using PAT pattern
1706 ** -A|--admin-user NAME Use NAME for the admin user
1707 **
1708 ** The --incremental option allows an existing repository to be extended
1709 ** with new content. The --rename-* options may be useful to avoid name
1710 ** conflicts when using the --incremental option. The --admin-user
1711 ** option is ignored if --incremental is specified.
@@ -1719,11 +1719,15 @@
1719 ** deleting them. It can be supplied multiple times if necessary.
1720 **
1721 ** The --attribute option takes a quoted string argument comprised of a
1722 ** Git committer email and the username to be attributed to corresponding
1723 ** check-ins in the Fossil repository. This option can be repeated. For
1724 ** example, --attribute "[email protected] drh" --attribute "[email protected] X"
 
 
 
 
1725 **
1726 ** See also: export
1727 */
1728 void import_cmd(void){
1729 char *zPassword;
@@ -1955,13 +1959,15 @@
1955 ** to either a desired username or full contact information string.
1956 */
1957 if(ggit.nGitAttr > 0) {
1958 int idx;
1959 db_unprotect(PROTECT_ALL);
1960 db_multi_exec(
1961 "CREATE TABLE fx_git(user TEXT, email TEXT UNIQUE);"
1962 );
 
 
1963 for(idx = 0; idx < ggit.nGitAttr; ++idx ){
1964 db_multi_exec(
1965 "INSERT OR IGNORE INTO fx_git(user, email) VALUES(%Q, %Q)",
1966 ggit.gitUserInfo[idx].zUser, ggit.gitUserInfo[idx].zEmail
1967 );
1968
--- src/import.c
+++ src/import.c
@@ -1701,11 +1701,11 @@
1701 ** --no-rebuild Skip the "rebuilding metadata" step
1702 ** --no-vacuum Skip the final VACUUM of the database file
1703 ** --rename-trunk NAME Use NAME as name of imported trunk branch
1704 ** --rename-branch PAT Rename all branch names using PAT pattern
1705 ** --rename-tag PAT Rename all tag names using PAT pattern
1706 ** -A|--admin-user NAME Use NAME for the admin user
1707 **
1708 ** The --incremental option allows an existing repository to be extended
1709 ** with new content. The --rename-* options may be useful to avoid name
1710 ** conflicts when using the --incremental option. The --admin-user
1711 ** option is ignored if --incremental is specified.
@@ -1719,11 +1719,15 @@
1719 ** deleting them. It can be supplied multiple times if necessary.
1720 **
1721 ** The --attribute option takes a quoted string argument comprised of a
1722 ** Git committer email and the username to be attributed to corresponding
1723 ** check-ins in the Fossil repository. This option can be repeated. For
1724 ** example, --attribute "[email protected] drh" --attribute "[email protected] X".
1725 ** Attributions are persisted to the repository so that subsequent
1726 ** 'fossil git export' operations attribute Fossil commits to corresponding
1727 ** 'Git Committer <[email protected]>' users, and incremental imports with
1728 ** 'fossil import --git --incremental' use previous --attribute records.
1729 **
1730 ** See also: export
1731 */
1732 void import_cmd(void){
1733 char *zPassword;
@@ -1955,13 +1959,15 @@
1959 ** to either a desired username or full contact information string.
1960 */
1961 if(ggit.nGitAttr > 0) {
1962 int idx;
1963 db_unprotect(PROTECT_ALL);
1964 if( !db_table_exists("repository", "fx_git") ){
1965 db_multi_exec(
1966 "CREATE TABLE fx_git(user TEXT, email TEXT UNIQUE);"
1967 );
1968 }
1969 for(idx = 0; idx < ggit.nGitAttr; ++idx ){
1970 db_multi_exec(
1971 "INSERT OR IGNORE INTO fx_git(user, email) VALUES(%Q, %Q)",
1972 ggit.gitUserInfo[idx].zUser, ggit.gitUserInfo[idx].zEmail
1973 );
1974

Keyboard Shortcuts

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