Fossil SCM

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.

rberteig 2016-03-24 22:27
Commit b81125e2501b52e42f9f86bd0c710adbd166e572
2 files changed +12 -9 +55 -4
+12 -9
--- src/wiki.c
+++ src/wiki.c
@@ -1150,22 +1150,25 @@
11501150
** output. One of PAGENAME or DATETIME must be specified.
11511151
**
11521152
** %fossil wiki (create|commit) PAGENAME ?FILE? ?OPTIONS?
11531153
**
11541154
** Create a new or commit changes to an existing wiki page or
1155
-** technote from FILE or from standard input.
1155
+** technote from FILE or from standard input. PAGENAME is the
1156
+** name of the wiki entry or the timeline comment of the
1157
+** technote.
11561158
**
11571159
** Options:
1158
-** -M|--mimetype TEXT-FORMAT The mime type of the update defaulting
1159
-** defaulting to the type used by the
1160
-** previous version of the page or (for
1161
-** new pages) text/x-fossil-wiki.
1162
-** -t|--technote DATETIME Specifies the timestamp of the technote
1163
-** to be created or updated.
1160
+** -M|--mimetype TEXT-FORMAT The mime type of the update.
1161
+** Defaults to the type used by
1162
+** the previous version of the
1163
+** page, or text/x-fossil-wiki.
1164
+** -t|--technote DATETIME Specifies the timestamp of
1165
+** the technote to be created or
1166
+** updated.
11641167
** --technote-tags TAGS The set of tags for a technote.
1165
-** --technote-bgcolor COLOR The color used for the technote on the
1166
-** timeline.
1168
+** --technote-bgcolor COLOR The color used for the technote
1169
+** on the timeline.
11671170
**
11681171
** %fossil wiki list ?--technote?
11691172
** %fossil wiki ls ?--technote?
11701173
**
11711174
** Lists all wiki entries, one per line, ordered
11721175
--- src/wiki.c
+++ src/wiki.c
@@ -1150,22 +1150,25 @@
1150 ** output. One of PAGENAME or DATETIME must be specified.
1151 **
1152 ** %fossil wiki (create|commit) PAGENAME ?FILE? ?OPTIONS?
1153 **
1154 ** Create a new or commit changes to an existing wiki page or
1155 ** technote from FILE or from standard input.
 
 
1156 **
1157 ** Options:
1158 ** -M|--mimetype TEXT-FORMAT The mime type of the update defaulting
1159 ** defaulting to the type used by the
1160 ** previous version of the page or (for
1161 ** new pages) text/x-fossil-wiki.
1162 ** -t|--technote DATETIME Specifies the timestamp of the technote
1163 ** to be created or updated.
 
