Show More
@@ -1,416 +1,417 | |||
|
1 | 1 | # discovery.py - protocol changeset discovery functions |
|
2 | 2 | # |
|
3 | 3 | # Copyright 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 | from __future__ import absolute_import |
|
9 | 9 | |
|
10 | 10 | from .i18n import _ |
|
11 | 11 | from .node import ( |
|
12 | 12 | nullid, |
|
13 | 13 | short, |
|
14 | 14 | ) |
|
15 | 15 | |
|
16 | 16 | from . import ( |
|
17 | 17 | bookmarks, |
|
18 | 18 | branchmap, |
|
19 | 19 | error, |
|
20 | 20 | obsolete, |
|
21 | 21 | phases, |
|
22 | 22 | setdiscovery, |
|
23 | 23 | treediscovery, |
|
24 | 24 | util, |
|
25 | 25 | ) |
|
26 | 26 | |
|
27 | 27 | def findcommonincoming(repo, remote, heads=None, force=False): |
|
28 | 28 | """Return a tuple (common, anyincoming, heads) used to identify the common |
|
29 | 29 | subset of nodes between repo and remote. |
|
30 | 30 | |
|
31 | 31 | "common" is a list of (at least) the heads of the common subset. |
|
32 | 32 | "anyincoming" is testable as a boolean indicating if any nodes are missing |
|
33 | 33 | locally. If remote does not support getbundle, this actually is a list of |
|
34 | 34 | roots of the nodes that would be incoming, to be supplied to |
|
35 | 35 | changegroupsubset. No code except for pull should be relying on this fact |
|
36 | 36 | any longer. |
|
37 | 37 | "heads" is either the supplied heads, or else the remote's heads. |
|
38 | 38 | |
|
39 | 39 | If you pass heads and they are all known locally, the response lists just |
|
40 | 40 | these heads in "common" and in "heads". |
|
41 | 41 | |
|
42 | 42 | Please use findcommonoutgoing to compute the set of outgoing nodes to give |
|
43 | 43 | extensions a good hook into outgoing. |
|
44 | 44 | """ |
|
45 | 45 | |
|
46 | 46 | if not remote.capable('getbundle'): |
|
47 | 47 | return treediscovery.findcommonincoming(repo, remote, heads, force) |
|
48 | 48 | |
|
49 | 49 | if heads: |
|
50 | 50 | allknown = True |
|
51 | 51 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered |
|
52 | 52 | for h in heads: |
|
53 | 53 | if not knownnode(h): |
|
54 | 54 | allknown = False |
|
55 | 55 | break |
|
56 | 56 | if allknown: |
|
57 | 57 | return (heads, False, heads) |
|
58 | 58 | |
|
59 | 59 | res = setdiscovery.findcommonheads(repo.ui, repo, remote, |
|
60 | 60 | abortwhenunrelated=not force) |
|
61 | 61 | common, anyinc, srvheads = res |
|
62 | 62 | return (list(common), anyinc, heads or list(srvheads)) |
|
63 | 63 | |
|
64 | 64 | class outgoing(object): |
|
65 | 65 | '''Represents the set of nodes present in a local repo but not in a |
|
66 | 66 | (possibly) remote one. |
|
67 | 67 | |
|
68 | 68 | Members: |
|
69 | 69 | |
|
70 | 70 | missing is a list of all nodes present in local but not in remote. |
|
71 | 71 | common is a list of all nodes shared between the two repos. |
|
72 | 72 | excluded is the list of missing changeset that shouldn't be sent remotely. |
|
73 | 73 | missingheads is the list of heads of missing. |
|
74 | 74 | commonheads is the list of heads of common. |
|
75 | 75 | |
|
76 | 76 | The sets are computed on demand from the heads, unless provided upfront |
|
77 | 77 | by discovery.''' |
|
78 | 78 | |
|
79 | 79 | def __init__(self, revlog, commonheads, missingheads): |
|
80 | 80 | self.commonheads = commonheads |
|
81 | 81 | self.missingheads = missingheads |
|
82 | 82 | self._revlog = revlog |
|
83 | 83 | self._common = None |
|
84 | 84 | self._missing = None |
|
85 | 85 | self.excluded = [] |
|
86 | 86 | |
|
87 | 87 | def _computecommonmissing(self): |
|
88 | 88 | sets = self._revlog.findcommonmissing(self.commonheads, |
|
89 | 89 | self.missingheads) |
|
90 | 90 | self._common, self._missing = sets |
|
91 | 91 | |
|
92 | 92 | @util.propertycache |
|
93 | 93 | def common(self): |
|
94 | 94 | if self._common is None: |
|
95 | 95 | self._computecommonmissing() |
|
96 | 96 | return self._common |
|
97 | 97 | |
|
98 | 98 | @util.propertycache |
|
99 | 99 | def missing(self): |
|
100 | 100 | if self._missing is None: |
|
101 | 101 | self._computecommonmissing() |
|
102 | 102 | return self._missing |
|
103 | 103 | |
|
104 | 104 | def findcommonoutgoing(repo, other, onlyheads=None, force=False, |
|
105 | 105 | commoninc=None, portable=False): |
|
106 | 106 | '''Return an outgoing instance to identify the nodes present in repo but |
|
107 | 107 | not in other. |
|
108 | 108 | |
|
109 | 109 | If onlyheads is given, only nodes ancestral to nodes in onlyheads |
|
110 | 110 | (inclusive) are included. If you already know the local repo's heads, |
|
111 | 111 | passing them in onlyheads is faster than letting them be recomputed here. |
|
112 | 112 | |
|
113 | 113 | If commoninc is given, it must be the result of a prior call to |
|
114 | 114 | findcommonincoming(repo, other, force) to avoid recomputing it here. |
|
115 | 115 | |
|
116 | 116 | If portable is given, compute more conservative common and missingheads, |
|
117 | 117 | to make bundles created from the instance more portable.''' |
|
118 | 118 | # declare an empty outgoing object to be filled later |
|
119 | 119 | og = outgoing(repo.changelog, None, None) |
|
120 | 120 | |
|
121 | 121 | # get common set if not provided |
|
122 | 122 | if commoninc is None: |
|
123 | 123 | commoninc = findcommonincoming(repo, other, force=force) |
|
124 | 124 | og.commonheads, _any, _hds = commoninc |
|
125 | 125 | |
|
126 | 126 | # compute outgoing |
|
127 | 127 | mayexclude = (repo._phasecache.phaseroots[phases.secret] or repo.obsstore) |
|
128 | 128 | if not mayexclude: |
|
129 | 129 | og.missingheads = onlyheads or repo.heads() |
|
130 | 130 | elif onlyheads is None: |
|
131 | 131 | # use visible heads as it should be cached |
|
132 | 132 | og.missingheads = repo.filtered("served").heads() |
|
133 | 133 | og.excluded = [ctx.node() for ctx in repo.set('secret() or extinct()')] |
|
134 | 134 | else: |
|
135 | 135 | # compute common, missing and exclude secret stuff |
|
136 | 136 | sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads) |
|
137 | 137 | og._common, allmissing = sets |
|
138 | 138 | og._missing = missing = [] |
|
139 | 139 | og.excluded = excluded = [] |
|
140 | 140 | for node in allmissing: |
|
141 | 141 | ctx = repo[node] |
|
142 | 142 | if ctx.phase() >= phases.secret or ctx.extinct(): |
|
143 | 143 | excluded.append(node) |
|
144 | 144 | else: |
|
145 | 145 | missing.append(node) |
|
146 | 146 | if len(missing) == len(allmissing): |
|
147 | 147 | missingheads = onlyheads |
|
148 | 148 | else: # update missing heads |
|
149 | 149 | missingheads = phases.newheads(repo, onlyheads, excluded) |
|
150 | 150 | og.missingheads = missingheads |
|
151 | 151 | if portable: |
|
152 | 152 | # recompute common and missingheads as if -r<rev> had been given for |
|
153 | 153 | # each head of missing, and --base <rev> for each head of the proper |
|
154 | 154 | # ancestors of missing |
|
155 | 155 | og._computecommonmissing() |
|
156 | 156 | cl = repo.changelog |
|
157 | 157 | missingrevs = set(cl.rev(n) for n in og._missing) |
|
158 | 158 | og._common = set(cl.ancestors(missingrevs)) - missingrevs |
|
159 | 159 | commonheads = set(og.commonheads) |
|
160 | 160 | og.missingheads = [h for h in og.missingheads if h not in commonheads] |
|
161 | 161 | |
|
162 | 162 | return og |
|
163 | 163 | |
|
164 | 164 | def _headssummary(repo, remote, outgoing): |
|
165 | 165 | """compute a summary of branch and heads status before and after push |
|
166 | 166 | |
|
167 | 167 | return {'branch': ([remoteheads], [newheads], [unsyncedheads])} mapping |
|
168 | 168 | |
|
169 | 169 | - branch: the branch name |
|
170 | 170 | - remoteheads: the list of remote heads known locally |
|
171 | 171 | None if the branch is new |
|
172 | 172 | - newheads: the new remote heads (known locally) with outgoing pushed |
|
173 | 173 | - unsyncedheads: the list of remote heads unknown locally. |
|
174 | 174 | """ |
|
175 | 175 | cl = repo.changelog |
|
176 | 176 | headssum = {} |
|
177 | 177 | # A. Create set of branches involved in the push. |
|
178 | 178 | branches = set(repo[n].branch() for n in outgoing.missing) |
|
179 | 179 | remotemap = remote.branchmap() |
|
180 | 180 | newbranches = branches - set(remotemap) |
|
181 | 181 | branches.difference_update(newbranches) |
|
182 | 182 | |
|
183 | 183 | # A. register remote heads |
|
184 | 184 | remotebranches = set() |
|
185 | 185 | for branch, heads in remote.branchmap().iteritems(): |
|
186 | 186 | remotebranches.add(branch) |
|
187 | 187 | known = [] |
|
188 | 188 | unsynced = [] |
|
189 | 189 | knownnode = cl.hasnode # do not use nodemap until it is filtered |
|
190 | 190 | for h in heads: |
|
191 | 191 | if knownnode(h): |
|
192 | 192 | known.append(h) |
|
193 | 193 | else: |
|
194 | 194 | unsynced.append(h) |
|
195 | 195 | headssum[branch] = (known, list(known), unsynced) |
|
196 | 196 | # B. add new branch data |
|
197 | 197 | missingctx = list(repo[n] for n in outgoing.missing) |
|
198 | 198 | touchedbranches = set() |
|
199 | 199 | for ctx in missingctx: |
|
200 | 200 | branch = ctx.branch() |
|
201 | 201 | touchedbranches.add(branch) |
|
202 | 202 | if branch not in headssum: |
|
203 | 203 | headssum[branch] = (None, [], []) |
|
204 | 204 | |
|
205 | 205 | # C drop data about untouched branches: |
|
206 | 206 | for branch in remotebranches - touchedbranches: |
|
207 | 207 | del headssum[branch] |
|
208 | 208 | |
|
209 | 209 | # D. Update newmap with outgoing changes. |
|
210 | 210 | # This will possibly add new heads and remove existing ones. |
|
211 | 211 | newmap = branchmap.branchcache((branch, heads[1]) |
|
212 | 212 | for branch, heads in headssum.iteritems() |
|
213 | 213 | if heads[0] is not None) |
|
214 | 214 | newmap.update(repo, (ctx.rev() for ctx in missingctx)) |
|
215 | 215 | for branch, newheads in newmap.iteritems(): |
|
216 | 216 | headssum[branch][1][:] = newheads |
|
217 | 217 | return headssum |
|
218 | 218 | |
|
219 | 219 | def _oldheadssummary(repo, remoteheads, outgoing, inc=False): |
|
220 | 220 | """Compute branchmapsummary for repo without branchmap support""" |
|
221 | 221 | |
|
222 | 222 | # 1-4b. old servers: Check for new topological heads. |
|
223 | 223 | # Construct {old,new}map with branch = None (topological branch). |
|
224 | 224 | # (code based on update) |
|
225 | 225 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered |
|
226 | 226 | oldheads = set(h for h in remoteheads if knownnode(h)) |
|
227 | 227 | # all nodes in outgoing.missing are children of either: |
|
228 | 228 | # - an element of oldheads |
|
229 | 229 | # - another element of outgoing.missing |
|
230 | 230 | # - nullrev |
|
231 | 231 | # This explains why the new head are very simple to compute. |
|
232 | 232 | r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing) |
|
233 | 233 | newheads = list(c.node() for c in r) |
|
234 | 234 | # set some unsynced head to issue the "unsynced changes" warning |
|
235 | 235 | if inc: |
|
236 | 236 | unsynced = set([None]) |
|
237 | 237 | else: |
|
238 | 238 | unsynced = set() |
|
239 | 239 | return {None: (oldheads, newheads, unsynced)} |
|
240 | 240 | |
|
241 | 241 | def _nowarnheads(pushop): |
|
242 | 242 | # Compute newly pushed bookmarks. We don't warn about bookmarked heads. |
|
243 | ||
|
244 | # internal config: bookmarks.pushing | |
|
245 | newbookmarks = pushop.ui.configlist('bookmarks', 'pushing') | |
|
246 | ||
|
247 | 243 | repo = pushop.repo.unfiltered() |
|
248 | 244 | remote = pushop.remote |
|
249 | 245 | localbookmarks = repo._bookmarks |
|
250 | 246 | remotebookmarks = remote.listkeys('bookmarks') |
|
251 | 247 | bookmarkedheads = set() |
|
248 | ||
|
249 | # internal config: bookmarks.pushing | |
|
250 | newbookmarks = [localbookmarks.expandname(b) | |
|
251 | for b in pushop.ui.configlist('bookmarks', 'pushing')] | |
|
252 | ||
|
252 | 253 | for bm in localbookmarks: |
|
253 | 254 | rnode = remotebookmarks.get(bm) |
|
254 | 255 | if rnode and rnode in repo: |
|
255 | 256 | lctx, rctx = repo[bm], repo[rnode] |
|
256 | 257 | if bookmarks.validdest(repo, rctx, lctx): |
|
257 | 258 | bookmarkedheads.add(lctx.node()) |
|
258 | 259 | else: |
|
259 | 260 | if bm in newbookmarks and bm not in remotebookmarks: |
|
260 | 261 | bookmarkedheads.add(repo[bm].node()) |
|
261 | 262 | |
|
262 | 263 | return bookmarkedheads |
|
263 | 264 | |
|
264 | 265 | def checkheads(pushop): |
|
265 | 266 | """Check that a push won't add any outgoing head |
|
266 | 267 | |
|
267 | 268 | raise Abort error and display ui message as needed. |
|
268 | 269 | """ |
|
269 | 270 | |
|
270 | 271 | repo = pushop.repo.unfiltered() |
|
271 | 272 | remote = pushop.remote |
|
272 | 273 | outgoing = pushop.outgoing |
|
273 | 274 | remoteheads = pushop.remoteheads |
|
274 | 275 | newbranch = pushop.newbranch |
|
275 | 276 | inc = bool(pushop.incoming) |
|
276 | 277 | |
|
277 | 278 | # Check for each named branch if we're creating new remote heads. |
|
278 | 279 | # To be a remote head after push, node must be either: |
|
279 | 280 | # - unknown locally |
|
280 | 281 | # - a local outgoing head descended from update |
|
281 | 282 | # - a remote head that's known locally and not |
|
282 | 283 | # ancestral to an outgoing head |
|
283 | 284 | if remoteheads == [nullid]: |
|
284 | 285 | # remote is empty, nothing to check. |
|
285 | 286 | return |
|
286 | 287 | |
|
287 | 288 | if remote.capable('branchmap'): |
|
288 | 289 | headssum = _headssummary(repo, remote, outgoing) |
|
289 | 290 | else: |
|
290 | 291 | headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) |
|
291 | 292 | newbranches = [branch for branch, heads in headssum.iteritems() |
|
292 | 293 | if heads[0] is None] |
|
293 | 294 | # 1. Check for new branches on the remote. |
|
294 | 295 | if newbranches and not newbranch: # new branch requires --new-branch |
|
295 | 296 | branchnames = ', '.join(sorted(newbranches)) |
|
296 | 297 | raise error.Abort(_("push creates new remote branches: %s!") |
|
297 | 298 | % branchnames, |
|
298 | 299 | hint=_("use 'hg push --new-branch' to create" |
|
299 | 300 | " new remote branches")) |
|
300 | 301 | |
|
301 | 302 | # 2. Find heads that we need not warn about |
|
302 | 303 | nowarnheads = _nowarnheads(pushop) |
|
303 | 304 | |
|
304 | 305 | # 3. Check for new heads. |
|
305 | 306 | # If there are more heads after the push than before, a suitable |
|
306 | 307 | # error message, depending on unsynced status, is displayed. |
|
307 | 308 | errormsg = None |
|
308 | 309 | # If there is no obsstore, allfuturecommon won't be used, so no |
|
309 | 310 | # need to compute it. |
|
310 | 311 | if repo.obsstore: |
|
311 | 312 | allmissing = set(outgoing.missing) |
|
312 | 313 | cctx = repo.set('%ld', outgoing.common) |
|
313 | 314 | allfuturecommon = set(c.node() for c in cctx) |
|
314 | 315 | allfuturecommon.update(allmissing) |
|
315 | 316 | for branch, heads in sorted(headssum.iteritems()): |
|
316 | 317 | remoteheads, newheads, unsyncedheads = heads |
|
317 | 318 | candidate_newhs = set(newheads) |
|
318 | 319 | # add unsynced data |
|
319 | 320 | if remoteheads is None: |
|
320 | 321 | oldhs = set() |
|
321 | 322 | else: |
|
322 | 323 | oldhs = set(remoteheads) |
|
323 | 324 | oldhs.update(unsyncedheads) |
|
324 | 325 | candidate_newhs.update(unsyncedheads) |
|
325 | 326 | dhs = None # delta heads, the new heads on branch |
|
326 | 327 | discardedheads = set() |
|
327 | 328 | if not repo.obsstore: |
|
328 | 329 | newhs = candidate_newhs |
|
329 | 330 | else: |
|
330 | 331 | # remove future heads which are actually obsoleted by another |
|
331 | 332 | # pushed element: |
|
332 | 333 | # |
|
333 | 334 | # XXX as above, There are several cases this code does not handle |
|
334 | 335 | # XXX properly |
|
335 | 336 | # |
|
336 | 337 | # (1) if <nh> is public, it won't be affected by obsolete marker |
|
337 | 338 | # and a new is created |
|
338 | 339 | # |
|
339 | 340 | # (2) if the new heads have ancestors which are not obsolete and |
|
340 | 341 | # not ancestors of any other heads we will have a new head too. |
|
341 | 342 | # |
|
342 | 343 | # These two cases will be easy to handle for known changeset but |
|
343 | 344 | # much more tricky for unsynced changes. |
|
344 | 345 | # |
|
345 | 346 | # In addition, this code is confused by prune as it only looks for |
|
346 | 347 | # successors of the heads (none if pruned) leading to issue4354 |
|
347 | 348 | newhs = set() |
|
348 | 349 | for nh in candidate_newhs: |
|
349 | 350 | if nh in repo and repo[nh].phase() <= phases.public: |
|
350 | 351 | newhs.add(nh) |
|
351 | 352 | else: |
|
352 | 353 | for suc in obsolete.allsuccessors(repo.obsstore, [nh]): |
|
353 | 354 | if suc != nh and suc in allfuturecommon: |
|
354 | 355 | discardedheads.add(nh) |
|
355 | 356 | break |
|
356 | 357 | else: |
|
357 | 358 | newhs.add(nh) |
|
358 | 359 | unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) |
|
359 | 360 | if unsynced: |
|
360 | 361 | if None in unsynced: |
|
361 | 362 | # old remote, no heads data |
|
362 | 363 | heads = None |
|
363 | 364 | elif len(unsynced) <= 4 or repo.ui.verbose: |
|
364 | 365 | heads = ' '.join(short(h) for h in unsynced) |
|
365 | 366 | else: |
|
366 | 367 | heads = (' '.join(short(h) for h in unsynced[:4]) + |
|
367 | 368 | ' ' + _("and %s others") % (len(unsynced) - 4)) |
|
368 | 369 | if heads is None: |
|
369 | 370 | repo.ui.status(_("remote has heads that are " |
|
370 | 371 | "not known locally\n")) |
|
371 | 372 | elif branch is None: |
|
372 | 373 | repo.ui.status(_("remote has heads that are " |
|
373 | 374 | "not known locally: %s\n") % heads) |
|
374 | 375 | else: |
|
375 | 376 | repo.ui.status(_("remote has heads on branch '%s' that are " |
|
376 | 377 | "not known locally: %s\n") % (branch, heads)) |
|
377 | 378 | if remoteheads is None: |
|
378 | 379 | if len(newhs) > 1: |
|
379 | 380 | dhs = list(newhs) |
|
380 | 381 | if errormsg is None: |
|
381 | 382 | errormsg = (_("push creates new branch '%s' " |
|
382 | 383 | "with multiple heads") % (branch)) |
|
383 | 384 | hint = _("merge or" |
|
384 | 385 | " see \"hg help push\" for details about" |
|
385 | 386 | " pushing new heads") |
|
386 | 387 | elif len(newhs) > len(oldhs): |
|
387 | 388 | # remove bookmarked or existing remote heads from the new heads list |
|
388 | 389 | dhs = sorted(newhs - nowarnheads - oldhs) |
|
389 | 390 | if dhs: |
|
390 | 391 | if errormsg is None: |
|
391 | 392 | if branch not in ('default', None): |
|
392 | 393 | errormsg = _("push creates new remote head %s " |
|
393 | 394 | "on branch '%s'!") % (short(dhs[0]), branch) |
|
394 | 395 | elif repo[dhs[0]].bookmarks(): |
|
395 | 396 | errormsg = _("push creates new remote head %s " |
|
396 | 397 | "with bookmark '%s'!") % ( |
|
397 | 398 | short(dhs[0]), repo[dhs[0]].bookmarks()[0]) |
|
398 | 399 | else: |
|
399 | 400 | errormsg = _("push creates new remote head %s!" |
|
400 | 401 | ) % short(dhs[0]) |
|
401 | 402 | if unsyncedheads: |
|
402 | 403 | hint = _("pull and merge or" |
|
403 | 404 | " see \"hg help push\" for details about" |
|
404 | 405 | " pushing new heads") |
|
405 | 406 | else: |
|
406 | 407 | hint = _("merge or" |
|
407 | 408 | " see \"hg help push\" for details about" |
|
408 | 409 | " pushing new heads") |
|
409 | 410 | if branch is None: |
|
410 | 411 | repo.ui.note(_("new remote heads:\n")) |
|
411 | 412 | else: |
|
412 | 413 | repo.ui.note(_("new remote heads on branch '%s':\n") % branch) |
|
413 | 414 | for h in dhs: |
|
414 | 415 | repo.ui.note((" %s\n") % short(h)) |
|
415 | 416 | if errormsg: |
|
416 | 417 | raise error.Abort(errormsg, hint=hint) |
@@ -1,850 +1,850 | |||
|
1 | 1 | #require serve |
|
2 | 2 | |
|
3 | 3 | $ cat << EOF >> $HGRCPATH |
|
4 | 4 | > [ui] |
|
5 | 5 | > logtemplate={rev}:{node|short} {desc|firstline} |
|
6 | 6 | > [phases] |
|
7 | 7 | > publish=False |
|
8 | 8 | > [experimental] |
|
9 | 9 | > evolution=createmarkers,exchange |
|
10 | 10 | > # drop me once bundle2 is the default, |
|
11 | 11 | > # added to get test change early. |
|
12 | 12 | > bundle2-exp = True |
|
13 | 13 | > EOF |
|
14 | 14 | |
|
15 | 15 | initialize |
|
16 | 16 | |
|
17 | 17 | $ hg init a |
|
18 | 18 | $ cd a |
|
19 | 19 | $ echo 'test' > test |
|
20 | 20 | $ hg commit -Am'test' |
|
21 | 21 | adding test |
|
22 | 22 | |
|
23 | 23 | set bookmarks |
|
24 | 24 | |
|
25 | 25 | $ hg bookmark X |
|
26 | 26 | $ hg bookmark Y |
|
27 | 27 | $ hg bookmark Z |
|
28 | 28 | |
|
29 | 29 | import bookmark by name |
|
30 | 30 | |
|
31 | 31 | $ hg init ../b |
|
32 | 32 | $ cd ../b |
|
33 | 33 | $ hg book Y |
|
34 | 34 | $ hg book |
|
35 | 35 | * Y -1:000000000000 |
|
36 | 36 | $ hg pull ../a |
|
37 | 37 | pulling from ../a |
|
38 | 38 | requesting all changes |
|
39 | 39 | adding changesets |
|
40 | 40 | adding manifests |
|
41 | 41 | adding file changes |
|
42 | 42 | added 1 changesets with 1 changes to 1 files |
|
43 | 43 | adding remote bookmark X |
|
44 | 44 | updating bookmark Y |
|
45 | 45 | adding remote bookmark Z |
|
46 | 46 | (run 'hg update' to get a working copy) |
|
47 | 47 | $ hg bookmarks |
|
48 | 48 | X 0:4e3505fd9583 |
|
49 | 49 | * Y 0:4e3505fd9583 |
|
50 | 50 | Z 0:4e3505fd9583 |
|
51 | 51 | $ hg debugpushkey ../a namespaces |
|
52 | 52 | bookmarks |
|
53 | 53 | namespaces |
|
54 | 54 | obsolete |
|
55 | 55 | phases |
|
56 | 56 | $ hg debugpushkey ../a bookmarks |
|
57 | 57 | X 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
58 | 58 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
59 | 59 | Z 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
60 | 60 | |
|
61 | 61 | delete the bookmark to re-pull it |
|
62 | 62 | |
|
63 | 63 | $ hg book -d X |
|
64 | 64 | $ hg pull -B X ../a |
|
65 | 65 | pulling from ../a |
|
66 | 66 | no changes found |
|
67 | 67 | adding remote bookmark X |
|
68 | 68 | |
|
69 | 69 | finally no-op pull |
|
70 | 70 | |
|
71 | 71 | $ hg pull -B X ../a |
|
72 | 72 | pulling from ../a |
|
73 | 73 | no changes found |
|
74 | 74 | $ hg bookmark |
|
75 | 75 | X 0:4e3505fd9583 |
|
76 | 76 | * Y 0:4e3505fd9583 |
|
77 | 77 | Z 0:4e3505fd9583 |
|
78 | 78 | |
|
79 | 79 | export bookmark by name |
|
80 | 80 | |
|
81 | 81 | $ hg bookmark W |
|
82 | 82 | $ hg bookmark foo |
|
83 | 83 | $ hg bookmark foobar |
|
84 | 84 | $ hg push -B W ../a |
|
85 | 85 | pushing to ../a |
|
86 | 86 | searching for changes |
|
87 | 87 | no changes found |
|
88 | 88 | exporting bookmark W |
|
89 | 89 | [1] |
|
90 | 90 | $ hg -R ../a bookmarks |
|
91 | 91 | W -1:000000000000 |
|
92 | 92 | X 0:4e3505fd9583 |
|
93 | 93 | Y 0:4e3505fd9583 |
|
94 | 94 | * Z 0:4e3505fd9583 |
|
95 | 95 | |
|
96 | 96 | delete a remote bookmark |
|
97 | 97 | |
|
98 | 98 | $ hg book -d W |
|
99 | 99 | $ hg push -B W ../a |
|
100 | 100 | pushing to ../a |
|
101 | 101 | searching for changes |
|
102 | 102 | no changes found |
|
103 | 103 | deleting remote bookmark W |
|
104 | 104 | [1] |
|
105 | 105 | |
|
106 | 106 | export the active bookmark |
|
107 | 107 | |
|
108 | 108 | $ hg bookmark V |
|
109 | 109 | $ hg push -B . ../a |
|
110 | 110 | pushing to ../a |
|
111 | 111 | searching for changes |
|
112 | 112 | no changes found |
|
113 | 113 | exporting bookmark V |
|
114 | 114 | [1] |
|
115 | 115 | |
|
116 | 116 | delete the bookmark |
|
117 | 117 | |
|
118 | 118 | $ hg book -d V |
|
119 | 119 | $ hg push -B V ../a |
|
120 | 120 | pushing to ../a |
|
121 | 121 | searching for changes |
|
122 | 122 | no changes found |
|
123 | 123 | deleting remote bookmark V |
|
124 | 124 | [1] |
|
125 | 125 | $ hg up foobar |
|
126 | 126 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | (activating bookmark foobar) |
|
128 | 128 | |
|
129 | 129 | push/pull name that doesn't exist |
|
130 | 130 | |
|
131 | 131 | $ hg push -B badname ../a |
|
132 | 132 | pushing to ../a |
|
133 | 133 | searching for changes |
|
134 | 134 | bookmark badname does not exist on the local or remote repository! |
|
135 | 135 | no changes found |
|
136 | 136 | [2] |
|
137 | 137 | $ hg pull -B anotherbadname ../a |
|
138 | 138 | pulling from ../a |
|
139 | 139 | abort: remote bookmark anotherbadname not found! |
|
140 | 140 | [255] |
|
141 | 141 | |
|
142 | 142 | divergent bookmarks |
|
143 | 143 | |
|
144 | 144 | $ cd ../a |
|
145 | 145 | $ echo c1 > f1 |
|
146 | 146 | $ hg ci -Am1 |
|
147 | 147 | adding f1 |
|
148 | 148 | $ hg book -f @ |
|
149 | 149 | $ hg book -f X |
|
150 | 150 | $ hg book |
|
151 | 151 | @ 1:0d2164f0ce0d |
|
152 | 152 | * X 1:0d2164f0ce0d |
|
153 | 153 | Y 0:4e3505fd9583 |
|
154 | 154 | Z 1:0d2164f0ce0d |
|
155 | 155 | |
|
156 | 156 | $ cd ../b |
|
157 | 157 | $ hg up |
|
158 | 158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
159 | 159 | updating bookmark foobar |
|
160 | 160 | $ echo c2 > f2 |
|
161 | 161 | $ hg ci -Am2 |
|
162 | 162 | adding f2 |
|
163 | 163 | $ hg book -if @ |
|
164 | 164 | $ hg book -if X |
|
165 | 165 | $ hg book |
|
166 | 166 | @ 1:9b140be10808 |
|
167 | 167 | X 1:9b140be10808 |
|
168 | 168 | Y 0:4e3505fd9583 |
|
169 | 169 | Z 0:4e3505fd9583 |
|
170 | 170 | foo -1:000000000000 |
|
171 | 171 | * foobar 1:9b140be10808 |
|
172 | 172 | |
|
173 | 173 | $ hg pull --config paths.foo=../a foo |
|
174 | 174 | pulling from $TESTTMP/a (glob) |
|
175 | 175 | searching for changes |
|
176 | 176 | adding changesets |
|
177 | 177 | adding manifests |
|
178 | 178 | adding file changes |
|
179 | 179 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
180 | 180 | divergent bookmark @ stored as @foo |
|
181 | 181 | divergent bookmark X stored as X@foo |
|
182 | 182 | updating bookmark Z |
|
183 | 183 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
184 | 184 | $ hg book |
|
185 | 185 | @ 1:9b140be10808 |
|
186 | 186 | @foo 2:0d2164f0ce0d |
|
187 | 187 | X 1:9b140be10808 |
|
188 | 188 | X@foo 2:0d2164f0ce0d |
|
189 | 189 | Y 0:4e3505fd9583 |
|
190 | 190 | Z 2:0d2164f0ce0d |
|
191 | 191 | foo -1:000000000000 |
|
192 | 192 | * foobar 1:9b140be10808 |
|
193 | 193 | |
|
194 | 194 | (test that too many divergence of bookmark) |
|
195 | 195 | |
|
196 | 196 | $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -r 000000000000 "X@${i}"; done |
|
197 | 197 | $ hg pull ../a |
|
198 | 198 | pulling from ../a |
|
199 | 199 | searching for changes |
|
200 | 200 | no changes found |
|
201 | 201 | warning: failed to assign numbered name to divergent bookmark X |
|
202 | 202 | divergent bookmark @ stored as @1 |
|
203 | 203 | $ hg bookmarks | grep '^ X' | grep -v ':000000000000' |
|
204 | 204 | X 1:9b140be10808 |
|
205 | 205 | X@foo 2:0d2164f0ce0d |
|
206 | 206 | |
|
207 | 207 | (test that remotely diverged bookmarks are reused if they aren't changed) |
|
208 | 208 | |
|
209 | 209 | $ hg bookmarks | grep '^ @' |
|
210 | 210 | @ 1:9b140be10808 |
|
211 | 211 | @1 2:0d2164f0ce0d |
|
212 | 212 | @foo 2:0d2164f0ce0d |
|
213 | 213 | $ hg pull ../a |
|
214 | 214 | pulling from ../a |
|
215 | 215 | searching for changes |
|
216 | 216 | no changes found |
|
217 | 217 | warning: failed to assign numbered name to divergent bookmark X |
|
218 | 218 | divergent bookmark @ stored as @1 |
|
219 | 219 | $ hg bookmarks | grep '^ @' |
|
220 | 220 | @ 1:9b140be10808 |
|
221 | 221 | @1 2:0d2164f0ce0d |
|
222 | 222 | @foo 2:0d2164f0ce0d |
|
223 | 223 | |
|
224 | 224 | $ python $TESTDIR/seq.py 1 100 | while read i; do hg bookmarks -d "X@${i}"; done |
|
225 | 225 | $ hg bookmarks -d "@1" |
|
226 | 226 | |
|
227 | 227 | $ hg push -f ../a |
|
228 | 228 | pushing to ../a |
|
229 | 229 | searching for changes |
|
230 | 230 | adding changesets |
|
231 | 231 | adding manifests |
|
232 | 232 | adding file changes |
|
233 | 233 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
234 | 234 | $ hg -R ../a book |
|
235 | 235 | @ 1:0d2164f0ce0d |
|
236 | 236 | * X 1:0d2164f0ce0d |
|
237 | 237 | Y 0:4e3505fd9583 |
|
238 | 238 | Z 1:0d2164f0ce0d |
|
239 | 239 | |
|
240 | 240 | explicit pull should overwrite the local version (issue4439) |
|
241 | 241 | |
|
242 | 242 | $ hg pull --config paths.foo=../a foo -B X |
|
243 | 243 | pulling from $TESTTMP/a (glob) |
|
244 | 244 | no changes found |
|
245 | 245 | divergent bookmark @ stored as @foo |
|
246 | 246 | importing bookmark X |
|
247 | 247 | |
|
248 | 248 | reinstall state for further testing: |
|
249 | 249 | |
|
250 | 250 | $ hg book -fr 9b140be10808 X |
|
251 | 251 | |
|
252 | 252 | revsets should not ignore divergent bookmarks |
|
253 | 253 | |
|
254 | 254 | $ hg bookmark -fr 1 Z |
|
255 | 255 | $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n' |
|
256 | 256 | 0:4e3505fd9583 Y |
|
257 | 257 | 1:9b140be10808 @ X Z foobar |
|
258 | 258 | 2:0d2164f0ce0d @foo X@foo |
|
259 | 259 | $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n' |
|
260 | 260 | 2:0d2164f0ce0d @foo X@foo |
|
261 | 261 | $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n' |
|
262 | 262 | 2:0d2164f0ce0d @foo X@foo |
|
263 | 263 | |
|
264 | 264 | update a remote bookmark from a non-head to a head |
|
265 | 265 | |
|
266 | 266 | $ hg up -q Y |
|
267 | 267 | $ echo c3 > f2 |
|
268 | 268 | $ hg ci -Am3 |
|
269 | 269 | adding f2 |
|
270 | 270 | created new head |
|
271 | 271 | $ hg push ../a |
|
272 | 272 | pushing to ../a |
|
273 | 273 | searching for changes |
|
274 | 274 | adding changesets |
|
275 | 275 | adding manifests |
|
276 | 276 | adding file changes |
|
277 | 277 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
278 | 278 | updating bookmark Y |
|
279 | 279 | $ hg -R ../a book |
|
280 | 280 | @ 1:0d2164f0ce0d |
|
281 | 281 | * X 1:0d2164f0ce0d |
|
282 | 282 | Y 3:f6fc62dde3c0 |
|
283 | 283 | Z 1:0d2164f0ce0d |
|
284 | 284 | |
|
285 | 285 | update a bookmark in the middle of a client pulling changes |
|
286 | 286 | |
|
287 | 287 | $ cd .. |
|
288 | 288 | $ hg clone -q a pull-race |
|
289 | 289 | |
|
290 | 290 | We want to use http because it is stateless and therefore more susceptible to |
|
291 | 291 | race conditions |
|
292 | 292 | |
|
293 | 293 | $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log |
|
294 | 294 | $ cat pull-race.pid >> $DAEMON_PIDS |
|
295 | 295 | |
|
296 | 296 | $ hg clone -q http://localhost:$HGPORT/ pull-race2 |
|
297 | 297 | $ cd pull-race |
|
298 | 298 | $ hg up -q Y |
|
299 | 299 | $ echo c4 > f2 |
|
300 | 300 | $ hg ci -Am4 |
|
301 | 301 | $ echo c5 > f3 |
|
302 | 302 | $ cat <<EOF > .hg/hgrc |
|
303 | 303 | > [hooks] |
|
304 | 304 | > outgoing.makecommit = hg ci -Am5; echo committed in pull-race |
|
305 | 305 | > EOF |
|
306 | 306 | |
|
307 | 307 | (new config needs a server restart) |
|
308 | 308 | |
|
309 | 309 | $ cd .. |
|
310 | 310 | $ killdaemons.py |
|
311 | 311 | $ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log |
|
312 | 312 | $ cat pull-race.pid >> $DAEMON_PIDS |
|
313 | 313 | $ cd pull-race2 |
|
314 | 314 | $ hg -R $TESTTMP/pull-race book |
|
315 | 315 | @ 1:0d2164f0ce0d |
|
316 | 316 | X 1:0d2164f0ce0d |
|
317 | 317 | * Y 4:b0a5eff05604 |
|
318 | 318 | Z 1:0d2164f0ce0d |
|
319 | 319 | $ hg pull |
|
320 | 320 | pulling from http://localhost:$HGPORT/ |
|
321 | 321 | searching for changes |
|
322 | 322 | adding changesets |
|
323 | 323 | adding manifests |
|
324 | 324 | adding file changes |
|
325 | 325 | added 1 changesets with 1 changes to 1 files |
|
326 | 326 | updating bookmark Y |
|
327 | 327 | (run 'hg update' to get a working copy) |
|
328 | 328 | $ hg book |
|
329 | 329 | * @ 1:0d2164f0ce0d |
|
330 | 330 | X 1:0d2164f0ce0d |
|
331 | 331 | Y 4:b0a5eff05604 |
|
332 | 332 | Z 1:0d2164f0ce0d |
|
333 | 333 | |
|
334 | 334 | Update a bookmark right after the initial lookup -B (issue4689) |
|
335 | 335 | |
|
336 | 336 | $ echo c6 > ../pull-race/f3 # to be committed during the race |
|
337 | 337 | $ cat <<EOF > ../pull-race/.hg/hgrc |
|
338 | 338 | > [hooks] |
|
339 | 339 | > # If anything to commit, commit it right after the first key listing used |
|
340 | 340 | > # during lookup. This makes the commit appear before the actual getbundle |
|
341 | 341 | > # call. |
|
342 | 342 | > listkeys.makecommit= ((hg st | grep -q M) && (hg commit -m race; echo commited in pull-race)) || exit 0 |
|
343 | 343 | > EOF |
|
344 | 344 | |
|
345 | 345 | (new config need server restart) |
|
346 | 346 | |
|
347 | 347 | $ killdaemons.py |
|
348 | 348 | $ hg serve -R ../pull-race -p $HGPORT -d --pid-file=../pull-race.pid -E main-error.log |
|
349 | 349 | $ cat ../pull-race.pid >> $DAEMON_PIDS |
|
350 | 350 | |
|
351 | 351 | $ hg -R $TESTTMP/pull-race book |
|
352 | 352 | @ 1:0d2164f0ce0d |
|
353 | 353 | X 1:0d2164f0ce0d |
|
354 | 354 | * Y 5:35d1ef0a8d1b |
|
355 | 355 | Z 1:0d2164f0ce0d |
|
356 | 356 | $ hg pull -B Y |
|
357 | 357 | pulling from http://localhost:$HGPORT/ |
|
358 | 358 | searching for changes |
|
359 | 359 | adding changesets |
|
360 | 360 | adding manifests |
|
361 | 361 | adding file changes |
|
362 | 362 | added 1 changesets with 1 changes to 1 files |
|
363 | 363 | updating bookmark Y |
|
364 | 364 | (run 'hg update' to get a working copy) |
|
365 | 365 | $ hg book |
|
366 | 366 | * @ 1:0d2164f0ce0d |
|
367 | 367 | X 1:0d2164f0ce0d |
|
368 | 368 | Y 5:35d1ef0a8d1b |
|
369 | 369 | Z 1:0d2164f0ce0d |
|
370 | 370 | |
|
371 | 371 | (done with this section of the test) |
|
372 | 372 | |
|
373 | 373 | $ killdaemons.py |
|
374 | 374 | $ cd ../b |
|
375 | 375 | |
|
376 | 376 | diverging a remote bookmark fails |
|
377 | 377 | |
|
378 | 378 | $ hg up -q 4e3505fd9583 |
|
379 | 379 | $ echo c4 > f2 |
|
380 | 380 | $ hg ci -Am4 |
|
381 | 381 | adding f2 |
|
382 | 382 | created new head |
|
383 | 383 | $ echo c5 > f2 |
|
384 | 384 | $ hg ci -Am5 |
|
385 | 385 | $ hg log -G |
|
386 | 386 | @ 5:c922c0139ca0 5 |
|
387 | 387 | | |
|
388 | 388 | o 4:4efff6d98829 4 |
|
389 | 389 | | |
|
390 | 390 | | o 3:f6fc62dde3c0 3 |
|
391 | 391 | |/ |
|
392 | 392 | | o 2:0d2164f0ce0d 1 |
|
393 | 393 | |/ |
|
394 | 394 | | o 1:9b140be10808 2 |
|
395 | 395 | |/ |
|
396 | 396 | o 0:4e3505fd9583 test |
|
397 | 397 | |
|
398 | 398 | |
|
399 | 399 | $ hg book -f Y |
|
400 | 400 | |
|
401 | 401 | $ cat <<EOF > ../a/.hg/hgrc |
|
402 | 402 | > [web] |
|
403 | 403 | > push_ssl = false |
|
404 | 404 | > allow_push = * |
|
405 | 405 | > EOF |
|
406 | 406 | |
|
407 | 407 | $ hg serve -R ../a -p $HGPORT2 -d --pid-file=../hg2.pid |
|
408 | 408 | $ cat ../hg2.pid >> $DAEMON_PIDS |
|
409 | 409 | |
|
410 | 410 | $ hg push http://localhost:$HGPORT2/ |
|
411 | 411 | pushing to http://localhost:$HGPORT2/ |
|
412 | 412 | searching for changes |
|
413 | 413 | abort: push creates new remote head c922c0139ca0 with bookmark 'Y'! |
|
414 | 414 | (merge or see "hg help push" for details about pushing new heads) |
|
415 | 415 | [255] |
|
416 | 416 | $ hg -R ../a book |
|
417 | 417 | @ 1:0d2164f0ce0d |
|
418 | 418 | * X 1:0d2164f0ce0d |
|
419 | 419 | Y 3:f6fc62dde3c0 |
|
420 | 420 | Z 1:0d2164f0ce0d |
|
421 | 421 | |
|
422 | 422 | |
|
423 | 423 | Unrelated marker does not alter the decision |
|
424 | 424 | |
|
425 | 425 | $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |
|
426 | 426 | $ hg push http://localhost:$HGPORT2/ |
|
427 | 427 | pushing to http://localhost:$HGPORT2/ |
|
428 | 428 | searching for changes |
|
429 | 429 | abort: push creates new remote head c922c0139ca0 with bookmark 'Y'! |
|
430 | 430 | (merge or see "hg help push" for details about pushing new heads) |
|
431 | 431 | [255] |
|
432 | 432 | $ hg -R ../a book |
|
433 | 433 | @ 1:0d2164f0ce0d |
|
434 | 434 | * X 1:0d2164f0ce0d |
|
435 | 435 | Y 3:f6fc62dde3c0 |
|
436 | 436 | Z 1:0d2164f0ce0d |
|
437 | 437 | |
|
438 | 438 | Update to a successor works |
|
439 | 439 | |
|
440 | 440 | $ hg id --debug -r 3 |
|
441 | 441 | f6fc62dde3c0771e29704af56ba4d8af77abcc2f |
|
442 | 442 | $ hg id --debug -r 4 |
|
443 | 443 | 4efff6d98829d9c824c621afd6e3f01865f5439f |
|
444 | 444 | $ hg id --debug -r 5 |
|
445 | 445 | c922c0139ca03858f655e4a2af4dd02796a63969 tip Y |
|
446 | 446 | $ hg debugobsolete f6fc62dde3c0771e29704af56ba4d8af77abcc2f cccccccccccccccccccccccccccccccccccccccc |
|
447 | 447 | $ hg debugobsolete cccccccccccccccccccccccccccccccccccccccc 4efff6d98829d9c824c621afd6e3f01865f5439f |
|
448 | 448 | $ hg push http://localhost:$HGPORT2/ |
|
449 | 449 | pushing to http://localhost:$HGPORT2/ |
|
450 | 450 | searching for changes |
|
451 | 451 | remote: adding changesets |
|
452 | 452 | remote: adding manifests |
|
453 | 453 | remote: adding file changes |
|
454 | 454 | remote: added 2 changesets with 2 changes to 1 files (+1 heads) |
|
455 | 455 | remote: 2 new obsolescence markers |
|
456 | 456 | updating bookmark Y |
|
457 | 457 | $ hg -R ../a book |
|
458 | 458 | @ 1:0d2164f0ce0d |
|
459 | 459 | * X 1:0d2164f0ce0d |
|
460 | 460 | Y 5:c922c0139ca0 |
|
461 | 461 | Z 1:0d2164f0ce0d |
|
462 | 462 | |
|
463 | 463 | hgweb |
|
464 | 464 | |
|
465 | 465 | $ cat <<EOF > .hg/hgrc |
|
466 | 466 | > [web] |
|
467 | 467 | > push_ssl = false |
|
468 | 468 | > allow_push = * |
|
469 | 469 | > EOF |
|
470 | 470 | |
|
471 | 471 | $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log |
|
472 | 472 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
473 | 473 | $ cd ../a |
|
474 | 474 | |
|
475 | 475 | $ hg debugpushkey http://localhost:$HGPORT/ namespaces |
|
476 | 476 | bookmarks |
|
477 | 477 | namespaces |
|
478 | 478 | obsolete |
|
479 | 479 | phases |
|
480 | 480 | $ hg debugpushkey http://localhost:$HGPORT/ bookmarks |
|
481 | 481 | @ 9b140be1080824d768c5a4691a564088eede71f9 |
|
482 | 482 | X 9b140be1080824d768c5a4691a564088eede71f9 |
|
483 | 483 | Y c922c0139ca03858f655e4a2af4dd02796a63969 |
|
484 | 484 | Z 9b140be1080824d768c5a4691a564088eede71f9 |
|
485 | 485 | foo 0000000000000000000000000000000000000000 |
|
486 | 486 | foobar 9b140be1080824d768c5a4691a564088eede71f9 |
|
487 | 487 | $ hg out -B http://localhost:$HGPORT/ |
|
488 | 488 | comparing with http://localhost:$HGPORT/ |
|
489 | 489 | searching for changed bookmarks |
|
490 | 490 | @ 0d2164f0ce0d |
|
491 | 491 | X 0d2164f0ce0d |
|
492 | 492 | Z 0d2164f0ce0d |
|
493 | 493 | foo |
|
494 | 494 | foobar |
|
495 | 495 | $ hg push -B Z http://localhost:$HGPORT/ |
|
496 | 496 | pushing to http://localhost:$HGPORT/ |
|
497 | 497 | searching for changes |
|
498 | 498 | no changes found |
|
499 | 499 | updating bookmark Z |
|
500 | 500 | [1] |
|
501 | 501 | $ hg book -d Z |
|
502 | 502 | $ hg in -B http://localhost:$HGPORT/ |
|
503 | 503 | comparing with http://localhost:$HGPORT/ |
|
504 | 504 | searching for changed bookmarks |
|
505 | 505 | @ 9b140be10808 |
|
506 | 506 | X 9b140be10808 |
|
507 | 507 | Z 0d2164f0ce0d |
|
508 | 508 | foo 000000000000 |
|
509 | 509 | foobar 9b140be10808 |
|
510 | 510 | $ hg pull -B Z http://localhost:$HGPORT/ |
|
511 | 511 | pulling from http://localhost:$HGPORT/ |
|
512 | 512 | no changes found |
|
513 | 513 | divergent bookmark @ stored as @1 |
|
514 | 514 | divergent bookmark X stored as X@1 |
|
515 | 515 | adding remote bookmark Z |
|
516 | 516 | adding remote bookmark foo |
|
517 | 517 | adding remote bookmark foobar |
|
518 | 518 | $ hg clone http://localhost:$HGPORT/ cloned-bookmarks |
|
519 | 519 | requesting all changes |
|
520 | 520 | adding changesets |
|
521 | 521 | adding manifests |
|
522 | 522 | adding file changes |
|
523 | 523 | added 5 changesets with 5 changes to 3 files (+2 heads) |
|
524 | 524 | 2 new obsolescence markers |
|
525 | 525 | updating to bookmark @ |
|
526 | 526 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
527 | 527 | $ hg -R cloned-bookmarks bookmarks |
|
528 | 528 | * @ 1:9b140be10808 |
|
529 | 529 | X 1:9b140be10808 |
|
530 | 530 | Y 4:c922c0139ca0 |
|
531 | 531 | Z 2:0d2164f0ce0d |
|
532 | 532 | foo -1:000000000000 |
|
533 | 533 | foobar 1:9b140be10808 |
|
534 | 534 | |
|
535 | 535 | $ cd .. |
|
536 | 536 | |
|
537 | 537 | Test to show result of bookmarks comparision |
|
538 | 538 | |
|
539 | 539 | $ mkdir bmcomparison |
|
540 | 540 | $ cd bmcomparison |
|
541 | 541 | |
|
542 | 542 | $ hg init source |
|
543 | 543 | $ hg -R source debugbuilddag '+2*2*3*4' |
|
544 | 544 | $ hg -R source log -G --template '{rev}:{node|short}' |
|
545 | 545 | o 4:e7bd5218ca15 |
|
546 | 546 | | |
|
547 | 547 | | o 3:6100d3090acf |
|
548 | 548 | |/ |
|
549 | 549 | | o 2:fa942426a6fd |
|
550 | 550 | |/ |
|
551 | 551 | | o 1:66f7d451a68b |
|
552 | 552 | |/ |
|
553 | 553 | o 0:1ea73414a91b |
|
554 | 554 | |
|
555 | 555 | $ hg -R source bookmarks -r 0 SAME |
|
556 | 556 | $ hg -R source bookmarks -r 0 ADV_ON_REPO1 |
|
557 | 557 | $ hg -R source bookmarks -r 0 ADV_ON_REPO2 |
|
558 | 558 | $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO1 |
|
559 | 559 | $ hg -R source bookmarks -r 0 DIFF_ADV_ON_REPO2 |
|
560 | 560 | $ hg -R source bookmarks -r 1 DIVERGED |
|
561 | 561 | |
|
562 | 562 | $ hg clone -U source repo1 |
|
563 | 563 | |
|
564 | 564 | (test that incoming/outgoing exit with 1, if there is no bookmark to |
|
565 | 565 | be exchanged) |
|
566 | 566 | |
|
567 | 567 | $ hg -R repo1 incoming -B |
|
568 | 568 | comparing with $TESTTMP/bmcomparison/source |
|
569 | 569 | searching for changed bookmarks |
|
570 | 570 | no changed bookmarks found |
|
571 | 571 | [1] |
|
572 | 572 | $ hg -R repo1 outgoing -B |
|
573 | 573 | comparing with $TESTTMP/bmcomparison/source |
|
574 | 574 | searching for changed bookmarks |
|
575 | 575 | no changed bookmarks found |
|
576 | 576 | [1] |
|
577 | 577 | |
|
578 | 578 | $ hg -R repo1 bookmarks -f -r 1 ADD_ON_REPO1 |
|
579 | 579 | $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1 |
|
580 | 580 | $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1 |
|
581 | 581 | $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED |
|
582 | 582 | $ hg -R repo1 -q --config extensions.mq= strip 4 |
|
583 | 583 | $ hg -R repo1 log -G --template '{node|short} ({bookmarks})' |
|
584 | 584 | o 6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED) |
|
585 | 585 | | |
|
586 | 586 | | o fa942426a6fd (ADV_ON_REPO1) |
|
587 | 587 | |/ |
|
588 | 588 | | o 66f7d451a68b (ADD_ON_REPO1 DIVERGED) |
|
589 | 589 | |/ |
|
590 | 590 | o 1ea73414a91b (ADV_ON_REPO2 DIFF_ADV_ON_REPO2 SAME) |
|
591 | 591 | |
|
592 | 592 | |
|
593 | 593 | $ hg clone -U source repo2 |
|
594 | 594 | $ hg -R repo2 bookmarks -f -r 1 ADD_ON_REPO2 |
|
595 | 595 | $ hg -R repo2 bookmarks -f -r 1 ADV_ON_REPO2 |
|
596 | 596 | $ hg -R repo2 bookmarks -f -r 2 DIVERGED |
|
597 | 597 | $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2 |
|
598 | 598 | $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED |
|
599 | 599 | $ hg -R repo2 -q --config extensions.mq= strip 3 |
|
600 | 600 | $ hg -R repo2 log -G --template '{node|short} ({bookmarks})' |
|
601 | 601 | o e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED) |
|
602 | 602 | | |
|
603 | 603 | | o fa942426a6fd (DIVERGED) |
|
604 | 604 | |/ |
|
605 | 605 | | o 66f7d451a68b (ADD_ON_REPO2 ADV_ON_REPO2) |
|
606 | 606 | |/ |
|
607 | 607 | o 1ea73414a91b (ADV_ON_REPO1 DIFF_ADV_ON_REPO1 SAME) |
|
608 | 608 | |
|
609 | 609 | |
|
610 | 610 | (test that difference of bookmarks between repositories are fully shown) |
|
611 | 611 | |
|
612 | 612 | $ hg -R repo1 incoming -B repo2 -v |
|
613 | 613 | comparing with repo2 |
|
614 | 614 | searching for changed bookmarks |
|
615 | 615 | ADD_ON_REPO2 66f7d451a68b added |
|
616 | 616 | ADV_ON_REPO2 66f7d451a68b advanced |
|
617 | 617 | DIFF_ADV_ON_REPO2 e7bd5218ca15 changed |
|
618 | 618 | DIFF_DIVERGED e7bd5218ca15 changed |
|
619 | 619 | DIVERGED fa942426a6fd diverged |
|
620 | 620 | $ hg -R repo1 outgoing -B repo2 -v |
|
621 | 621 | comparing with repo2 |
|
622 | 622 | searching for changed bookmarks |
|
623 | 623 | ADD_ON_REPO1 66f7d451a68b added |
|
624 | 624 | ADD_ON_REPO2 deleted |
|
625 | 625 | ADV_ON_REPO1 fa942426a6fd advanced |
|
626 | 626 | DIFF_ADV_ON_REPO1 6100d3090acf advanced |
|
627 | 627 | DIFF_ADV_ON_REPO2 1ea73414a91b changed |
|
628 | 628 | DIFF_DIVERGED 6100d3090acf changed |
|
629 | 629 | DIVERGED 66f7d451a68b diverged |
|
630 | 630 | |
|
631 | 631 | $ hg -R repo2 incoming -B repo1 -v |
|
632 | 632 | comparing with repo1 |
|
633 | 633 | searching for changed bookmarks |
|
634 | 634 | ADD_ON_REPO1 66f7d451a68b added |
|
635 | 635 | ADV_ON_REPO1 fa942426a6fd advanced |
|
636 | 636 | DIFF_ADV_ON_REPO1 6100d3090acf changed |
|
637 | 637 | DIFF_DIVERGED 6100d3090acf changed |
|
638 | 638 | DIVERGED 66f7d451a68b diverged |
|
639 | 639 | $ hg -R repo2 outgoing -B repo1 -v |
|
640 | 640 | comparing with repo1 |
|
641 | 641 | searching for changed bookmarks |
|
642 | 642 | ADD_ON_REPO1 deleted |
|
643 | 643 | ADD_ON_REPO2 66f7d451a68b added |
|
644 | 644 | ADV_ON_REPO2 66f7d451a68b advanced |
|
645 | 645 | DIFF_ADV_ON_REPO1 1ea73414a91b changed |
|
646 | 646 | DIFF_ADV_ON_REPO2 e7bd5218ca15 advanced |
|
647 | 647 | DIFF_DIVERGED e7bd5218ca15 changed |
|
648 | 648 | DIVERGED fa942426a6fd diverged |
|
649 | 649 | |
|
650 | 650 | $ cd .. |
|
651 | 651 | |
|
652 | 652 | Pushing a bookmark should only push the changes required by that |
|
653 | 653 | bookmark, not all outgoing changes: |
|
654 | 654 | $ hg clone http://localhost:$HGPORT/ addmarks |
|
655 | 655 | requesting all changes |
|
656 | 656 | adding changesets |
|
657 | 657 | adding manifests |
|
658 | 658 | adding file changes |
|
659 | 659 | added 5 changesets with 5 changes to 3 files (+2 heads) |
|
660 | 660 | 2 new obsolescence markers |
|
661 | 661 | updating to bookmark @ |
|
662 | 662 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
663 | 663 | $ cd addmarks |
|
664 | 664 | $ echo foo > foo |
|
665 | 665 | $ hg add foo |
|
666 | 666 | $ hg commit -m 'add foo' |
|
667 | 667 | $ echo bar > bar |
|
668 | 668 | $ hg add bar |
|
669 | 669 | $ hg commit -m 'add bar' |
|
670 | 670 | $ hg co "tip^" |
|
671 | 671 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
672 | 672 | (leaving bookmark @) |
|
673 | 673 | $ hg book add-foo |
|
674 | 674 | $ hg book -r tip add-bar |
|
675 | 675 | Note: this push *must* push only a single changeset, as that's the point |
|
676 | 676 | of this test. |
|
677 | 677 | $ hg push -B add-foo --traceback |
|
678 | 678 | pushing to http://localhost:$HGPORT/ |
|
679 | 679 | searching for changes |
|
680 | 680 | remote: adding changesets |
|
681 | 681 | remote: adding manifests |
|
682 | 682 | remote: adding file changes |
|
683 | 683 | remote: added 1 changesets with 1 changes to 1 files |
|
684 | 684 | exporting bookmark add-foo |
|
685 | 685 | |
|
686 | 686 | pushing a new bookmark on a new head does not require -f if -B is specified |
|
687 | 687 | |
|
688 | 688 | $ hg up -q X |
|
689 | 689 | $ hg book W |
|
690 | 690 | $ echo c5 > f2 |
|
691 | 691 | $ hg ci -Am5 |
|
692 | 692 | created new head |
|
693 |
$ hg push -B |
|
|
693 | $ hg push -B . | |
|
694 | 694 | pushing to http://localhost:$HGPORT/ |
|
695 | 695 | searching for changes |
|
696 | 696 | remote: adding changesets |
|
697 | 697 | remote: adding manifests |
|
698 | 698 | remote: adding file changes |
|
699 | 699 | remote: added 1 changesets with 1 changes to 1 files (+1 heads) |
|
700 | 700 | exporting bookmark W |
|
701 | 701 | $ hg -R ../b id -r W |
|
702 | 702 | cc978a373a53 tip W |
|
703 | 703 | |
|
704 | 704 | pushing an existing but divergent bookmark with -B still requires -f |
|
705 | 705 | |
|
706 | 706 | $ hg clone -q . ../r |
|
707 | 707 | $ hg up -q X |
|
708 | 708 | $ echo 1 > f2 |
|
709 | 709 | $ hg ci -qAml |
|
710 | 710 | |
|
711 | 711 | $ cd ../r |
|
712 | 712 | $ hg up -q X |
|
713 | 713 | $ echo 2 > f2 |
|
714 | 714 | $ hg ci -qAmr |
|
715 | 715 | $ hg push -B X |
|
716 | 716 | pushing to $TESTTMP/addmarks (glob) |
|
717 | 717 | searching for changes |
|
718 | 718 | remote has heads on branch 'default' that are not known locally: a2a606d9ff1b |
|
719 | 719 | abort: push creates new remote head 54694f811df9 with bookmark 'X'! |
|
720 | 720 | (pull and merge or see "hg help push" for details about pushing new heads) |
|
721 | 721 | [255] |
|
722 | 722 | $ cd ../addmarks |
|
723 | 723 | |
|
724 | 724 | Check summary output for incoming/outgoing bookmarks |
|
725 | 725 | |
|
726 | 726 | $ hg bookmarks -d X |
|
727 | 727 | $ hg bookmarks -d Y |
|
728 | 728 | $ hg summary --remote | grep '^remote:' |
|
729 | 729 | remote: *, 2 incoming bookmarks, 1 outgoing bookmarks (glob) |
|
730 | 730 | |
|
731 | 731 | $ cd .. |
|
732 | 732 | |
|
733 | 733 | pushing an unchanged bookmark should result in no changes |
|
734 | 734 | |
|
735 | 735 | $ hg init unchanged-a |
|
736 | 736 | $ hg init unchanged-b |
|
737 | 737 | $ cd unchanged-a |
|
738 | 738 | $ echo initial > foo |
|
739 | 739 | $ hg commit -A -m initial |
|
740 | 740 | adding foo |
|
741 | 741 | $ hg bookmark @ |
|
742 | 742 | $ hg push -B @ ../unchanged-b |
|
743 | 743 | pushing to ../unchanged-b |
|
744 | 744 | searching for changes |
|
745 | 745 | adding changesets |
|
746 | 746 | adding manifests |
|
747 | 747 | adding file changes |
|
748 | 748 | added 1 changesets with 1 changes to 1 files |
|
749 | 749 | exporting bookmark @ |
|
750 | 750 | |
|
751 | 751 | $ hg push -B @ ../unchanged-b |
|
752 | 752 | pushing to ../unchanged-b |
|
753 | 753 | searching for changes |
|
754 | 754 | no changes found |
|
755 | 755 | [1] |
|
756 | 756 | |
|
757 | 757 | |
|
758 | 758 | Check hook preventing push (issue4455) |
|
759 | 759 | ====================================== |
|
760 | 760 | |
|
761 | 761 | $ hg bookmarks |
|
762 | 762 | * @ 0:55482a6fb4b1 |
|
763 | 763 | $ hg log -G |
|
764 | 764 | @ 0:55482a6fb4b1 initial |
|
765 | 765 | |
|
766 | 766 | $ hg init ../issue4455-dest |
|
767 | 767 | $ hg push ../issue4455-dest # changesets only |
|
768 | 768 | pushing to ../issue4455-dest |
|
769 | 769 | searching for changes |
|
770 | 770 | adding changesets |
|
771 | 771 | adding manifests |
|
772 | 772 | adding file changes |
|
773 | 773 | added 1 changesets with 1 changes to 1 files |
|
774 | 774 | $ cat >> .hg/hgrc << EOF |
|
775 | 775 | > [paths] |
|
776 | 776 | > local=../issue4455-dest/ |
|
777 | 777 | > ssh=ssh://user@dummy/issue4455-dest |
|
778 | 778 | > http=http://localhost:$HGPORT/ |
|
779 | 779 | > [ui] |
|
780 | 780 | > ssh=python "$TESTDIR/dummyssh" |
|
781 | 781 | > EOF |
|
782 | 782 | $ cat >> ../issue4455-dest/.hg/hgrc << EOF |
|
783 | 783 | > [hooks] |
|
784 | 784 | > prepushkey=false |
|
785 | 785 | > [web] |
|
786 | 786 | > push_ssl = false |
|
787 | 787 | > allow_push = * |
|
788 | 788 | > EOF |
|
789 | 789 | $ killdaemons.py |
|
790 | 790 | $ hg serve -R ../issue4455-dest -p $HGPORT -d --pid-file=../issue4455.pid -E ../issue4455-error.log |
|
791 | 791 | $ cat ../issue4455.pid >> $DAEMON_PIDS |
|
792 | 792 | |
|
793 | 793 | Local push |
|
794 | 794 | ---------- |
|
795 | 795 | |
|
796 | 796 | $ hg push -B @ local |
|
797 | 797 | pushing to $TESTTMP/issue4455-dest (glob) |
|
798 | 798 | searching for changes |
|
799 | 799 | no changes found |
|
800 | 800 | pushkey-abort: prepushkey hook exited with status 1 |
|
801 | 801 | abort: exporting bookmark @ failed! |
|
802 | 802 | [255] |
|
803 | 803 | $ hg -R ../issue4455-dest/ bookmarks |
|
804 | 804 | no bookmarks set |
|
805 | 805 | |
|
806 | 806 | Using ssh |
|
807 | 807 | --------- |
|
808 | 808 | |
|
809 | 809 | $ hg push -B @ ssh --config experimental.bundle2-exp=True |
|
810 | 810 | pushing to ssh://user@dummy/issue4455-dest |
|
811 | 811 | searching for changes |
|
812 | 812 | no changes found |
|
813 | 813 | remote: pushkey-abort: prepushkey hook exited with status 1 |
|
814 | 814 | abort: exporting bookmark @ failed! |
|
815 | 815 | [255] |
|
816 | 816 | $ hg -R ../issue4455-dest/ bookmarks |
|
817 | 817 | no bookmarks set |
|
818 | 818 | |
|
819 | 819 | $ hg push -B @ ssh --config experimental.bundle2-exp=False |
|
820 | 820 | pushing to ssh://user@dummy/issue4455-dest |
|
821 | 821 | searching for changes |
|
822 | 822 | no changes found |
|
823 | 823 | remote: pushkey-abort: prepushkey hook exited with status 1 |
|
824 | 824 | exporting bookmark @ failed! |
|
825 | 825 | [1] |
|
826 | 826 | $ hg -R ../issue4455-dest/ bookmarks |
|
827 | 827 | no bookmarks set |
|
828 | 828 | |
|
829 | 829 | Using http |
|
830 | 830 | ---------- |
|
831 | 831 | |
|
832 | 832 | $ hg push -B @ http --config experimental.bundle2-exp=True |
|
833 | 833 | pushing to http://localhost:$HGPORT/ |
|
834 | 834 | searching for changes |
|
835 | 835 | no changes found |
|
836 | 836 | remote: pushkey-abort: prepushkey hook exited with status 1 |
|
837 | 837 | abort: exporting bookmark @ failed! |
|
838 | 838 | [255] |
|
839 | 839 | $ hg -R ../issue4455-dest/ bookmarks |
|
840 | 840 | no bookmarks set |
|
841 | 841 | |
|
842 | 842 | $ hg push -B @ http --config experimental.bundle2-exp=False |
|
843 | 843 | pushing to http://localhost:$HGPORT/ |
|
844 | 844 | searching for changes |
|
845 | 845 | no changes found |
|
846 | 846 | remote: pushkey-abort: prepushkey hook exited with status 1 |
|
847 | 847 | exporting bookmark @ failed! |
|
848 | 848 | [1] |
|
849 | 849 | $ hg -R ../issue4455-dest/ bookmarks |
|
850 | 850 | no bookmarks set |
General Comments 0
You need to be logged in to leave comments.
Login now