Fossil

Check-in [b81125e2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed some typos and attempted to improve documentation of the fossil wiki command. Added and rearranged test casesd for fossil wiki to explicitly include a knownBug case for the collision between a previous attachment and a new technote that happen to occur in the same second. Note that the reverse order does not fail, as demonstrated by some additional tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | technoteattachcli
Files: files | file ages | folders
SHA1:b81125e2501b52e42f9f86bd0c710adbd166e572
User & Date: rberteig 2016-03-24 22:27:12
Context
2016-03-28
12:12
Stop using 10h as the format for tech note ids. Note that the comment for any existing attachments to tech notes won't change as the comment is generated when the attachment is made (since this change is new, I'd expect there to be none outside of my own personal fossil repositories) check-in: 4ce3c62b user: dave.vines tags: technoteattachcli
2016-03-24
22:27
Fixed some typos and attempted to improve documentation of the fossil wiki command. Added and rearranged test casesd for fossil wiki to explicitly include a knownBug case for the collision between a previous attachment and a new technote that happen to occur in the same second. Note that the reverse order does not fail, as demonstrated by some additional tests. check-in: b81125e2 user: rberteig tags: technoteattachcli
18:28
Fixed inconsistent calls to usage() in the attachment command which result in printing the fossil command name twice in the Usage: message. check-in: 420a5fc0 user: rberteig tags: technoteattachcli
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wiki.c.

1148
1149
1150
1151
1152
1153
1154
1155


1156
1157
1158
1159
1160
1161
1162

1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
**       Sends the latest version of either the PAGENAME wiki entry
**       or the DATETIME tech note to the given file or standard 
**       output. One of PAGENAME or DATETIME must be specified.
**
**    %fossil wiki (create|commit) PAGENAME ?FILE? ?OPTIONS?
**              
**       Create a new or commit changes to an existing wiki page or 
**       technote from FILE or from standard input.


**
**       Options:
**         -M|--mimetype TEXT-FORMAT   The mime type of the update defaulting
**                                     defaulting to the type used by the 
**                                     previous version of the page or (for 
**                                     new pages) text/x-fossil-wiki.
**         -t|--technote DATETIME      Specifies the timestamp of the technote

**                                     to be created or updated.
**         --technote-tags TAGS        The set of tags for a technote.
**         --technote-bgcolor COLOR    The color used for the technote on the
**                                     timeline.
**
**    %fossil wiki list ?--technote?
**    %fossil wiki ls ?--technote?
**
**       Lists all wiki entries, one per line, ordered
**       case-insensitively by name. The --technote flag
**       specifies that technotes will be listed instead of







|
>
>


|
|
|
|
|
>
|

|
|







1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
**       Sends the latest version of either the PAGENAME wiki entry
**       or the DATETIME tech note to the given file or standard 
**       output. One of PAGENAME or DATETIME must be specified.
**
**    %fossil wiki (create|commit) PAGENAME ?FILE? ?OPTIONS?
**              
**       Create a new or commit changes to an existing wiki page or 
**       technote from FILE or from standard input. PAGENAME is the
**       name of the wiki entry or the timeline comment of the
**       technote.
**
**       Options:
**         -M|--mimetype TEXT-FORMAT   The mime type of the update.
**                                     Defaults to the type used by
**                                     the previous version of the
**                                     page, or text/x-fossil-wiki.
**         -t|--technote DATETIME      Specifies the timestamp of
**                                     the technote to be created or
**                                     updated.
**         --technote-tags TAGS        The set of tags for a technote.
**         --technote-bgcolor COLOR    The color used for the technote
**                                     on the timeline.
**
**    %fossil wiki list ?--technote?
**    %fossil wiki ls ?--technote?
**
**       Lists all wiki entries, one per line, ordered
**       case-insensitively by name. The --technote flag
**       specifies that technotes will be listed instead of

Changes to test/wiki.test.

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
...
155
156
157
158
159
160
161
162
163
164
165
166




















































167
168
169
170
171

###############################################################################
# There shouldn't be any tech notes at this point
fossil wiki list --technote
test wiki-8 {[normalize_result] eq {}}

###############################################################################
# Creating a tech note without specifying the timestamp should add a technote
write_file f3 "A technote"
fossil wiki create technote f3 --technote {2016-01-01 12:34}
test wiki-9 {$CODE == 0}
fossil wiki list --technote
test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}

###############################################################################
................................................................................
# Check longest form of timestamp for the technote
write_file f7 "Different timestamps"
fossil wiki create technotenow f7 --technote {2016-01-04 12:34:56+00:00}
test wiki-29 {$CODE == 0}

###############################################################################
# Check a technote appears on the timeline
after 1200
write_file f8 "Contents of a 'unique' tech note"
fossil wiki create {Unique technote} f8 --technote now
fossil timeline
test wiki-30 {[string match *Unique*technote* [second_data_line]]}





















































###############################################################################

test_cleanup








|







 







<

|

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
...
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222

###############################################################################
# There shouldn't be any tech notes at this point
fossil wiki list --technote
test wiki-8 {[normalize_result] eq {}}

###############################################################################
# Creating a tech note with a specified timestamp should add a technote
write_file f3 "A technote"
fossil wiki create technote f3 --technote {2016-01-01 12:34}
test wiki-9 {$CODE == 0}
fossil wiki list --technote
test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}

###############################################################################
................................................................................
# Check longest form of timestamp for the technote
write_file f7 "Different timestamps"
fossil wiki create technotenow f7 --technote {2016-01-04 12:34:56+00:00}
test wiki-29 {$CODE == 0}

###############################################################################
# Check a technote appears on the timeline

write_file f8 "Contents of a 'unique' tech note"
fossil wiki create {Unique technote} f8 --technote {2016-01-05 01:02:03}
fossil timeline
test wiki-30 {[string match *Unique*technote* $RESULT]}


###############################################################################
# Check for a collision between an attachment and a note, this is a
# bug that results from some code apparently treating the attachment
# entry as if it were a technote when it isn't really. 
#
# First, wait for the top of the next second so the attachment
# happens at a known time, then add an attachment to an existing note
# and a new note immediately after. 

set t0 [clock seconds]
while {$t0 == [clock seconds]} {
  after 100
}
set t1 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
write_file f9 "Timestamp: $t1"
fossil attachment add f9 --technote {2016-01-05 01:02:03}
test wiki-31 {$CODE == 0}
fossil wiki create {Attachment collision} f9 --technote now
test wiki-32 {$CODE == 0} knownBug
#
# Now waste time until the next second so that the remaining tests
# don't have to suffer from this known bug with attachments. This
# delay could be removed if that bug is fixed, but probably shouldn't
# be.
set t0 [clock seconds]
while {$t0 == [clock seconds]} {
  after 100
}

###############################################################################
# Check a technote with no timestamp can not be created, but that
# "now" is a valid stamp.
set t2 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
fossil wiki create "Unstamped Note" f10 --technote -expectError
test wiki-33 {$CODE != 0}
fossil wiki create "Unstamped Note" f10 --technote now
test wiki-34 {$CODE == 0}
fossil wiki list -t 
test wiki-35 {[string match "*$t2*" $RESULT]}
###############################################################################
# Check an attachment to it in the same second works. 
write_file f11 "Time Stamp was $t2"
fossil attachment add f11 --technote $t2
test wiki-36 {$CODE == 0}
fossil timeline
test wiki-36-1 {$CODE == 0}
fossil wiki list -t
test wiki-36-2 {$CODE == 0}


###############################################################################

test_cleanup