921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
|
** The values in set|add are not validated against the definitions
** given in "Ticket Common Script".
*/
void ticket_cmd(void){
int n;
const char *zUser;
const char *zDate;
/* do some ints, we want to be inside a checkout */
db_find_and_open_repository(0, 0);
user_select();
zUser = find_option("user-override",0,1);
if( zUser==0 ) zUser = g.zLogin;
zDate = find_option("date-override",0,1);
if( zDate==0 ) zDate = "now";
zDate = date_in_standard_format(zDate);
/*
** Check that the user exists.
*/
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", zUser) ){
fossil_fatal("no such user: %s", zUser);
}
|
>
>
>
>
>
|
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
|
** The values in set|add are not validated against the definitions
** given in "Ticket Common Script".
*/
void ticket_cmd(void){
int n;
const char *zUser;
const char *zDate;
const char *zTktUuid;
/* do some ints, we want to be inside a checkout */
db_find_and_open_repository(0, 0);
user_select();
zUser = find_option("user-override",0,1);
if( zUser==0 ) zUser = g.zLogin;
zDate = find_option("date-override",0,1);
if( zDate==0 ) zDate = "now";
zDate = date_in_standard_format(zDate);
zTktUuid = find_option("uuid-override",0,1);
if( zTktUuid && (strlen(zTktUuid)!=40 || !validate16(zTktUuid,40)) ){
fossil_fatal("invalid --uuid-override: must be 40 characters of hex");
}
/*
** Check that the user exists.
*/
if( !db_exists("SELECT 1 FROM user WHERE login=%Q", zUser) ){
fossil_fatal("no such user: %s", zUser);
}
|
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
|
rptshow( zRep, zSep, zFilterUuid, tktEncoding );
}
}else{
/* add a new ticket or update an existing ticket */
enum { set,add,history,err } eCmd = err;
int i = 0;
int rid;
const char *zTktUuid = 0;
Blob tktchng, cksum;
/* get command type (set/add) and get uuid, if needed for set */
if( strncmp(g.argv[2],"set",n)==0 || strncmp(g.argv[2],"change",n)==0 ||
strncmp(g.argv[2],"history",n)==0 ){
if( strncmp(g.argv[2],"history",n)==0 ){
eCmd = history;
|
<
|
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
|
rptshow( zRep, zSep, zFilterUuid, tktEncoding );
}
}else{
/* add a new ticket or update an existing ticket */
enum { set,add,history,err } eCmd = err;
int i = 0;
int rid;
Blob tktchng, cksum;
/* get command type (set/add) and get uuid, if needed for set */
if( strncmp(g.argv[2],"set",n)==0 || strncmp(g.argv[2],"change",n)==0 ||
strncmp(g.argv[2],"history",n)==0 ){
if( strncmp(g.argv[2],"history",n)==0 ){
eCmd = history;
|
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
|
if( !zTktUuid ){
fossil_fatal("unknown ticket: '%s'!",g.argv[3]);
}
i=4;
}else if( strncmp(g.argv[2],"add",n)==0 ){
eCmd = add;
i = 3;
zTktUuid = db_text(0, "SELECT lower(hex(randomblob(20)))");
}
/* none of set/add, so show the usage! */
if( eCmd==err ){
usage("add|fieldlist|set|show|history");
}
/* we just handle history separately here, does not get out */
|
>
|
>
|
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
|
if( !zTktUuid ){
fossil_fatal("unknown ticket: '%s'!",g.argv[3]);
}
i=4;
}else if( strncmp(g.argv[2],"add",n)==0 ){
eCmd = add;
i = 3;
if( zTktUuid==0 ){
zTktUuid = db_text(0, "SELECT lower(hex(randomblob(20)))");
}
}
/* none of set/add, so show the usage! */
if( eCmd==err ){
usage("add|fieldlist|set|show|history");
}
/* we just handle history separately here, does not get out */
|