Fossil SCM
Have the TH1 "unversioned list" and "unversioned content" commands treat a repository with no unversioned table as one with no unversioned files, instead of stopping with a database error.
Commit
9429e85416d33c92eda085d2350b20c1614a58ec1e854ee82399c8d980235192
Parent
b0a9eb39348702b…
1 file changed
+10
-6
+10
-6
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -1734,11 +1734,13 @@ | ||
| 1734 | 1734 | if( argc!=3 ){ |
| 1735 | 1735 | return Th_WrongNumArgs(interp, "unversioned content FILENAME"); |
| 1736 | 1736 | } |
| 1737 | 1737 | if( Th_IsRepositoryOpen() ){ |
| 1738 | 1738 | Blob content; |
| 1739 | - if( unversioned_content(argv[2], &content)!=0 ){ | |
| 1739 | + if( db_table_exists("repository", "unversioned") | |
| 1740 | + && unversioned_content(argv[2], &content)!=0 | |
| 1741 | + ){ | |
| 1740 | 1742 | Th_SetResult(interp, blob_str(&content), blob_size(&content)); |
| 1741 | 1743 | blob_reset(&content); |
| 1742 | 1744 | return TH_OK; |
| 1743 | 1745 | }else{ |
| 1744 | 1746 | return TH_ERROR; |
| @@ -1767,16 +1769,18 @@ | ||
| 1767 | 1769 | } |
| 1768 | 1770 | if( Th_IsRepositoryOpen() ){ |
| 1769 | 1771 | Stmt q; |
| 1770 | 1772 | char *zList = 0; |
| 1771 | 1773 | int nList = 0; |
| 1772 | - db_prepare(&q, "SELECT name FROM unversioned WHERE hash IS NOT NULL" | |
| 1773 | - " ORDER BY name"); | |
| 1774 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 1775 | - Th_ListAppend(interp, &zList, &nList, db_column_text(&q,0), -1); | |
| 1774 | + if( db_table_exists("repository", "unversioned") ){ | |
| 1775 | + db_prepare(&q, "SELECT name FROM unversioned WHERE hash IS NOT NULL" | |
| 1776 | + " ORDER BY name"); | |
| 1777 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 1778 | + Th_ListAppend(interp, &zList, &nList, db_column_text(&q,0), -1); | |
| 1779 | + } | |
| 1780 | + db_finalize(&q); | |
| 1776 | 1781 | } |
| 1777 | - db_finalize(&q); | |
| 1778 | 1782 | Th_SetResult(interp, zList, nList); |
| 1779 | 1783 | Th_Free(interp, zList); |
| 1780 | 1784 | return TH_OK; |
| 1781 | 1785 | }else{ |
| 1782 | 1786 | Th_SetResult(interp, "repository unavailable", -1); |
| 1783 | 1787 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1734,11 +1734,13 @@ | |
| 1734 | if( argc!=3 ){ |
| 1735 | return Th_WrongNumArgs(interp, "unversioned content FILENAME"); |
| 1736 | } |
| 1737 | if( Th_IsRepositoryOpen() ){ |
| 1738 | Blob content; |
| 1739 | if( unversioned_content(argv[2], &content)!=0 ){ |
| 1740 | Th_SetResult(interp, blob_str(&content), blob_size(&content)); |
| 1741 | blob_reset(&content); |
| 1742 | return TH_OK; |
| 1743 | }else{ |
| 1744 | return TH_ERROR; |
| @@ -1767,16 +1769,18 @@ | |
| 1767 | } |
| 1768 | if( Th_IsRepositoryOpen() ){ |
| 1769 | Stmt q; |
| 1770 | char *zList = 0; |
| 1771 | int nList = 0; |
| 1772 | db_prepare(&q, "SELECT name FROM unversioned WHERE hash IS NOT NULL" |
| 1773 | " ORDER BY name"); |
| 1774 | while( db_step(&q)==SQLITE_ROW ){ |
| 1775 | Th_ListAppend(interp, &zList, &nList, db_column_text(&q,0), -1); |
| 1776 | } |
| 1777 | db_finalize(&q); |
| 1778 | Th_SetResult(interp, zList, nList); |
| 1779 | Th_Free(interp, zList); |
| 1780 | return TH_OK; |
| 1781 | }else{ |
| 1782 | Th_SetResult(interp, "repository unavailable", -1); |
| 1783 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1734,11 +1734,13 @@ | |
| 1734 | if( argc!=3 ){ |
| 1735 | return Th_WrongNumArgs(interp, "unversioned content FILENAME"); |
| 1736 | } |
| 1737 | if( Th_IsRepositoryOpen() ){ |
| 1738 | Blob content; |
| 1739 | if( db_table_exists("repository", "unversioned") |
| 1740 | && unversioned_content(argv[2], &content)!=0 |
| 1741 | ){ |
| 1742 | Th_SetResult(interp, blob_str(&content), blob_size(&content)); |
| 1743 | blob_reset(&content); |
| 1744 | return TH_OK; |
| 1745 | }else{ |
| 1746 | return TH_ERROR; |
| @@ -1767,16 +1769,18 @@ | |
| 1769 | } |
| 1770 | if( Th_IsRepositoryOpen() ){ |
| 1771 | Stmt q; |
| 1772 | char *zList = 0; |
| 1773 | int nList = 0; |
| 1774 | if( db_table_exists("repository", "unversioned") ){ |
| 1775 | db_prepare(&q, "SELECT name FROM unversioned WHERE hash IS NOT NULL" |
| 1776 | " ORDER BY name"); |
| 1777 | while( db_step(&q)==SQLITE_ROW ){ |
| 1778 | Th_ListAppend(interp, &zList, &nList, db_column_text(&q,0), -1); |
| 1779 | } |
| 1780 | db_finalize(&q); |
| 1781 | } |
| 1782 | Th_SetResult(interp, zList, nList); |
| 1783 | Th_Free(interp, zList); |
| 1784 | return TH_OK; |
| 1785 | }else{ |
| 1786 | Th_SetResult(interp, "repository unavailable", -1); |
| 1787 |