Overview
SHA1 Hash: | 55fc643edab6cbe5638fe2458bd07e46328c85ab |
---|---|
Date: | 2008-11-09 13:21:57 |
User: | drh |
Comment: | Add a test command to invoke the manifest parser from the command-line on an arbitrary text file. For testing only. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/manifest.c from [8c3d459bd4] to [b6902558ff].
@@ -671,10 +671,29 @@ manifest_clear(p); return 0; } /* +** COMMAND: test-parse-manifest +** +** Usage: %fossil test-parse-manifest FILENAME +** +** Parse the manifest and discarded. Use for testing only. +*/ +void manifest_test_parse_cmd(void){ + Manifest m; + Blob b; + if( g.argc!=3 ){ + usage("FILENAME"); + } + db_must_be_within_tree(); + blob_read_from_file(&b, g.argv[2]); + manifest_parse(&m, &b); + manifest_clear(&m); +} + +/* ** Add a single entry to the mlink table. Also add the filename to ** the filename table if it is not there already. */ static void add_one_mlink( int mid, /* The record ID of the manifest */ @@ -916,51 +935,10 @@ isNew = ticket_insert(&m, 1, 1); zTag = mprintf("tkt-%s", m.zTicketUuid); tag_insert(zTag, 1, 0, rid, m.rDate, rid); free(zTag); blob_zero(&comment); -#if 0 - if( m.nField==1 ){ - if( m.aField[0].zName[0]=='+' ){ - blob_appendf(&comment, - "Appended to %h in ticket [%.10s]", - &m.aField[0].zName[1], m.zTicketUuid - ); - }else if( strlen(m.aField[0].zValue)<40 ){ - blob_appendf(&comment, - "Changed %h to \"%h\" in ticket [%.10s]", - m.aField[0].zName, m.aField[0].zValue, m.zTicketUuid - ); - }else{ - blob_appendf(&comment, - "Changed %h in ticket [%.10s]", - m.aField[0].zName, m.zTicketUuid - ); - } - }else{ - int i; - const char *z; - const char *zSep = " "; - blob_appendf(&comment, "%d changes to ticket [%.10s]:", - m.nField, m.zTicketUuid); - for(i=0; i<m.nField; i++){ - z = m.aField[i].zName; - if( z[0]=='+' ) z++; - blob_appendf(&comment, "%s%h", zSep, z); - zSep = ", "; - } - int i; - const char *zStatus = 0; - const char *zTitle; - for(i=0; i<m.nField; i++){ - z = m.aField[i].zName; - if( strcmp(z, "status") ) zStatus = m.aField[i].zValue; - } - if( zField - blob_appendf(&comment, "Edits to ticket [%.10s]", m.zTicketUuid); - } -#endif if( once ){ once = 0; zTitleExpr = db_get("ticket-title-expr", "title"); zStatusColumn = db_get("ticket-status-column", "status"); }