Fossil SCM

Expand the 'fossil wiki export --technote' interface to support technote retrieval via tag name as discussed in the chat. The query looks to match against both 'sym-TAG' and 'TAG' as technote tags are presently prefixed with 'sym-'. This identifier should be reserved for branches, however, so may be removed from technotes, at which point this query should be changed.

jamsek 2021-09-06 13:22 trunk
Commit d71b648c6ce92a7a3e8f5e0d8dce660e9ad09dff35ff3c649dd1773ef69ea510
2 files changed +27 -5 +22 -1
+27 -5
--- src/wiki.c
+++ src/wiki.c
@@ -2048,12 +2048,12 @@
20482048
db_end_transaction(0);
20492049
return 1;
20502050
}
20512051
20522052
/*
2053
-** Determine the rid for a tech note given either its id or its
2054
-** timestamp. Returns 0 if there is no such item and -1 if the details
2053
+** Determine the rid for a tech note given either its id, its timestamp,
2054
+** or its tag. Returns 0 if there is no such item and -1 if the details
20552055
** are ambiguous and could refer to multiple items.
20562056
*/
20572057
int wiki_technote_to_rid(const char *zETime) {
20582058
int rid=0; /* Artifact ID of the tech note */
20592059
int nETime = strlen(zETime);
@@ -2084,10 +2084,31 @@
20842084
" AND tagid IS NOT NULL"
20852085
" ORDER BY objid DESC LIMIT 1",
20862086
zETime);
20872087
}
20882088
}
2089
+ if( !rid ) {
2090
+ /*
2091
+ ** At present, technote tags are prefixed with 'sym-', which shouldn't
2092
+ ** be the case, so we check for both with and without the prefix until
2093
+ ** such time as tags have the errant prefix dropped.
2094
+ */
2095
+ rid = db_int(0, "SELECT e.objid"
2096
+ " FROM event e, tag t, tagxref tx"
2097
+ " WHERE e.type='e'"
2098
+ " AND e.tagid IS NOT NULL"
2099
+ " AND e.objid IN"
2100
+ " (SELECT rid FROM tagxref"
2101
+ " WHERE tagid=(SELECT tagid FROM tag"
2102
+ " WHERE tagname GLOB '%q'))"
2103
+ " OR e.objid IN"
2104
+ " (SELECT rid FROM tagxref"
2105
+ " WHERE tagid=(SELECT tagid FROM tag"
2106
+ " WHERE tagname GLOB 'sym-%q'))"
2107
+ " ORDER BY e.mtime DESC LIMIT 1",
2108
+ zETime, zETime);
2109
+ }
20892110
return rid;
20902111
}
20912112
20922113
/*
20932114
** COMMAND: wiki*
@@ -2095,24 +2116,25 @@
20952116
** Usage: %fossil wiki (export|create|commit|list) WikiName
20962117
**
20972118
** Run various subcommands to work with wiki entries or tech notes.
20982119
**
20992120
** > fossil wiki export ?OPTIONS? PAGENAME ?FILE?
2100
-** > fossil wiki export ?OPTIONS? -t|--technote DATETIME|TECHNOTE-ID ?FILE?
2121
+** > fossil wiki export ?OPTIONS? -t|--technote DATETIME|TECHNOTE-ID|TAG ?FILE?
21012122
**
21022123
** Sends the latest version of either a wiki page or of a tech
21032124
** note to the given file or standard output. A filename of "-"
21042125
** writes the output to standard output. The directory parts of
21052126
** the output filename are created if needed.
21062127
** If PAGENAME is provided, the named wiki page will be output.
21072128
**
21082129
** Options:
2109
-** -t|--technote DATETIME|TECHNOTE-ID
2130
+** -t|--technote DATETIME|TECHNOTE-ID|TAG
21102131
** Specifies that a technote, rather than a wiki page,
21112132
** will be exported. If DATETIME is used, the most
21122133
** recently modified tech note with that DATETIME will
2113
-** output.
2134
+** output. If TAG is used, the most recently modified
2135
+** tech note with that TAG will be output.
21142136
** -h|--html The body (only) is rendered in HTML form, without
21152137
** any page header/foot or HTML/BODY tag wrappers.
21162138
** -H|--HTML Works like -h|-html but wraps the output in
21172139
** <html><body>...</body></html>.
21182140
** -p|--pre If -h|-H is used and the page or technote has
21192141
--- src/wiki.c
+++ src/wiki.c
@@ -2048,12 +2048,12 @@
2048 db_end_transaction(0);
2049 return 1;
2050 }
2051
2052 /*
2053 ** Determine the rid for a tech note given either its id or its
2054 ** timestamp. Returns 0 if there is no such item and -1 if the details
2055 ** are ambiguous and could refer to multiple items.
2056 */
2057 int wiki_technote_to_rid(const char *zETime) {
2058 int rid=0; /* Artifact ID of the tech note */
2059 int nETime = strlen(zETime);
@@ -2084,10 +2084,31 @@
2084 " AND tagid IS NOT NULL"
2085 " ORDER BY objid DESC LIMIT 1",
2086 zETime);
2087 }
2088 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2089 return rid;
2090 }
2091
2092 /*
2093 ** COMMAND: wiki*
@@ -2095,24 +2116,25 @@
2095 ** Usage: %fossil wiki (export|create|commit|list) WikiName
2096 **
2097 ** Run various subcommands to work with wiki entries or tech notes.
2098 **
2099 ** > fossil wiki export ?OPTIONS? PAGENAME ?FILE?
2100 ** > fossil wiki export ?OPTIONS? -t|--technote DATETIME|TECHNOTE-ID ?FILE?
2101 **
2102 ** Sends the latest version of either a wiki page or of a tech
2103 ** note to the given file or standard output. A filename of "-"
2104 ** writes the output to standard output. The directory parts of
2105 ** the output filename are created if needed.
2106 ** If PAGENAME is provided, the named wiki page will be output.
2107 **
2108 ** Options:
2109 ** -t|--technote DATETIME|TECHNOTE-ID
2110 ** Specifies that a technote, rather than a wiki page,
2111 ** will be exported. If DATETIME is used, the most
2112 ** recently modified tech note with that DATETIME will
2113 ** output.
 
2114 ** -h|--html The body (only) is rendered in HTML form, without
2115 ** any page header/foot or HTML/BODY tag wrappers.
2116 ** -H|--HTML Works like -h|-html but wraps the output in
2117 ** <html><body>...</body></html>.
2118 ** -p|--pre If -h|-H is used and the page or technote has
2119
--- src/wiki.c
+++ src/wiki.c
@@ -2048,12 +2048,12 @@
2048 db_end_transaction(0);
2049 return 1;
2050 }
2051
2052 /*
2053 ** Determine the rid for a tech note given either its id, its timestamp,
2054 ** or its tag. Returns 0 if there is no such item and -1 if the details
2055 ** are ambiguous and could refer to multiple items.
2056 */
2057 int wiki_technote_to_rid(const char *zETime) {
2058 int rid=0; /* Artifact ID of the tech note */
2059 int nETime = strlen(zETime);
@@ -2084,10 +2084,31 @@
2084 " AND tagid IS NOT NULL"
2085 " ORDER BY objid DESC LIMIT 1",
2086 zETime);
2087 }
2088 }
2089 if( !rid ) {
2090 /*
2091 ** At present, technote tags are prefixed with 'sym-', which shouldn't
2092 ** be the case, so we check for both with and without the prefix until
2093 ** such time as tags have the errant prefix dropped.
2094 */
2095 rid = db_int(0, "SELECT e.objid"
2096 " FROM event e, tag t, tagxref tx"
2097 " WHERE e.type='e'"
2098 " AND e.tagid IS NOT NULL"
2099 " AND e.objid IN"
2100 " (SELECT rid FROM tagxref"
2101 " WHERE tagid=(SELECT tagid FROM tag"
2102 " WHERE tagname GLOB '%q'))"
2103 " OR e.objid IN"
2104 " (SELECT rid FROM tagxref"
2105 " WHERE tagid=(SELECT tagid FROM tag"
2106 " WHERE tagname GLOB 'sym-%q'))"
2107 " ORDER BY e.mtime DESC LIMIT 1",
2108 zETime, zETime);
2109 }
2110 return rid;
2111 }
2112
2113 /*
2114 ** COMMAND: wiki*
@@ -2095,24 +2116,25 @@
2116 ** Usage: %fossil wiki (export|create|commit|list) WikiName
2117 **
2118 ** Run various subcommands to work with wiki entries or tech notes.
2119 **
2120 ** > fossil wiki export ?OPTIONS? PAGENAME ?FILE?
2121 ** > fossil wiki export ?OPTIONS? -t|--technote DATETIME|TECHNOTE-ID|TAG ?FILE?
2122 **
2123 ** Sends the latest version of either a wiki page or of a tech
2124 ** note to the given file or standard output. A filename of "-"
2125 ** writes the output to standard output. The directory parts of
2126 ** the output filename are created if needed.
2127 ** If PAGENAME is provided, the named wiki page will be output.
2128 **
2129 ** Options:
2130 ** -t|--technote DATETIME|TECHNOTE-ID|TAG
2131 ** Specifies that a technote, rather than a wiki page,
2132 ** will be exported. If DATETIME is used, the most
2133 ** recently modified tech note with that DATETIME will
2134 ** output. If TAG is used, the most recently modified
2135 ** tech note with that TAG will be output.
2136 ** -h|--html The body (only) is rendered in HTML form, without
2137 ** any page header/foot or HTML/BODY tag wrappers.
2138 ** -H|--HTML Works like -h|-html but wraps the output in
2139 ** <html><body>...</body></html>.
2140 ** -p|--pre If -h|-H is used and the page or technote has
2141
+22 -1
--- www/event.wiki
+++ www/event.wiki
@@ -43,10 +43,16 @@
4343
reporting as news.
4444
4545
* <b>Announcements</b>. Changes to the composition of the development
4646
team or acquisition of new project sponsors can be communicated as
4747
announcements which can be implemented as technotes.
48
+
49
+ * <b>Signed Checksums</b>. Technotes containing cryptographically signed
50
+ checksums can be linked to repository artifacts, thereby creating a
51
+ traceable, auditable chain so that users can readily verify the integrity
52
+ and authenticity of project deliverables. And the command line interface
53
+ to technotes enables embedding such processes in scripts.
4854
4955
No project is required to use technotes. But technotes can help many projects
5056
stay better organized and provide a better historical record of the
5157
development progress.
5258
@@ -82,11 +88,11 @@
8288
Different technotes can have the same timestamp.
8389
8490
The first argument to create, <b>TECHNOTE-COMMENT</b>, is the title text for the technote
8591
that appears in the timeline.
8692
87
-To view technotes, use the <b>wiki ls</b> command:
93
+To view all technotes, use the <b>wiki ls</b> command:
8894
8995
<blockquote>
9096
<b>
9197
fossil wiki ls --technote --show-technote-ids<br>
9298
<tt>z739263a134bf0da1d28e939f4c4367f51ef4c51 2020-12-19 13:20:19</tt><br>
@@ -93,13 +99,28 @@
9399
<tt>e15a918a8bed71c2ac091d74dc397b8d3340d5e1 2018-09-22 17:40:10</tt><br>
94100
</b>
95101
</blockquote>
96102
97103
A technote ID is the UUID of the technote.
104
+
105
+To view an individual technote, use the <b>wiki export</b> command:
106
+
107
+<blockquote>
108
+<b>
109
+fossil wiki export --technote version-2.16<br>
110
+Release Notes 2021-07-02
111
+
112
+This note describes changes in the Fossil snapshot for ...
113
+</b>
114
+</blockquote>
115
+
116
+The <b>-t|--technote</b> option to the <b>export</b> subcommand takes one of
117
+three identifiers: <b>DATETIME</b>; <b>TECHNOTE-ID</b>; and <b>TAG</b>.
118
+See the [/help?cmd=wiki | wiki help] for specifics.
98119
99120
Users must have check-in privileges (permission "i") in order to
100121
create or edit technotes. In addition, users must have create-wiki
101122
privilege (permission "f") to create new technotes and edit-wiki
102123
privilege (permission "k") in order to edit existing technotes.
103124
104125
Technote content may be formatted as [/wiki_rules | Fossil wiki],
105126
[/md_rules | Markdown], or a plain text.
106127
--- www/event.wiki
+++ www/event.wiki
@@ -43,10 +43,16 @@
43 reporting as news.
44
45 * <b>Announcements</b>. Changes to the composition of the development
46 team or acquisition of new project sponsors can be communicated as
47 announcements which can be implemented as technotes.
 
 
 
 
 
 
48
49 No project is required to use technotes. But technotes can help many projects
50 stay better organized and provide a better historical record of the
51 development progress.
52
@@ -82,11 +88,11 @@
82 Different technotes can have the same timestamp.
83
84 The first argument to create, <b>TECHNOTE-COMMENT</b>, is the title text for the technote
85 that appears in the timeline.
86
87 To view technotes, use the <b>wiki ls</b> command:
88
89 <blockquote>
90 <b>
91 fossil wiki ls --technote --show-technote-ids<br>
92 <tt>z739263a134bf0da1d28e939f4c4367f51ef4c51 2020-12-19 13:20:19</tt><br>
@@ -93,13 +99,28 @@
93 <tt>e15a918a8bed71c2ac091d74dc397b8d3340d5e1 2018-09-22 17:40:10</tt><br>
94 </b>
95 </blockquote>
96
97 A technote ID is the UUID of the technote.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
99 Users must have check-in privileges (permission "i") in order to
100 create or edit technotes. In addition, users must have create-wiki
101 privilege (permission "f") to create new technotes and edit-wiki
102 privilege (permission "k") in order to edit existing technotes.
103
104 Technote content may be formatted as [/wiki_rules | Fossil wiki],
105 [/md_rules | Markdown], or a plain text.
106
--- www/event.wiki
+++ www/event.wiki
@@ -43,10 +43,16 @@
43 reporting as news.
44
45 * <b>Announcements</b>. Changes to the composition of the development
46 team or acquisition of new project sponsors can be communicated as
47 announcements which can be implemented as technotes.
48
49 * <b>Signed Checksums</b>. Technotes containing cryptographically signed
50 checksums can be linked to repository artifacts, thereby creating a
51 traceable, auditable chain so that users can readily verify the integrity
52 and authenticity of project deliverables. And the command line interface
53 to technotes enables embedding such processes in scripts.
54
55 No project is required to use technotes. But technotes can help many projects
56 stay better organized and provide a better historical record of the
57 development progress.
58
@@ -82,11 +88,11 @@
88 Different technotes can have the same timestamp.
89
90 The first argument to create, <b>TECHNOTE-COMMENT</b>, is the title text for the technote
91 that appears in the timeline.
92
93 To view all technotes, use the <b>wiki ls</b> command:
94
95 <blockquote>
96 <b>
97 fossil wiki ls --technote --show-technote-ids<br>
98 <tt>z739263a134bf0da1d28e939f4c4367f51ef4c51 2020-12-19 13:20:19</tt><br>
@@ -93,13 +99,28 @@
99 <tt>e15a918a8bed71c2ac091d74dc397b8d3340d5e1 2018-09-22 17:40:10</tt><br>
100 </b>
101 </blockquote>
102
103 A technote ID is the UUID of the technote.
104
105 To view an individual technote, use the <b>wiki export</b> command:
106
107 <blockquote>
108 <b>
109 fossil wiki export --technote version-2.16<br>
110 Release Notes 2021-07-02
111
112 This note describes changes in the Fossil snapshot for ...
113 </b>
114 </blockquote>
115
116 The <b>-t|--technote</b> option to the <b>export</b> subcommand takes one of
117 three identifiers: <b>DATETIME</b>; <b>TECHNOTE-ID</b>; and <b>TAG</b>.
118 See the [/help?cmd=wiki | wiki help] for specifics.
119
120 Users must have check-in privileges (permission "i") in order to
121 create or edit technotes. In addition, users must have create-wiki
122 privilege (permission "f") to create new technotes and edit-wiki
123 privilege (permission "k") in order to edit existing technotes.
124
125 Technote content may be formatted as [/wiki_rules | Fossil wiki],
126 [/md_rules | Markdown], or a plain text.
127

Keyboard Shortcuts

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