Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add new "Tranfer Commit" hook, together with UI pages. Move existing "Ticket" hook there as well. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | tkt-change-hook |
| Files: | files | file ages | folders |
| SHA1: |
266aca1c42b445c03e0b473d12f70ec3 |
| User & Date: | jan.nijtmans 2013-07-10 10:22:54.546 |
Context
|
2013-07-10
| ||
| 13:00 | Bug-fixes: - ticket change resulted in ticket hook firing twice. - uuid for commits was determined wrong. ... (check-in: 078c67e0c4 user: jan.nijtmans tags: tkt-change-hook) | |
| 10:22 | Add new "Tranfer Commit" hook, together with UI pages. Move existing "Ticket" hook there as well. ... (check-in: 266aca1c42 user: jan.nijtmans tags: tkt-change-hook) | |
| 10:10 | Only set "seen-delta-manifest" once. ... (check-in: 18d762af88 user: jan.nijtmans tags: trunk) | |
| 08:07 | Some code cleanup. Rename "tkt" variable to "uuid". ... (check-in: 8564e1c6bb user: jan.nijtmans tags: tkt-change-hook) | |
Changes
Changes to src/configure.c.
| ︙ | ︙ | |||
109 110 111 112 113 114 115 |
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
| < > > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
{ "crnl-glob", CONFIGSET_PROJ },
{ "encoding-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
{ "ticket-editpage", CONFIGSET_TKT },
{ "ticket-reportlist", CONFIGSET_TKT },
{ "ticket-report-template", CONFIGSET_TKT },
{ "ticket-key-template", CONFIGSET_TKT },
{ "ticket-title-expr", CONFIGSET_TKT },
{ "ticket-closed-expr", CONFIGSET_TKT },
{ "@reportfmt", CONFIGSET_TKT },
{ "@user", CONFIGSET_USER },
{ "@concealed", CONFIGSET_ADDR },
{ "@shun", CONFIGSET_SHUN },
{ "xfer-common-script", CONFIGSET_XFER },
{ "xfer-push-script", CONFIGSET_XFER },
{ "xfer-commit-script", CONFIGSET_XFER },
{ "ticket-change", CONFIGSET_XFER },
};
static int iConfig = 0;
/*
** Return name of first configuration property matching the given mask.
*/
|
| ︙ | ︙ |
Changes to src/json_config.c.
| ︙ | ︙ | |||
72 73 74 75 76 77 78 |
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
| < | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
{ "keep-glob", CONFIGSET_PROJ },
{ "crnl-glob", CONFIGSET_PROJ },
{ "empty-dirs", CONFIGSET_PROJ },
{ "allow-symlinks", CONFIGSET_PROJ },
{ "ticket-table", CONFIGSET_TKT },
{ "ticket-common", CONFIGSET_TKT },
{ "ticket-newpage", CONFIGSET_TKT },
{ "ticket-viewpage", CONFIGSET_TKT },
{ "ticket-editpage", CONFIGSET_TKT },
{ "ticket-reportlist", CONFIGSET_TKT },
{ "ticket-report-template", CONFIGSET_TKT },
{ "ticket-key-template", CONFIGSET_TKT },
{ "ticket-title-expr", CONFIGSET_TKT },
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 |
** file, is a legacy of its original use.
*/
int manifest_crosslink(int rid, Blob *pContent){
int i;
Manifest *p;
Stmt q;
int parentid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
assert( blob_is_reset(pContent) || pContent==0 );
return 0;
}
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
db_begin_transaction();
if( p->type==CFTYPE_MANIFEST ){
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
char *zCom;
for(i=0; i<p->nParent; i++){
int pid = uuid_to_rid(p->azParent[i], 1);
db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
"VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
if( i==0 ){
| > > > | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 |
** file, is a legacy of its original use.
*/
int manifest_crosslink(int rid, Blob *pContent){
int i;
Manifest *p;
Stmt q;
int parentid = 0;
const char *hook = 0;
char *zUuid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
assert( blob_is_reset(pContent) || pContent==0 );
return 0;
}
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
db_begin_transaction();
if( p->type==CFTYPE_MANIFEST ){
hook = "xfer-commit-script";
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
char *zCom;
for(i=0; i<p->nParent; i++){
int pid = uuid_to_rid(p->azParent[i], 1);
db_multi_exec("INSERT OR IGNORE INTO plink(pid, cid, isprim, mtime)"
"VALUES(%d, %d, %d, %.17g)", pid, rid, i==0, p->rDate);
if( i==0 ){
|
| ︙ | ︙ | |||
1713 1714 1715 1716 1717 1718 1719 |
free(zCom);
/* If this is a delta-manifest, record the fact that this repository
** contains delta manifests, to free the "commit" logic to generate
** new delta manifests.
*/
if( p->zBaseline!=0 ){
| | | | 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 |
free(zCom);
/* If this is a delta-manifest, record the fact that this repository
** contains delta manifests, to free the "commit" logic to generate
** new delta manifests.
*/
if( p->zBaseline!=0 ){
static int once = 1;
if( once ){
db_set_int("seen-delta-manifest", 1, 0);
once = 0;
}
}
}
}
if( p->type==CFTYPE_CLUSTER ){
|
| ︙ | ︙ | |||
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 |
|| p->type==CFTYPE_MANIFEST
|| p->type==CFTYPE_EVENT
){
for(i=0; i<p->nTag; i++){
int tid;
int type;
if( p->aTag[i].zUuid ){
tid = uuid_to_rid(p->aTag[i].zUuid, 1);
}else{
tid = rid;
}
if( tid ){
switch( p->aTag[i].zName[0] ){
case '-': type = 0; break; /* Cancel prior occurrences */
| > | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 |
|| p->type==CFTYPE_MANIFEST
|| p->type==CFTYPE_EVENT
){
for(i=0; i<p->nTag; i++){
int tid;
int type;
if( p->aTag[i].zUuid ){
zUuid = p->aTag[i].zUuid;
tid = uuid_to_rid(p->aTag[i].zUuid, 1);
}else{
tid = rid;
}
if( tid ){
switch( p->aTag[i].zName[0] ){
case '-': type = 0; break; /* Cancel prior occurrences */
|
| ︙ | ︙ | |||
1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 |
TAG_BGCOLOR, rid
);
}
}
if( p->type==CFTYPE_TICKET ){
char *zTag;
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);
}
| > > | 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 |
TAG_BGCOLOR, rid
);
}
}
if( p->type==CFTYPE_TICKET ){
char *zTag;
hook = "ticket-change";
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);
}
|
| ︙ | ︙ | |||
1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 |
"REPLACE INTO event(type,mtime,objid,user,comment)"
"VALUES('g',%.17g,%d,%Q,%Q)",
p->rDate, rid, p->zUser, blob_str(&comment)
);
blob_reset(&comment);
}
db_end_transaction(0);
if( p->type==CFTYPE_MANIFEST ){
manifest_cache_insert(p);
}else{
manifest_destroy(p);
}
assert( blob_is_reset(pContent) );
return 1;
| > > > > > > > > > > | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 |
"REPLACE INTO event(type,mtime,objid,user,comment)"
"VALUES('g',%.17g,%d,%Q,%Q)",
p->rDate, rid, p->zUser, blob_str(&comment)
);
blob_reset(&comment);
}
db_end_transaction(0);
if( hook ){
const char *zScript = db_get(hook, 0);
if( zScript && *zScript ){
Th_FossilInit(0, 1, 1); /* Make sure TH1 is ready. */
if( zUuid ){
Th_SetVar(g.interp, "uuid", -1, zUuid, strlen(zUuid));
}
return Th_Eval(g.interp, 0, zScript, -1) == TH_OK;
}
}
if( p->type==CFTYPE_MANIFEST ){
manifest_cache_insert(p);
}else{
manifest_destroy(p);
}
assert( blob_is_reset(pContent) );
return 1;
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
/*
** Create the TH1 interpreter and load the "change" code.
*/
int ticket_change(const char *zUuid){
const char *zConfig;
Th_FossilInit(0, 1, 1); /* Make sure TH1 is ready. */
Th_SetVar(g.interp, "uuid", -1, zUuid, strlen(zUuid));
zConfig = ticket_change_code();
return Th_Eval(g.interp, 0, zConfig, -1);
}
/*
** Recreate the TICKET and TICKETCHNG tables.
*/
| > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
/*
** Create the TH1 interpreter and load the "change" code.
*/
int ticket_change(const char *zUuid){
const char *zConfig;
Th_FossilInit(0, 1, 1); /* Make sure TH1 is ready. */
Th_SetVar(g.interp, "uuid", -1, zUuid, strlen(zUuid));
if( run_common_script() == TH_ERROR ) return TH_ERROR;
zConfig = ticket_change_code();
return Th_Eval(g.interp, 0, zConfig, -1);
}
/*
** Recreate the TICKET and TICKETCHNG tables.
*/
|
| ︙ | ︙ |
Changes to src/tktsetup.c.
| ︙ | ︙ | |||
36 37 38 39 40 41 42 |
@ <table border="0" cellspacing="20">
setup_menu_entry("Table", "tktsetup_tab",
"Specify the schema of the \"ticket\" table in the database.");
setup_menu_entry("Timeline", "tktsetup_timeline",
"How to display ticket status in the timeline");
setup_menu_entry("Common", "tktsetup_com",
"Common TH1 code run before all ticket processing.");
| < < | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
@ <table border="0" cellspacing="20">
setup_menu_entry("Table", "tktsetup_tab",
"Specify the schema of the \"ticket\" table in the database.");
setup_menu_entry("Timeline", "tktsetup_timeline",
"How to display ticket status in the timeline");
setup_menu_entry("Common", "tktsetup_com",
"Common TH1 code run before all ticket processing.");
setup_menu_entry("New Ticket Page", "tktsetup_newpage",
"HTML with embedded TH1 code for the \"new ticket\" webpage.");
setup_menu_entry("View Ticket Page", "tktsetup_viewpage",
"HTML with embedded TH1 code for the \"view ticket\" webpage.");
setup_menu_entry("Edit Ticket Page", "tktsetup_editpage",
"HTML with embedded TH1 code for the \"edit ticket\" webpage.");
setup_menu_entry("Report List Page", "tktsetup_reportlist",
|
| ︙ | ︙ | |||
256 257 258 259 260 261 262 |
zDesc,
0,
0,
30
);
}
| < < < < | < < < < < < < < < < < < < < < < < < < | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
zDesc,
0,
0,
30
);
}
/*
** Return the ticket change code.
*/
const char *ticket_change_code(void){
return db_get("ticket-change", "");
}
static const char zDefaultNew[] =
@ <th1>
@ if {![info exists mutype]} {set mutype {[links only]}}
@ if {[info exists submit]} {
@ set status Open
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
815 816 817 818 819 820 821 | Th_FossilInit(0, 1, 1); /* Make sure TH1 is ready. */ return Th_Eval(g.interp, 0, zScript, -1); } /* ** Run the pre-transfer TH1 script, if any, and returns the return code. */ | | | 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 |
Th_FossilInit(0, 1, 1); /* Make sure TH1 is ready. */
return Th_Eval(g.interp, 0, zScript, -1);
}
/*
** Run the pre-transfer TH1 script, if any, and returns the return code.
*/
int run_common_script(void){
return run_script(db_get("xfer-common-script", 0));
}
/*
** Run the post-push TH1 script, if any, and returns the return code.
*/
static int run_push_script(void){
|
| ︙ | ︙ |
Changes to src/xfersetup.c.
| ︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
style_header("Transfer Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Common", "xfersetup_com",
"Common TH1 code run before all transfer request processing.");
setup_menu_entry("Push", "xfersetup_push",
"Specific TH1 code to run after \"push\" transfer requests.");
@ </table>
style_footer();
}
/*
** Common implementation for the transfer setup editor pages.
*/
| > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
style_header("Transfer Setup");
@ <table border="0" cellspacing="20">
setup_menu_entry("Common", "xfersetup_com",
"Common TH1 code run before all transfer request processing.");
setup_menu_entry("Push", "xfersetup_push",
"Specific TH1 code to run after \"push\" transfer requests.");
setup_menu_entry("Commit", "xfersetup_commit",
"The TH1 code run after a commit.");
setup_menu_entry("Ticket", "xfersetup_ticket",
"The TH1 code run after a ticket change.");
@ </table>
style_footer();
}
/*
** Common implementation for the transfer setup editor pages.
*/
|
| ︙ | ︙ | |||
138 139 140 141 142 143 144 145 146 147 148 |
;
xfersetup_generic(
"Transfer Push Script",
"xfer-push-script",
zDefaultXferPush,
zDesc,
0,
0,
30
);
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
;
xfersetup_generic(
"Transfer Push Script",
"xfer-push-script",
zDefaultXferPush,
zDesc,
0,
0,
30
);
}
static const char *zDefaultXferCommit = 0;
/*
** WEBPAGE: xfersetup_commit
*/
void xfersetup_commit_page(void){
static const char zDesc[] =
@ Enter TH1 script that runs for each "commit" in a transfer requests.
;
xfersetup_generic(
"Transfer Commit Script",
"xfer-commit-script",
zDefaultXferCommit,
zDesc,
0,
0,
30
);
}
static const char *zDefaultXferTicket = 0;
/*
** WEBPAGE: xfersetup_ticket
*/
void xfersetup_ticket_page(void){
static const char zDesc[] =
@ Enter TH1 script that runs for each "ticket" change in a transfer requests.
;
xfersetup_generic(
"Transfer Ticket Script",
"ticket-change",
zDefaultXferTicket,
zDesc,
0,
0,
30
);
}
|