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