1164 ** --technote-tags TAGS The set of tags for a technote.
1165 ** --technote-bgcolor COLOR The color used for the technote on the
1166 ** timeline.
1167 **
1168 ** %fossil wiki list ?--technote?
1169 ** %fossil wiki ls ?--technote?
1170 **
1171 ** Lists all wiki entries, one per line, ordered
1172
--- src/wiki.c
+++ src/wiki.c
@@ -1150,22 +1150,25 @@
1150 ** output. One of PAGENAME or DATETIME must be specified.
1151 **
1152 ** %fossil wiki (create|commit) PAGENAME ?FILE? ?OPTIONS?
1153 **
1154 ** Create a new or commit changes to an existing wiki page or
1155 ** technote from FILE or from standard input. PAGENAME is the
1156 ** name of the wiki entry or the timeline comment of the
1157 ** technote.
1158 **
1159 ** Options:
1160 ** -M|--mimetype TEXT-FORMAT The mime type of the update.
1161 ** Defaults to the type used by
1162 ** the previous version of the
1163 ** page, or text/x-fossil-wiki.
1164 ** -t|--technote DATETIME Specifies the timestamp of
1165 ** the technote to be created or
1166 ** updated.
1167 ** --technote-tags TAGS The set of tags for a technote.
1168 ** --technote-bgcolor COLOR The color used for the technote
1169 ** on the timeline.
1170 **
1171 ** %fossil wiki list ?--technote?
1172 ** %fossil wiki ls ?--technote?
1173 **
1174 ** Lists all wiki entries, one per line, ordered
1175
+55 -4
--- test/wiki.test
+++ test/wiki.test
@@ -72,11 +72,11 @@
7272
# There shouldn't be any tech notes at this point
7373
fossil wiki list --technote
7474
test wiki-8 {[normalize_result] eq {}}
7575
7676
###############################################################################
77
-# Creating a tech note without specifying the timestamp should add a technote
77
+# Creating a tech note with a specified timestamp should add a technote
7878
write_file f3 "A technote"
7979
fossil wiki create technote f3 --technote {2016-01-01 12:34}
8080
test wiki-9 {$CODE == 0}
8181
fossil wiki list --technote
8282
test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}
@@ -157,15 +157,66 @@
157157
fossil wiki create technotenow f7 --technote {2016-01-04 12:34:56+00:00}
158158
test wiki-29 {$CODE == 0}
159159
160160
###############################################################################
161161
# Check a technote appears on the timeline
162
-after 1200
163162
write_file f8 "Contents of a 'unique' tech note"
164
-fossil wiki create {Unique technote} f8 --technote now
163
+fossil wiki create {Unique technote} f8 --technote {2016-01-05 01:02:03}
164
+fossil timeline
165
+test wiki-30 {[string match *Unique*technote* $RESULT]}
166
+
167
+
168
+###############################################################################
169
+# Check for a collision between an attachment and a note, this is a
170
+# bug that results from some code apparently treating the attachment
171
+# entry as if it were a technote when it isn't really.
172
+#
173
+# First, wait for the top of the next second so the attachment
174
+# happens at a known time, then add an attachment to an existing note
175
+# and a new note immediately after.
176
+
177
+set t0 [clock seconds]
178
+while {$t0 == [clock seconds]} {
179
+ after 100
180
+}
181
+set t1 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
182
+write_file f9 "Timestamp: $t1"
183
+fossil attachment add f9 --technote {2016-01-05 01:02:03}
184
+test wiki-31 {$CODE == 0}
185
+fossil wiki create {Attachment collision} f9 --technote now
186
+test wiki-32 {$CODE == 0} knownBug
187
+#
188
+# Now waste time until the next second so that the remaining tests
189
+# don't have to suffer from this known bug with attachments. This
190
+# delay could be removed if that bug is fixed, but probably shouldn't
191
+# be.
192
+set t0 [clock seconds]
193
+while {$t0 == [clock seconds]} {
194
+ after 100
195
+}
196
+
197
+###############################################################################
198
+# Check a technote with no timestamp can not be created, but that
199
+# "now" is a valid stamp.
200
+set t2 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
201
+write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
202
+fossil wiki create "Unstamped Note" f10 --technote -expectError
203
+test wiki-33 {$CODE != 0}
204
+fossil wiki create "Unstamped Note" f10 --technote now
205
+test wiki-34 {$CODE == 0}
206
+fossil wiki list -t
207
+test wiki-35 {[string match "*$t2*" $RESULT]}
208
+###############################################################################
209
+# Check an attachment to it in the same second works.
210
+write_file f11 "Time Stamp was $t2"
211
+fossil attachment add f11 --technote $t2
212
+test wiki-36 {$CODE == 0}
165213
fossil timeline
166
-test wiki-30 {[string match *Unique*technote* [second_data_line]]}
214
+test wiki-36-1 {$CODE == 0}
215
+fossil wiki list -t
216
+test wiki-36-2 {$CODE == 0}
217
+
167218
168219
###############################################################################
169220
170221
test_cleanup
171222
172223
--- test/wiki.test
+++ test/wiki.test
@@ -72,11 +72,11 @@
72 # There shouldn't be any tech notes at this point
73 fossil wiki list --technote
74 test wiki-8 {[normalize_result] eq {}}
75
76 ###############################################################################
77 # Creating a tech note without specifying the timestamp should add a technote
78 write_file f3 "A technote"
79 fossil wiki create technote f3 --technote {2016-01-01 12:34}
80 test wiki-9 {$CODE == 0}
81 fossil wiki list --technote
82 test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}
@@ -157,15 +157,66 @@
157 fossil wiki create technotenow f7 --technote {2016-01-04 12:34:56+00:00}
158 test wiki-29 {$CODE == 0}
159
160 ###############################################################################
161 # Check a technote appears on the timeline
162 after 1200
163 write_file f8 "Contents of a 'unique' tech note"
164 fossil wiki create {Unique technote} f8 --technote now
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165 fossil timeline
166 test wiki-30 {[string match *Unique*technote* [second_data_line]]}
 
 
 
