Show More
@@ -302,7 +302,9 b' class bundlerepository:' | |||||
302 |
|
302 | |||
303 | cgpart = None |
|
303 | cgpart = None | |
304 | for part in bundle.iterparts(seekable=True): |
|
304 | for part in bundle.iterparts(seekable=True): | |
305 |
if part.type == b' |
|
305 | if part.type == b'phase-heads': | |
|
306 | self._handle_bundle2_phase_part(bundle, part) | |||
|
307 | elif part.type == b'changegroup': | |||
306 | if cgpart: |
|
308 | if cgpart: | |
307 | raise NotImplementedError( |
|
309 | raise NotImplementedError( | |
308 | b"can't process multiple changegroups" |
|
310 | b"can't process multiple changegroups" | |
@@ -346,6 +348,17 b' class bundlerepository:' | |||||
346 | def _handle_bundle2_cg_part(self, bundle, part): |
|
348 | def _handle_bundle2_cg_part(self, bundle, part): | |
347 | assert part.type == b'changegroup' |
|
349 | assert part.type == b'changegroup' | |
348 | cgstream = part |
|
350 | cgstream = part | |
|
351 | targetphase = part.params.get(b'targetphase') | |||
|
352 | try: | |||
|
353 | targetphase = int(targetphase) | |||
|
354 | except TypeError: | |||
|
355 | pass | |||
|
356 | if targetphase is None: | |||
|
357 | targetphase = phases.draft | |||
|
358 | if targetphase not in phases.allphases: | |||
|
359 | m = _(b'unsupported targetphase: %d') | |||
|
360 | m %= targetphase | |||
|
361 | raise error.Abort(m) | |||
349 | version = part.params.get(b'version', b'01') |
|
362 | version = part.params.get(b'version', b'01') | |
350 | legalcgvers = changegroup.supportedincomingversions(self) |
|
363 | legalcgvers = changegroup.supportedincomingversions(self) | |
351 | if version not in legalcgvers: |
|
364 | if version not in legalcgvers: | |
@@ -360,10 +373,17 b' class bundlerepository:' | |||||
360 | phases.retractboundary( |
|
373 | phases.retractboundary( | |
361 | self, |
|
374 | self, | |
362 | None, |
|
375 | None, | |
363 |
phase |
|
376 | targetphase, | |
364 | [ctx.node() for ctx in self[self.firstnewrev :]], |
|
377 | [ctx.node() for ctx in self[self.firstnewrev :]], | |
365 | ) |
|
378 | ) | |
366 |
|
379 | |||
|
380 | def _handle_bundle2_phase_part(self, bundle, part): | |||
|
381 | assert part.type == b'phase-heads' | |||
|
382 | ||||
|
383 | unfi = self.unfiltered() | |||
|
384 | headsbyphase = phases.binarydecode(part) | |||
|
385 | phases.updatephases(unfi, lambda: None, headsbyphase) | |||
|
386 | ||||
367 | def _writetempbundle(self, readfn, suffix, header=b''): |
|
387 | def _writetempbundle(self, readfn, suffix, header=b''): | |
368 | """Write a temporary file to disk""" |
|
388 | """Write a temporary file to disk""" | |
369 | fdtemp, temp = self.vfs.mkstemp(prefix=b"hg-bundle-", suffix=suffix) |
|
389 | fdtemp, temp = self.vfs.mkstemp(prefix=b"hg-bundle-", suffix=suffix) |
@@ -33,7 +33,6 b' Set up repo with linear history' | |||||
33 | | |
|
33 | | | |
34 | o A public |
|
34 | o A public | |
35 |
|
35 | |||
36 | Phases are restored when unbundling |
|
|||
37 | $ hg bundle --base B -r E bundle |
|
36 | $ hg bundle --base B -r E bundle | |
38 | 3 changesets found |
|
37 | 3 changesets found | |
39 | $ hg debugbundle bundle |
|
38 | $ hg debugbundle bundle | |
@@ -46,6 +45,57 b' Phases are restored when unbundling' | |||||
46 | phase-heads -- {} (mandatory: True) |
|
45 | phase-heads -- {} (mandatory: True) | |
47 | 26805aba1e600a82e93661149f2313866a221a7b draft |
|
46 | 26805aba1e600a82e93661149f2313866a221a7b draft | |
48 | $ hg strip --no-backup C |
|
47 | $ hg strip --no-backup C | |
|
48 | ||||
|
49 | Phases show on incoming, and are also restored when pulling. Secret commits | |||
|
50 | aren't incoming or pulled, following usual incoming/pull semantics. | |||
|
51 | ||||
|
52 | $ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' | |||
|
53 | o E secret | |||
|
54 | | | |||
|
55 | o D secret | |||
|
56 | | | |||
|
57 | o C draft | |||
|
58 | | | |||
|
59 | o B draft | |||
|
60 | | | |||
|
61 | ~ | |||
|
62 | ||||
|
63 | $ hg incoming bundle -G -T '{desc} {phase}\n' | |||
|
64 | comparing with bundle | |||
|
65 | searching for changes | |||
|
66 | o C draft | |||
|
67 | ||||
|
68 | $ hg pull bundle | |||
|
69 | pulling from bundle | |||
|
70 | searching for changes | |||
|
71 | adding changesets | |||
|
72 | adding manifests | |||
|
73 | adding file changes | |||
|
74 | added 1 changesets with 1 changes to 1 files | |||
|
75 | new changesets 26805aba1e60 (1 drafts) | |||
|
76 | (run 'hg update' to get a working copy) | |||
|
77 | $ hg log -G -T '{desc} {phase}\n' | |||
|
78 | o C draft | |||
|
79 | | | |||
|
80 | o B draft | |||
|
81 | | | |||
|
82 | o A public | |||
|
83 | ||||
|
84 | $ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' | |||
|
85 | o E secret | |||
|
86 | | | |||
|
87 | o D secret | |||
|
88 | | | |||
|
89 | o C draft | |||
|
90 | | | |||
|
91 | o B draft | |||
|
92 | | | |||
|
93 | ~ | |||
|
94 | ||||
|
95 | $ hg rollback --config ui.rollback=1 | |||
|
96 | repository tip rolled back to revision 1 (undo pull) | |||
|
97 | ||||
|
98 | Phases are restored when unbundling | |||
49 | $ hg unbundle -q bundle |
|
99 | $ hg unbundle -q bundle | |
50 | $ rm bundle |
|
100 | $ rm bundle | |
51 |
|
|
101 | $ hg log -G -T '{desc} {phase}\n' | |
@@ -64,7 +114,27 b" Root revision's phase is preserved" | |||||
64 | 5 changesets found |
|
114 | 5 changesets found | |
65 | $ hg strip --no-backup A |
|
115 | $ hg strip --no-backup A | |
66 | $ hg unbundle -q bundle |
|
116 | $ hg unbundle -q bundle | |
67 | $ rm bundle |
|
117 | $ hg log -G -T '{desc} {phase}\n' | |
|
118 | o E secret | |||
|
119 | | | |||
|
120 | o D secret | |||
|
121 | | | |||
|
122 | o C draft | |||
|
123 | | | |||
|
124 | o B draft | |||
|
125 | | | |||
|
126 | o A public | |||
|
127 | ||||
|
128 | $ hg init empty | |||
|
129 | $ hg -R empty pull bundle | |||
|
130 | pulling from bundle | |||
|
131 | requesting all changes | |||
|
132 | adding changesets | |||
|
133 | adding manifests | |||
|
134 | adding file changes | |||
|
135 | added 3 changesets with 3 changes to 3 files | |||
|
136 | new changesets 426bada5c675:26805aba1e60 (2 drafts) | |||
|
137 | (run 'hg update' to get a working copy) | |||
68 | $ hg log -G -T '{desc} {phase}\n' |
|
138 | $ hg log -G -T '{desc} {phase}\n' | |
69 | o E secret |
|
139 | o E secret | |
70 | | |
|
140 | | | |
@@ -76,8 +146,74 b" Root revision's phase is preserved" | |||||
76 | | |
|
146 | | | |
77 | o A public |
|
147 | o A public | |
78 |
|
148 | |||
|
149 | ||||
|
150 | Public repo commits take precedence over phases in the bundle | |||
|
151 | $ hg phase --public E | |||
|
152 | $ hg incoming bundle -G -T '{desc} {phase}\n' | |||
|
153 | comparing with bundle | |||
|
154 | searching for changes | |||
|
155 | no changes found | |||
|
156 | $ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' | |||
|
157 | o E public | |||
|
158 | | | |||
|
159 | o D public | |||
|
160 | | | |||
|
161 | o C public | |||
|
162 | | | |||
|
163 | o B public | |||
|
164 | | | |||
|
165 | o A public | |||
|
166 | ||||
|
167 | $ hg pull bundle | |||
|
168 | pulling from bundle | |||
|
169 | searching for changes | |||
|
170 | no changes found | |||
|
171 | $ hg log -G -T '{desc} {phase}\n' | |||
|
172 | o E public | |||
|
173 | | | |||
|
174 | o D public | |||
|
175 | | | |||
|
176 | o C public | |||
|
177 | | | |||
|
178 | o B public | |||
|
179 | | | |||
|
180 | o A public | |||
|
181 | ||||
|
182 | $ rm bundle | |||
|
183 | ||||
|
184 | A bundle with public phases that are not public in the repo will show as public | |||
|
185 | with `hg log`, but will remain not public in the plain repo. | |||
|
186 | ||||
|
187 | $ hg bundle --base B -r E bundle | |||
|
188 | 3 changesets found | |||
|
189 | $ hg phase --force --draft -r C | |||
|
190 | ||||
|
191 | $ hg log -R bundle -G -T '{desc} {phase}\n' | |||
|
192 | o E public | |||
|
193 | | | |||
|
194 | o D public | |||
|
195 | | | |||
|
196 | o C public | |||
|
197 | | | |||
|
198 | o B public | |||
|
199 | | | |||
|
200 | o A public | |||
|
201 | ||||
|
202 | $ hg log -G -T '{desc} {phase}\n' | |||
|
203 | o E draft | |||
|
204 | | | |||
|
205 | o D draft | |||
|
206 | | | |||
|
207 | o C draft | |||
|
208 | | | |||
|
209 | o B public | |||
|
210 | | | |||
|
211 | o A public | |||
|
212 | ||||
|
213 | $ hg phase --public -r E | |||
|
214 | $ rm bundle | |||
|
215 | ||||
79 | Completely public history can be restored |
|
216 | Completely public history can be restored | |
80 | $ hg phase --public E |
|
|||
81 | $ hg bundle -a bundle |
|
217 | $ hg bundle -a bundle | |
82 | 5 changesets found |
|
218 | 5 changesets found | |
83 | $ hg strip --no-backup A |
|
219 | $ hg strip --no-backup A |
General Comments 0
You need to be logged in to leave comments.
Login now