Show More
@@ -1,221 +1,243 b'' | |||
|
1 | 1 | setup |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > share = |
|
6 | 6 | > [format] |
|
7 | 7 | > exp-share-safe = True |
|
8 | 8 | > EOF |
|
9 | 9 | |
|
10 | 10 | prepare source repo |
|
11 | 11 | |
|
12 | 12 | $ hg init source |
|
13 | 13 | $ cd source |
|
14 | 14 | $ cat .hg/requires |
|
15 | 15 | exp-sharesafe |
|
16 | 16 | $ cat .hg/store/requires |
|
17 | 17 | dotencode |
|
18 | 18 | fncache |
|
19 | 19 | generaldelta |
|
20 | 20 | revlogv1 |
|
21 | 21 | sparserevlog |
|
22 | 22 | store |
|
23 | 23 | $ hg debugrequirements |
|
24 | 24 | dotencode |
|
25 | 25 | exp-sharesafe |
|
26 | 26 | fncache |
|
27 | 27 | generaldelta |
|
28 | 28 | revlogv1 |
|
29 | 29 | sparserevlog |
|
30 | 30 | store |
|
31 | 31 | |
|
32 | 32 | $ echo a > a |
|
33 | 33 | $ hg ci -Aqm "added a" |
|
34 | 34 | $ echo b > b |
|
35 | 35 | $ hg ci -Aqm "added b" |
|
36 | 36 | |
|
37 | 37 | $ HGEDITOR=cat hg config --shared |
|
38 | 38 | abort: repository is not shared; can't use --shared |
|
39 | 39 | [255] |
|
40 | 40 | $ cd .. |
|
41 | 41 | |
|
42 | 42 | Create a shared repo and check the requirements are shared and read correctly |
|
43 | 43 | $ hg share source shared1 |
|
44 | 44 | updating working directory |
|
45 | 45 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
46 | 46 | $ cd shared1 |
|
47 | 47 | $ cat .hg/requires |
|
48 | 48 | exp-sharesafe |
|
49 | 49 | shared |
|
50 | 50 | |
|
51 | 51 | $ hg debugrequirements -R ../source |
|
52 | 52 | dotencode |
|
53 | 53 | exp-sharesafe |
|
54 | 54 | fncache |
|
55 | 55 | generaldelta |
|
56 | 56 | revlogv1 |
|
57 | 57 | sparserevlog |
|
58 | 58 | store |
|
59 | 59 | |
|
60 | 60 | $ hg debugrequirements |
|
61 | 61 | dotencode |
|
62 | 62 | exp-sharesafe |
|
63 | 63 | fncache |
|
64 | 64 | generaldelta |
|
65 | 65 | revlogv1 |
|
66 | 66 | shared |
|
67 | 67 | sparserevlog |
|
68 | 68 | store |
|
69 | 69 | |
|
70 | 70 | $ echo c > c |
|
71 | 71 | $ hg ci -Aqm "added c" |
|
72 | 72 | |
|
73 | 73 | Check that config of the source repository is also loaded |
|
74 | 74 | |
|
75 | 75 | $ hg showconfig ui.curses |
|
76 | 76 | [1] |
|
77 | 77 | |
|
78 | 78 | $ echo "[ui]" >> ../source/.hg/hgrc |
|
79 | 79 | $ echo "curses=true" >> ../source/.hg/hgrc |
|
80 | 80 | |
|
81 | 81 | $ hg showconfig ui.curses |
|
82 | 82 | true |
|
83 | 83 | |
|
84 | 84 | However, local .hg/hgrc should override the config set by share source |
|
85 | 85 | |
|
86 | 86 | $ echo "[ui]" >> .hg/hgrc |
|
87 | 87 | $ echo "curses=false" >> .hg/hgrc |
|
88 | 88 | |
|
89 | 89 | $ hg showconfig ui.curses |
|
90 | 90 | false |
|
91 | 91 | |
|
92 | 92 | $ HGEDITOR=cat hg config --shared |
|
93 | 93 | [ui] |
|
94 | 94 | curses=true |
|
95 | 95 | |
|
96 | 96 | $ HGEDITOR=cat hg config --local |
|
97 | 97 | [ui] |
|
98 | 98 | curses=false |
|
99 | 99 | |
|
100 | 100 | Testing that hooks set in source repository also runs in shared repo |
|
101 | 101 | |
|
102 | 102 | $ cd ../source |
|
103 | 103 | $ cat <<EOF >> .hg/hgrc |
|
104 | 104 | > [extensions] |
|
105 | 105 | > hooklib= |
|
106 | 106 | > [hooks] |
|
107 | 107 | > pretxnchangegroup.reject_merge_commits = \ |
|
108 | 108 | > python:hgext.hooklib.reject_merge_commits.hook |
|
109 | 109 | > EOF |
|
110 | 110 | |
|
111 | 111 | $ cd .. |
|
112 | 112 | $ hg clone source cloned |
|
113 | 113 | updating to branch default |
|
114 | 114 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
115 | 115 | $ cd cloned |
|
116 | 116 | $ hg up 0 |
|
117 | 117 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
118 | 118 | $ echo bar > bar |
|
119 | 119 | $ hg ci -Aqm "added bar" |
|
120 | 120 | $ hg merge |
|
121 | 121 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
122 | 122 | (branch merge, don't forget to commit) |
|
123 | 123 | $ hg ci -m "merge commit" |
|
124 | 124 | |
|
125 | 125 | $ hg push ../source |
|
126 | 126 | pushing to ../source |
|
127 | 127 | searching for changes |
|
128 | 128 | adding changesets |
|
129 | 129 | adding manifests |
|
130 | 130 | adding file changes |
|
131 | 131 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
132 | 132 | transaction abort! |
|
133 | 133 | rollback completed |
|
134 | 134 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
135 | 135 | [255] |
|
136 | 136 | |
|
137 | 137 | $ hg push ../shared1 |
|
138 | 138 | pushing to ../shared1 |
|
139 | 139 | searching for changes |
|
140 | 140 | adding changesets |
|
141 | 141 | adding manifests |
|
142 | 142 | adding file changes |
|
143 | 143 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
144 | 144 | transaction abort! |
|
145 | 145 | rollback completed |
|
146 | 146 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
147 | 147 | [255] |
|
148 | 148 | |
|
149 | 149 | Test that if share source config is untrusted, we dont read it |
|
150 | 150 | |
|
151 | 151 | $ cd ../shared1 |
|
152 | 152 | |
|
153 | 153 | $ cat << EOF > $TESTTMP/untrusted.py |
|
154 | 154 | > from mercurial import scmutil, util |
|
155 | 155 | > def uisetup(ui): |
|
156 | 156 | > class untrustedui(ui.__class__): |
|
157 | 157 | > def _trusted(self, fp, f): |
|
158 | 158 | > if util.normpath(fp.name).endswith(b'source/.hg/hgrc'): |
|
159 | 159 | > return False |
|
160 | 160 | > return super(untrustedui, self)._trusted(fp, f) |
|
161 | 161 | > ui.__class__ = untrustedui |
|
162 | 162 | > EOF |
|
163 | 163 | |
|
164 | 164 | $ hg showconfig hooks |
|
165 | 165 | hooks.pretxnchangegroup.reject_merge_commits=python:hgext.hooklib.reject_merge_commits.hook |
|
166 | 166 | |
|
167 | 167 | $ hg showconfig hooks --config extensions.untrusted=$TESTTMP/untrusted.py |
|
168 | 168 | [1] |
|
169 | 169 | |
|
170 | 170 | Update the source repository format and check that shared repo works |
|
171 | 171 | |
|
172 | 172 | $ cd ../source |
|
173 | ||
|
174 | Disable zstd related tests because its not present on pure version | |
|
175 | #if zstd | |
|
173 | 176 | $ echo "[format]" >> .hg/hgrc |
|
174 | 177 | $ echo "revlog-compression=zstd" >> .hg/hgrc |
|
175 | 178 | |
|
176 | $ hg debugupgraderepo --run -q -R ../shared1 | |
|
177 | abort: cannot upgrade repository; unsupported source requirement: shared | |
|
178 | [255] | |
|
179 | ||
|
180 | 179 |
$ |
|
181 | 180 | upgrade will perform the following actions: |
|
182 | 181 | |
|
183 | 182 | requirements |
|
184 | 183 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store |
|
185 | 184 | added: revlog-compression-zstd |
|
186 | 185 | |
|
187 | 186 | $ hg log -r . |
|
188 | 187 | changeset: 1:5f6d8a4bf34a |
|
189 | 188 | user: test |
|
190 | 189 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
191 | 190 | summary: added b |
|
192 | 191 | |
|
192 | #endif | |
|
193 | $ echo "[format]" >> .hg/hgrc | |
|
194 | $ echo "use-persistent-nodemap=True" >> .hg/hgrc | |
|
195 | ||
|
196 | $ hg debugupgraderepo --run -q -R ../shared1 | |
|
197 | abort: cannot upgrade repository; unsupported source requirement: shared | |
|
198 | [255] | |
|
199 | ||
|
200 | $ hg debugupgraderepo --run -q | |
|
201 | upgrade will perform the following actions: | |
|
202 | ||
|
203 | requirements | |
|
204 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlogv1, sparserevlog, store (no-zstd !) | |
|
205 | preserved: dotencode, exp-sharesafe, fncache, generaldelta, revlog-compression-zstd, revlogv1, sparserevlog, store (zstd !) | |
|
206 | added: persistent-nodemap | |
|
207 | ||
|
208 | $ hg log -r . | |
|
209 | changeset: 1:5f6d8a4bf34a | |
|
210 | user: test | |
|
211 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
212 | summary: added b | |
|
213 | ||
|
214 | ||
|
193 | 215 | Shared one should work |
|
194 | 216 | $ cd ../shared1 |
|
195 | 217 | $ hg log -r . |
|
196 | 218 | changeset: 2:155349b645be |
|
197 | 219 | tag: tip |
|
198 | 220 | user: test |
|
199 | 221 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
200 | 222 | summary: added c |
|
201 | 223 | |
|
202 | 224 | Unsharing works |
|
203 | 225 | |
|
204 | 226 | $ hg unshare |
|
205 | 227 | |
|
206 | 228 | Test that source config is added to the shared one after unshare, and the config |
|
207 | 229 | of current repo is still respected over the config which came from source config |
|
208 | 230 | $ cd ../cloned |
|
209 | 231 | $ hg push ../shared1 |
|
210 | 232 | pushing to ../shared1 |
|
211 | 233 | searching for changes |
|
212 | 234 | adding changesets |
|
213 | 235 | adding manifests |
|
214 | 236 | adding file changes |
|
215 | 237 | error: pretxnchangegroup.reject_merge_commits hook failed: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
216 | 238 | transaction abort! |
|
217 | 239 | rollback completed |
|
218 | 240 | abort: bcde3522682d rejected as merge on the same branch. Please consider rebase. |
|
219 | 241 | [255] |
|
220 | 242 | $ hg showconfig ui.curses -R ../shared1 |
|
221 | 243 | false |
General Comments 0
You need to be logged in to leave comments.
Login now