Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | First shot at better error-reporting. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | tkt-change-hook |
| Files: | files | file ages | folders |
| SHA1: |
0dbaf29294cc7c7994f4216026426ffa |
| User & Date: | jan.nijtmans 2013-07-11 11:58:13.356 |
Context
|
2013-07-12
| ||
| 11:38 | rebase ... (check-in: ebc22d22d2 user: jan.nijtmans tags: tkt-change-hook) | |
|
2013-07-11
| ||
| 11:58 | First shot at better error-reporting. ... (check-in: 0dbaf29294 user: jan.nijtmans tags: tkt-change-hook) | |
| 11:28 | wrong default return value. ... (check-in: 3db66bc98f user: jan.nijtmans tags: tkt-change-hook) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
151 152 153 154 155 156 157 |
}
brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
if( brid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
| < | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
}
brid = content_put_ex(&branch, 0, 0, 0, isPrivate);
if( brid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( run_common_script()!=TH_OK || manifest_crosslink(brid, &branch)==0 ){
fossil_panic("%s\n", Th_GetResult(g.interp, 0));
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
fossil_print("New branch: %s\n", zUuid);
if( g.argc==3 ){
fossil_print(
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
1682 1683 1684 1685 1686 1687 1688 |
}
nvid = content_put(&manifest);
if( nvid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
if( !dryRunFlag ){
| < | > > | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 |
}
nvid = content_put(&manifest);
if( nvid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
if( !dryRunFlag ){
if( run_common_script()!=TH_OK || manifest_crosslink(nvid, &manifest)==0 ){
fossil_panic("%s\n", Th_GetResult(g.interp, 0));
}
}
assert( blob_is_reset(&manifest) );
content_deltify(vid, nvid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
fossil_print("New_Version: %s\n", zUuid);
if( outputManifest ){
zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1996 1997 1998 1999 2000 2001 2002 |
"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);
| | | | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 |
"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);
i = run_script(hook, zUuid);
if( p->type==CFTYPE_MANIFEST ){
manifest_cache_insert(p);
}else{
manifest_destroy(p);
}
assert( blob_is_reset(pContent) );
return (i == TH_OK);
}
/*
** COMMAND: test-crosslink
**
** Usage: %fossil test-crosslink RECORDID
**
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
501 502 503 504 505 506 507 |
aField[idx].zAppend = mprintf("%.*s", argl[2], argv[2]);
return TH_OK;
}
/*
** Write a ticket into the repository.
*/
| | > | > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
aField[idx].zAppend = mprintf("%.*s", argl[2], argv[2]);
return TH_OK;
}
/*
** Write a ticket into the repository.
*/
static int ticket_put(
Blob *pTicket, /* The text of the ticket change record */
const char *zTktId, /* The ticket to which this change is applied */
int needMod /* True if moderation is needed */
){
int result;
int rid = content_put_ex(pTicket, 0, 0, 0, needMod);
if( rid==0 ){
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
}
if( needMod ){
moderation_table_create();
db_multi_exec(
"INSERT INTO modreq(objid, tktid) VALUES(%d,'%s')",
rid, zTktId
);
}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);
assert( blob_is_reset(pTicket) );
manifest_crosslink_end();
return result;
}
/*
** Subscript command: submit_ticket
**
** Construct and submit a new ticket artifact. The fields of the artifact
** are the names of the columns in the TICKET table. The content is
|
| ︙ | ︙ | |||
613 614 615 616 617 618 619 |
@ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote>
@ <hr /></font>
return TH_OK;
}else if( g.thTrace ){
Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n"
"}<br />\n",
blob_str(&tktchng));
| < | | > | 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
@ <blockquote><pre>%h(blob_str(&tktchng))</pre></blockquote>
@ <hr /></font>
return TH_OK;
}else if( g.thTrace ){
Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n"
"}<br />\n",
blob_str(&tktchng));
}else if( !ticket_put(&tktchng, zUuid,
(g.perm.ModTkt==0 && db_get_boolean("modreq-tkt",0)==1))) {
return TH_ERROR;
}
return TH_OK;
}
/*
** WEBPAGE: tktnew
|
| ︙ | ︙ | |||
1335 1336 1337 1338 1339 1340 1341 |
aField[i].zName, strlen(zValue), zValue);
}
}
blob_appendf(&tktchng, "K %s\n", zTktUuid);
blob_appendf(&tktchng, "U %F\n", zUser);
md5sum_blob(&tktchng, &cksum);
blob_appendf(&tktchng, "Z %b\n", &cksum);
| < | > > | > | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 |
aField[i].zName, strlen(zValue), zValue);
}
}
blob_appendf(&tktchng, "K %s\n", zTktUuid);
blob_appendf(&tktchng, "U %F\n", zUser);
md5sum_blob(&tktchng, &cksum);
blob_appendf(&tktchng, "Z %b\n", &cksum);
if( run_common_script()!=TH_OK || ticket_put(&tktchng, zTktUuid, 0)){
fossil_panic("%s\n", Th_GetResult(g.interp, 0));
}else{
fossil_print("ticket %s succeeded for %s\n",
(eCmd==set?"set":"add"),zTktUuid);
}
}
}
}
|
Changes to src/xfer.c.
| ︙ | ︙ | |||
894 895 896 897 898 899 900 | } static int commonScriptRan = 0; /* ** Run the specified TH1 script, if any, and returns the return code or TH_OK ** when there is no script. If run_common_script() was not ran before, this | | | | 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
}
static int commonScriptRan = 0;
/*
** Run the specified TH1 script, if any, and returns the return code or TH_OK
** when there is no script. If run_common_script() was not ran before, this
** function will return TH_OK without doing anything.
*/
int run_script(const char *zScript, const char *zUuid){
if( !commonScriptRan || !zScript || !(zScript = db_get(zScript, 0))){
return TH_OK; /* No script or common script didn't run, return success. */
}
if( zUuid ){
Th_SetVar(g.interp, "uuid", -1, zUuid, strlen(zUuid));
}
return Th_Eval(g.interp, 0, zScript, -1);
}
|
| ︙ | ︙ |