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