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.

dmestas 2026-11-21 21:38 UTC small-fixes
Commit 9429e85416d33c92eda085d2350b20c1614a58ec1e854ee82399c8d980235192
1 file changed +10 -6
+10 -6
--- src/th_main.c
+++ src/th_main.c
@@ -1734,11 +1734,13 @@
17341734
if( argc!=3 ){
17351735
return Th_WrongNumArgs(interp, "unversioned content FILENAME");
17361736
}
17371737
if( Th_IsRepositoryOpen() ){
17381738
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
+ ){
17401742
Th_SetResult(interp, blob_str(&content), blob_size(&content));
17411743
blob_reset(&content);
17421744
return TH_OK;
17431745
}else{
17441746
return TH_ERROR;
@@ -1767,16 +1769,18 @@
17671769
}
17681770
if( Th_IsRepositoryOpen() ){
17691771
Stmt q;
17701772
char *zList = 0;
17711773
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);
17761781
}
1777
- db_finalize(&q);
17781782
Th_SetResult(interp, zList, nList);
17791783
Th_Free(interp, zList);
17801784
return TH_OK;
17811785
}else{
17821786
Th_SetResult(interp, "repository unavailable", -1);
17831787
--- 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

Keyboard Shortcuts

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