Show More
@@ -1,619 +1,619 b'' | |||
|
1 | 1 | # wireproto.py - generic wire protocol support functions |
|
2 | 2 | # |
|
3 | 3 | # Copyright 2005-2010 Matt Mackall <mpm@selenic.com> |
|
4 | 4 | # |
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | 8 | import urllib, tempfile, os, sys |
|
9 | 9 | from i18n import _ |
|
10 | 10 | from node import bin, hex |
|
11 | 11 | import changegroup as changegroupmod |
|
12 | 12 | import peer, error, encoding, util, store |
|
13 | 13 | import discovery, phases |
|
14 | 14 | |
|
15 | 15 | # abstract batching support |
|
16 | 16 | |
|
17 | 17 | class future(object): |
|
18 | 18 | '''placeholder for a value to be set later''' |
|
19 | 19 | def set(self, value): |
|
20 | 20 | if util.safehasattr(self, 'value'): |
|
21 | 21 | raise error.RepoError("future is already set") |
|
22 | 22 | self.value = value |
|
23 | 23 | |
|
24 | 24 | class batcher(object): |
|
25 | 25 | '''base class for batches of commands submittable in a single request |
|
26 | 26 | |
|
27 | 27 | All methods invoked on instances of this class are simply queued and |
|
28 | 28 | return a a future for the result. Once you call submit(), all the queued |
|
29 | 29 | calls are performed and the results set in their respective futures. |
|
30 | 30 | ''' |
|
31 | 31 | def __init__(self): |
|
32 | 32 | self.calls = [] |
|
33 | 33 | def __getattr__(self, name): |
|
34 | 34 | def call(*args, **opts): |
|
35 | 35 | resref = future() |
|
36 | 36 | self.calls.append((name, args, opts, resref,)) |
|
37 | 37 | return resref |
|
38 | 38 | return call |
|
39 | 39 | def submit(self): |
|
40 | 40 | pass |
|
41 | 41 | |
|
42 | 42 | class localbatch(batcher): |
|
43 | 43 | '''performs the queued calls directly''' |
|
44 | 44 | def __init__(self, local): |
|
45 | 45 | batcher.__init__(self) |
|
46 | 46 | self.local = local |
|
47 | 47 | def submit(self): |
|
48 | 48 | for name, args, opts, resref in self.calls: |
|
49 | 49 | resref.set(getattr(self.local, name)(*args, **opts)) |
|
50 | 50 | |
|
51 | 51 | class remotebatch(batcher): |
|
52 | 52 | '''batches the queued calls; uses as few roundtrips as possible''' |
|
53 | 53 | def __init__(self, remote): |
|
54 | 54 | '''remote must support _submitbatch(encbatch) and |
|
55 | 55 | _submitone(op, encargs)''' |
|
56 | 56 | batcher.__init__(self) |
|
57 | 57 | self.remote = remote |
|
58 | 58 | def submit(self): |
|
59 | 59 | req, rsp = [], [] |
|
60 | 60 | for name, args, opts, resref in self.calls: |
|
61 | 61 | mtd = getattr(self.remote, name) |
|
62 | 62 | batchablefn = getattr(mtd, 'batchable', None) |
|
63 | 63 | if batchablefn is not None: |
|
64 | 64 | batchable = batchablefn(mtd.im_self, *args, **opts) |
|
65 | 65 | encargsorres, encresref = batchable.next() |
|
66 | 66 | if encresref: |
|
67 | 67 | req.append((name, encargsorres,)) |
|
68 | 68 | rsp.append((batchable, encresref, resref,)) |
|
69 | 69 | else: |
|
70 | 70 | resref.set(encargsorres) |
|
71 | 71 | else: |
|
72 | 72 | if req: |
|
73 | 73 | self._submitreq(req, rsp) |
|
74 | 74 | req, rsp = [], [] |
|
75 | 75 | resref.set(mtd(*args, **opts)) |
|
76 | 76 | if req: |
|
77 | 77 | self._submitreq(req, rsp) |
|
78 | 78 | def _submitreq(self, req, rsp): |
|
79 | 79 | encresults = self.remote._submitbatch(req) |
|
80 | 80 | for encres, r in zip(encresults, rsp): |
|
81 | 81 | batchable, encresref, resref = r |
|
82 | 82 | encresref.set(encres) |
|
83 | 83 | resref.set(batchable.next()) |
|
84 | 84 | |
|
85 | 85 | def batchable(f): |
|
86 | 86 | '''annotation for batchable methods |
|
87 | 87 | |
|
88 | 88 | Such methods must implement a coroutine as follows: |
|
89 | 89 | |
|
90 | 90 | @batchable |
|
91 | 91 | def sample(self, one, two=None): |
|
92 | 92 | # Handle locally computable results first: |
|
93 | 93 | if not one: |
|
94 | 94 | yield "a local result", None |
|
95 | 95 | # Build list of encoded arguments suitable for your wire protocol: |
|
96 | 96 | encargs = [('one', encode(one),), ('two', encode(two),)] |
|
97 | 97 | # Create future for injection of encoded result: |
|
98 | 98 | encresref = future() |
|
99 | 99 | # Return encoded arguments and future: |
|
100 | 100 | yield encargs, encresref |
|
101 | 101 | # Assuming the future to be filled with the result from the batched |
|
102 | 102 | # request now. Decode it: |
|
103 | 103 | yield decode(encresref.value) |
|
104 | 104 | |
|
105 | 105 | The decorator returns a function which wraps this coroutine as a plain |
|
106 | 106 | method, but adds the original method as an attribute called "batchable", |
|
107 | 107 | which is used by remotebatch to split the call into separate encoding and |
|
108 | 108 | decoding phases. |
|
109 | 109 | ''' |
|
110 | 110 | def plain(*args, **opts): |
|
111 | 111 | batchable = f(*args, **opts) |
|
112 | 112 | encargsorres, encresref = batchable.next() |
|
113 | 113 | if not encresref: |
|
114 | 114 | return encargsorres # a local result in this case |
|
115 | 115 | self = args[0] |
|
116 | 116 | encresref.set(self._submitone(f.func_name, encargsorres)) |
|
117 | 117 | return batchable.next() |
|
118 | 118 | setattr(plain, 'batchable', f) |
|
119 | 119 | return plain |
|
120 | 120 | |
|
121 | 121 | # list of nodes encoding / decoding |
|
122 | 122 | |
|
123 | 123 | def decodelist(l, sep=' '): |
|
124 | 124 | if l: |
|
125 | 125 | return map(bin, l.split(sep)) |
|
126 | 126 | return [] |
|
127 | 127 | |
|
128 | 128 | def encodelist(l, sep=' '): |
|
129 | 129 | return sep.join(map(hex, l)) |
|
130 | 130 | |
|
131 | 131 | # batched call argument encoding |
|
132 | 132 | |
|
133 | 133 | def escapearg(plain): |
|
134 | 134 | return (plain |
|
135 | 135 | .replace(':', '::') |
|
136 | 136 | .replace(',', ':,') |
|
137 | 137 | .replace(';', ':;') |
|
138 | 138 | .replace('=', ':=')) |
|
139 | 139 | |
|
140 | 140 | def unescapearg(escaped): |
|
141 | 141 | return (escaped |
|
142 | 142 | .replace(':=', '=') |
|
143 | 143 | .replace(':;', ';') |
|
144 | 144 | .replace(':,', ',') |
|
145 | 145 | .replace('::', ':')) |
|
146 | 146 | |
|
147 | 147 | # client side |
|
148 | 148 | |
|
149 | 149 | def todict(**args): |
|
150 | 150 | return args |
|
151 | 151 | |
|
152 | 152 | class wirepeer(peer.peerrepository): |
|
153 | 153 | |
|
154 | 154 | def batch(self): |
|
155 | 155 | return remotebatch(self) |
|
156 | 156 | def _submitbatch(self, req): |
|
157 | 157 | cmds = [] |
|
158 | 158 | for op, argsdict in req: |
|
159 | 159 | args = ','.join('%s=%s' % p for p in argsdict.iteritems()) |
|
160 | 160 | cmds.append('%s %s' % (op, args)) |
|
161 | 161 | rsp = self._call("batch", cmds=';'.join(cmds)) |
|
162 | 162 | return rsp.split(';') |
|
163 | 163 | def _submitone(self, op, args): |
|
164 | 164 | return self._call(op, **args) |
|
165 | 165 | |
|
166 | 166 | @batchable |
|
167 | 167 | def lookup(self, key): |
|
168 | 168 | self.requirecap('lookup', _('look up remote revision')) |
|
169 | 169 | f = future() |
|
170 | 170 | yield todict(key=encoding.fromlocal(key)), f |
|
171 | 171 | d = f.value |
|
172 | 172 | success, data = d[:-1].split(" ", 1) |
|
173 | 173 | if int(success): |
|
174 | 174 | yield bin(data) |
|
175 | 175 | self._abort(error.RepoError(data)) |
|
176 | 176 | |
|
177 | 177 | @batchable |
|
178 | 178 | def heads(self): |
|
179 | 179 | f = future() |
|
180 | 180 | yield {}, f |
|
181 | 181 | d = f.value |
|
182 | 182 | try: |
|
183 | 183 | yield decodelist(d[:-1]) |
|
184 | 184 | except ValueError: |
|
185 | 185 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
186 | 186 | |
|
187 | 187 | @batchable |
|
188 | 188 | def known(self, nodes): |
|
189 | 189 | f = future() |
|
190 | 190 | yield todict(nodes=encodelist(nodes)), f |
|
191 | 191 | d = f.value |
|
192 | 192 | try: |
|
193 | 193 | yield [bool(int(f)) for f in d] |
|
194 | 194 | except ValueError: |
|
195 | 195 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
196 | 196 | |
|
197 | 197 | @batchable |
|
198 | 198 | def branchmap(self): |
|
199 | 199 | f = future() |
|
200 | 200 | yield {}, f |
|
201 | 201 | d = f.value |
|
202 | 202 | try: |
|
203 | 203 | branchmap = {} |
|
204 | 204 | for branchpart in d.splitlines(): |
|
205 | 205 | branchname, branchheads = branchpart.split(' ', 1) |
|
206 | 206 | branchname = encoding.tolocal(urllib.unquote(branchname)) |
|
207 | 207 | branchheads = decodelist(branchheads) |
|
208 | 208 | branchmap[branchname] = branchheads |
|
209 | 209 | yield branchmap |
|
210 | 210 | except TypeError: |
|
211 | 211 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
212 | 212 | |
|
213 | 213 | def branches(self, nodes): |
|
214 | 214 | n = encodelist(nodes) |
|
215 | 215 | d = self._call("branches", nodes=n) |
|
216 | 216 | try: |
|
217 | 217 | br = [tuple(decodelist(b)) for b in d.splitlines()] |
|
218 | 218 | return br |
|
219 | 219 | except ValueError: |
|
220 | 220 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
221 | 221 | |
|
222 | 222 | def between(self, pairs): |
|
223 | 223 | batch = 8 # avoid giant requests |
|
224 | 224 | r = [] |
|
225 | 225 | for i in xrange(0, len(pairs), batch): |
|
226 | 226 | n = " ".join([encodelist(p, '-') for p in pairs[i:i + batch]]) |
|
227 | 227 | d = self._call("between", pairs=n) |
|
228 | 228 | try: |
|
229 | 229 | r.extend(l and decodelist(l) or [] for l in d.splitlines()) |
|
230 | 230 | except ValueError: |
|
231 | 231 | self._abort(error.ResponseError(_("unexpected response:"), d)) |
|
232 | 232 | return r |
|
233 | 233 | |
|
234 | 234 | @batchable |
|
235 | 235 | def pushkey(self, namespace, key, old, new): |
|
236 | 236 | if not self.capable('pushkey'): |
|
237 | 237 | yield False, None |
|
238 | 238 | f = future() |
|
239 | 239 | self.ui.debug('preparing pushkey for "%s:%s"\n' % (namespace, key)) |
|
240 | 240 | yield todict(namespace=encoding.fromlocal(namespace), |
|
241 | 241 | key=encoding.fromlocal(key), |
|
242 | 242 | old=encoding.fromlocal(old), |
|
243 | 243 | new=encoding.fromlocal(new)), f |
|
244 | 244 | d = f.value |
|
245 | 245 | d, output = d.split('\n', 1) |
|
246 | 246 | try: |
|
247 | 247 | d = bool(int(d)) |
|
248 | 248 | except ValueError: |
|
249 | 249 | raise error.ResponseError( |
|
250 | 250 | _('push failed (unexpected response):'), d) |
|
251 | 251 | for l in output.splitlines(True): |
|
252 | 252 | self.ui.status(_('remote: '), l) |
|
253 | 253 | yield d |
|
254 | 254 | |
|
255 | 255 | @batchable |
|
256 | 256 | def listkeys(self, namespace): |
|
257 | 257 | if not self.capable('pushkey'): |
|
258 | 258 | yield {}, None |
|
259 | 259 | f = future() |
|
260 | 260 | self.ui.debug('preparing listkeys for "%s"\n' % namespace) |
|
261 | 261 | yield todict(namespace=encoding.fromlocal(namespace)), f |
|
262 | 262 | d = f.value |
|
263 | 263 | r = {} |
|
264 | 264 | for l in d.splitlines(): |
|
265 | 265 | k, v = l.split('\t') |
|
266 | 266 | r[encoding.tolocal(k)] = encoding.tolocal(v) |
|
267 | 267 | yield r |
|
268 | 268 | |
|
269 | 269 | def stream_out(self): |
|
270 | 270 | return self._callstream('stream_out') |
|
271 | 271 | |
|
272 | 272 | def changegroup(self, nodes, kind): |
|
273 | 273 | n = encodelist(nodes) |
|
274 | 274 | f = self._callstream("changegroup", roots=n) |
|
275 | 275 | return changegroupmod.unbundle10(self._decompress(f), 'UN') |
|
276 | 276 | |
|
277 | 277 | def changegroupsubset(self, bases, heads, kind): |
|
278 | 278 | self.requirecap('changegroupsubset', _('look up remote changes')) |
|
279 | 279 | bases = encodelist(bases) |
|
280 | 280 | heads = encodelist(heads) |
|
281 | 281 | f = self._callstream("changegroupsubset", |
|
282 | 282 | bases=bases, heads=heads) |
|
283 | 283 | return changegroupmod.unbundle10(self._decompress(f), 'UN') |
|
284 | 284 | |
|
285 | 285 | def getbundle(self, source, heads=None, common=None): |
|
286 | 286 | self.requirecap('getbundle', _('look up remote changes')) |
|
287 | 287 | opts = {} |
|
288 | 288 | if heads is not None: |
|
289 | 289 | opts['heads'] = encodelist(heads) |
|
290 | 290 | if common is not None: |
|
291 | 291 | opts['common'] = encodelist(common) |
|
292 | 292 | f = self._callstream("getbundle", **opts) |
|
293 | 293 | return changegroupmod.unbundle10(self._decompress(f), 'UN') |
|
294 | 294 | |
|
295 | 295 | def unbundle(self, cg, heads, source): |
|
296 | 296 | '''Send cg (a readable file-like object representing the |
|
297 | 297 | changegroup to push, typically a chunkbuffer object) to the |
|
298 | 298 | remote server as a bundle. Return an integer indicating the |
|
299 | 299 | result of the push (see localrepository.addchangegroup()).''' |
|
300 | 300 | |
|
301 | 301 | if heads != ['force'] and self.capable('unbundlehash'): |
|
302 | 302 | heads = encodelist(['hashed', |
|
303 | 303 | util.sha1(''.join(sorted(heads))).digest()]) |
|
304 | 304 | else: |
|
305 | 305 | heads = encodelist(heads) |
|
306 | 306 | |
|
307 | 307 | ret, output = self._callpush("unbundle", cg, heads=heads) |
|
308 | 308 | if ret == "": |
|
309 | 309 | raise error.ResponseError( |
|
310 | 310 | _('push failed:'), output) |
|
311 | 311 | try: |
|
312 | 312 | ret = int(ret) |
|
313 | 313 | except ValueError: |
|
314 | 314 | raise error.ResponseError( |
|
315 | 315 | _('push failed (unexpected response):'), ret) |
|
316 | 316 | |
|
317 | 317 | for l in output.splitlines(True): |
|
318 | 318 | self.ui.status(_('remote: '), l) |
|
319 | 319 | return ret |
|
320 | 320 | |
|
321 | 321 | def debugwireargs(self, one, two, three=None, four=None, five=None): |
|
322 | 322 | # don't pass optional arguments left at their default value |
|
323 | 323 | opts = {} |
|
324 | 324 | if three is not None: |
|
325 | 325 | opts['three'] = three |
|
326 | 326 | if four is not None: |
|
327 | 327 | opts['four'] = four |
|
328 | 328 | return self._call('debugwireargs', one=one, two=two, **opts) |
|
329 | 329 | |
|
330 | 330 | # server side |
|
331 | 331 | |
|
332 | 332 | class streamres(object): |
|
333 | 333 | def __init__(self, gen): |
|
334 | 334 | self.gen = gen |
|
335 | 335 | |
|
336 | 336 | class pushres(object): |
|
337 | 337 | def __init__(self, res): |
|
338 | 338 | self.res = res |
|
339 | 339 | |
|
340 | 340 | class pusherr(object): |
|
341 | 341 | def __init__(self, res): |
|
342 | 342 | self.res = res |
|
343 | 343 | |
|
344 | 344 | class ooberror(object): |
|
345 | 345 | def __init__(self, message): |
|
346 | 346 | self.message = message |
|
347 | 347 | |
|
348 | 348 | def dispatch(repo, proto, command): |
|
349 | 349 | func, spec = commands[command] |
|
350 | 350 | args = proto.getargs(spec) |
|
351 | 351 | return func(repo, proto, *args) |
|
352 | 352 | |
|
353 | 353 | def options(cmd, keys, others): |
|
354 | 354 | opts = {} |
|
355 | 355 | for k in keys: |
|
356 | 356 | if k in others: |
|
357 | 357 | opts[k] = others[k] |
|
358 | 358 | del others[k] |
|
359 | 359 | if others: |
|
360 | 360 | sys.stderr.write("abort: %s got unexpected arguments %s\n" |
|
361 | 361 | % (cmd, ",".join(others))) |
|
362 | 362 | return opts |
|
363 | 363 | |
|
364 | 364 | def batch(repo, proto, cmds, others): |
|
365 | 365 | res = [] |
|
366 | 366 | for pair in cmds.split(';'): |
|
367 | 367 | op, args = pair.split(' ', 1) |
|
368 | 368 | vals = {} |
|
369 | 369 | for a in args.split(','): |
|
370 | 370 | if a: |
|
371 | 371 | n, v = a.split('=') |
|
372 | 372 | vals[n] = unescapearg(v) |
|
373 | 373 | func, spec = commands[op] |
|
374 | 374 | if spec: |
|
375 | 375 | keys = spec.split() |
|
376 | 376 | data = {} |
|
377 | 377 | for k in keys: |
|
378 | 378 | if k == '*': |
|
379 | 379 | star = {} |
|
380 | 380 | for key in vals.keys(): |
|
381 | 381 | if key not in keys: |
|
382 | 382 | star[key] = vals[key] |
|
383 | 383 | data['*'] = star |
|
384 | 384 | else: |
|
385 | 385 | data[k] = vals[k] |
|
386 | 386 | result = func(repo, proto, *[data[k] for k in keys]) |
|
387 | 387 | else: |
|
388 | 388 | result = func(repo, proto) |
|
389 | 389 | if isinstance(result, ooberror): |
|
390 | 390 | return result |
|
391 | 391 | res.append(escapearg(result)) |
|
392 | 392 | return ';'.join(res) |
|
393 | 393 | |
|
394 | 394 | def between(repo, proto, pairs): |
|
395 | 395 | pairs = [decodelist(p, '-') for p in pairs.split(" ")] |
|
396 | 396 | r = [] |
|
397 | 397 | for b in repo.between(pairs): |
|
398 | 398 | r.append(encodelist(b) + "\n") |
|
399 | 399 | return "".join(r) |
|
400 | 400 | |
|
401 | 401 | def branchmap(repo, proto): |
|
402 | 402 | branchmap = discovery.visiblebranchmap(repo) |
|
403 | 403 | heads = [] |
|
404 | 404 | for branch, nodes in branchmap.iteritems(): |
|
405 | 405 | branchname = urllib.quote(encoding.fromlocal(branch)) |
|
406 | 406 | branchnodes = encodelist(nodes) |
|
407 | 407 | heads.append('%s %s' % (branchname, branchnodes)) |
|
408 | 408 | return '\n'.join(heads) |
|
409 | 409 | |
|
410 | 410 | def branches(repo, proto, nodes): |
|
411 | 411 | nodes = decodelist(nodes) |
|
412 | 412 | r = [] |
|
413 | 413 | for b in repo.branches(nodes): |
|
414 | 414 | r.append(encodelist(b) + "\n") |
|
415 | 415 | return "".join(r) |
|
416 | 416 | |
|
417 | 417 | def capabilities(repo, proto): |
|
418 | 418 | caps = ('lookup changegroupsubset branchmap pushkey known getbundle ' |
|
419 | 419 | 'unbundlehash batch').split() |
|
420 | 420 | if _allowstream(repo.ui): |
|
421 | 421 | if repo.ui.configbool('server', 'preferuncompressed', False): |
|
422 | 422 | caps.append('stream-preferred') |
|
423 | 423 | requiredformats = repo.requirements & repo.supportedformats |
|
424 | 424 | # if our local revlogs are just revlogv1, add 'stream' cap |
|
425 | 425 | if not requiredformats - set(('revlogv1',)): |
|
426 | 426 | caps.append('stream') |
|
427 | 427 | # otherwise, add 'streamreqs' detailing our local revlog format |
|
428 | 428 | else: |
|
429 | 429 | caps.append('streamreqs=%s' % ','.join(requiredformats)) |
|
430 | 430 | caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) |
|
431 | 431 | caps.append('httpheader=1024') |
|
432 | 432 | return ' '.join(caps) |
|
433 | 433 | |
|
434 | 434 | def changegroup(repo, proto, roots): |
|
435 | 435 | nodes = decodelist(roots) |
|
436 | 436 | cg = repo.changegroup(nodes, 'serve') |
|
437 | 437 | return streamres(proto.groupchunks(cg)) |
|
438 | 438 | |
|
439 | 439 | def changegroupsubset(repo, proto, bases, heads): |
|
440 | 440 | bases = decodelist(bases) |
|
441 | 441 | heads = decodelist(heads) |
|
442 | 442 | cg = repo.changegroupsubset(bases, heads, 'serve') |
|
443 | 443 | return streamres(proto.groupchunks(cg)) |
|
444 | 444 | |
|
445 | 445 | def debugwireargs(repo, proto, one, two, others): |
|
446 | 446 | # only accept optional args from the known set |
|
447 | 447 | opts = options('debugwireargs', ['three', 'four'], others) |
|
448 | 448 | return repo.debugwireargs(one, two, **opts) |
|
449 | 449 | |
|
450 | 450 | def getbundle(repo, proto, others): |
|
451 | 451 | opts = options('getbundle', ['heads', 'common'], others) |
|
452 | 452 | for k, v in opts.iteritems(): |
|
453 | 453 | opts[k] = decodelist(v) |
|
454 | 454 | cg = repo.getbundle('serve', **opts) |
|
455 | 455 | return streamres(proto.groupchunks(cg)) |
|
456 | 456 | |
|
457 | 457 | def heads(repo, proto): |
|
458 | 458 | h = discovery.visibleheads(repo) |
|
459 | 459 | return encodelist(h) + "\n" |
|
460 | 460 | |
|
461 | 461 | def hello(repo, proto): |
|
462 | 462 | '''the hello command returns a set of lines describing various |
|
463 | 463 | interesting things about the server, in an RFC822-like format. |
|
464 | 464 | Currently the only one defined is "capabilities", which |
|
465 | 465 | consists of a line in the form: |
|
466 | 466 | |
|
467 | 467 | capabilities: space separated list of tokens |
|
468 | 468 | ''' |
|
469 | 469 | return "capabilities: %s\n" % (capabilities(repo, proto)) |
|
470 | 470 | |
|
471 | 471 | def listkeys(repo, proto, namespace): |
|
472 | 472 | d = repo.listkeys(encoding.tolocal(namespace)).items() |
|
473 | 473 | t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v)) |
|
474 | 474 | for k, v in d]) |
|
475 | 475 | return t |
|
476 | 476 | |
|
477 | 477 | def lookup(repo, proto, key): |
|
478 | 478 | try: |
|
479 | 479 | k = encoding.tolocal(key) |
|
480 | 480 | c = repo[k] |
|
481 | 481 | if c.phase() == phases.secret: |
|
482 | 482 | raise error.RepoLookupError(_("unknown revision '%s'") % k) |
|
483 | 483 | r = c.hex() |
|
484 | 484 | success = 1 |
|
485 | 485 | except Exception, inst: |
|
486 | 486 | r = str(inst) |
|
487 | 487 | success = 0 |
|
488 | 488 | return "%s %s\n" % (success, r) |
|
489 | 489 | |
|
490 | 490 | def known(repo, proto, nodes, others): |
|
491 | 491 | return ''.join(b and "1" or "0" for b in repo.known(decodelist(nodes))) |
|
492 | 492 | |
|
493 | 493 | def pushkey(repo, proto, namespace, key, old, new): |
|
494 | 494 | # compatibility with pre-1.8 clients which were accidentally |
|
495 | 495 | # sending raw binary nodes rather than utf-8-encoded hex |
|
496 | 496 | if len(new) == 20 and new.encode('string-escape') != new: |
|
497 | 497 | # looks like it could be a binary node |
|
498 | 498 | try: |
|
499 | 499 | new.decode('utf-8') |
|
500 | 500 | new = encoding.tolocal(new) # but cleanly decodes as UTF-8 |
|
501 | 501 | except UnicodeDecodeError: |
|
502 | 502 | pass # binary, leave unmodified |
|
503 | 503 | else: |
|
504 | 504 | new = encoding.tolocal(new) # normal path |
|
505 | 505 | |
|
506 | 506 | r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), |
|
507 | 507 | encoding.tolocal(old), new) |
|
508 | 508 | return '%s\n' % int(r) |
|
509 | 509 | |
|
510 | 510 | def _allowstream(ui): |
|
511 | 511 | return ui.configbool('server', 'uncompressed', True, untrusted=True) |
|
512 | 512 | |
|
513 | 513 | def stream(repo, proto): |
|
514 | 514 | '''If the server supports streaming clone, it advertises the "stream" |
|
515 | 515 | capability with a value representing the version and flags of the repo |
|
516 | 516 | it is serving. Client checks to see if it understands the format. |
|
517 | 517 | |
|
518 | 518 | The format is simple: the server writes out a line with the amount |
|
519 | of files, then the total amount of bytes to be transfered (separated | |
|
519 | of files, then the total amount of bytes to be transferred (separated | |
|
520 | 520 | by a space). Then, for each file, the server first writes the filename |
|
521 | 521 | and filesize (separated by the null character), then the file contents. |
|
522 | 522 | ''' |
|
523 | 523 | |
|
524 | 524 | if not _allowstream(repo.ui): |
|
525 | 525 | return '1\n' |
|
526 | 526 | |
|
527 | 527 | entries = [] |
|
528 | 528 | total_bytes = 0 |
|
529 | 529 | try: |
|
530 | 530 | # get consistent snapshot of repo, lock during scan |
|
531 | 531 | lock = repo.lock() |
|
532 | 532 | try: |
|
533 | 533 | repo.ui.debug('scanning\n') |
|
534 | 534 | for name, ename, size in repo.store.walk(): |
|
535 | 535 | entries.append((name, size)) |
|
536 | 536 | total_bytes += size |
|
537 | 537 | finally: |
|
538 | 538 | lock.release() |
|
539 | 539 | except error.LockError: |
|
540 | 540 | return '2\n' # error: 2 |
|
541 | 541 | |
|
542 | 542 | def streamer(repo, entries, total): |
|
543 | 543 | '''stream out all metadata files in repository.''' |
|
544 | 544 | yield '0\n' # success |
|
545 | 545 | repo.ui.debug('%d files, %d bytes to transfer\n' % |
|
546 | 546 | (len(entries), total_bytes)) |
|
547 | 547 | yield '%d %d\n' % (len(entries), total_bytes) |
|
548 | 548 | for name, size in entries: |
|
549 | 549 | repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) |
|
550 | 550 | # partially encode name over the wire for backwards compat |
|
551 | 551 | yield '%s\0%d\n' % (store.encodedir(name), size) |
|
552 | 552 | for chunk in util.filechunkiter(repo.sopener(name), limit=size): |
|
553 | 553 | yield chunk |
|
554 | 554 | |
|
555 | 555 | return streamres(streamer(repo, entries, total_bytes)) |
|
556 | 556 | |
|
557 | 557 | def unbundle(repo, proto, heads): |
|
558 | 558 | their_heads = decodelist(heads) |
|
559 | 559 | |
|
560 | 560 | def check_heads(): |
|
561 | 561 | heads = discovery.visibleheads(repo) |
|
562 | 562 | heads_hash = util.sha1(''.join(sorted(heads))).digest() |
|
563 | 563 | return (their_heads == ['force'] or their_heads == heads or |
|
564 | 564 | their_heads == ['hashed', heads_hash]) |
|
565 | 565 | |
|
566 | 566 | proto.redirect() |
|
567 | 567 | |
|
568 | 568 | # fail early if possible |
|
569 | 569 | if not check_heads(): |
|
570 | 570 | return pusherr('unsynced changes') |
|
571 | 571 | |
|
572 | 572 | # write bundle data to temporary file because it can be big |
|
573 | 573 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') |
|
574 | 574 | fp = os.fdopen(fd, 'wb+') |
|
575 | 575 | r = 0 |
|
576 | 576 | try: |
|
577 | 577 | proto.getfile(fp) |
|
578 | 578 | lock = repo.lock() |
|
579 | 579 | try: |
|
580 | 580 | if not check_heads(): |
|
581 | 581 | # someone else committed/pushed/unbundled while we |
|
582 | 582 | # were transferring data |
|
583 | 583 | return pusherr('unsynced changes') |
|
584 | 584 | |
|
585 | 585 | # push can proceed |
|
586 | 586 | fp.seek(0) |
|
587 | 587 | gen = changegroupmod.readbundle(fp, None) |
|
588 | 588 | |
|
589 | 589 | try: |
|
590 | 590 | r = repo.addchangegroup(gen, 'serve', proto._client()) |
|
591 | 591 | except util.Abort, inst: |
|
592 | 592 | sys.stderr.write("abort: %s\n" % inst) |
|
593 | 593 | finally: |
|
594 | 594 | lock.release() |
|
595 | 595 | return pushres(r) |
|
596 | 596 | |
|
597 | 597 | finally: |
|
598 | 598 | fp.close() |
|
599 | 599 | os.unlink(tempname) |
|
600 | 600 | |
|
601 | 601 | commands = { |
|
602 | 602 | 'batch': (batch, 'cmds *'), |
|
603 | 603 | 'between': (between, 'pairs'), |
|
604 | 604 | 'branchmap': (branchmap, ''), |
|
605 | 605 | 'branches': (branches, 'nodes'), |
|
606 | 606 | 'capabilities': (capabilities, ''), |
|
607 | 607 | 'changegroup': (changegroup, 'roots'), |
|
608 | 608 | 'changegroupsubset': (changegroupsubset, 'bases heads'), |
|
609 | 609 | 'debugwireargs': (debugwireargs, 'one two *'), |
|
610 | 610 | 'getbundle': (getbundle, '*'), |
|
611 | 611 | 'heads': (heads, ''), |
|
612 | 612 | 'hello': (hello, ''), |
|
613 | 613 | 'known': (known, 'nodes *'), |
|
614 | 614 | 'listkeys': (listkeys, 'namespace'), |
|
615 | 615 | 'lookup': (lookup, 'key'), |
|
616 | 616 | 'pushkey': (pushkey, 'namespace key old new'), |
|
617 | 617 | 'stream_out': (stream, ''), |
|
618 | 618 | 'unbundle': (unbundle, 'heads'), |
|
619 | 619 | } |
@@ -1,1065 +1,1065 b'' | |||
|
1 | 1 | $ "$TESTDIR/hghave" serve || exit 80 |
|
2 | 2 | |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > graphlog= |
|
6 | 6 | > EOF |
|
7 | 7 | $ hgph() { hg log -G --template "{rev} {phase} {desc} - {node|short}\n" $*; } |
|
8 | 8 | |
|
9 | 9 | $ mkcommit() { |
|
10 | 10 | > echo "$1" > "$1" |
|
11 | 11 | > hg add "$1" |
|
12 | 12 | > message="$1" |
|
13 | 13 | > shift |
|
14 | 14 | > hg ci -m "$message" $* |
|
15 | 15 | > } |
|
16 | 16 | |
|
17 | 17 | $ hg init alpha |
|
18 | 18 | $ cd alpha |
|
19 | 19 | $ mkcommit a-A |
|
20 | 20 | $ mkcommit a-B |
|
21 | 21 | $ mkcommit a-C |
|
22 | 22 | $ mkcommit a-D |
|
23 | 23 | $ hgph |
|
24 | 24 | @ 3 draft a-D - b555f63b6063 |
|
25 | 25 | | |
|
26 | 26 | o 2 draft a-C - 54acac6f23ab |
|
27 | 27 | | |
|
28 | 28 | o 1 draft a-B - 548a3d25dbf0 |
|
29 | 29 | | |
|
30 | 30 | o 0 draft a-A - 054250a37db4 |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | $ hg init ../beta |
|
34 | 34 | $ hg push -r 1 ../beta |
|
35 | 35 | pushing to ../beta |
|
36 | 36 | searching for changes |
|
37 | 37 | adding changesets |
|
38 | 38 | adding manifests |
|
39 | 39 | adding file changes |
|
40 | 40 | added 2 changesets with 2 changes to 2 files |
|
41 | 41 | $ hgph |
|
42 | 42 | @ 3 draft a-D - b555f63b6063 |
|
43 | 43 | | |
|
44 | 44 | o 2 draft a-C - 54acac6f23ab |
|
45 | 45 | | |
|
46 | 46 | o 1 public a-B - 548a3d25dbf0 |
|
47 | 47 | | |
|
48 | 48 | o 0 public a-A - 054250a37db4 |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | $ cd ../beta |
|
52 | 52 | $ hgph |
|
53 | 53 | o 1 public a-B - 548a3d25dbf0 |
|
54 | 54 | | |
|
55 | 55 | o 0 public a-A - 054250a37db4 |
|
56 | 56 | |
|
57 | 57 | $ hg up -q |
|
58 | 58 | $ mkcommit b-A |
|
59 | 59 | $ hgph |
|
60 | 60 | @ 2 draft b-A - f54f1bb90ff3 |
|
61 | 61 | | |
|
62 | 62 | o 1 public a-B - 548a3d25dbf0 |
|
63 | 63 | | |
|
64 | 64 | o 0 public a-A - 054250a37db4 |
|
65 | 65 | |
|
66 | 66 | $ hg pull ../alpha |
|
67 | 67 | pulling from ../alpha |
|
68 | 68 | searching for changes |
|
69 | 69 | adding changesets |
|
70 | 70 | adding manifests |
|
71 | 71 | adding file changes |
|
72 | 72 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
73 | 73 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
74 | 74 | $ hgph |
|
75 | 75 | o 4 public a-D - b555f63b6063 |
|
76 | 76 | | |
|
77 | 77 | o 3 public a-C - 54acac6f23ab |
|
78 | 78 | | |
|
79 | 79 | | @ 2 draft b-A - f54f1bb90ff3 |
|
80 | 80 | |/ |
|
81 | 81 | o 1 public a-B - 548a3d25dbf0 |
|
82 | 82 | | |
|
83 | 83 | o 0 public a-A - 054250a37db4 |
|
84 | 84 | |
|
85 | 85 | |
|
86 | 86 | pull did not updated ../alpha state. |
|
87 | push from alpha to beta should update phase even if nothing is transfered | |
|
87 | push from alpha to beta should update phase even if nothing is transferred | |
|
88 | 88 | |
|
89 | 89 | $ cd ../alpha |
|
90 | 90 | $ hgph # not updated by remote pull |
|
91 | 91 | @ 3 draft a-D - b555f63b6063 |
|
92 | 92 | | |
|
93 | 93 | o 2 draft a-C - 54acac6f23ab |
|
94 | 94 | | |
|
95 | 95 | o 1 public a-B - 548a3d25dbf0 |
|
96 | 96 | | |
|
97 | 97 | o 0 public a-A - 054250a37db4 |
|
98 | 98 | |
|
99 | 99 | $ hg push ../beta |
|
100 | 100 | pushing to ../beta |
|
101 | 101 | searching for changes |
|
102 | 102 | no changes found |
|
103 | 103 | [1] |
|
104 | 104 | $ hgph |
|
105 | 105 | @ 3 public a-D - b555f63b6063 |
|
106 | 106 | | |
|
107 | 107 | o 2 public a-C - 54acac6f23ab |
|
108 | 108 | | |
|
109 | 109 | o 1 public a-B - 548a3d25dbf0 |
|
110 | 110 | | |
|
111 | 111 | o 0 public a-A - 054250a37db4 |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | update must update phase of common changeset too |
|
115 | 115 | |
|
116 | 116 | $ hg pull ../beta # getting b-A |
|
117 | 117 | pulling from ../beta |
|
118 | 118 | searching for changes |
|
119 | 119 | adding changesets |
|
120 | 120 | adding manifests |
|
121 | 121 | adding file changes |
|
122 | 122 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
123 | 123 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
124 | 124 | |
|
125 | 125 | $ cd ../beta |
|
126 | 126 | $ hgph # not updated by remote pull |
|
127 | 127 | o 4 public a-D - b555f63b6063 |
|
128 | 128 | | |
|
129 | 129 | o 3 public a-C - 54acac6f23ab |
|
130 | 130 | | |
|
131 | 131 | | @ 2 draft b-A - f54f1bb90ff3 |
|
132 | 132 | |/ |
|
133 | 133 | o 1 public a-B - 548a3d25dbf0 |
|
134 | 134 | | |
|
135 | 135 | o 0 public a-A - 054250a37db4 |
|
136 | 136 | |
|
137 | 137 | $ hg pull ../alpha |
|
138 | 138 | pulling from ../alpha |
|
139 | 139 | searching for changes |
|
140 | 140 | no changes found |
|
141 | 141 | $ hgph |
|
142 | 142 | o 4 public a-D - b555f63b6063 |
|
143 | 143 | | |
|
144 | 144 | o 3 public a-C - 54acac6f23ab |
|
145 | 145 | | |
|
146 | 146 | | @ 2 public b-A - f54f1bb90ff3 |
|
147 | 147 | |/ |
|
148 | 148 | o 1 public a-B - 548a3d25dbf0 |
|
149 | 149 | | |
|
150 | 150 | o 0 public a-A - 054250a37db4 |
|
151 | 151 | |
|
152 | 152 | |
|
153 | 153 | Publish configuration option |
|
154 | 154 | ---------------------------- |
|
155 | 155 | |
|
156 | 156 | Pull |
|
157 | 157 | ```` |
|
158 | 158 | |
|
159 | 159 | changegroup are added without phase movement |
|
160 | 160 | |
|
161 | 161 | $ hg bundle -a ../base.bundle |
|
162 | 162 | 5 changesets found |
|
163 | 163 | $ cd .. |
|
164 | 164 | $ hg init mu |
|
165 | 165 | $ cd mu |
|
166 | 166 | $ cat > .hg/hgrc << EOF |
|
167 | 167 | > [phases] |
|
168 | 168 | > publish=0 |
|
169 | 169 | > EOF |
|
170 | 170 | $ hg unbundle ../base.bundle |
|
171 | 171 | adding changesets |
|
172 | 172 | adding manifests |
|
173 | 173 | adding file changes |
|
174 | 174 | added 5 changesets with 5 changes to 5 files (+1 heads) |
|
175 | 175 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
176 | 176 | $ hgph |
|
177 | 177 | o 4 draft a-D - b555f63b6063 |
|
178 | 178 | | |
|
179 | 179 | o 3 draft a-C - 54acac6f23ab |
|
180 | 180 | | |
|
181 | 181 | | o 2 draft b-A - f54f1bb90ff3 |
|
182 | 182 | |/ |
|
183 | 183 | o 1 draft a-B - 548a3d25dbf0 |
|
184 | 184 | | |
|
185 | 185 | o 0 draft a-A - 054250a37db4 |
|
186 | 186 | |
|
187 | 187 | $ cd .. |
|
188 | 188 | |
|
189 | 189 | Pulling from publish=False to publish=False does not move boundary. |
|
190 | 190 | |
|
191 | 191 | $ hg init nu |
|
192 | 192 | $ cd nu |
|
193 | 193 | $ cat > .hg/hgrc << EOF |
|
194 | 194 | > [phases] |
|
195 | 195 | > publish=0 |
|
196 | 196 | > EOF |
|
197 | 197 | $ hg pull ../mu -r 54acac6f23ab |
|
198 | 198 | pulling from ../mu |
|
199 | 199 | adding changesets |
|
200 | 200 | adding manifests |
|
201 | 201 | adding file changes |
|
202 | 202 | added 3 changesets with 3 changes to 3 files |
|
203 | 203 | (run 'hg update' to get a working copy) |
|
204 | 204 | $ hgph |
|
205 | 205 | o 2 draft a-C - 54acac6f23ab |
|
206 | 206 | | |
|
207 | 207 | o 1 draft a-B - 548a3d25dbf0 |
|
208 | 208 | | |
|
209 | 209 | o 0 draft a-A - 054250a37db4 |
|
210 | 210 | |
|
211 | 211 | |
|
212 | 212 | Even for common |
|
213 | 213 | |
|
214 | 214 | $ hg pull ../mu -r f54f1bb90ff3 |
|
215 | 215 | pulling from ../mu |
|
216 | 216 | searching for changes |
|
217 | 217 | adding changesets |
|
218 | 218 | adding manifests |
|
219 | 219 | adding file changes |
|
220 | 220 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
221 | 221 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
222 | 222 | $ hgph |
|
223 | 223 | o 3 draft b-A - f54f1bb90ff3 |
|
224 | 224 | | |
|
225 | 225 | | o 2 draft a-C - 54acac6f23ab |
|
226 | 226 | |/ |
|
227 | 227 | o 1 draft a-B - 548a3d25dbf0 |
|
228 | 228 | | |
|
229 | 229 | o 0 draft a-A - 054250a37db4 |
|
230 | 230 | |
|
231 | 231 | |
|
232 | 232 | |
|
233 | 233 | Pulling from Publish=True to Publish=False move boundary in common set. |
|
234 | 234 | we are in nu |
|
235 | 235 | |
|
236 | 236 | $ hg pull ../alpha -r b555f63b6063 |
|
237 | 237 | pulling from ../alpha |
|
238 | 238 | searching for changes |
|
239 | 239 | adding changesets |
|
240 | 240 | adding manifests |
|
241 | 241 | adding file changes |
|
242 | 242 | added 1 changesets with 1 changes to 1 files |
|
243 | 243 | (run 'hg update' to get a working copy) |
|
244 | 244 | $ hgph # f54f1bb90ff3 stay draft, not ancestor of -r |
|
245 | 245 | o 4 public a-D - b555f63b6063 |
|
246 | 246 | | |
|
247 | 247 | | o 3 draft b-A - f54f1bb90ff3 |
|
248 | 248 | | | |
|
249 | 249 | o | 2 public a-C - 54acac6f23ab |
|
250 | 250 | |/ |
|
251 | 251 | o 1 public a-B - 548a3d25dbf0 |
|
252 | 252 | | |
|
253 | 253 | o 0 public a-A - 054250a37db4 |
|
254 | 254 | |
|
255 | 255 | |
|
256 | 256 | pulling from Publish=False to publish=False with some public |
|
257 | 257 | |
|
258 | 258 | $ hg up -q f54f1bb90ff3 |
|
259 | 259 | $ mkcommit n-A |
|
260 | 260 | $ mkcommit n-B |
|
261 | 261 | $ hgph |
|
262 | 262 | @ 6 draft n-B - 145e75495359 |
|
263 | 263 | | |
|
264 | 264 | o 5 draft n-A - d6bcb4f74035 |
|
265 | 265 | | |
|
266 | 266 | | o 4 public a-D - b555f63b6063 |
|
267 | 267 | | | |
|
268 | 268 | o | 3 draft b-A - f54f1bb90ff3 |
|
269 | 269 | | | |
|
270 | 270 | | o 2 public a-C - 54acac6f23ab |
|
271 | 271 | |/ |
|
272 | 272 | o 1 public a-B - 548a3d25dbf0 |
|
273 | 273 | | |
|
274 | 274 | o 0 public a-A - 054250a37db4 |
|
275 | 275 | |
|
276 | 276 | $ cd ../mu |
|
277 | 277 | $ hg pull ../nu |
|
278 | 278 | pulling from ../nu |
|
279 | 279 | searching for changes |
|
280 | 280 | adding changesets |
|
281 | 281 | adding manifests |
|
282 | 282 | adding file changes |
|
283 | 283 | added 2 changesets with 2 changes to 2 files |
|
284 | 284 | (run 'hg update' to get a working copy) |
|
285 | 285 | $ hgph |
|
286 | 286 | o 6 draft n-B - 145e75495359 |
|
287 | 287 | | |
|
288 | 288 | o 5 draft n-A - d6bcb4f74035 |
|
289 | 289 | | |
|
290 | 290 | | o 4 public a-D - b555f63b6063 |
|
291 | 291 | | | |
|
292 | 292 | | o 3 public a-C - 54acac6f23ab |
|
293 | 293 | | | |
|
294 | 294 | o | 2 draft b-A - f54f1bb90ff3 |
|
295 | 295 | |/ |
|
296 | 296 | o 1 public a-B - 548a3d25dbf0 |
|
297 | 297 | | |
|
298 | 298 | o 0 public a-A - 054250a37db4 |
|
299 | 299 | |
|
300 | 300 | $ cd .. |
|
301 | 301 | |
|
302 | 302 | pulling into publish=True |
|
303 | 303 | |
|
304 | 304 | $ cd alpha |
|
305 | 305 | $ hgph |
|
306 | 306 | o 4 public b-A - f54f1bb90ff3 |
|
307 | 307 | | |
|
308 | 308 | | @ 3 public a-D - b555f63b6063 |
|
309 | 309 | | | |
|
310 | 310 | | o 2 public a-C - 54acac6f23ab |
|
311 | 311 | |/ |
|
312 | 312 | o 1 public a-B - 548a3d25dbf0 |
|
313 | 313 | | |
|
314 | 314 | o 0 public a-A - 054250a37db4 |
|
315 | 315 | |
|
316 | 316 | $ hg pull ../mu |
|
317 | 317 | pulling from ../mu |
|
318 | 318 | searching for changes |
|
319 | 319 | adding changesets |
|
320 | 320 | adding manifests |
|
321 | 321 | adding file changes |
|
322 | 322 | added 2 changesets with 2 changes to 2 files |
|
323 | 323 | (run 'hg update' to get a working copy) |
|
324 | 324 | $ hgph |
|
325 | 325 | o 6 draft n-B - 145e75495359 |
|
326 | 326 | | |
|
327 | 327 | o 5 draft n-A - d6bcb4f74035 |
|
328 | 328 | | |
|
329 | 329 | o 4 public b-A - f54f1bb90ff3 |
|
330 | 330 | | |
|
331 | 331 | | @ 3 public a-D - b555f63b6063 |
|
332 | 332 | | | |
|
333 | 333 | | o 2 public a-C - 54acac6f23ab |
|
334 | 334 | |/ |
|
335 | 335 | o 1 public a-B - 548a3d25dbf0 |
|
336 | 336 | | |
|
337 | 337 | o 0 public a-A - 054250a37db4 |
|
338 | 338 | |
|
339 | 339 | $ cd .. |
|
340 | 340 | |
|
341 | 341 | pulling back into original repo |
|
342 | 342 | |
|
343 | 343 | $ cd nu |
|
344 | 344 | $ hg pull ../alpha |
|
345 | 345 | pulling from ../alpha |
|
346 | 346 | searching for changes |
|
347 | 347 | no changes found |
|
348 | 348 | $ hgph |
|
349 | 349 | @ 6 public n-B - 145e75495359 |
|
350 | 350 | | |
|
351 | 351 | o 5 public n-A - d6bcb4f74035 |
|
352 | 352 | | |
|
353 | 353 | | o 4 public a-D - b555f63b6063 |
|
354 | 354 | | | |
|
355 | 355 | o | 3 public b-A - f54f1bb90ff3 |
|
356 | 356 | | | |
|
357 | 357 | | o 2 public a-C - 54acac6f23ab |
|
358 | 358 | |/ |
|
359 | 359 | o 1 public a-B - 548a3d25dbf0 |
|
360 | 360 | | |
|
361 | 361 | o 0 public a-A - 054250a37db4 |
|
362 | 362 | |
|
363 | 363 | |
|
364 | 364 | Push |
|
365 | 365 | ```` |
|
366 | 366 | |
|
367 | 367 | (inserted) |
|
368 | 368 | |
|
369 | 369 | Test that phase are pushed even when they are nothing to pus |
|
370 | 370 | (this might be tested later bu are very convenient to not alter too much test) |
|
371 | 371 | |
|
372 | 372 | Push back to alpha |
|
373 | 373 | |
|
374 | 374 | $ hg push ../alpha # from nu |
|
375 | 375 | pushing to ../alpha |
|
376 | 376 | searching for changes |
|
377 | 377 | no changes found |
|
378 | 378 | [1] |
|
379 | 379 | $ cd .. |
|
380 | 380 | $ cd alpha |
|
381 | 381 | $ hgph |
|
382 | 382 | o 6 public n-B - 145e75495359 |
|
383 | 383 | | |
|
384 | 384 | o 5 public n-A - d6bcb4f74035 |
|
385 | 385 | | |
|
386 | 386 | o 4 public b-A - f54f1bb90ff3 |
|
387 | 387 | | |
|
388 | 388 | | @ 3 public a-D - b555f63b6063 |
|
389 | 389 | | | |
|
390 | 390 | | o 2 public a-C - 54acac6f23ab |
|
391 | 391 | |/ |
|
392 | 392 | o 1 public a-B - 548a3d25dbf0 |
|
393 | 393 | | |
|
394 | 394 | o 0 public a-A - 054250a37db4 |
|
395 | 395 | |
|
396 | 396 | |
|
397 | 397 | (end insertion) |
|
398 | 398 | |
|
399 | 399 | |
|
400 | 400 | initial setup |
|
401 | 401 | |
|
402 | 402 | $ hg glog # of alpha |
|
403 | 403 | o changeset: 6:145e75495359 |
|
404 | 404 | | tag: tip |
|
405 | 405 | | user: test |
|
406 | 406 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
407 | 407 | | summary: n-B |
|
408 | 408 | | |
|
409 | 409 | o changeset: 5:d6bcb4f74035 |
|
410 | 410 | | user: test |
|
411 | 411 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
412 | 412 | | summary: n-A |
|
413 | 413 | | |
|
414 | 414 | o changeset: 4:f54f1bb90ff3 |
|
415 | 415 | | parent: 1:548a3d25dbf0 |
|
416 | 416 | | user: test |
|
417 | 417 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
418 | 418 | | summary: b-A |
|
419 | 419 | | |
|
420 | 420 | | @ changeset: 3:b555f63b6063 |
|
421 | 421 | | | user: test |
|
422 | 422 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
423 | 423 | | | summary: a-D |
|
424 | 424 | | | |
|
425 | 425 | | o changeset: 2:54acac6f23ab |
|
426 | 426 | |/ user: test |
|
427 | 427 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
428 | 428 | | summary: a-C |
|
429 | 429 | | |
|
430 | 430 | o changeset: 1:548a3d25dbf0 |
|
431 | 431 | | user: test |
|
432 | 432 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
433 | 433 | | summary: a-B |
|
434 | 434 | | |
|
435 | 435 | o changeset: 0:054250a37db4 |
|
436 | 436 | user: test |
|
437 | 437 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
438 | 438 | summary: a-A |
|
439 | 439 | |
|
440 | 440 | $ mkcommit a-E |
|
441 | 441 | $ mkcommit a-F |
|
442 | 442 | $ mkcommit a-G |
|
443 | 443 | $ hg up d6bcb4f74035 -q |
|
444 | 444 | $ mkcommit a-H |
|
445 | 445 | created new head |
|
446 | 446 | $ hgph |
|
447 | 447 | @ 10 draft a-H - 967b449fbc94 |
|
448 | 448 | | |
|
449 | 449 | | o 9 draft a-G - 3e27b6f1eee1 |
|
450 | 450 | | | |
|
451 | 451 | | o 8 draft a-F - b740e3e5c05d |
|
452 | 452 | | | |
|
453 | 453 | | o 7 draft a-E - e9f537e46dea |
|
454 | 454 | | | |
|
455 | 455 | +---o 6 public n-B - 145e75495359 |
|
456 | 456 | | | |
|
457 | 457 | o | 5 public n-A - d6bcb4f74035 |
|
458 | 458 | | | |
|
459 | 459 | o | 4 public b-A - f54f1bb90ff3 |
|
460 | 460 | | | |
|
461 | 461 | | o 3 public a-D - b555f63b6063 |
|
462 | 462 | | | |
|
463 | 463 | | o 2 public a-C - 54acac6f23ab |
|
464 | 464 | |/ |
|
465 | 465 | o 1 public a-B - 548a3d25dbf0 |
|
466 | 466 | | |
|
467 | 467 | o 0 public a-A - 054250a37db4 |
|
468 | 468 | |
|
469 | 469 | |
|
470 | 470 | Pulling from bundle does not alter phases of changeset not present in the bundle |
|
471 | 471 | |
|
472 | 472 | $ hg bundle --base 1 -r 6 -r 3 ../partial-bundle.hg |
|
473 | 473 | 5 changesets found |
|
474 | 474 | $ hg pull ../partial-bundle.hg |
|
475 | 475 | pulling from ../partial-bundle.hg |
|
476 | 476 | searching for changes |
|
477 | 477 | no changes found |
|
478 | 478 | $ hgph |
|
479 | 479 | @ 10 draft a-H - 967b449fbc94 |
|
480 | 480 | | |
|
481 | 481 | | o 9 draft a-G - 3e27b6f1eee1 |
|
482 | 482 | | | |
|
483 | 483 | | o 8 draft a-F - b740e3e5c05d |
|
484 | 484 | | | |
|
485 | 485 | | o 7 draft a-E - e9f537e46dea |
|
486 | 486 | | | |
|
487 | 487 | +---o 6 public n-B - 145e75495359 |
|
488 | 488 | | | |
|
489 | 489 | o | 5 public n-A - d6bcb4f74035 |
|
490 | 490 | | | |
|
491 | 491 | o | 4 public b-A - f54f1bb90ff3 |
|
492 | 492 | | | |
|
493 | 493 | | o 3 public a-D - b555f63b6063 |
|
494 | 494 | | | |
|
495 | 495 | | o 2 public a-C - 54acac6f23ab |
|
496 | 496 | |/ |
|
497 | 497 | o 1 public a-B - 548a3d25dbf0 |
|
498 | 498 | | |
|
499 | 499 | o 0 public a-A - 054250a37db4 |
|
500 | 500 | |
|
501 | 501 | |
|
502 | 502 | Pushing to Publish=False (unknown changeset) |
|
503 | 503 | |
|
504 | 504 | $ hg push ../mu -r b740e3e5c05d # a-F |
|
505 | 505 | pushing to ../mu |
|
506 | 506 | searching for changes |
|
507 | 507 | adding changesets |
|
508 | 508 | adding manifests |
|
509 | 509 | adding file changes |
|
510 | 510 | added 2 changesets with 2 changes to 2 files |
|
511 | 511 | $ hgph |
|
512 | 512 | @ 10 draft a-H - 967b449fbc94 |
|
513 | 513 | | |
|
514 | 514 | | o 9 draft a-G - 3e27b6f1eee1 |
|
515 | 515 | | | |
|
516 | 516 | | o 8 draft a-F - b740e3e5c05d |
|
517 | 517 | | | |
|
518 | 518 | | o 7 draft a-E - e9f537e46dea |
|
519 | 519 | | | |
|
520 | 520 | +---o 6 public n-B - 145e75495359 |
|
521 | 521 | | | |
|
522 | 522 | o | 5 public n-A - d6bcb4f74035 |
|
523 | 523 | | | |
|
524 | 524 | o | 4 public b-A - f54f1bb90ff3 |
|
525 | 525 | | | |
|
526 | 526 | | o 3 public a-D - b555f63b6063 |
|
527 | 527 | | | |
|
528 | 528 | | o 2 public a-C - 54acac6f23ab |
|
529 | 529 | |/ |
|
530 | 530 | o 1 public a-B - 548a3d25dbf0 |
|
531 | 531 | | |
|
532 | 532 | o 0 public a-A - 054250a37db4 |
|
533 | 533 | |
|
534 | 534 | |
|
535 | 535 | $ cd ../mu |
|
536 | 536 | $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft, |
|
537 | 537 | > # not ancestor of -r |
|
538 | 538 | o 8 draft a-F - b740e3e5c05d |
|
539 | 539 | | |
|
540 | 540 | o 7 draft a-E - e9f537e46dea |
|
541 | 541 | | |
|
542 | 542 | | o 6 draft n-B - 145e75495359 |
|
543 | 543 | | | |
|
544 | 544 | | o 5 draft n-A - d6bcb4f74035 |
|
545 | 545 | | | |
|
546 | 546 | o | 4 public a-D - b555f63b6063 |
|
547 | 547 | | | |
|
548 | 548 | o | 3 public a-C - 54acac6f23ab |
|
549 | 549 | | | |
|
550 | 550 | | o 2 draft b-A - f54f1bb90ff3 |
|
551 | 551 | |/ |
|
552 | 552 | o 1 public a-B - 548a3d25dbf0 |
|
553 | 553 | | |
|
554 | 554 | o 0 public a-A - 054250a37db4 |
|
555 | 555 | |
|
556 | 556 | |
|
557 | 557 | Pushing to Publish=True (unknown changeset) |
|
558 | 558 | |
|
559 | 559 | $ hg push ../beta -r b740e3e5c05d |
|
560 | 560 | pushing to ../beta |
|
561 | 561 | searching for changes |
|
562 | 562 | adding changesets |
|
563 | 563 | adding manifests |
|
564 | 564 | adding file changes |
|
565 | 565 | added 2 changesets with 2 changes to 2 files |
|
566 | 566 | $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft, |
|
567 | 567 | > # not ancestor of -r |
|
568 | 568 | o 8 public a-F - b740e3e5c05d |
|
569 | 569 | | |
|
570 | 570 | o 7 public a-E - e9f537e46dea |
|
571 | 571 | | |
|
572 | 572 | | o 6 draft n-B - 145e75495359 |
|
573 | 573 | | | |
|
574 | 574 | | o 5 draft n-A - d6bcb4f74035 |
|
575 | 575 | | | |
|
576 | 576 | o | 4 public a-D - b555f63b6063 |
|
577 | 577 | | | |
|
578 | 578 | o | 3 public a-C - 54acac6f23ab |
|
579 | 579 | | | |
|
580 | 580 | | o 2 draft b-A - f54f1bb90ff3 |
|
581 | 581 | |/ |
|
582 | 582 | o 1 public a-B - 548a3d25dbf0 |
|
583 | 583 | | |
|
584 | 584 | o 0 public a-A - 054250a37db4 |
|
585 | 585 | |
|
586 | 586 | |
|
587 | 587 | Pushing to Publish=True (common changeset) |
|
588 | 588 | |
|
589 | 589 | $ cd ../beta |
|
590 | 590 | $ hg push ../alpha |
|
591 | 591 | pushing to ../alpha |
|
592 | 592 | searching for changes |
|
593 | 593 | no changes found |
|
594 | 594 | [1] |
|
595 | 595 | $ hgph |
|
596 | 596 | o 6 public a-F - b740e3e5c05d |
|
597 | 597 | | |
|
598 | 598 | o 5 public a-E - e9f537e46dea |
|
599 | 599 | | |
|
600 | 600 | o 4 public a-D - b555f63b6063 |
|
601 | 601 | | |
|
602 | 602 | o 3 public a-C - 54acac6f23ab |
|
603 | 603 | | |
|
604 | 604 | | @ 2 public b-A - f54f1bb90ff3 |
|
605 | 605 | |/ |
|
606 | 606 | o 1 public a-B - 548a3d25dbf0 |
|
607 | 607 | | |
|
608 | 608 | o 0 public a-A - 054250a37db4 |
|
609 | 609 | |
|
610 | 610 | $ cd ../alpha |
|
611 | 611 | $ hgph |
|
612 | 612 | @ 10 draft a-H - 967b449fbc94 |
|
613 | 613 | | |
|
614 | 614 | | o 9 draft a-G - 3e27b6f1eee1 |
|
615 | 615 | | | |
|
616 | 616 | | o 8 public a-F - b740e3e5c05d |
|
617 | 617 | | | |
|
618 | 618 | | o 7 public a-E - e9f537e46dea |
|
619 | 619 | | | |
|
620 | 620 | +---o 6 public n-B - 145e75495359 |
|
621 | 621 | | | |
|
622 | 622 | o | 5 public n-A - d6bcb4f74035 |
|
623 | 623 | | | |
|
624 | 624 | o | 4 public b-A - f54f1bb90ff3 |
|
625 | 625 | | | |
|
626 | 626 | | o 3 public a-D - b555f63b6063 |
|
627 | 627 | | | |
|
628 | 628 | | o 2 public a-C - 54acac6f23ab |
|
629 | 629 | |/ |
|
630 | 630 | o 1 public a-B - 548a3d25dbf0 |
|
631 | 631 | | |
|
632 | 632 | o 0 public a-A - 054250a37db4 |
|
633 | 633 | |
|
634 | 634 | |
|
635 | 635 | Pushing to Publish=False (common changeset that change phase + unknown one) |
|
636 | 636 | |
|
637 | 637 | $ hg push ../mu -r 967b449fbc94 -f |
|
638 | 638 | pushing to ../mu |
|
639 | 639 | searching for changes |
|
640 | 640 | adding changesets |
|
641 | 641 | adding manifests |
|
642 | 642 | adding file changes |
|
643 | 643 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
644 | 644 | $ hgph |
|
645 | 645 | @ 10 draft a-H - 967b449fbc94 |
|
646 | 646 | | |
|
647 | 647 | | o 9 draft a-G - 3e27b6f1eee1 |
|
648 | 648 | | | |
|
649 | 649 | | o 8 public a-F - b740e3e5c05d |
|
650 | 650 | | | |
|
651 | 651 | | o 7 public a-E - e9f537e46dea |
|
652 | 652 | | | |
|
653 | 653 | +---o 6 public n-B - 145e75495359 |
|
654 | 654 | | | |
|
655 | 655 | o | 5 public n-A - d6bcb4f74035 |
|
656 | 656 | | | |
|
657 | 657 | o | 4 public b-A - f54f1bb90ff3 |
|
658 | 658 | | | |
|
659 | 659 | | o 3 public a-D - b555f63b6063 |
|
660 | 660 | | | |
|
661 | 661 | | o 2 public a-C - 54acac6f23ab |
|
662 | 662 | |/ |
|
663 | 663 | o 1 public a-B - 548a3d25dbf0 |
|
664 | 664 | | |
|
665 | 665 | o 0 public a-A - 054250a37db4 |
|
666 | 666 | |
|
667 | 667 | $ cd ../mu |
|
668 | 668 | $ hgph # d6bcb4f74035 should have changed phase |
|
669 | 669 | > # 145e75495359 is still draft. not ancestor of -r |
|
670 | 670 | o 9 draft a-H - 967b449fbc94 |
|
671 | 671 | | |
|
672 | 672 | | o 8 public a-F - b740e3e5c05d |
|
673 | 673 | | | |
|
674 | 674 | | o 7 public a-E - e9f537e46dea |
|
675 | 675 | | | |
|
676 | 676 | +---o 6 draft n-B - 145e75495359 |
|
677 | 677 | | | |
|
678 | 678 | o | 5 public n-A - d6bcb4f74035 |
|
679 | 679 | | | |
|
680 | 680 | | o 4 public a-D - b555f63b6063 |
|
681 | 681 | | | |
|
682 | 682 | | o 3 public a-C - 54acac6f23ab |
|
683 | 683 | | | |
|
684 | 684 | o | 2 public b-A - f54f1bb90ff3 |
|
685 | 685 | |/ |
|
686 | 686 | o 1 public a-B - 548a3d25dbf0 |
|
687 | 687 | | |
|
688 | 688 | o 0 public a-A - 054250a37db4 |
|
689 | 689 | |
|
690 | 690 | |
|
691 | 691 | |
|
692 | 692 | Pushing to Publish=True (common changeset from publish=False) |
|
693 | 693 | |
|
694 | 694 | (in mu) |
|
695 | 695 | $ hg push ../alpha |
|
696 | 696 | pushing to ../alpha |
|
697 | 697 | searching for changes |
|
698 | 698 | no changes found |
|
699 | 699 | [1] |
|
700 | 700 | $ hgph |
|
701 | 701 | o 9 public a-H - 967b449fbc94 |
|
702 | 702 | | |
|
703 | 703 | | o 8 public a-F - b740e3e5c05d |
|
704 | 704 | | | |
|
705 | 705 | | o 7 public a-E - e9f537e46dea |
|
706 | 706 | | | |
|
707 | 707 | +---o 6 public n-B - 145e75495359 |
|
708 | 708 | | | |
|
709 | 709 | o | 5 public n-A - d6bcb4f74035 |
|
710 | 710 | | | |
|
711 | 711 | | o 4 public a-D - b555f63b6063 |
|
712 | 712 | | | |
|
713 | 713 | | o 3 public a-C - 54acac6f23ab |
|
714 | 714 | | | |
|
715 | 715 | o | 2 public b-A - f54f1bb90ff3 |
|
716 | 716 | |/ |
|
717 | 717 | o 1 public a-B - 548a3d25dbf0 |
|
718 | 718 | | |
|
719 | 719 | o 0 public a-A - 054250a37db4 |
|
720 | 720 | |
|
721 | 721 | $ hgph -R ../alpha # a-H should have been synced to 0 |
|
722 | 722 | @ 10 public a-H - 967b449fbc94 |
|
723 | 723 | | |
|
724 | 724 | | o 9 draft a-G - 3e27b6f1eee1 |
|
725 | 725 | | | |
|
726 | 726 | | o 8 public a-F - b740e3e5c05d |
|
727 | 727 | | | |
|
728 | 728 | | o 7 public a-E - e9f537e46dea |
|
729 | 729 | | | |
|
730 | 730 | +---o 6 public n-B - 145e75495359 |
|
731 | 731 | | | |
|
732 | 732 | o | 5 public n-A - d6bcb4f74035 |
|
733 | 733 | | | |
|
734 | 734 | o | 4 public b-A - f54f1bb90ff3 |
|
735 | 735 | | | |
|
736 | 736 | | o 3 public a-D - b555f63b6063 |
|
737 | 737 | | | |
|
738 | 738 | | o 2 public a-C - 54acac6f23ab |
|
739 | 739 | |/ |
|
740 | 740 | o 1 public a-B - 548a3d25dbf0 |
|
741 | 741 | | |
|
742 | 742 | o 0 public a-A - 054250a37db4 |
|
743 | 743 | |
|
744 | 744 | |
|
745 | 745 | |
|
746 | 746 | Discovery locally secret changeset on a remote repository: |
|
747 | 747 | |
|
748 | 748 | - should make it non-secret |
|
749 | 749 | |
|
750 | 750 | $ cd ../alpha |
|
751 | 751 | $ mkcommit A-secret --config phases.new-commit=2 |
|
752 | 752 | $ hgph |
|
753 | 753 | @ 11 secret A-secret - 435b5d83910c |
|
754 | 754 | | |
|
755 | 755 | o 10 public a-H - 967b449fbc94 |
|
756 | 756 | | |
|
757 | 757 | | o 9 draft a-G - 3e27b6f1eee1 |
|
758 | 758 | | | |
|
759 | 759 | | o 8 public a-F - b740e3e5c05d |
|
760 | 760 | | | |
|
761 | 761 | | o 7 public a-E - e9f537e46dea |
|
762 | 762 | | | |
|
763 | 763 | +---o 6 public n-B - 145e75495359 |
|
764 | 764 | | | |
|
765 | 765 | o | 5 public n-A - d6bcb4f74035 |
|
766 | 766 | | | |
|
767 | 767 | o | 4 public b-A - f54f1bb90ff3 |
|
768 | 768 | | | |
|
769 | 769 | | o 3 public a-D - b555f63b6063 |
|
770 | 770 | | | |
|
771 | 771 | | o 2 public a-C - 54acac6f23ab |
|
772 | 772 | |/ |
|
773 | 773 | o 1 public a-B - 548a3d25dbf0 |
|
774 | 774 | | |
|
775 | 775 | o 0 public a-A - 054250a37db4 |
|
776 | 776 | |
|
777 | 777 | $ hg bundle --base 'parents(.)' -r . ../secret-bundle.hg |
|
778 | 778 | 1 changesets found |
|
779 | 779 | $ hg -R ../mu unbundle ../secret-bundle.hg |
|
780 | 780 | adding changesets |
|
781 | 781 | adding manifests |
|
782 | 782 | adding file changes |
|
783 | 783 | added 1 changesets with 1 changes to 1 files |
|
784 | 784 | (run 'hg update' to get a working copy) |
|
785 | 785 | $ hgph -R ../mu |
|
786 | 786 | o 10 draft A-secret - 435b5d83910c |
|
787 | 787 | | |
|
788 | 788 | o 9 public a-H - 967b449fbc94 |
|
789 | 789 | | |
|
790 | 790 | | o 8 public a-F - b740e3e5c05d |
|
791 | 791 | | | |
|
792 | 792 | | o 7 public a-E - e9f537e46dea |
|
793 | 793 | | | |
|
794 | 794 | +---o 6 public n-B - 145e75495359 |
|
795 | 795 | | | |
|
796 | 796 | o | 5 public n-A - d6bcb4f74035 |
|
797 | 797 | | | |
|
798 | 798 | | o 4 public a-D - b555f63b6063 |
|
799 | 799 | | | |
|
800 | 800 | | o 3 public a-C - 54acac6f23ab |
|
801 | 801 | | | |
|
802 | 802 | o | 2 public b-A - f54f1bb90ff3 |
|
803 | 803 | |/ |
|
804 | 804 | o 1 public a-B - 548a3d25dbf0 |
|
805 | 805 | | |
|
806 | 806 | o 0 public a-A - 054250a37db4 |
|
807 | 807 | |
|
808 | 808 | $ hg pull ../mu |
|
809 | 809 | pulling from ../mu |
|
810 | 810 | searching for changes |
|
811 | 811 | no changes found |
|
812 | 812 | $ hgph |
|
813 | 813 | @ 11 draft A-secret - 435b5d83910c |
|
814 | 814 | | |
|
815 | 815 | o 10 public a-H - 967b449fbc94 |
|
816 | 816 | | |
|
817 | 817 | | o 9 draft a-G - 3e27b6f1eee1 |
|
818 | 818 | | | |
|
819 | 819 | | o 8 public a-F - b740e3e5c05d |
|
820 | 820 | | | |
|
821 | 821 | | o 7 public a-E - e9f537e46dea |
|
822 | 822 | | | |
|
823 | 823 | +---o 6 public n-B - 145e75495359 |
|
824 | 824 | | | |
|
825 | 825 | o | 5 public n-A - d6bcb4f74035 |
|
826 | 826 | | | |
|
827 | 827 | o | 4 public b-A - f54f1bb90ff3 |
|
828 | 828 | | | |
|
829 | 829 | | o 3 public a-D - b555f63b6063 |
|
830 | 830 | | | |
|
831 | 831 | | o 2 public a-C - 54acac6f23ab |
|
832 | 832 | |/ |
|
833 | 833 | o 1 public a-B - 548a3d25dbf0 |
|
834 | 834 | | |
|
835 | 835 | o 0 public a-A - 054250a37db4 |
|
836 | 836 | |
|
837 | 837 | |
|
838 | 838 | pushing a locally public and draft changesets remotly secret should make them |
|
839 | 839 | appear on the remote side. |
|
840 | 840 | |
|
841 | 841 | |
|
842 | 842 | $ hg -R ../mu phase --secret --force 967b449fbc94 |
|
843 | 843 | $ hg push -r 435b5d83910c ../mu |
|
844 | 844 | pushing to ../mu |
|
845 | 845 | searching for changes |
|
846 | 846 | abort: push creates new remote head 435b5d83910c! |
|
847 | 847 | (did you forget to merge? use push -f to force) |
|
848 | 848 | [255] |
|
849 | 849 | $ hg push -fr 435b5d83910c ../mu # because the push will create new visible head |
|
850 | 850 | pushing to ../mu |
|
851 | 851 | searching for changes |
|
852 | 852 | adding changesets |
|
853 | 853 | adding manifests |
|
854 | 854 | adding file changes |
|
855 | 855 | added 0 changesets with 0 changes to 2 files |
|
856 | 856 | $ hgph -R ../mu |
|
857 | 857 | o 10 draft A-secret - 435b5d83910c |
|
858 | 858 | | |
|
859 | 859 | o 9 public a-H - 967b449fbc94 |
|
860 | 860 | | |
|
861 | 861 | | o 8 public a-F - b740e3e5c05d |
|
862 | 862 | | | |
|
863 | 863 | | o 7 public a-E - e9f537e46dea |
|
864 | 864 | | | |
|
865 | 865 | +---o 6 public n-B - 145e75495359 |
|
866 | 866 | | | |
|
867 | 867 | o | 5 public n-A - d6bcb4f74035 |
|
868 | 868 | | | |
|
869 | 869 | | o 4 public a-D - b555f63b6063 |
|
870 | 870 | | | |
|
871 | 871 | | o 3 public a-C - 54acac6f23ab |
|
872 | 872 | | | |
|
873 | 873 | o | 2 public b-A - f54f1bb90ff3 |
|
874 | 874 | |/ |
|
875 | 875 | o 1 public a-B - 548a3d25dbf0 |
|
876 | 876 | | |
|
877 | 877 | o 0 public a-A - 054250a37db4 |
|
878 | 878 | |
|
879 | 879 | |
|
880 | 880 | pull new changeset with common draft locally |
|
881 | 881 | |
|
882 | 882 | $ hg up -q 967b449fbc94 # create a new root for draft |
|
883 | 883 | $ mkcommit 'alpha-more' |
|
884 | 884 | created new head |
|
885 | 885 | $ hg push -fr . ../mu |
|
886 | 886 | pushing to ../mu |
|
887 | 887 | searching for changes |
|
888 | 888 | adding changesets |
|
889 | 889 | adding manifests |
|
890 | 890 | adding file changes |
|
891 | 891 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
892 | 892 | $ cd ../mu |
|
893 | 893 | $ hg phase --secret --force 1c5cfd894796 |
|
894 | 894 | $ hg up -q 435b5d83910c |
|
895 | 895 | $ mkcommit 'mu-more' |
|
896 | 896 | $ cd ../alpha |
|
897 | 897 | $ hg pull ../mu |
|
898 | 898 | pulling from ../mu |
|
899 | 899 | searching for changes |
|
900 | 900 | adding changesets |
|
901 | 901 | adding manifests |
|
902 | 902 | adding file changes |
|
903 | 903 | added 1 changesets with 1 changes to 1 files |
|
904 | 904 | (run 'hg update' to get a working copy) |
|
905 | 905 | $ hgph |
|
906 | 906 | o 13 draft mu-more - 5237fb433fc8 |
|
907 | 907 | | |
|
908 | 908 | | @ 12 draft alpha-more - 1c5cfd894796 |
|
909 | 909 | | | |
|
910 | 910 | o | 11 draft A-secret - 435b5d83910c |
|
911 | 911 | |/ |
|
912 | 912 | o 10 public a-H - 967b449fbc94 |
|
913 | 913 | | |
|
914 | 914 | | o 9 draft a-G - 3e27b6f1eee1 |
|
915 | 915 | | | |
|
916 | 916 | | o 8 public a-F - b740e3e5c05d |
|
917 | 917 | | | |
|
918 | 918 | | o 7 public a-E - e9f537e46dea |
|
919 | 919 | | | |
|
920 | 920 | +---o 6 public n-B - 145e75495359 |
|
921 | 921 | | | |
|
922 | 922 | o | 5 public n-A - d6bcb4f74035 |
|
923 | 923 | | | |
|
924 | 924 | o | 4 public b-A - f54f1bb90ff3 |
|
925 | 925 | | | |
|
926 | 926 | | o 3 public a-D - b555f63b6063 |
|
927 | 927 | | | |
|
928 | 928 | | o 2 public a-C - 54acac6f23ab |
|
929 | 929 | |/ |
|
930 | 930 | o 1 public a-B - 548a3d25dbf0 |
|
931 | 931 | | |
|
932 | 932 | o 0 public a-A - 054250a37db4 |
|
933 | 933 | |
|
934 | 934 | |
|
935 | 935 | Test that test are properly ignored on remote event when existing locally |
|
936 | 936 | |
|
937 | 937 | $ cd .. |
|
938 | 938 | $ hg clone -qU -r b555f63b6063 -r f54f1bb90ff3 beta gamma |
|
939 | 939 | |
|
940 | 940 | # pathological case are |
|
941 | 941 | # |
|
942 | 942 | # * secret remotely |
|
943 | 943 | # * known locally |
|
944 | 944 | # * repo have uncommon changeset |
|
945 | 945 | |
|
946 | 946 | $ hg -R beta phase --secret --force f54f1bb90ff3 |
|
947 | 947 | $ hg -R gamma phase --draft --force f54f1bb90ff3 |
|
948 | 948 | |
|
949 | 949 | $ cd gamma |
|
950 | 950 | $ hg pull ../beta |
|
951 | 951 | pulling from ../beta |
|
952 | 952 | searching for changes |
|
953 | 953 | adding changesets |
|
954 | 954 | adding manifests |
|
955 | 955 | adding file changes |
|
956 | 956 | added 2 changesets with 2 changes to 2 files |
|
957 | 957 | (run 'hg update' to get a working copy) |
|
958 | 958 | $ hg phase f54f1bb90ff3 |
|
959 | 959 | 2: draft |
|
960 | 960 | |
|
961 | 961 | same over the wire |
|
962 | 962 | |
|
963 | 963 | $ cd ../beta |
|
964 | 964 | $ hg serve -p $HGPORT -d --pid-file=../beta.pid -E ../beta-error.log |
|
965 | 965 | $ cat ../beta.pid >> $DAEMON_PIDS |
|
966 | 966 | $ cd ../gamma |
|
967 | 967 | |
|
968 | 968 | $ hg pull http://localhost:$HGPORT/ |
|
969 | 969 | pulling from http://localhost:$HGPORT/ |
|
970 | 970 | searching for changes |
|
971 | 971 | no changes found |
|
972 | 972 | $ hg phase f54f1bb90ff3 |
|
973 | 973 | 2: draft |
|
974 | 974 | |
|
975 | 975 | check that secret local on both side are not synced to public |
|
976 | 976 | |
|
977 | 977 | $ hg push -r b555f63b6063 http://localhost:$HGPORT/ |
|
978 | 978 | pushing to http://localhost:$HGPORT/ |
|
979 | 979 | searching for changes |
|
980 | 980 | no changes found |
|
981 | 981 | [1] |
|
982 | 982 | $ hg phase f54f1bb90ff3 |
|
983 | 983 | 2: draft |
|
984 | 984 | |
|
985 | 985 | put the changeset in the draft state again |
|
986 | 986 | (first test after this one expect to be able to copy) |
|
987 | 987 | |
|
988 | 988 | $ cd .. |
|
989 | 989 | |
|
990 | 990 | |
|
991 | 991 | Test Clone behavior |
|
992 | 992 | |
|
993 | 993 | A. Clone without secret changeset |
|
994 | 994 | |
|
995 | 995 | 1. cloning non-publishing repository |
|
996 | 996 | (Phase should be preserved) |
|
997 | 997 | |
|
998 | 998 | # make sure there is no secret so we can use a copy clone |
|
999 | 999 | |
|
1000 | 1000 | $ hg -R mu phase --draft 'secret()' |
|
1001 | 1001 | |
|
1002 | 1002 | $ hg clone -U mu Tau |
|
1003 | 1003 | $ hgph -R Tau |
|
1004 | 1004 | o 12 draft mu-more - 5237fb433fc8 |
|
1005 | 1005 | | |
|
1006 | 1006 | | o 11 draft alpha-more - 1c5cfd894796 |
|
1007 | 1007 | | | |
|
1008 | 1008 | o | 10 draft A-secret - 435b5d83910c |
|
1009 | 1009 | |/ |
|
1010 | 1010 | o 9 public a-H - 967b449fbc94 |
|
1011 | 1011 | | |
|
1012 | 1012 | | o 8 public a-F - b740e3e5c05d |
|
1013 | 1013 | | | |
|
1014 | 1014 | | o 7 public a-E - e9f537e46dea |
|
1015 | 1015 | | | |
|
1016 | 1016 | +---o 6 public n-B - 145e75495359 |
|
1017 | 1017 | | | |
|
1018 | 1018 | o | 5 public n-A - d6bcb4f74035 |
|
1019 | 1019 | | | |
|
1020 | 1020 | | o 4 public a-D - b555f63b6063 |
|
1021 | 1021 | | | |
|
1022 | 1022 | | o 3 public a-C - 54acac6f23ab |
|
1023 | 1023 | | | |
|
1024 | 1024 | o | 2 public b-A - f54f1bb90ff3 |
|
1025 | 1025 | |/ |
|
1026 | 1026 | o 1 public a-B - 548a3d25dbf0 |
|
1027 | 1027 | | |
|
1028 | 1028 | o 0 public a-A - 054250a37db4 |
|
1029 | 1029 | |
|
1030 | 1030 | |
|
1031 | 1031 | 2. cloning publishing repository |
|
1032 | 1032 | |
|
1033 | 1033 | (everything should be public) |
|
1034 | 1034 | |
|
1035 | 1035 | $ hg clone -U alpha Upsilon |
|
1036 | 1036 | $ hgph -R Upsilon |
|
1037 | 1037 | o 13 public mu-more - 5237fb433fc8 |
|
1038 | 1038 | | |
|
1039 | 1039 | | o 12 public alpha-more - 1c5cfd894796 |
|
1040 | 1040 | | | |
|
1041 | 1041 | o | 11 public A-secret - 435b5d83910c |
|
1042 | 1042 | |/ |
|
1043 | 1043 | o 10 public a-H - 967b449fbc94 |
|
1044 | 1044 | | |
|
1045 | 1045 | | o 9 public a-G - 3e27b6f1eee1 |
|
1046 | 1046 | | | |
|
1047 | 1047 | | o 8 public a-F - b740e3e5c05d |
|
1048 | 1048 | | | |
|
1049 | 1049 | | o 7 public a-E - e9f537e46dea |
|
1050 | 1050 | | | |
|
1051 | 1051 | +---o 6 public n-B - 145e75495359 |
|
1052 | 1052 | | | |
|
1053 | 1053 | o | 5 public n-A - d6bcb4f74035 |
|
1054 | 1054 | | | |
|
1055 | 1055 | o | 4 public b-A - f54f1bb90ff3 |
|
1056 | 1056 | | | |
|
1057 | 1057 | | o 3 public a-D - b555f63b6063 |
|
1058 | 1058 | | | |
|
1059 | 1059 | | o 2 public a-C - 54acac6f23ab |
|
1060 | 1060 | |/ |
|
1061 | 1061 | o 1 public a-B - 548a3d25dbf0 |
|
1062 | 1062 | | |
|
1063 | 1063 | o 0 public a-A - 054250a37db4 |
|
1064 | 1064 | |
|
1065 | 1065 |
General Comments 0
You need to be logged in to leave comments.
Login now