Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | add TECHNOTEID to fossil attach command |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both |
| Files: | files | file ages | folders |
| SHA1: |
70131d08e27bf47f50a40132dd80dd85 |
| User & Date: | dave.vines 2016-04-18 13:36:59.277 |
Context
|
2016-04-18
| ||
| 19:18 | Sanitize the mimetypes on both the CLI and json. Allow more friendly names for the supported mimetypes as well as the formal mimetypes ... (check-in: 7ed9c7e4a9 user: dave.vines) | |
| 13:36 | add TECHNOTEID to fossil attach command ... (check-in: 70131d08e2 user: dave.vines) | |
| 08:17 | add TECHNOTEID to fossil wiki commit and allow creation of multiple tech notes with the same timestamp (as already permitted by the GUI). ... (check-in: aeaef8fbb1 user: dave.vines) | |
Changes
Changes to src/attach.c.
| ︙ | ︙ | |||
683 684 685 686 687 688 689 | db_finalize(&q); } /* ** COMMAND: attachment* ** | | | > | > > > > > > > > | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
db_finalize(&q);
}
/*
** COMMAND: attachment*
**
** Usage: %fossil attachment add ?PAGENAME? FILENAME ?OPTIONS?
**
** Add an attachment to an existing wiki page or tech note.
**
** Options:
** -t|--technote DATETIME Specifies the timestamp of
** the technote to which the attachment
** is to be made. The attachment will be
** to the most recently modified tech note
** with the specified timestamp.
** -t|--technote TECHNOTE-ID Specifies the technote to be
** updated by its technote id.
**
** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified.
*/
void attachment_cmd(void){
int n;
db_find_and_open_repository(0, 0);
if( g.argc<3 ){
goto attachment_cmd_usage;
}
|
| ︙ | ︙ | |||
730 731 732 733 734 735 736 |
if( zBody==0 ){
fossil_fatal("wiki page [%s] not found",zPageName);
}
zTarget = zPageName;
zFile = g.argv[4];
}else{
if( g.argc!=4 ){
| | < < < | | > > | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 |
if( zBody==0 ){
fossil_fatal("wiki page [%s] not found",zPageName);
}
zTarget = zPageName;
zFile = g.argv[4];
}else{
if( g.argc!=4 ){
usage("add FILENAME --technote DATETIME|TECHNOTE-ID");
}
rid = wiki_technote_to_rid(zETime);
if( rid<0 ){
fossil_fatal("ambiguous tech note id: %s", zETime);
}
if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){
zBody = pWiki->zWiki;
}
if( zBody==0 ){
fossil_fatal("technote [%s] not found",zETime);
}
zTarget = db_text(0,
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
1140 1141 1142 1143 1144 1145 1146 |
if( db_step(&q)==SQLITE_ROW ) rid = -1;
}
db_finalize(&q);
}
if (!rid) {
if (strlen(zETime)>4) {
rid = db_int(0, "SELECT objid"
| | | > | 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 |
if( db_step(&q)==SQLITE_ROW ) rid = -1;
}
db_finalize(&q);
}
if (!rid) {
if (strlen(zETime)>4) {
rid = db_int(0, "SELECT objid"
" FROM event"
" WHERE datetime(mtime)=datetime('%q')"
" AND type='e'"
" AND tagid IS NOT NULL"
" ORDER BY mtime DESC LIMIT 1",
zETime);
}
}
return rid;
}
|
| ︙ | ︙ |
Changes to test/wiki.test.
| ︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 |
###############################################################################
# Check we can update technote by its id
write_file f14 "Updated text for the really old tech note"
fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid
fossil wiki export a14 --technote $anoldtechnoteid
test wiki-43 {[similar_file f14 a14]}
###############################################################################
# Also check that we can specify a prefix of the tech note id
write_file f15 "Updated text for the really old tech note specified by its id"
fossil wiki commit {Old tech note} f15 --technote [string range $anoldtechnoteid 0 20]
fossil wiki export a15 --technote $anoldtechnoteid
| > > > > > | > > > > > | > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
###############################################################################
# Check we can update technote by its id
write_file f14 "Updated text for the really old tech note"
fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid
fossil wiki export a14 --technote $anoldtechnoteid
test wiki-43 {[similar_file f14 a14]}
###############################################################################
# Check we can add attachments to a technote by its id
fossil attachment add fa --technote $anoldtechnoteid
test wiki-44 {$CODE == 0}
###############################################################################
# Also check that we can specify a prefix of the tech note id
write_file f15 "Updated text for the really old tech note specified by its id"
fossil wiki commit {Old tech note} f15 --technote [string range $anoldtechnoteid 0 20]
fossil wiki export a15 --technote $anoldtechnoteid
test wiki-45 {[similar_file f15 a15]}
###############################################################################
# Check we can add attachments to a technote by a prefix of its id
fossil attachment add fa --technote [string range $anoldtechnoteid 0 20]
test wiki-46 {$CODE == 0}
###############################################################################
# And we get an error for the ambiguous tech note id
fossil wiki commit {Old tech note} f15 --technote $duplicateid -expectError
test wiki-47 {$CODE != 0}
fossil attachment add fa --technote $duplicateid -expectError
test wiki-48 {$CODE != 0}
###############################################################################
test_cleanup
|