Re: [fossil-users] Small issue with ticket hook script
2014-01-12 0:09 GMT+01:00 Mark Janssen mpc.jans...@gmail.com: On 11 Jan 2014 20:09, Jan Nijtmans jan.nijtm...@gmail.com wrote: Anyone interested in writing a TH1 encodeURIComponent() function? I guess more parts in fossil could benefit from that. Of course it would be easier if th1 had a command like this, but considering the TCL bridge is there and the fact that tickets are not in high volume, for me the current solution is good enough. I now added the httpize function to fossil, exactly for this purpose. There already was a TH1 htmlize function, so it was quite trivial. Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
2014/1/9 Mark Janssen mpc.jans...@gmail.com: When I use the following script as a ticket hook: set project simpletask tclInvoke package require http query {SELECT title, status FROM ticket WHERE tkt_uuid=$uuid} { set title [tclInvoke http::formatQuery $title] http -asynchronous -- http://127.0.0.1/cgi-bin/tkt-hook?uuid=$uuidtitle=$titlestatus=$statusproject=$project } Looking at this again, fossil could benefit from a TH1 encodeURIComponent() function, which does the same as the Javascript function with the same name. Doing this through Tcl's http::formatQuery command is a lot more expensive. Anyone interested in writing a TH1 encodeURIComponent() function? I guess more parts in fossil could benefit from that. Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On 11 Jan 2014 20:09, Jan Nijtmans jan.nijtm...@gmail.com wrote: 2014/1/9 Mark Janssen mpc.jans...@gmail.com: When I use the following script as a ticket hook: set project simpletask tclInvoke package require http query {SELECT title, status FROM ticket WHERE tkt_uuid=$uuid} { set title [tclInvoke http::formatQuery $title] http -asynchronous -- http://127.0.0.1/cgi-bin/tkt-hook?uuid=$uuidtitle=$titlestatus=$statusproject=$project } Looking at this again, fossil could benefit from a TH1 encodeURIComponent() function, which does the same as the Javascript function with the same name. Doing this through Tcl's http::formatQuery command is a lot more expensive. Anyone interested in writing a TH1 encodeURIComponent() function? I guess more parts in fossil could benefit from that. Of course it would be easier if th1 had a command like this, but considering the TCL bridge is there and the fact that tickets are not in high volume, for me the current solution is good enough. Mark ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Thu, Jan 9, 2014 at 7:49 PM, Mark Janssen mpc.jans...@gmail.com wrote: On Thu, Jan 9, 2014 at 5:58 PM, Mark Janssen mpc.jans...@gmail.comwrote: On Thu, Jan 9, 2014 at 5:31 PM, Jan Nijtmans jan.nijtm...@gmail.comwrote: 2014/1/9 Jan Nijtmans jan.nijtm...@gmail.com: I have a different fix in mind, I'll come back on that later. http://fossil-scm.org/index.html/timeline?r=delay-ticket-hook Does this work for you? Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users No with this a ticket change from the web UI will not trigger the xfer script. With change below it works again is rc what you think it is at that part in the code? Sorry to keep replying to myself, but with latest version of delay-ticket-hook [e4af590ff9]http://www.fossil-scm.org/index.html/info/e4af590ff9 it still doesn't work. The cause is that in tkt.c the result logic is off. Below change fixes it: --- src/tkt.c +++ src/tkt.c @@ -537,11 +537,11 @@ db_multi_exec(INSERT OR IGNORE INTO unclustered VALUES(%d);, rid); } manifest_crosslink_begin(); result = (manifest_crosslink(rid, pTicket, 0)==0); assert( blob_is_reset(pTicket) ); - if( result ){ + if( !result ){ result = manifest_crosslink_end(MC_PERMIT_HOOKS); }else{ manifest_crosslink_end(0); } return result; Mark ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
2014/1/10 Mark Janssen mpc.jans...@gmail.com: Sorry to keep replying to myself, but with latest version of delay-ticket-hook [e4af590ff9] it still doesn't work. The cause is that in tkt.c the result logic is off. Below change fixes it: Yes, that's it! I saw Joe's fixes, but I still wasn't sure if that was enough to fix everything. The return value of manifest_crossling(), which is 0 for errors, always confuse me I'm not 100% sure that error-reporting is handled correctly everywhere, but it's getting close! A review by anyone else familiar wouldn't hurt either. Anyway, It will miss the 1.28 release, but it should be merge-able to trunk not too long after that. Thanks! Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Fri, Jan 10, 2014 at 11:46 AM, Jan Nijtmans jan.nijtm...@gmail.comwrote: 2014/1/10 Mark Janssen mpc.jans...@gmail.com: Sorry to keep replying to myself, but with latest version of delay-ticket-hook [e4af590ff9] it still doesn't work. The cause is that in tkt.c the result logic is off. Below change fixes it: Yes, that's it! I saw Joe's fixes, but I still wasn't sure if that was enough to fix everything. The return value of manifest_crossling(), which is 0 for errors, always confuse me I'm not 100% sure that error-reporting is handled correctly everywhere, but it's getting close! A review by anyone else familiar wouldn't hurt either. Anyway, It will miss the 1.28 release, but it should be merge-able to trunk not too long after that. Thanks! Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users The 0 for error return of manifest_crosslink() tripped me up too. It took me way to long to spot why it wasn't working. Anyway with this change the ticket hooking works for my purposes. Thanks, Mark ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
[fossil-users] Small issue with ticket hook script
When I use the following script as a ticket hook: set project simpletask tclInvoke package require http query {SELECT title, status FROM ticket WHERE tkt_uuid=$uuid} { set title [tclInvoke http::formatQuery $title] http -asynchronous -- http://127.0.0.1/cgi-bin/tkt-hook?uuid=$uuidtitle=$titlestatus=$statusproject=$project } The reflected information in the query is the info from before the ticket update. I suspect the ticket hook is fired before the actual ticket change transaction is commited. Would it be possible to reverse this so that the hook script will be executed after the ticket change has been commited? Thanks, Mark ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
2014/1/9 Mark Janssen mpc.jans...@gmail.com: The reflected information in the query is the info from before the ticket update. I suspect the ticket hook is fired before the actual ticket change transaction is commited. Would it be possible to reverse this so that the hook script will be executed after the ticket change has been commited? I'll have a look at that. In your test, how did the ticket change come in? Either with an xfer from another repository, or simply edited in the web-interface. This difference is important: The code path leading to the hook firing is different in those two situations. Thanks! Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Thu, Jan 9, 2014 at 2:20 PM, Jan Nijtmans jan.nijtm...@gmail.com wrote: 2014/1/9 Mark Janssen mpc.jans...@gmail.com: The reflected information in the query is the info from before the ticket update. I suspect the ticket hook is fired before the actual ticket change transaction is commited. Would it be possible to reverse this so that the hook script will be executed after the ticket change has been commited? I'll have a look at that. In your test, how did the ticket change come in? Either with an xfer from another repository, or simply edited in the web-interface. This difference is important: The code path leading to the hook firing is different in those two situations. Thanks! Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users I tested it with ticket changes from the web interface. Patch below fixes the behavior for the webinterface, Not sure about tickets that are transfered in. Mark Index: src/manifest.c == --- src/manifest.c +++ src/manifest.c @@ -1882,19 +1882,20 @@ ); } } if( p-type==CFTYPE_TICKET ){ char *zTag; - +manifest_crosslink_begin(); zScript = xfer_ticket_code(); zUuid = p-zTicketUuid; assert( manifest_crosslink_busy==1 ); zTag = mprintf(tkt-%s, p-zTicketUuid); tag_insert(zTag, 1, 0, rid, p-rDate, rid); free(zTag); db_multi_exec(INSERT OR IGNORE INTO pending_tkt VALUES(%Q), p-zTicketUuid); +manifest_crosslink_end(); } if( p-type==CFTYPE_ATTACHMENT ){ db_multi_exec( INSERT INTO attachment(attachid, mtime, src, target, filename, comment, user) Index: src/tkt.c == --- src/tkt.c +++ src/tkt.c @@ -534,14 +534,12 @@ ); }else{ db_multi_exec(INSERT OR IGNORE INTO unsent VALUES(%d);, rid); db_multi_exec(INSERT OR IGNORE INTO unclustered VALUES(%d);, rid); } - manifest_crosslink_begin(); result = (manifest_crosslink(rid, pTicket, MC_PERMIT_HOOKS)==0); assert( blob_is_reset(pTicket) ); - manifest_crosslink_end(); return result; } /* ** Subscript command: submit_ticket ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
2014/1/9 Mark Janssen mpc.jans...@gmail.com: I tested it with ticket changes from the web interface. That's indeed what I suspected. I have a different fix in mind, I'll come back on that later. Thanks! Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
2014/1/9 Jan Nijtmans jan.nijtm...@gmail.com: I have a different fix in mind, I'll come back on that later. http://fossil-scm.org/index.html/timeline?r=delay-ticket-hook Does this work for you? Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Thu, Jan 9, 2014 at 5:31 PM, Jan Nijtmans jan.nijtm...@gmail.com wrote: 2014/1/9 Jan Nijtmans jan.nijtm...@gmail.com: I have a different fix in mind, I'll come back on that later. http://fossil-scm.org/index.html/timeline?r=delay-ticket-hook Does this work for you? Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users No with this a ticket change from the web UI will not trigger the xfer script. ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Thu, Jan 9, 2014 at 8:05 AM, Mark Janssen mpc.jans...@gmail.com wrote: ... The reflected information in the query is the info from before the ticket update. I suspect the ticket hook is fired before the actual ticket change transaction is commited. Would it be possible to reverse this so that the hook script will be executed after the ticket change has been commited? Actually, how about 2 hooks, one before and one after? ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Small issue with ticket hook script
On Thu, Jan 9, 2014 at 5:58 PM, Mark Janssen mpc.jans...@gmail.com wrote: On Thu, Jan 9, 2014 at 5:31 PM, Jan Nijtmans jan.nijtm...@gmail.comwrote: 2014/1/9 Jan Nijtmans jan.nijtm...@gmail.com: I have a different fix in mind, I'll come back on that later. http://fossil-scm.org/index.html/timeline?r=delay-ticket-hook Does this work for you? Regards, Jan Nijtmans ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users No with this a ticket change from the web UI will not trigger the xfer script. With change below it works again is rc what you think it is at that part in the code? I would think that a single ticket hook script failure should not terminate all of them. --- src/manifest.c +++ src/manifest.c @@ -1506,13 +1506,11 @@ } db_prepare(q, SELECT uuid FROM pending_tkt); while( db_step(q)==SQLITE_ROW ){ const char *zUuid = db_column_text(q, 0); ticket_rebuild_entry(zUuid); -if( rc==TH_OK ){ - rc = xfer_run_script(xfer_ticket_code(), zUuid); -} +rc = xfer_run_script(xfer_ticket_code(), zUuid); } db_finalize(q); db_multi_exec(DROP TABLE pending_tkt); /* If multiple check-ins happen close together in time, adjust their ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users