Fossil SCM
Enhance the whatis command to show a description of the origin of phantoms.
Commit
d25027685b7d9757af721dd494b626461fe7feca2edd7c5246e79a73398ded9b
Parent
cd624d4ff267736…
1 file changed
+16
+16
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -776,10 +776,11 @@ | ||
| 776 | 776 | } |
| 777 | 777 | fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), |
| 778 | 778 | db_column_text(&q, 1)); |
| 779 | 779 | fossil_print("comment: "); |
| 780 | 780 | comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format()); |
| 781 | + cnt++; | |
| 781 | 782 | } |
| 782 | 783 | db_finalize(&q); |
| 783 | 784 | |
| 784 | 785 | /* Check to see if this object is used as a file in a check-in */ |
| 785 | 786 | db_prepare(&q, |
| @@ -798,10 +799,11 @@ | ||
| 798 | 799 | db_column_text(&q, 1), |
| 799 | 800 | db_column_text(&q, 3), |
| 800 | 801 | db_column_text(&q, 2)); |
| 801 | 802 | fossil_print(" "); |
| 802 | 803 | comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format()); |
| 804 | + cnt++; | |
| 803 | 805 | } |
| 804 | 806 | db_finalize(&q); |
| 805 | 807 | |
| 806 | 808 | /* Check to see if this object is used as an attachment */ |
| 807 | 809 | db_prepare(&q, |
| @@ -833,12 +835,26 @@ | ||
| 833 | 835 | } |
| 834 | 836 | fossil_print(" by user %s on %s\n", |
| 835 | 837 | db_column_text(&q,2), db_column_text(&q,3)); |
| 836 | 838 | fossil_print(" "); |
| 837 | 839 | comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format()); |
| 840 | + cnt++; | |
| 838 | 841 | } |
| 839 | 842 | db_finalize(&q); |
| 843 | + | |
| 844 | + /* If other information available, try to describe the object */ | |
| 845 | + if( cnt==0 ){ | |
| 846 | + char *zWhere = mprintf("=%d", rid); | |
| 847 | + char *zDesc; | |
| 848 | + describe_artifacts(zWhere); | |
| 849 | + free(zWhere); | |
| 850 | + zDesc = db_text(0, | |
| 851 | + "SELECT printf('%%-12s%%s %%s',type||':',summary,substr(ref,1,16))" | |
| 852 | + " FROM description WHERE rid=%d", rid); | |
| 853 | + fossil_print("%s\n", zDesc); | |
| 854 | + fossil_free(zDesc); | |
| 855 | + } | |
| 840 | 856 | } |
| 841 | 857 | |
| 842 | 858 | /* |
| 843 | 859 | ** COMMAND: whatis* |
| 844 | 860 | ** |
| 845 | 861 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -776,10 +776,11 @@ | |
| 776 | } |
| 777 | fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), |
| 778 | db_column_text(&q, 1)); |
| 779 | fossil_print("comment: "); |
| 780 | comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format()); |
| 781 | } |
| 782 | db_finalize(&q); |
| 783 | |
| 784 | /* Check to see if this object is used as a file in a check-in */ |
| 785 | db_prepare(&q, |
| @@ -798,10 +799,11 @@ | |
| 798 | db_column_text(&q, 1), |
| 799 | db_column_text(&q, 3), |
| 800 | db_column_text(&q, 2)); |
| 801 | fossil_print(" "); |
| 802 | comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format()); |
| 803 | } |
| 804 | db_finalize(&q); |
| 805 | |
| 806 | /* Check to see if this object is used as an attachment */ |
| 807 | db_prepare(&q, |
| @@ -833,12 +835,26 @@ | |
| 833 | } |
| 834 | fossil_print(" by user %s on %s\n", |
| 835 | db_column_text(&q,2), db_column_text(&q,3)); |
| 836 | fossil_print(" "); |
| 837 | comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format()); |
| 838 | } |
| 839 | db_finalize(&q); |
| 840 | } |
| 841 | |
| 842 | /* |
| 843 | ** COMMAND: whatis* |
| 844 | ** |
| 845 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -776,10 +776,11 @@ | |
| 776 | } |
| 777 | fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2), |
| 778 | db_column_text(&q, 1)); |
| 779 | fossil_print("comment: "); |
| 780 | comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format()); |
| 781 | cnt++; |
| 782 | } |
| 783 | db_finalize(&q); |
| 784 | |
| 785 | /* Check to see if this object is used as a file in a check-in */ |
| 786 | db_prepare(&q, |
| @@ -798,10 +799,11 @@ | |
| 799 | db_column_text(&q, 1), |
| 800 | db_column_text(&q, 3), |
| 801 | db_column_text(&q, 2)); |
| 802 | fossil_print(" "); |
| 803 | comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format()); |
| 804 | cnt++; |
| 805 | } |
| 806 | db_finalize(&q); |
| 807 | |
| 808 | /* Check to see if this object is used as an attachment */ |
| 809 | db_prepare(&q, |
| @@ -833,12 +835,26 @@ | |
| 835 | } |
| 836 | fossil_print(" by user %s on %s\n", |
| 837 | db_column_text(&q,2), db_column_text(&q,3)); |
| 838 | fossil_print(" "); |
| 839 | comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format()); |
| 840 | cnt++; |
| 841 | } |
| 842 | db_finalize(&q); |
| 843 | |
| 844 | /* If other information available, try to describe the object */ |
| 845 | if( cnt==0 ){ |
| 846 | char *zWhere = mprintf("=%d", rid); |
| 847 | char *zDesc; |
| 848 | describe_artifacts(zWhere); |
| 849 | free(zWhere); |
| 850 | zDesc = db_text(0, |
| 851 | "SELECT printf('%%-12s%%s %%s',type||':',summary,substr(ref,1,16))" |
| 852 | " FROM description WHERE rid=%d", rid); |
| 853 | fossil_print("%s\n", zDesc); |
| 854 | fossil_free(zDesc); |
| 855 | } |
| 856 | } |
| 857 | |
| 858 | /* |
| 859 | ** COMMAND: whatis* |
| 860 | ** |
| 861 |