Fossil SCM

fossil ticket show may use report name instead of report number

wolfgang 2010-10-05 16:37 wolfgangTicketCmd
Commit 63d91f0b87b0f68a014c1072e3c2c6d69a8975eb
2 files changed +11 -5 +6 -4
+11 -5
--- src/report.c
+++ src/report.c
@@ -998,26 +998,32 @@
998998
/*
999999
** Generate a report. The rn query parameter is the report number.
10001000
** The output is written to stdout as flat file. The zFilter paramater
10011001
** is a full WHERE-condition.
10021002
*/
1003
-void rptshow( int rn, const char *zSep, const char *zFilter ){
1003
+void rptshow( const char *zRep, const char *zSep, const char *zFilter ){
10041004
Stmt q;
10051005
char *zSql;
10061006
char *zTitle;
10071007
char *zOwner;
10081008
char *zClrKey;
10091009
char *zErr1 = 0;
10101010
char *zErr2 = 0;
10111011
int count = 0;
1012
+ int rn;
10121013
1013
- /* view_add_functions(tabs); */
1014
- db_prepare(&q,
1015
- "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn);
1014
+ rn = atoi(zRep);
1015
+ if( rn ){
1016
+ db_prepare(&q,
1017
+ "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn);
1018
+ }else{
1019
+ db_prepare(&q,
1020
+ "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep);
1021
+ }
10161022
if( db_step(&q)!=SQLITE_ROW ){
10171023
db_finalize(&q);
1018
- fossil_fatal("unkown report format(%d)!",rn);
1024
+ fossil_fatal("unkown report format(%s)!",zRep);
10191025
}
10201026
zTitle = db_column_malloc(&q, 0);
10211027
zSql = db_column_malloc(&q, 1);
10221028
zOwner = db_column_malloc(&q, 2);
10231029
zClrKey = db_column_malloc(&q, 3);
10241030
--- src/report.c
+++ src/report.c
@@ -998,26 +998,32 @@
998 /*
999 ** Generate a report. The rn query parameter is the report number.
1000 ** The output is written to stdout as flat file. The zFilter paramater
1001 ** is a full WHERE-condition.
1002 */
1003 void rptshow( int rn, const char *zSep, const char *zFilter ){
1004 Stmt q;
1005 char *zSql;
1006 char *zTitle;
1007 char *zOwner;
1008 char *zClrKey;
1009 char *zErr1 = 0;
1010 char *zErr2 = 0;
1011 int count = 0;
 
1012
1013 /* view_add_functions(tabs); */
1014 db_prepare(&q,
1015 "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn);
 
 
 
 
 
1016 if( db_step(&q)!=SQLITE_ROW ){
1017 db_finalize(&q);
1018 fossil_fatal("unkown report format(%d)!",rn);
1019 }
1020 zTitle = db_column_malloc(&q, 0);
1021 zSql = db_column_malloc(&q, 1);
1022 zOwner = db_column_malloc(&q, 2);
1023 zClrKey = db_column_malloc(&q, 3);
1024
--- src/report.c
+++ src/report.c
@@ -998,26 +998,32 @@
998 /*
999 ** Generate a report. The rn query parameter is the report number.
1000 ** The output is written to stdout as flat file. The zFilter paramater
1001 ** is a full WHERE-condition.
1002 */
1003 void rptshow( const char *zRep, const char *zSep, const char *zFilter ){
1004 Stmt q;
1005 char *zSql;
1006 char *zTitle;
1007 char *zOwner;
1008 char *zClrKey;
1009 char *zErr1 = 0;
1010 char *zErr2 = 0;
1011 int count = 0;
1012 int rn;
1013
1014 rn = atoi(zRep);
1015 if( rn ){
1016 db_prepare(&q,
1017 "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE rn=%d", rn);
1018 }else{
1019 db_prepare(&q,
1020 "SELECT title, sqlcode, owner, cols FROM reportfmt WHERE title='%s'", zRep);
1021 }
1022 if( db_step(&q)!=SQLITE_ROW ){
1023 db_finalize(&q);
1024 fossil_fatal("unkown report format(%s)!",zRep);
1025 }
1026 zTitle = db_column_malloc(&q, 0);
1027 zSql = db_column_malloc(&q, 1);
1028 zOwner = db_column_malloc(&q, 2);
1029 zClrKey = db_column_malloc(&q, 3);
1030
+6 -4
--- src/tkt.c
+++ src/tkt.c
@@ -837,20 +837,22 @@
837837
** COMMAND: ticket
838838
** Usage: %fossil ticket SUBCOMMAND ...
839839
**
840840
** Run various subcommands to control tickets
841841
**
842
-** %fossil ticket show REPORTNR ?TICKETFILTER? ?-l|--limit LIMITCHAR?
842
+** %fossil ticket show (REPORTNR|REPORTTITLE) ?TICKETFILTER? ?-l|--limit LIMITCHAR?
843843
**
844844
** Run the the ticket report, identified by the report number
845845
** used in the gui. The data is written as flat file on stdout,
846846
** using "," as separator. The seperator "," can be changed using
847847
** the -l or --limit option.
848848
** If TICKETFILTER is given on the commandline, the query is
849849
** limited with a new WHERE-condition.
850850
** example: Report lists a column # with the uuid
851851
** TICKETFILTER may be [#]='uuuuuuuuu'
852
+** Instead of the report number its possible to use the report
853
+** title (please quote the string, if it contains whitespace).
852854
**
853855
** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ?
854856
**
855857
** change ticket identified by TICKETUUID and set the value of
856858
** field FIELD to VALUE. Valid field descriptions are:
@@ -890,21 +892,21 @@
890892
usage("ticket show|set|add");
891893
}else if( strncmp(g.argv[2],"show",n)==0 ){
892894
if( g.argc==3 ){
893895
usage("ticket show REPORTNR");
894896
}else{
895
- int rn;
897
+ const char *zRep = 0;
896898
const char *zSep = 0;
897899
const char *zFilterUuid = 0;
898900
899901
zSep = find_option("limit","l",1);
900
- rn = atoi(g.argv[3]);
902
+ zRep = g.argv[3];
901903
if( g.argc>4 ){
902904
zFilterUuid = g.argv[4];
903905
}
904906
905
- rptshow( rn, zSep, zFilterUuid );
907
+ rptshow( zRep, zSep, zFilterUuid );
906908
907909
}
908910
}else{
909911
enum { set,add,err } eCmd = err;
910912
int i;
911913
--- src/tkt.c
+++ src/tkt.c
@@ -837,20 +837,22 @@
837 ** COMMAND: ticket
838 ** Usage: %fossil ticket SUBCOMMAND ...
839 **
840 ** Run various subcommands to control tickets
841 **
842 ** %fossil ticket show REPORTNR ?TICKETFILTER? ?-l|--limit LIMITCHAR?
843 **
844 ** Run the the ticket report, identified by the report number
845 ** used in the gui. The data is written as flat file on stdout,
846 ** using "," as separator. The seperator "," can be changed using
847 ** the -l or --limit option.
848 ** If TICKETFILTER is given on the commandline, the query is
849 ** limited with a new WHERE-condition.
850 ** example: Report lists a column # with the uuid
851 ** TICKETFILTER may be [#]='uuuuuuuuu'
 
 
852 **
853 ** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ?
854 **
855 ** change ticket identified by TICKETUUID and set the value of
856 ** field FIELD to VALUE. Valid field descriptions are:
@@ -890,21 +892,21 @@
890 usage("ticket show|set|add");
891 }else if( strncmp(g.argv[2],"show",n)==0 ){
892 if( g.argc==3 ){
893 usage("ticket show REPORTNR");
894 }else{
895 int rn;
896 const char *zSep = 0;
897 const char *zFilterUuid = 0;
898
899 zSep = find_option("limit","l",1);
900 rn = atoi(g.argv[3]);
901 if( g.argc>4 ){
902 zFilterUuid = g.argv[4];
903 }
904
905 rptshow( rn, zSep, zFilterUuid );
906
907 }
908 }else{
909 enum { set,add,err } eCmd = err;
910 int i;
911
--- src/tkt.c
+++ src/tkt.c
@@ -837,20 +837,22 @@
837 ** COMMAND: ticket
838 ** Usage: %fossil ticket SUBCOMMAND ...
839 **
840 ** Run various subcommands to control tickets
841 **
842 ** %fossil ticket show (REPORTNR|REPORTTITLE) ?TICKETFILTER? ?-l|--limit LIMITCHAR?
843 **
844 ** Run the the ticket report, identified by the report number
845 ** used in the gui. The data is written as flat file on stdout,
846 ** using "," as separator. The seperator "," can be changed using
847 ** the -l or --limit option.
848 ** If TICKETFILTER is given on the commandline, the query is
849 ** limited with a new WHERE-condition.
850 ** example: Report lists a column # with the uuid
851 ** TICKETFILTER may be [#]='uuuuuuuuu'
852 ** Instead of the report number its possible to use the report
853 ** title (please quote the string, if it contains whitespace).
854 **
855 ** %fossil ticket set TICKETUUID FIELD VALUE ?FIELD VALUE ... ?
856 **
857 ** change ticket identified by TICKETUUID and set the value of
858 ** field FIELD to VALUE. Valid field descriptions are:
@@ -890,21 +892,21 @@
892 usage("ticket show|set|add");
893 }else if( strncmp(g.argv[2],"show",n)==0 ){
894 if( g.argc==3 ){
895 usage("ticket show REPORTNR");
896 }else{
897 const char *zRep = 0;
898 const char *zSep = 0;
899 const char *zFilterUuid = 0;
900
901 zSep = find_option("limit","l",1);
902 zRep = g.argv[3];
903 if( g.argc>4 ){
904 zFilterUuid = g.argv[4];
905 }
906
907 rptshow( zRep, zSep, zFilterUuid );
908
909 }
910 }else{
911 enum { set,add,err } eCmd = err;
912 int i;
913

Keyboard Shortcuts

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