Fossil SCM

Rename policy setting for private merges to 'unpublished.'

preben 2023-10-18 12:14 warn-on-merging-private-branch
Commit f2322d90447b4f65a8bf1dc121a50c980b44197dedb974c089eea48197548375
1 file changed +8 -9
--- src/warnpolicy.c
+++ src/warnpolicy.c
@@ -28,22 +28,21 @@
2828
**
2929
** commit: Used when committing. A list of objects with names in
3030
** (message, branch, except-branch, users, except-users).
3131
** merge: Used when merging. A List of objects with names in
3232
** (message, branch, except-branch, from, except-from,
33
-** users, except-users, history-loss).
33
+** users, except-users, unpublished).
3434
** match-style: If "regexp", patterns use REGEXP, otherwise GLOB.
3535
**
3636
** Meaning of names used in lists above:
3737
**
3838
** message: MESSAGE Required: Message to show.
3939
** branch: PATTERN Apply branch match PATTERN (default any).
4040
** except-branch: PATTERN Exclude when in a branch matching PATTERN.
4141
** from: PATTERN Apply if merging from PATTERN (default any).
4242
** except-from: PATTERN Exclude when merging from PATTERN.
43
-** history-loss: true If true, only show message when history loss
44
-** would occur; that is, when merging a private
43
+** unpublished: true If true, only show when merging from a private
4544
** branch into a public branch.
4645
** users: LIST Show only for users in LIST (default any).
4746
** except-users: LIST Users in LIST will not be shown the messages.
4847
**
4948
** Example:
@@ -53,13 +52,13 @@
5352
** { "message": "Release pending, proceed with caution.",
5453
** "branch": "trunk",
5554
** "except-users": [ "owner", "admin" ] }
5655
** ],
5756
** "merge": [
58
-** { "message": "Please 'fossil publish' before merging private to public",
57
+** { "message": "Please use 'fossil publish' before merging private to public",
5958
** "except-branch": "rebased-branch-*",
60
-** "history-loss": true },
59
+** "unpublished": true },
6160
** { "message": "Updates to release branches should be merged from rc.",
6261
** "branch": "release-*",
6362
** "except-from": "rc-*" }
6463
** ]
6564
** }
@@ -172,12 +171,12 @@
172171
zFrom, zMatch, zFrom, zMatch,
173172
g.zLogin, g.zLogin
174173
);
175174
if( !historyLoss ){
176175
blob_append_sql(&sql,
177
- " AND (elm->>'history-loss' IS NULL"
178
- " OR NOT elm->>'history-loss')"
176
+ " AND (elm->>'unpublished' IS NULL"
177
+ " OR NOT elm->>'unpublished')"
179178
);
180179
}
181180
nWarnings = print_policy_warnings(&sql);
182181
blob_reset(&sql);
183182
return nWarnings;
@@ -197,11 +196,11 @@
197196
** -b|--branch BRANCH Test commit to BRANCH.
198197
**
199198
** Options for "merge" event:
200199
** -b|--branch BRANCH Test merge to BRANCH.
201200
** -f|--from BRANCH Test merge from BRANCH.
202
-** -hl|--history-loss Test merging from a private to a public branch.
201
+** -u|--unpublished Test merging from a private to a public branch.
203202
*/
204203
void test_warning_policy_cmd(void){
205204
const char *zEvent;
206205
const char *zJSON;
207206
@@ -229,11 +228,11 @@
229228
verify_all_options();
230229
issue_commit_warnings(zBranch);
231230
}else if( fossil_strcmp(zEvent, "merge")==0 ){
232231
const char *zBranch = find_option("branch", "b", 1);
233232
const char *zFrom = find_option("from", "f", 1);
234
- int historyLoss = find_option("history-loss", "hl", 0)!=0;
233
+ int historyLoss = find_option("unpublished", "u", 0)!=0;
235234
if( zBranch==0 ) fossil_fatal("%s: missing --branch option", zEvent);
236235
if( zFrom==0 ) fossil_fatal("%s: missing --from option", zEvent);
237236
verify_all_options();
238237
issue_merge_warnings(zBranch, zFrom, historyLoss);
239238
}else{
240239
--- src/warnpolicy.c
+++ src/warnpolicy.c
@@ -28,22 +28,21 @@
28 **
29 ** commit: Used when committing. A list of objects with names in
30 ** (message, branch, except-branch, users, except-users).
31 ** merge: Used when merging. A List of objects with names in
32 ** (message, branch, except-branch, from, except-from,
33 ** users, except-users, history-loss).
34 ** match-style: If "regexp", patterns use REGEXP, otherwise GLOB.
35 **
36 ** Meaning of names used in lists above:
37 **
38 ** message: MESSAGE Required: Message to show.
39 ** branch: PATTERN Apply branch match PATTERN (default any).
40 ** except-branch: PATTERN Exclude when in a branch matching PATTERN.
41 ** from: PATTERN Apply if merging from PATTERN (default any).
42 ** except-from: PATTERN Exclude when merging from PATTERN.
43 ** history-loss: true If true, only show message when history loss
44 ** would occur; that is, when merging a private
45 ** branch into a public branch.
46 ** users: LIST Show only for users in LIST (default any).
47 ** except-users: LIST Users in LIST will not be shown the messages.
48 **
49 ** Example:
@@ -53,13 +52,13 @@
53 ** { "message": "Release pending, proceed with caution.",
54 ** "branch": "trunk",
55 ** "except-users": [ "owner", "admin" ] }
56 ** ],
57 ** "merge": [
58 ** { "message": "Please 'fossil publish' before merging private to public",
59 ** "except-branch": "rebased-branch-*",
60 ** "history-loss": true },
61 ** { "message": "Updates to release branches should be merged from rc.",
62 ** "branch": "release-*",
63 ** "except-from": "rc-*" }
64 ** ]
65 ** }
@@ -172,12 +171,12 @@
172 zFrom, zMatch, zFrom, zMatch,
173 g.zLogin, g.zLogin
174 );
175 if( !historyLoss ){
176 blob_append_sql(&sql,
177 " AND (elm->>'history-loss' IS NULL"
178 " OR NOT elm->>'history-loss')"
179 );
180 }
181 nWarnings = print_policy_warnings(&sql);
182 blob_reset(&sql);
183 return nWarnings;
@@ -197,11 +196,11 @@
197 ** -b|--branch BRANCH Test commit to BRANCH.
198 **
199 ** Options for "merge" event:
200 ** -b|--branch BRANCH Test merge to BRANCH.
201 ** -f|--from BRANCH Test merge from BRANCH.
202 ** -hl|--history-loss Test merging from a private to a public branch.
203 */
204 void test_warning_policy_cmd(void){
205 const char *zEvent;
206 const char *zJSON;
207
@@ -229,11 +228,11 @@
229 verify_all_options();
230 issue_commit_warnings(zBranch);
231 }else if( fossil_strcmp(zEvent, "merge")==0 ){
232 const char *zBranch = find_option("branch", "b", 1);
233 const char *zFrom = find_option("from", "f", 1);
234 int historyLoss = find_option("history-loss", "hl", 0)!=0;
235 if( zBranch==0 ) fossil_fatal("%s: missing --branch option", zEvent);
236 if( zFrom==0 ) fossil_fatal("%s: missing --from option", zEvent);
237 verify_all_options();
238 issue_merge_warnings(zBranch, zFrom, historyLoss);
239 }else{
240
--- src/warnpolicy.c
+++ src/warnpolicy.c
@@ -28,22 +28,21 @@
28 **
29 ** commit: Used when committing. A list of objects with names in
30 ** (message, branch, except-branch, users, except-users).
31 ** merge: Used when merging. A List of objects with names in
32 ** (message, branch, except-branch, from, except-from,
33 ** users, except-users, unpublished).
34 ** match-style: If "regexp", patterns use REGEXP, otherwise GLOB.
35 **
36 ** Meaning of names used in lists above:
37 **
38 ** message: MESSAGE Required: Message to show.
39 ** branch: PATTERN Apply branch match PATTERN (default any).
40 ** except-branch: PATTERN Exclude when in a branch matching PATTERN.
41 ** from: PATTERN Apply if merging from PATTERN (default any).
42 ** except-from: PATTERN Exclude when merging from PATTERN.
43 ** unpublished: true If true, only show when merging from a private
 
44 ** branch into a public branch.
45 ** users: LIST Show only for users in LIST (default any).
46 ** except-users: LIST Users in LIST will not be shown the messages.
47 **
48 ** Example:
@@ -53,13 +52,13 @@
52 ** { "message": "Release pending, proceed with caution.",
53 ** "branch": "trunk",
54 ** "except-users": [ "owner", "admin" ] }
55 ** ],
56 ** "merge": [
57 ** { "message": "Please use 'fossil publish' before merging private to public",
58 ** "except-branch": "rebased-branch-*",
59 ** "unpublished": true },
60 ** { "message": "Updates to release branches should be merged from rc.",
61 ** "branch": "release-*",
62 ** "except-from": "rc-*" }
63 ** ]
64 ** }
@@ -172,12 +171,12 @@
171 zFrom, zMatch, zFrom, zMatch,
172 g.zLogin, g.zLogin
173 );
174 if( !historyLoss ){
175 blob_append_sql(&sql,
176 " AND (elm->>'unpublished' IS NULL"
177 " OR NOT elm->>'unpublished')"
178 );
179 }
180 nWarnings = print_policy_warnings(&sql);
181 blob_reset(&sql);
182 return nWarnings;
@@ -197,11 +196,11 @@
196 ** -b|--branch BRANCH Test commit to BRANCH.
197 **
198 ** Options for "merge" event:
199 ** -b|--branch BRANCH Test merge to BRANCH.
200 ** -f|--from BRANCH Test merge from BRANCH.
201 ** -u|--unpublished Test merging from a private to a public branch.
202 */
203 void test_warning_policy_cmd(void){
204 const char *zEvent;
205 const char *zJSON;
206
@@ -229,11 +228,11 @@
228 verify_all_options();
229 issue_commit_warnings(zBranch);
230 }else if( fossil_strcmp(zEvent, "merge")==0 ){
231 const char *zBranch = find_option("branch", "b", 1);
232 const char *zFrom = find_option("from", "f", 1);
233 int historyLoss = find_option("unpublished", "u", 0)!=0;
234 if( zBranch==0 ) fossil_fatal("%s: missing --branch option", zEvent);
235 if( zFrom==0 ) fossil_fatal("%s: missing --from option", zEvent);
236 verify_all_options();
237 issue_merge_warnings(zBranch, zFrom, historyLoss);
238 }else{
239

Keyboard Shortcuts

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