Fossil SCM

Enhance the whatis command to show a description of the origin of phantoms.

drh 2020-10-13 13:50 trunk
Commit d25027685b7d9757af721dd494b626461fe7feca2edd7c5246e79a73398ded9b
1 file changed +16
+16
--- src/name.c
+++ src/name.c
@@ -776,10 +776,11 @@
776776
}
777777
fossil_print("type: %s by %s on %s\n", zType, db_column_text(&q,2),
778778
db_column_text(&q, 1));
779779
fossil_print("comment: ");
780780
comment_print(db_column_text(&q,3), 0, 12, -1, get_comment_format());
781
+ cnt++;
781782
}
782783
db_finalize(&q);
783784
784785
/* Check to see if this object is used as a file in a check-in */
785786
db_prepare(&q,
@@ -798,10 +799,11 @@
798799
db_column_text(&q, 1),
799800
db_column_text(&q, 3),
800801
db_column_text(&q, 2));
801802
fossil_print(" ");
802803
comment_print(db_column_text(&q,4), 0, 12, -1, get_comment_format());
804
+ cnt++;
803805
}
804806
db_finalize(&q);
805807
806808
/* Check to see if this object is used as an attachment */
807809
db_prepare(&q,
@@ -833,12 +835,26 @@
833835
}
834836
fossil_print(" by user %s on %s\n",
835837
db_column_text(&q,2), db_column_text(&q,3));
836838
fossil_print(" ");
837839
comment_print(db_column_text(&q,1), 0, 12, -1, get_comment_format());
840
+ cnt++;
838841
}
839842
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
+ }
840856
}
841857
842858
/*
843859
** COMMAND: whatis*
844860
**
845861
--- 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

Keyboard Shortcuts

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