comparison tests/test-topic-flow-reject-untopiced.t @ 3235:8a772f0c54d9

topics: add a config to reject draft changeset without topic on a server This patch adds a new config option experimental.topic-mode.server which if sets to True, the server won't accept any draft changeset without topic on it. In case both `experimental.topic-mode.server` and `experimental.topic.publish-bare-branch` are set to True, the enforce-topic one is respected. Tests are added for it. The CHANGELOG file is also updated mentioning about the config option.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 09 Dec 2017 06:13:28 +0100
parents
children e642bad8174a
comparison
equal deleted inserted replaced
3234:a18ca224e812 3235:8a772f0c54d9
1 Testing the config option for rejecting draft changeset without topic
2 The config option is "experimental.topic-mode.server"
3
4 $ . "$TESTDIR/testlib/topic_setup.sh"
5
6 Creating a server repo
7
8 $ hg init server
9 $ cd server
10 $ cat <<EOF >>.hg/hgrc
11 > [phases]
12 > publish=False
13 > [experimental]
14 > topic-mode.server = enforce
15 > EOF
16
17 $ hg topic server
18 marked working directory as topic: server
19 $ for ch in a b c; do echo foo > $ch; hg ci -Aqm "Added "$ch; done
20
21 $ hg log -G -T "{rev}:{node|short}\n{desc} {topics}"
22 @ 2:a7b96f87a214
23 | Added c server
24 o 1:d6a8197e192a
25 | Added b server
26 o 0:49a3f206c9ae
27 Added a server
28
29 $ cd ..
30
31 Creating a client repo
32
33 $ hg clone server client
34 updating to branch default
35 switching to topic server
36 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 $ cd client
38 $ hg log -G -T "{rev}:{node|short}\n{desc} {topics}"
39 @ 2:a7b96f87a214
40 | Added c server
41 o 1:d6a8197e192a
42 | Added b server
43 o 0:49a3f206c9ae
44 Added a server
45
46 $ hg topic
47 * server (3 changesets)
48
49 Create a changeset without topic
50
51 $ hg topic --clear
52 $ echo foo > d
53 $ hg ci -Aqm "added d"
54
55 $ hg log -G -T "{rev}:{node|short}\n{desc} {topics}"
56 @ 3:4e8b0e0237c6
57 | added d
58 o 2:a7b96f87a214
59 | Added c server
60 o 1:d6a8197e192a
61 | Added b server
62 o 0:49a3f206c9ae
63 Added a server
64
65 Push a draft changeset without topic
66
67 $ hg push ../server --new-branch
68 pushing to ../server
69 searching for changes
70 adding changesets
71 adding manifests
72 adding file changes
73 added 1 changesets with 1 changes to 1 files
74 transaction abort!
75 rollback completed
76 abort: rejecting draft changesets: 4e8b0e0237
77 [255]
78
79 $ hg push ../server -f
80 pushing to ../server
81 searching for changes
82 adding changesets
83 adding manifests
84 adding file changes
85 added 1 changesets with 1 changes to 1 files
86 transaction abort!
87 rollback completed
88 abort: rejecting draft changesets: 4e8b0e0237
89 [255]
90
91 Grow the stack with more changesets having topic
92
93 $ hg topic client
94 marked working directory as topic: client
95 $ for ch in e f g; do echo foo > $ch; hg ci -Aqm "Added "$ch; done;
96
97 $ hg log -G -T "{rev}:{node|short}\n{desc} {topics}"
98 @ 6:42c4ac86452a
99 | Added g client
100 o 5:3dc456efb491
101 | Added f client
102 o 4:18a516babc60
103 | Added e client
104 o 3:4e8b0e0237c6
105 | added d
106 o 2:a7b96f87a214
107 | Added c server
108 o 1:d6a8197e192a
109 | Added b server
110 o 0:49a3f206c9ae
111 Added a server
112
113 Pushing multiple changeset with some having topics and some not
114
115 $ hg push ../server --new-branch
116 pushing to ../server
117 searching for changes
118 adding changesets
119 adding manifests
120 adding file changes
121 added 4 changesets with 4 changes to 4 files
122 transaction abort!
123 rollback completed
124 abort: rejecting draft changesets: 4e8b0e0237
125 [255]
126
127 Testing case when both experimental.topic-mode.server and
128 experimental.topic.publish-bare-branch are set
129
130 $ cd ../server
131 $ echo 'topic.publish-bare-branch=True' >> .hg/hgrc
132 $ cd ../client
133 $ hg push ../server --new-branch
134 pushing to ../server
135 searching for changes
136 adding changesets
137 adding manifests
138 adding file changes
139 added 4 changesets with 4 changes to 4 files
140 transaction abort!
141 rollback completed
142 abort: rejecting draft changesets: 4e8b0e0237
143 [255]
144
145 Turning the changeset public and testing push
146
147 $ hg phase -r 3 -p
148 $ hg log -G -T "{rev}:{node|short}\n{desc} {topics}"
149 @ 6:42c4ac86452a
150 | Added g client
151 o 5:3dc456efb491
152 | Added f client
153 o 4:18a516babc60
154 | Added e client
155 o 3:4e8b0e0237c6
156 | added d
157 o 2:a7b96f87a214
158 | Added c
159 o 1:d6a8197e192a
160 | Added b
161 o 0:49a3f206c9ae
162 Added a
163
164 $ hg push ../server
165 pushing to ../server
166 searching for changes
167 adding changesets
168 adding manifests
169 adding file changes
170 added 4 changesets with 4 changes to 4 files
171 active topic 'server' is now empty