167
168 ###############################################################################
169
170 test_cleanup
171
172
--- test/wiki.test
+++ test/wiki.test
@@ -72,11 +72,11 @@
72 # There shouldn't be any tech notes at this point
73 fossil wiki list --technote
74 test wiki-8 {[normalize_result] eq {}}
75
76 ###############################################################################
77 # Creating a tech note with a specified timestamp should add a technote
78 write_file f3 "A technote"
79 fossil wiki create technote f3 --technote {2016-01-01 12:34}
80 test wiki-9 {$CODE == 0}
81 fossil wiki list --technote
82 test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}
@@ -157,15 +157,66 @@
157 fossil wiki create technotenow f7 --technote {2016-01-04 12:34:56+00:00}
158 test wiki-29 {$CODE == 0}
159
160 ###############################################################################
161 # Check a technote appears on the timeline
 
162 write_file f8 "Contents of a 'unique' tech note"
163 fossil wiki create {Unique technote} f8 --technote {2016-01-05 01:02:03}
164 fossil timeline
165 test wiki-30 {[string match *Unique*technote* $RESULT]}
166
167
168 ###############################################################################
169 # Check for a collision between an attachment and a note, this is a
170 # bug that results from some code apparently treating the attachment
171 # entry as if it were a technote when it isn't really.
172 #
173 # First, wait for the top of the next second so the attachment
174 # happens at a known time, then add an attachment to an existing note
175 # and a new note immediately after.
176
177 set t0 [clock seconds]
178 while {$t0 == [clock seconds]} {
179 after 100
180 }
181 set t1 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
182 write_file f9 "Timestamp: $t1"
183 fossil attachment add f9 --technote {2016-01-05 01:02:03}
184 test wiki-31 {$CODE == 0}
185 fossil wiki create {Attachment collision} f9 --technote now
186 test wiki-32 {$CODE == 0} knownBug
187 #
188 # Now waste time until the next second so that the remaining tests
189 # don't have to suffer from this known bug with attachments. This
190 # delay could be removed if that bug is fixed, but probably shouldn't
191 # be.
192 set t0 [clock seconds]
193 while {$t0 == [clock seconds]} {
194 after 100
195 }
196
197 ###############################################################################
198 # Check a technote with no timestamp can not be created, but that
199 # "now" is a valid stamp.
200 set t2 [clock format [clock seconds] -gmt 1 -format "%Y-%m-%d %H:%M:%S"]
201 write_file f10 "Even unstampted notes are delivered.\nStamped $t2"
202 fossil wiki create "Unstamped Note" f10 --technote -expectError
203 test wiki-33 {$CODE != 0}
204 fossil wiki create "Unstamped Note" f10 --technote now
205 test wiki-34 {$CODE == 0}
206 fossil wiki list -t
207 test wiki-35 {[string match "*$t2*" $RESULT]}
208 ###############################################################################
209 # Check an attachment to it in the same second works.
210 write_file f11 "Time Stamp was $t2"
211 fossil attachment add f11 --technote $t2
212 test wiki-36 {$CODE == 0}
213 fossil timeline
214 test wiki-36-1 {$CODE == 0}
215 fossil wiki list -t
216 test wiki-36-2 {$CODE == 0}
217
218
219 ###############################################################################
220
221 test_cleanup
222
223

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button