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]
Commit
47fb3ddc5a9100f56ca7dfb39a055a8c70d7709cbc8317b6b3de21f47aacad38
Parent
1c2c0a1f953dda4…
1 file changed
+11
-5
+11
-5
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -1701,11 +1701,11 @@ | ||
| 1701 | 1701 | ** --no-rebuild Skip the "rebuilding metadata" step |
| 1702 | 1702 | ** --no-vacuum Skip the final VACUUM of the database file |
| 1703 | 1703 | ** --rename-trunk NAME Use NAME as name of imported trunk branch |
| 1704 | 1704 | ** --rename-branch PAT Rename all branch names using PAT pattern |
| 1705 | 1705 | ** --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 | |
| 1707 | 1707 | ** |
| 1708 | 1708 | ** The --incremental option allows an existing repository to be extended |
| 1709 | 1709 | ** with new content. The --rename-* options may be useful to avoid name |
| 1710 | 1710 | ** conflicts when using the --incremental option. The --admin-user |
| 1711 | 1711 | ** option is ignored if --incremental is specified. |
| @@ -1719,11 +1719,15 @@ | ||
| 1719 | 1719 | ** deleting them. It can be supplied multiple times if necessary. |
| 1720 | 1720 | ** |
| 1721 | 1721 | ** The --attribute option takes a quoted string argument comprised of a |
| 1722 | 1722 | ** Git committer email and the username to be attributed to corresponding |
| 1723 | 1723 | ** 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. | |
| 1725 | 1729 | ** |
| 1726 | 1730 | ** See also: export |
| 1727 | 1731 | */ |
| 1728 | 1732 | void import_cmd(void){ |
| 1729 | 1733 | char *zPassword; |
| @@ -1955,13 +1959,15 @@ | ||
| 1955 | 1959 | ** to either a desired username or full contact information string. |
| 1956 | 1960 | */ |
| 1957 | 1961 | if(ggit.nGitAttr > 0) { |
| 1958 | 1962 | int idx; |
| 1959 | 1963 | 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 | + } | |
| 1963 | 1969 | for(idx = 0; idx < ggit.nGitAttr; ++idx ){ |
| 1964 | 1970 | db_multi_exec( |
| 1965 | 1971 | "INSERT OR IGNORE INTO fx_git(user, email) VALUES(%Q, %Q)", |
| 1966 | 1972 | ggit.gitUserInfo[idx].zUser, ggit.gitUserInfo[idx].zEmail |
| 1967 | 1973 | ); |
| 1968 | 1974 |
| --- 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 |