Show More
@@ -1,358 +1,362 | |||||
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 node import nullid, short |
|
8 | from node import nullid, short | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import util, setdiscovery, treediscovery, phases, obsolete, bookmarks |
|
10 | import util, setdiscovery, treediscovery, phases, obsolete, bookmarks | |
11 | import branchmap |
|
11 | import branchmap | |
12 |
|
12 | |||
13 | def findcommonincoming(repo, remote, heads=None, force=False): |
|
13 | def findcommonincoming(repo, remote, heads=None, force=False): | |
14 | """Return a tuple (common, anyincoming, heads) used to identify the common |
|
14 | """Return a tuple (common, anyincoming, heads) used to identify the common | |
15 | subset of nodes between repo and remote. |
|
15 | subset of nodes between repo and remote. | |
16 |
|
16 | |||
17 | "common" is a list of (at least) the heads of the common subset. |
|
17 | "common" is a list of (at least) the heads of the common subset. | |
18 | "anyincoming" is testable as a boolean indicating if any nodes are missing |
|
18 | "anyincoming" is testable as a boolean indicating if any nodes are missing | |
19 | locally. If remote does not support getbundle, this actually is a list of |
|
19 | locally. If remote does not support getbundle, this actually is a list of | |
20 | roots of the nodes that would be incoming, to be supplied to |
|
20 | roots of the nodes that would be incoming, to be supplied to | |
21 | changegroupsubset. No code except for pull should be relying on this fact |
|
21 | changegroupsubset. No code except for pull should be relying on this fact | |
22 | any longer. |
|
22 | any longer. | |
23 | "heads" is either the supplied heads, or else the remote's heads. |
|
23 | "heads" is either the supplied heads, or else the remote's heads. | |
24 |
|
24 | |||
25 | If you pass heads and they are all known locally, the response lists just |
|
25 | If you pass heads and they are all known locally, the response lists just | |
26 | these heads in "common" and in "heads". |
|
26 | these heads in "common" and in "heads". | |
27 |
|
27 | |||
28 | Please use findcommonoutgoing to compute the set of outgoing nodes to give |
|
28 | Please use findcommonoutgoing to compute the set of outgoing nodes to give | |
29 | extensions a good hook into outgoing. |
|
29 | extensions a good hook into outgoing. | |
30 | """ |
|
30 | """ | |
31 |
|
31 | |||
32 | if not remote.capable('getbundle'): |
|
32 | if not remote.capable('getbundle'): | |
33 | return treediscovery.findcommonincoming(repo, remote, heads, force) |
|
33 | return treediscovery.findcommonincoming(repo, remote, heads, force) | |
34 |
|
34 | |||
35 | if heads: |
|
35 | if heads: | |
36 | allknown = True |
|
36 | allknown = True | |
37 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered |
|
37 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered | |
38 | for h in heads: |
|
38 | for h in heads: | |
39 | if not knownnode(h): |
|
39 | if not knownnode(h): | |
40 | allknown = False |
|
40 | allknown = False | |
41 | break |
|
41 | break | |
42 | if allknown: |
|
42 | if allknown: | |
43 | return (heads, False, heads) |
|
43 | return (heads, False, heads) | |
44 |
|
44 | |||
45 | res = setdiscovery.findcommonheads(repo.ui, repo, remote, |
|
45 | res = setdiscovery.findcommonheads(repo.ui, repo, remote, | |
46 | abortwhenunrelated=not force) |
|
46 | abortwhenunrelated=not force) | |
47 | common, anyinc, srvheads = res |
|
47 | common, anyinc, srvheads = res | |
48 | return (list(common), anyinc, heads or list(srvheads)) |
|
48 | return (list(common), anyinc, heads or list(srvheads)) | |
49 |
|
49 | |||
50 | class outgoing(object): |
|
50 | class outgoing(object): | |
51 | '''Represents the set of nodes present in a local repo but not in a |
|
51 | '''Represents the set of nodes present in a local repo but not in a | |
52 | (possibly) remote one. |
|
52 | (possibly) remote one. | |
53 |
|
53 | |||
54 | Members: |
|
54 | Members: | |
55 |
|
55 | |||
56 | missing is a list of all nodes present in local but not in remote. |
|
56 | missing is a list of all nodes present in local but not in remote. | |
57 | common is a list of all nodes shared between the two repos. |
|
57 | common is a list of all nodes shared between the two repos. | |
58 | excluded is the list of missing changeset that shouldn't be sent remotely. |
|
58 | excluded is the list of missing changeset that shouldn't be sent remotely. | |
59 | missingheads is the list of heads of missing. |
|
59 | missingheads is the list of heads of missing. | |
60 | commonheads is the list of heads of common. |
|
60 | commonheads is the list of heads of common. | |
61 |
|
61 | |||
62 | The sets are computed on demand from the heads, unless provided upfront |
|
62 | The sets are computed on demand from the heads, unless provided upfront | |
63 | by discovery.''' |
|
63 | by discovery.''' | |
64 |
|
64 | |||
65 | def __init__(self, revlog, commonheads, missingheads): |
|
65 | def __init__(self, revlog, commonheads, missingheads): | |
66 | self.commonheads = commonheads |
|
66 | self.commonheads = commonheads | |
67 | self.missingheads = missingheads |
|
67 | self.missingheads = missingheads | |
68 | self._revlog = revlog |
|
68 | self._revlog = revlog | |
69 | self._common = None |
|
69 | self._common = None | |
70 | self._missing = None |
|
70 | self._missing = None | |
71 | self.excluded = [] |
|
71 | self.excluded = [] | |
72 |
|
72 | |||
73 | def _computecommonmissing(self): |
|
73 | def _computecommonmissing(self): | |
74 | sets = self._revlog.findcommonmissing(self.commonheads, |
|
74 | sets = self._revlog.findcommonmissing(self.commonheads, | |
75 | self.missingheads) |
|
75 | self.missingheads) | |
76 | self._common, self._missing = sets |
|
76 | self._common, self._missing = sets | |
77 |
|
77 | |||
78 | @util.propertycache |
|
78 | @util.propertycache | |
79 | def common(self): |
|
79 | def common(self): | |
80 | if self._common is None: |
|
80 | if self._common is None: | |
81 | self._computecommonmissing() |
|
81 | self._computecommonmissing() | |
82 | return self._common |
|
82 | return self._common | |
83 |
|
83 | |||
84 | @util.propertycache |
|
84 | @util.propertycache | |
85 | def missing(self): |
|
85 | def missing(self): | |
86 | if self._missing is None: |
|
86 | if self._missing is None: | |
87 | self._computecommonmissing() |
|
87 | self._computecommonmissing() | |
88 | return self._missing |
|
88 | return self._missing | |
89 |
|
89 | |||
90 | def findcommonoutgoing(repo, other, onlyheads=None, force=False, |
|
90 | def findcommonoutgoing(repo, other, onlyheads=None, force=False, | |
91 | commoninc=None, portable=False): |
|
91 | commoninc=None, portable=False): | |
92 | '''Return an outgoing instance to identify the nodes present in repo but |
|
92 | '''Return an outgoing instance to identify the nodes present in repo but | |
93 | not in other. |
|
93 | not in other. | |
94 |
|
94 | |||
95 | If onlyheads is given, only nodes ancestral to nodes in onlyheads |
|
95 | If onlyheads is given, only nodes ancestral to nodes in onlyheads | |
96 | (inclusive) are included. If you already know the local repo's heads, |
|
96 | (inclusive) are included. If you already know the local repo's heads, | |
97 | passing them in onlyheads is faster than letting them be recomputed here. |
|
97 | passing them in onlyheads is faster than letting them be recomputed here. | |
98 |
|
98 | |||
99 | If commoninc is given, it must be the result of a prior call to |
|
99 | If commoninc is given, it must be the result of a prior call to | |
100 | findcommonincoming(repo, other, force) to avoid recomputing it here. |
|
100 | findcommonincoming(repo, other, force) to avoid recomputing it here. | |
101 |
|
101 | |||
102 | If portable is given, compute more conservative common and missingheads, |
|
102 | If portable is given, compute more conservative common and missingheads, | |
103 | to make bundles created from the instance more portable.''' |
|
103 | to make bundles created from the instance more portable.''' | |
104 | # declare an empty outgoing object to be filled later |
|
104 | # declare an empty outgoing object to be filled later | |
105 | og = outgoing(repo.changelog, None, None) |
|
105 | og = outgoing(repo.changelog, None, None) | |
106 |
|
106 | |||
107 | # get common set if not provided |
|
107 | # get common set if not provided | |
108 | if commoninc is None: |
|
108 | if commoninc is None: | |
109 | commoninc = findcommonincoming(repo, other, force=force) |
|
109 | commoninc = findcommonincoming(repo, other, force=force) | |
110 | og.commonheads, _any, _hds = commoninc |
|
110 | og.commonheads, _any, _hds = commoninc | |
111 |
|
111 | |||
112 | # compute outgoing |
|
112 | # compute outgoing | |
113 | mayexclude = (repo._phasecache.phaseroots[phases.secret] or repo.obsstore) |
|
113 | mayexclude = (repo._phasecache.phaseroots[phases.secret] or repo.obsstore) | |
114 | if not mayexclude: |
|
114 | if not mayexclude: | |
115 | og.missingheads = onlyheads or repo.heads() |
|
115 | og.missingheads = onlyheads or repo.heads() | |
116 | elif onlyheads is None: |
|
116 | elif onlyheads is None: | |
117 | # use visible heads as it should be cached |
|
117 | # use visible heads as it should be cached | |
118 | og.missingheads = repo.filtered("served").heads() |
|
118 | og.missingheads = repo.filtered("served").heads() | |
119 | og.excluded = [ctx.node() for ctx in repo.set('secret() or extinct()')] |
|
119 | og.excluded = [ctx.node() for ctx in repo.set('secret() or extinct()')] | |
120 | else: |
|
120 | else: | |
121 | # compute common, missing and exclude secret stuff |
|
121 | # compute common, missing and exclude secret stuff | |
122 | sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads) |
|
122 | sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads) | |
123 | og._common, allmissing = sets |
|
123 | og._common, allmissing = sets | |
124 | og._missing = missing = [] |
|
124 | og._missing = missing = [] | |
125 | og.excluded = excluded = [] |
|
125 | og.excluded = excluded = [] | |
126 | for node in allmissing: |
|
126 | for node in allmissing: | |
127 | ctx = repo[node] |
|
127 | ctx = repo[node] | |
128 | if ctx.phase() >= phases.secret or ctx.extinct(): |
|
128 | if ctx.phase() >= phases.secret or ctx.extinct(): | |
129 | excluded.append(node) |
|
129 | excluded.append(node) | |
130 | else: |
|
130 | else: | |
131 | missing.append(node) |
|
131 | missing.append(node) | |
132 | if len(missing) == len(allmissing): |
|
132 | if len(missing) == len(allmissing): | |
133 | missingheads = onlyheads |
|
133 | missingheads = onlyheads | |
134 | else: # update missing heads |
|
134 | else: # update missing heads | |
135 | missingheads = phases.newheads(repo, onlyheads, excluded) |
|
135 | missingheads = phases.newheads(repo, onlyheads, excluded) | |
136 | og.missingheads = missingheads |
|
136 | og.missingheads = missingheads | |
137 | if portable: |
|
137 | if portable: | |
138 | # recompute common and missingheads as if -r<rev> had been given for |
|
138 | # recompute common and missingheads as if -r<rev> had been given for | |
139 | # each head of missing, and --base <rev> for each head of the proper |
|
139 | # each head of missing, and --base <rev> for each head of the proper | |
140 | # ancestors of missing |
|
140 | # ancestors of missing | |
141 | og._computecommonmissing() |
|
141 | og._computecommonmissing() | |
142 | cl = repo.changelog |
|
142 | cl = repo.changelog | |
143 | missingrevs = set(cl.rev(n) for n in og._missing) |
|
143 | missingrevs = set(cl.rev(n) for n in og._missing) | |
144 | og._common = set(cl.ancestors(missingrevs)) - missingrevs |
|
144 | og._common = set(cl.ancestors(missingrevs)) - missingrevs | |
145 | commonheads = set(og.commonheads) |
|
145 | commonheads = set(og.commonheads) | |
146 | og.missingheads = [h for h in og.missingheads if h not in commonheads] |
|
146 | og.missingheads = [h for h in og.missingheads if h not in commonheads] | |
147 |
|
147 | |||
148 | return og |
|
148 | return og | |
149 |
|
149 | |||
150 | def _headssummary(repo, remote, outgoing): |
|
150 | def _headssummary(repo, remote, outgoing): | |
151 | """compute a summary of branch and heads status before and after push |
|
151 | """compute a summary of branch and heads status before and after push | |
152 |
|
152 | |||
153 | return {'branch': ([remoteheads], [newheads], [unsyncedheads])} mapping |
|
153 | return {'branch': ([remoteheads], [newheads], [unsyncedheads])} mapping | |
154 |
|
154 | |||
155 | - branch: the branch name |
|
155 | - branch: the branch name | |
156 | - remoteheads: the list of remote heads known locally |
|
156 | - remoteheads: the list of remote heads known locally | |
157 | None if the branch is new |
|
157 | None if the branch is new | |
158 | - newheads: the new remote heads (known locally) with outgoing pushed |
|
158 | - newheads: the new remote heads (known locally) with outgoing pushed | |
159 | - unsyncedheads: the list of remote heads unknown locally. |
|
159 | - unsyncedheads: the list of remote heads unknown locally. | |
160 | """ |
|
160 | """ | |
161 | cl = repo.changelog |
|
161 | cl = repo.changelog | |
162 | headssum = {} |
|
162 | headssum = {} | |
163 | # A. Create set of branches involved in the push. |
|
163 | # A. Create set of branches involved in the push. | |
164 | branches = set(repo[n].branch() for n in outgoing.missing) |
|
164 | branches = set(repo[n].branch() for n in outgoing.missing) | |
165 | remotemap = remote.branchmap() |
|
165 | remotemap = remote.branchmap() | |
166 | newbranches = branches - set(remotemap) |
|
166 | newbranches = branches - set(remotemap) | |
167 | branches.difference_update(newbranches) |
|
167 | branches.difference_update(newbranches) | |
168 |
|
168 | |||
169 | # A. register remote heads |
|
169 | # A. register remote heads | |
170 | remotebranches = set() |
|
170 | remotebranches = set() | |
171 | for branch, heads in remote.branchmap().iteritems(): |
|
171 | for branch, heads in remote.branchmap().iteritems(): | |
172 | remotebranches.add(branch) |
|
172 | remotebranches.add(branch) | |
173 | known = [] |
|
173 | known = [] | |
174 | unsynced = [] |
|
174 | unsynced = [] | |
175 | knownnode = cl.hasnode # do not use nodemap until it is filtered |
|
175 | knownnode = cl.hasnode # do not use nodemap until it is filtered | |
176 | for h in heads: |
|
176 | for h in heads: | |
177 | if knownnode(h): |
|
177 | if knownnode(h): | |
178 | known.append(h) |
|
178 | known.append(h) | |
179 | else: |
|
179 | else: | |
180 | unsynced.append(h) |
|
180 | unsynced.append(h) | |
181 | headssum[branch] = (known, list(known), unsynced) |
|
181 | headssum[branch] = (known, list(known), unsynced) | |
182 | # B. add new branch data |
|
182 | # B. add new branch data | |
183 | missingctx = list(repo[n] for n in outgoing.missing) |
|
183 | missingctx = list(repo[n] for n in outgoing.missing) | |
184 | touchedbranches = set() |
|
184 | touchedbranches = set() | |
185 | for ctx in missingctx: |
|
185 | for ctx in missingctx: | |
186 | branch = ctx.branch() |
|
186 | branch = ctx.branch() | |
187 | touchedbranches.add(branch) |
|
187 | touchedbranches.add(branch) | |
188 | if branch not in headssum: |
|
188 | if branch not in headssum: | |
189 | headssum[branch] = (None, [], []) |
|
189 | headssum[branch] = (None, [], []) | |
190 |
|
190 | |||
191 | # C drop data about untouched branches: |
|
191 | # C drop data about untouched branches: | |
192 | for branch in remotebranches - touchedbranches: |
|
192 | for branch in remotebranches - touchedbranches: | |
193 | del headssum[branch] |
|
193 | del headssum[branch] | |
194 |
|
194 | |||
195 | # D. Update newmap with outgoing changes. |
|
195 | # D. Update newmap with outgoing changes. | |
196 | # This will possibly add new heads and remove existing ones. |
|
196 | # This will possibly add new heads and remove existing ones. | |
197 | newmap = branchmap.branchcache((branch, heads[1]) |
|
197 | newmap = branchmap.branchcache((branch, heads[1]) | |
198 | for branch, heads in headssum.iteritems() |
|
198 | for branch, heads in headssum.iteritems() | |
199 | if heads[0] is not None) |
|
199 | if heads[0] is not None) | |
200 | newmap.update(repo, (ctx.rev() for ctx in missingctx)) |
|
200 | newmap.update(repo, (ctx.rev() for ctx in missingctx)) | |
201 | for branch, newheads in newmap.iteritems(): |
|
201 | for branch, newheads in newmap.iteritems(): | |
202 | headssum[branch][1][:] = newheads |
|
202 | headssum[branch][1][:] = newheads | |
203 | return headssum |
|
203 | return headssum | |
204 |
|
204 | |||
205 | def _oldheadssummary(repo, remoteheads, outgoing, inc=False): |
|
205 | def _oldheadssummary(repo, remoteheads, outgoing, inc=False): | |
206 | """Compute branchmapsummary for repo without branchmap support""" |
|
206 | """Compute branchmapsummary for repo without branchmap support""" | |
207 |
|
207 | |||
208 | # 1-4b. old servers: Check for new topological heads. |
|
208 | # 1-4b. old servers: Check for new topological heads. | |
209 | # Construct {old,new}map with branch = None (topological branch). |
|
209 | # Construct {old,new}map with branch = None (topological branch). | |
210 | # (code based on update) |
|
210 | # (code based on update) | |
211 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered |
|
211 | knownnode = repo.changelog.hasnode # no nodemap until it is filtered | |
212 | oldheads = set(h for h in remoteheads if knownnode(h)) |
|
212 | oldheads = set(h for h in remoteheads if knownnode(h)) | |
213 | # all nodes in outgoing.missing are children of either: |
|
213 | # all nodes in outgoing.missing are children of either: | |
214 | # - an element of oldheads |
|
214 | # - an element of oldheads | |
215 | # - another element of outgoing.missing |
|
215 | # - another element of outgoing.missing | |
216 | # - nullrev |
|
216 | # - nullrev | |
217 | # This explains why the new head are very simple to compute. |
|
217 | # This explains why the new head are very simple to compute. | |
218 | r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing) |
|
218 | r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing) | |
219 | newheads = list(c.node() for c in r) |
|
219 | newheads = list(c.node() for c in r) | |
220 | unsynced = inc and set([None]) or set() |
|
220 | unsynced = inc and set([None]) or set() | |
221 | return {None: (oldheads, newheads, unsynced)} |
|
221 | return {None: (oldheads, newheads, unsynced)} | |
222 |
|
222 | |||
223 | def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False, |
|
223 | def checkheads(repo, remote, outgoing, remoteheads, newbranch=False, inc=False, | |
224 | newbookmarks=[]): |
|
224 | newbookmarks=[]): | |
225 | """Check that a push won't add any outgoing head |
|
225 | """Check that a push won't add any outgoing head | |
226 |
|
226 | |||
227 | raise Abort error and display ui message as needed. |
|
227 | raise Abort error and display ui message as needed. | |
228 | """ |
|
228 | """ | |
229 | # Check for each named branch if we're creating new remote heads. |
|
229 | # Check for each named branch if we're creating new remote heads. | |
230 | # To be a remote head after push, node must be either: |
|
230 | # To be a remote head after push, node must be either: | |
231 | # - unknown locally |
|
231 | # - unknown locally | |
232 | # - a local outgoing head descended from update |
|
232 | # - a local outgoing head descended from update | |
233 | # - a remote head that's known locally and not |
|
233 | # - a remote head that's known locally and not | |
234 | # ancestral to an outgoing head |
|
234 | # ancestral to an outgoing head | |
235 | if remoteheads == [nullid]: |
|
235 | if remoteheads == [nullid]: | |
236 | # remote is empty, nothing to check. |
|
236 | # remote is empty, nothing to check. | |
237 | return |
|
237 | return | |
238 |
|
238 | |||
239 | if remote.capable('branchmap'): |
|
239 | if remote.capable('branchmap'): | |
240 | headssum = _headssummary(repo, remote, outgoing) |
|
240 | headssum = _headssummary(repo, remote, outgoing) | |
241 | else: |
|
241 | else: | |
242 | headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) |
|
242 | headssum = _oldheadssummary(repo, remoteheads, outgoing, inc) | |
243 | newbranches = [branch for branch, heads in headssum.iteritems() |
|
243 | newbranches = [branch for branch, heads in headssum.iteritems() | |
244 | if heads[0] is None] |
|
244 | if heads[0] is None] | |
245 | # 1. Check for new branches on the remote. |
|
245 | # 1. Check for new branches on the remote. | |
246 | if newbranches and not newbranch: # new branch requires --new-branch |
|
246 | if newbranches and not newbranch: # new branch requires --new-branch | |
247 | branchnames = ', '.join(sorted(newbranches)) |
|
247 | branchnames = ', '.join(sorted(newbranches)) | |
248 | raise util.Abort(_("push creates new remote branches: %s!") |
|
248 | raise util.Abort(_("push creates new remote branches: %s!") | |
249 | % branchnames, |
|
249 | % branchnames, | |
250 | hint=_("use 'hg push --new-branch' to create" |
|
250 | hint=_("use 'hg push --new-branch' to create" | |
251 | " new remote branches")) |
|
251 | " new remote branches")) | |
252 |
|
252 | |||
253 | # 2. Compute newly pushed bookmarks. We don't warn about bookmarked heads. |
|
253 | # 2. Compute newly pushed bookmarks. We don't warn about bookmarked heads. | |
254 | localbookmarks = repo._bookmarks |
|
254 | localbookmarks = repo._bookmarks | |
255 | remotebookmarks = remote.listkeys('bookmarks') |
|
255 | remotebookmarks = remote.listkeys('bookmarks') | |
256 | bookmarkedheads = set() |
|
256 | bookmarkedheads = set() | |
257 | for bm in localbookmarks: |
|
257 | for bm in localbookmarks: | |
258 | rnode = remotebookmarks.get(bm) |
|
258 | rnode = remotebookmarks.get(bm) | |
259 | if rnode and rnode in repo: |
|
259 | if rnode and rnode in repo: | |
260 | lctx, rctx = repo[bm], repo[rnode] |
|
260 | lctx, rctx = repo[bm], repo[rnode] | |
261 | if bookmarks.validdest(repo, rctx, lctx): |
|
261 | if bookmarks.validdest(repo, rctx, lctx): | |
262 | bookmarkedheads.add(lctx.node()) |
|
262 | bookmarkedheads.add(lctx.node()) | |
263 | else: |
|
263 | else: | |
264 | if bm in newbookmarks: |
|
264 | if bm in newbookmarks: | |
265 | bookmarkedheads.add(repo[bm].node()) |
|
265 | bookmarkedheads.add(repo[bm].node()) | |
266 |
|
266 | |||
267 | # 3. Check for new heads. |
|
267 | # 3. Check for new heads. | |
268 | # If there are more heads after the push than before, a suitable |
|
268 | # If there are more heads after the push than before, a suitable | |
269 | # error message, depending on unsynced status, is displayed. |
|
269 | # error message, depending on unsynced status, is displayed. | |
270 | error = None |
|
270 | error = None | |
271 | allmissing = set(outgoing.missing) |
|
271 | allmissing = set(outgoing.missing) | |
272 | allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common)) |
|
272 | allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common)) | |
273 | allfuturecommon.update(allmissing) |
|
273 | allfuturecommon.update(allmissing) | |
274 | for branch, heads in sorted(headssum.iteritems()): |
|
274 | for branch, heads in sorted(headssum.iteritems()): | |
275 | remoteheads, newheads, unsyncedheads = heads |
|
275 | remoteheads, newheads, unsyncedheads = heads | |
276 | candidate_newhs = set(newheads) |
|
276 | candidate_newhs = set(newheads) | |
277 | # add unsynced data |
|
277 | # add unsynced data | |
278 | if remoteheads is None: |
|
278 | if remoteheads is None: | |
279 | oldhs = set() |
|
279 | oldhs = set() | |
280 | else: |
|
280 | else: | |
281 | oldhs = set(remoteheads) |
|
281 | oldhs = set(remoteheads) | |
282 | oldhs.update(unsyncedheads) |
|
282 | oldhs.update(unsyncedheads) | |
283 | candidate_newhs.update(unsyncedheads) |
|
283 | candidate_newhs.update(unsyncedheads) | |
284 | dhs = None # delta heads, the new heads on branch |
|
284 | dhs = None # delta heads, the new heads on branch | |
285 | discardedheads = set() |
|
285 | discardedheads = set() | |
286 | if repo.obsstore: |
|
286 | if repo.obsstore: | |
287 | # remove future heads which are actually obsoleted by another |
|
287 | # remove future heads which are actually obsoleted by another | |
288 | # pushed element: |
|
288 | # pushed element: | |
289 | # |
|
289 | # | |
290 | # XXX as above, There are several cases this case does not handle |
|
290 | # XXX as above, There are several cases this case does not handle | |
291 | # XXX properly |
|
291 | # XXX properly | |
292 | # |
|
292 | # | |
293 | # (1) if <nh> is public, it won't be affected by obsolete marker |
|
293 | # (1) if <nh> is public, it won't be affected by obsolete marker | |
294 | # and a new is created |
|
294 | # and a new is created | |
295 | # |
|
295 | # | |
296 | # (2) if the new heads have ancestors which are not obsolete and |
|
296 | # (2) if the new heads have ancestors which are not obsolete and | |
297 | # not ancestors of any other heads we will have a new head too. |
|
297 | # not ancestors of any other heads we will have a new head too. | |
298 | # |
|
298 | # | |
299 | # These two cases will be easy to handle for known changeset but |
|
299 | # These two cases will be easy to handle for known changeset but | |
300 | # much more tricky for unsynced changes. |
|
300 | # much more tricky for unsynced changes. | |
301 | newhs = set() |
|
301 | newhs = set() | |
302 | for nh in candidate_newhs: |
|
302 | for nh in candidate_newhs: | |
303 | if nh in repo and repo[nh].phase() <= phases.public: |
|
303 | if nh in repo and repo[nh].phase() <= phases.public: | |
304 | newhs.add(nh) |
|
304 | newhs.add(nh) | |
305 | else: |
|
305 | else: | |
306 | for suc in obsolete.allsuccessors(repo.obsstore, [nh]): |
|
306 | for suc in obsolete.allsuccessors(repo.obsstore, [nh]): | |
307 | if suc != nh and suc in allfuturecommon: |
|
307 | if suc != nh and suc in allfuturecommon: | |
308 | discardedheads.add(nh) |
|
308 | discardedheads.add(nh) | |
309 | break |
|
309 | break | |
310 | else: |
|
310 | else: | |
311 | newhs.add(nh) |
|
311 | newhs.add(nh) | |
312 | else: |
|
312 | else: | |
313 | newhs = candidate_newhs |
|
313 | newhs = candidate_newhs | |
314 | unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) |
|
314 | unsynced = sorted(h for h in unsyncedheads if h not in discardedheads) | |
315 | if unsynced: |
|
315 | if unsynced: | |
316 | heads = ' '.join(short(h) for h in unsynced) |
|
316 | if len(unsynced) <= 4 or repo.ui.verbose: | |
|
317 | heads = ' '.join(short(h) for h in unsynced) | |||
|
318 | else: | |||
|
319 | heads = (' '.join(short(h) for h in unsynced[:4]) + | |||
|
320 | ' ' + _("and %s others") % (len(unsynced) - 4)) | |||
317 | if branch is None: |
|
321 | if branch is None: | |
318 | repo.ui.status(_("remote has heads that are " |
|
322 | repo.ui.status(_("remote has heads that are " | |
319 | "not known locally: %s\n") % heads) |
|
323 | "not known locally: %s\n") % heads) | |
320 | else: |
|
324 | else: | |
321 | repo.ui.status(_("remote has heads on branch '%s' that are " |
|
325 | repo.ui.status(_("remote has heads on branch '%s' that are " | |
322 | "not known locally: %s\n") % (branch, heads)) |
|
326 | "not known locally: %s\n") % (branch, heads)) | |
323 | if remoteheads is None: |
|
327 | if remoteheads is None: | |
324 | if len(newhs) > 1: |
|
328 | if len(newhs) > 1: | |
325 | dhs = list(newhs) |
|
329 | dhs = list(newhs) | |
326 | if error is None: |
|
330 | if error is None: | |
327 | error = (_("push creates new branch '%s' " |
|
331 | error = (_("push creates new branch '%s' " | |
328 | "with multiple heads") % (branch)) |
|
332 | "with multiple heads") % (branch)) | |
329 | hint = _("merge or" |
|
333 | hint = _("merge or" | |
330 | " see \"hg help push\" for details about" |
|
334 | " see \"hg help push\" for details about" | |
331 | " pushing new heads") |
|
335 | " pushing new heads") | |
332 | elif len(newhs) > len(oldhs): |
|
336 | elif len(newhs) > len(oldhs): | |
333 | # remove bookmarked or existing remote heads from the new heads list |
|
337 | # remove bookmarked or existing remote heads from the new heads list | |
334 | dhs = sorted(newhs - bookmarkedheads - oldhs) |
|
338 | dhs = sorted(newhs - bookmarkedheads - oldhs) | |
335 | if dhs: |
|
339 | if dhs: | |
336 | if error is None: |
|
340 | if error is None: | |
337 | if branch not in ('default', None): |
|
341 | if branch not in ('default', None): | |
338 | error = _("push creates new remote head %s " |
|
342 | error = _("push creates new remote head %s " | |
339 | "on branch '%s'!") % (short(dhs[0]), branch) |
|
343 | "on branch '%s'!") % (short(dhs[0]), branch) | |
340 | else: |
|
344 | else: | |
341 | error = _("push creates new remote head %s!" |
|
345 | error = _("push creates new remote head %s!" | |
342 | ) % short(dhs[0]) |
|
346 | ) % short(dhs[0]) | |
343 | if unsyncedheads: |
|
347 | if unsyncedheads: | |
344 | hint = _("pull and merge or" |
|
348 | hint = _("pull and merge or" | |
345 | " see \"hg help push\" for details about" |
|
349 | " see \"hg help push\" for details about" | |
346 | " pushing new heads") |
|
350 | " pushing new heads") | |
347 | else: |
|
351 | else: | |
348 | hint = _("merge or" |
|
352 | hint = _("merge or" | |
349 | " see \"hg help push\" for details about" |
|
353 | " see \"hg help push\" for details about" | |
350 | " pushing new heads") |
|
354 | " pushing new heads") | |
351 | if branch is None: |
|
355 | if branch is None: | |
352 | repo.ui.note(_("new remote heads:\n")) |
|
356 | repo.ui.note(_("new remote heads:\n")) | |
353 | else: |
|
357 | else: | |
354 | repo.ui.note(_("new remote heads on branch '%s':\n") % branch) |
|
358 | repo.ui.note(_("new remote heads on branch '%s':\n") % branch) | |
355 | for h in dhs: |
|
359 | for h in dhs: | |
356 | repo.ui.note((" %s\n") % short(h)) |
|
360 | repo.ui.note((" %s\n") % short(h)) | |
357 | if error: |
|
361 | if error: | |
358 | raise util.Abort(error, hint=hint) |
|
362 | raise util.Abort(error, hint=hint) |
@@ -1,755 +1,774 | |||||
1 | $ hg init a |
|
1 | $ hg init a | |
2 | $ cd a |
|
2 | $ cd a | |
3 | $ echo foo > t1 |
|
3 | $ echo foo > t1 | |
4 | $ hg add t1 |
|
4 | $ hg add t1 | |
5 | $ hg commit -m "1" |
|
5 | $ hg commit -m "1" | |
6 |
|
6 | |||
7 | $ cd .. |
|
7 | $ cd .. | |
8 | $ hg clone a b |
|
8 | $ hg clone a b | |
9 | updating to branch default |
|
9 | updating to branch default | |
10 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
10 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
11 |
|
11 | |||
12 | $ cd a |
|
12 | $ cd a | |
13 | $ echo foo > t2 |
|
13 | $ echo foo > t2 | |
14 | $ hg add t2 |
|
14 | $ hg add t2 | |
15 | $ hg commit -m "2" |
|
15 | $ hg commit -m "2" | |
16 |
|
16 | |||
17 | $ cd ../b |
|
17 | $ cd ../b | |
18 | $ echo foo > t3 |
|
18 | $ echo foo > t3 | |
19 | $ hg add t3 |
|
19 | $ hg add t3 | |
20 | $ hg commit -m "3" |
|
20 | $ hg commit -m "3" | |
21 |
|
21 | |||
22 | $ hg push ../a |
|
22 | $ hg push ../a | |
23 | pushing to ../a |
|
23 | pushing to ../a | |
24 | searching for changes |
|
24 | searching for changes | |
25 | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a |
|
25 | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | |
26 | abort: push creates new remote head 1e108cc5548c! |
|
26 | abort: push creates new remote head 1e108cc5548c! | |
27 | (pull and merge or see "hg help push" for details about pushing new heads) |
|
27 | (pull and merge or see "hg help push" for details about pushing new heads) | |
28 | [255] |
|
28 | [255] | |
29 |
|
29 | |||
30 | $ hg push --debug ../a |
|
30 | $ hg push --debug ../a | |
31 | pushing to ../a |
|
31 | pushing to ../a | |
32 | query 1; heads |
|
32 | query 1; heads | |
33 | searching for changes |
|
33 | searching for changes | |
34 | taking quick initial sample |
|
34 | taking quick initial sample | |
35 | searching: 2 queries |
|
35 | searching: 2 queries | |
36 | query 2; still undecided: 1, sample size is: 1 |
|
36 | query 2; still undecided: 1, sample size is: 1 | |
37 | 2 total queries |
|
37 | 2 total queries | |
38 | listing keys for "bookmarks" |
|
38 | listing keys for "bookmarks" | |
39 | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a |
|
39 | remote has heads on branch 'default' that are not known locally: 1c9246a22a0a | |
40 | new remote heads on branch 'default': |
|
40 | new remote heads on branch 'default': | |
41 | 1e108cc5548c |
|
41 | 1e108cc5548c | |
42 | abort: push creates new remote head 1e108cc5548c! |
|
42 | abort: push creates new remote head 1e108cc5548c! | |
43 | (pull and merge or see "hg help push" for details about pushing new heads) |
|
43 | (pull and merge or see "hg help push" for details about pushing new heads) | |
44 | [255] |
|
44 | [255] | |
45 |
|
45 | |||
46 | $ hg pull ../a |
|
46 | $ hg pull ../a | |
47 | pulling from ../a |
|
47 | pulling from ../a | |
48 | searching for changes |
|
48 | searching for changes | |
49 | adding changesets |
|
49 | adding changesets | |
50 | adding manifests |
|
50 | adding manifests | |
51 | adding file changes |
|
51 | adding file changes | |
52 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
52 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
53 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
53 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
54 |
|
54 | |||
55 | $ hg push ../a |
|
55 | $ hg push ../a | |
56 | pushing to ../a |
|
56 | pushing to ../a | |
57 | searching for changes |
|
57 | searching for changes | |
58 | abort: push creates new remote head 1e108cc5548c! |
|
58 | abort: push creates new remote head 1e108cc5548c! | |
59 | (merge or see "hg help push" for details about pushing new heads) |
|
59 | (merge or see "hg help push" for details about pushing new heads) | |
60 | [255] |
|
60 | [255] | |
61 |
|
61 | |||
62 | $ hg merge |
|
62 | $ hg merge | |
63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
64 | (branch merge, don't forget to commit) |
|
64 | (branch merge, don't forget to commit) | |
65 |
|
65 | |||
66 | $ hg commit -m "4" |
|
66 | $ hg commit -m "4" | |
67 | $ hg push ../a |
|
67 | $ hg push ../a | |
68 | pushing to ../a |
|
68 | pushing to ../a | |
69 | searching for changes |
|
69 | searching for changes | |
70 | adding changesets |
|
70 | adding changesets | |
71 | adding manifests |
|
71 | adding manifests | |
72 | adding file changes |
|
72 | adding file changes | |
73 | added 2 changesets with 1 changes to 1 files |
|
73 | added 2 changesets with 1 changes to 1 files | |
74 |
|
74 | |||
75 | $ cd .. |
|
75 | $ cd .. | |
76 |
|
76 | |||
77 | $ hg init c |
|
77 | $ hg init c | |
78 | $ cd c |
|
78 | $ cd c | |
79 | $ for i in 0 1 2; do |
|
79 | $ for i in 0 1 2; do | |
80 | > echo $i >> foo |
|
80 | > echo $i >> foo | |
81 | > hg ci -Am $i |
|
81 | > hg ci -Am $i | |
82 | > done |
|
82 | > done | |
83 | adding foo |
|
83 | adding foo | |
84 | $ cd .. |
|
84 | $ cd .. | |
85 |
|
85 | |||
86 | $ hg clone c d |
|
86 | $ hg clone c d | |
87 | updating to branch default |
|
87 | updating to branch default | |
88 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
88 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
89 |
|
89 | |||
90 | $ cd d |
|
90 | $ cd d | |
91 | $ for i in 0 1; do |
|
91 | $ for i in 0 1; do | |
92 | > hg co -C $i |
|
92 | > hg co -C $i | |
93 | > echo d-$i >> foo |
|
93 | > echo d-$i >> foo | |
94 | > hg ci -m d-$i |
|
94 | > hg ci -m d-$i | |
95 | > done |
|
95 | > done | |
96 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
96 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
97 | created new head |
|
97 | created new head | |
98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
99 | created new head |
|
99 | created new head | |
100 |
|
100 | |||
101 | $ HGMERGE=true hg merge 3 |
|
101 | $ HGMERGE=true hg merge 3 | |
102 | merging foo |
|
102 | merging foo | |
103 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
103 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
104 | (branch merge, don't forget to commit) |
|
104 | (branch merge, don't forget to commit) | |
105 |
|
105 | |||
106 | $ hg ci -m c-d |
|
106 | $ hg ci -m c-d | |
107 |
|
107 | |||
108 | $ hg push ../c |
|
108 | $ hg push ../c | |
109 | pushing to ../c |
|
109 | pushing to ../c | |
110 | searching for changes |
|
110 | searching for changes | |
111 | abort: push creates new remote head 6346d66eb9f5! |
|
111 | abort: push creates new remote head 6346d66eb9f5! | |
112 | (merge or see "hg help push" for details about pushing new heads) |
|
112 | (merge or see "hg help push" for details about pushing new heads) | |
113 | [255] |
|
113 | [255] | |
114 |
|
114 | |||
115 | $ hg push -r 2 ../c |
|
115 | $ hg push -r 2 ../c | |
116 | pushing to ../c |
|
116 | pushing to ../c | |
117 | searching for changes |
|
117 | searching for changes | |
118 | no changes found |
|
118 | no changes found | |
119 | [1] |
|
119 | [1] | |
120 |
|
120 | |||
121 | $ hg push -r 3 ../c |
|
121 | $ hg push -r 3 ../c | |
122 | pushing to ../c |
|
122 | pushing to ../c | |
123 | searching for changes |
|
123 | searching for changes | |
124 | abort: push creates new remote head a5dda829a167! |
|
124 | abort: push creates new remote head a5dda829a167! | |
125 | (merge or see "hg help push" for details about pushing new heads) |
|
125 | (merge or see "hg help push" for details about pushing new heads) | |
126 | [255] |
|
126 | [255] | |
127 |
|
127 | |||
128 | $ hg push -v -r 3 -r 4 ../c |
|
128 | $ hg push -v -r 3 -r 4 ../c | |
129 | pushing to ../c |
|
129 | pushing to ../c | |
130 | searching for changes |
|
130 | searching for changes | |
131 | new remote heads on branch 'default': |
|
131 | new remote heads on branch 'default': | |
132 | a5dda829a167 |
|
132 | a5dda829a167 | |
133 | ee8fbc7a0295 |
|
133 | ee8fbc7a0295 | |
134 | abort: push creates new remote head a5dda829a167! |
|
134 | abort: push creates new remote head a5dda829a167! | |
135 | (merge or see "hg help push" for details about pushing new heads) |
|
135 | (merge or see "hg help push" for details about pushing new heads) | |
136 | [255] |
|
136 | [255] | |
137 |
|
137 | |||
138 | $ hg push -v -f -r 3 -r 4 ../c |
|
138 | $ hg push -v -f -r 3 -r 4 ../c | |
139 | pushing to ../c |
|
139 | pushing to ../c | |
140 | searching for changes |
|
140 | searching for changes | |
141 | 2 changesets found |
|
141 | 2 changesets found | |
142 | adding changesets |
|
142 | adding changesets | |
143 | adding manifests |
|
143 | adding manifests | |
144 | adding file changes |
|
144 | adding file changes | |
145 | added 2 changesets with 2 changes to 1 files (+2 heads) |
|
145 | added 2 changesets with 2 changes to 1 files (+2 heads) | |
146 |
|
146 | |||
147 | $ hg push -r 5 ../c |
|
147 | $ hg push -r 5 ../c | |
148 | pushing to ../c |
|
148 | pushing to ../c | |
149 | searching for changes |
|
149 | searching for changes | |
150 | adding changesets |
|
150 | adding changesets | |
151 | adding manifests |
|
151 | adding manifests | |
152 | adding file changes |
|
152 | adding file changes | |
153 | added 1 changesets with 1 changes to 1 files (-1 heads) |
|
153 | added 1 changesets with 1 changes to 1 files (-1 heads) | |
154 |
|
154 | |||
155 | $ hg in ../c |
|
155 | $ hg in ../c | |
156 | comparing with ../c |
|
156 | comparing with ../c | |
157 | searching for changes |
|
157 | searching for changes | |
158 | no changes found |
|
158 | no changes found | |
159 | [1] |
|
159 | [1] | |
160 |
|
160 | |||
161 |
|
161 | |||
162 | Issue450: push -r warns about remote head creation even if no heads |
|
162 | Issue450: push -r warns about remote head creation even if no heads | |
163 | will be created |
|
163 | will be created | |
164 |
|
164 | |||
165 | $ hg init ../e |
|
165 | $ hg init ../e | |
166 | $ hg push -r 0 ../e |
|
166 | $ hg push -r 0 ../e | |
167 | pushing to ../e |
|
167 | pushing to ../e | |
168 | searching for changes |
|
168 | searching for changes | |
169 | adding changesets |
|
169 | adding changesets | |
170 | adding manifests |
|
170 | adding manifests | |
171 | adding file changes |
|
171 | adding file changes | |
172 | added 1 changesets with 1 changes to 1 files |
|
172 | added 1 changesets with 1 changes to 1 files | |
173 |
|
173 | |||
174 | $ hg push -r 1 ../e |
|
174 | $ hg push -r 1 ../e | |
175 | pushing to ../e |
|
175 | pushing to ../e | |
176 | searching for changes |
|
176 | searching for changes | |
177 | adding changesets |
|
177 | adding changesets | |
178 | adding manifests |
|
178 | adding manifests | |
179 | adding file changes |
|
179 | adding file changes | |
180 | added 1 changesets with 1 changes to 1 files |
|
180 | added 1 changesets with 1 changes to 1 files | |
181 |
|
181 | |||
182 | $ cd .. |
|
182 | $ cd .. | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | Issue736: named branches are not considered for detection of |
|
185 | Issue736: named branches are not considered for detection of | |
186 | unmerged heads in "hg push" |
|
186 | unmerged heads in "hg push" | |
187 |
|
187 | |||
188 | $ hg init f |
|
188 | $ hg init f | |
189 | $ cd f |
|
189 | $ cd f | |
190 | $ hg -q branch a |
|
190 | $ hg -q branch a | |
191 | $ echo 0 > foo |
|
191 | $ echo 0 > foo | |
192 | $ hg -q ci -Am 0 |
|
192 | $ hg -q ci -Am 0 | |
193 | $ echo 1 > foo |
|
193 | $ echo 1 > foo | |
194 | $ hg -q ci -m 1 |
|
194 | $ hg -q ci -m 1 | |
195 | $ hg -q up 0 |
|
195 | $ hg -q up 0 | |
196 | $ echo 2 > foo |
|
196 | $ echo 2 > foo | |
197 | $ hg -q ci -m 2 |
|
197 | $ hg -q ci -m 2 | |
198 | $ hg -q up 0 |
|
198 | $ hg -q up 0 | |
199 | $ hg -q branch b |
|
199 | $ hg -q branch b | |
200 | $ echo 3 > foo |
|
200 | $ echo 3 > foo | |
201 | $ hg -q ci -m 3 |
|
201 | $ hg -q ci -m 3 | |
202 | $ cd .. |
|
202 | $ cd .. | |
203 |
|
203 | |||
204 | $ hg -q clone f g |
|
204 | $ hg -q clone f g | |
205 | $ cd g |
|
205 | $ cd g | |
206 |
|
206 | |||
207 | Push on existing branch and new branch: |
|
207 | Push on existing branch and new branch: | |
208 |
|
208 | |||
209 | $ hg -q up 1 |
|
209 | $ hg -q up 1 | |
210 | $ echo 4 > foo |
|
210 | $ echo 4 > foo | |
211 | $ hg -q ci -m 4 |
|
211 | $ hg -q ci -m 4 | |
212 | $ hg -q up 0 |
|
212 | $ hg -q up 0 | |
213 | $ echo 5 > foo |
|
213 | $ echo 5 > foo | |
214 | $ hg -q branch c |
|
214 | $ hg -q branch c | |
215 | $ hg -q ci -m 5 |
|
215 | $ hg -q ci -m 5 | |
216 |
|
216 | |||
217 | $ hg push ../f |
|
217 | $ hg push ../f | |
218 | pushing to ../f |
|
218 | pushing to ../f | |
219 | searching for changes |
|
219 | searching for changes | |
220 | abort: push creates new remote branches: c! |
|
220 | abort: push creates new remote branches: c! | |
221 | (use 'hg push --new-branch' to create new remote branches) |
|
221 | (use 'hg push --new-branch' to create new remote branches) | |
222 | [255] |
|
222 | [255] | |
223 |
|
223 | |||
224 | $ hg push -r 4 -r 5 ../f |
|
224 | $ hg push -r 4 -r 5 ../f | |
225 | pushing to ../f |
|
225 | pushing to ../f | |
226 | searching for changes |
|
226 | searching for changes | |
227 | abort: push creates new remote branches: c! |
|
227 | abort: push creates new remote branches: c! | |
228 | (use 'hg push --new-branch' to create new remote branches) |
|
228 | (use 'hg push --new-branch' to create new remote branches) | |
229 | [255] |
|
229 | [255] | |
230 |
|
230 | |||
231 |
|
231 | |||
232 | Multiple new branches: |
|
232 | Multiple new branches: | |
233 |
|
233 | |||
234 | $ hg -q branch d |
|
234 | $ hg -q branch d | |
235 | $ echo 6 > foo |
|
235 | $ echo 6 > foo | |
236 | $ hg -q ci -m 6 |
|
236 | $ hg -q ci -m 6 | |
237 |
|
237 | |||
238 | $ hg push ../f |
|
238 | $ hg push ../f | |
239 | pushing to ../f |
|
239 | pushing to ../f | |
240 | searching for changes |
|
240 | searching for changes | |
241 | abort: push creates new remote branches: c, d! |
|
241 | abort: push creates new remote branches: c, d! | |
242 | (use 'hg push --new-branch' to create new remote branches) |
|
242 | (use 'hg push --new-branch' to create new remote branches) | |
243 | [255] |
|
243 | [255] | |
244 |
|
244 | |||
245 | $ hg push -r 4 -r 6 ../f |
|
245 | $ hg push -r 4 -r 6 ../f | |
246 | pushing to ../f |
|
246 | pushing to ../f | |
247 | searching for changes |
|
247 | searching for changes | |
248 | abort: push creates new remote branches: c, d! |
|
248 | abort: push creates new remote branches: c, d! | |
249 | (use 'hg push --new-branch' to create new remote branches) |
|
249 | (use 'hg push --new-branch' to create new remote branches) | |
250 | [255] |
|
250 | [255] | |
251 |
|
251 | |||
252 | $ cd ../g |
|
252 | $ cd ../g | |
253 |
|
253 | |||
254 |
|
254 | |||
255 | Fail on multiple head push: |
|
255 | Fail on multiple head push: | |
256 |
|
256 | |||
257 | $ hg -q up 1 |
|
257 | $ hg -q up 1 | |
258 | $ echo 7 > foo |
|
258 | $ echo 7 > foo | |
259 | $ hg -q ci -m 7 |
|
259 | $ hg -q ci -m 7 | |
260 |
|
260 | |||
261 | $ hg push -r 4 -r 7 ../f |
|
261 | $ hg push -r 4 -r 7 ../f | |
262 | pushing to ../f |
|
262 | pushing to ../f | |
263 | searching for changes |
|
263 | searching for changes | |
264 | abort: push creates new remote head 0b715ef6ff8f on branch 'a'! |
|
264 | abort: push creates new remote head 0b715ef6ff8f on branch 'a'! | |
265 | (merge or see "hg help push" for details about pushing new heads) |
|
265 | (merge or see "hg help push" for details about pushing new heads) | |
266 | [255] |
|
266 | [255] | |
267 |
|
267 | |||
268 | Push replacement head on existing branches: |
|
268 | Push replacement head on existing branches: | |
269 |
|
269 | |||
270 | $ hg -q up 3 |
|
270 | $ hg -q up 3 | |
271 | $ echo 8 > foo |
|
271 | $ echo 8 > foo | |
272 | $ hg -q ci -m 8 |
|
272 | $ hg -q ci -m 8 | |
273 |
|
273 | |||
274 | $ hg push -r 7 -r 8 ../f |
|
274 | $ hg push -r 7 -r 8 ../f | |
275 | pushing to ../f |
|
275 | pushing to ../f | |
276 | searching for changes |
|
276 | searching for changes | |
277 | adding changesets |
|
277 | adding changesets | |
278 | adding manifests |
|
278 | adding manifests | |
279 | adding file changes |
|
279 | adding file changes | |
280 | added 2 changesets with 2 changes to 1 files |
|
280 | added 2 changesets with 2 changes to 1 files | |
281 |
|
281 | |||
282 |
|
282 | |||
283 | Merge of branch a to other branch b followed by unrelated push |
|
283 | Merge of branch a to other branch b followed by unrelated push | |
284 | on branch a: |
|
284 | on branch a: | |
285 |
|
285 | |||
286 | $ hg -q up 7 |
|
286 | $ hg -q up 7 | |
287 | $ HGMERGE=true hg -q merge 8 |
|
287 | $ HGMERGE=true hg -q merge 8 | |
288 | $ hg -q ci -m 9 |
|
288 | $ hg -q ci -m 9 | |
289 | $ hg -q up 8 |
|
289 | $ hg -q up 8 | |
290 | $ echo 10 > foo |
|
290 | $ echo 10 > foo | |
291 | $ hg -q ci -m 10 |
|
291 | $ hg -q ci -m 10 | |
292 |
|
292 | |||
293 | $ hg push -r 9 ../f |
|
293 | $ hg push -r 9 ../f | |
294 | pushing to ../f |
|
294 | pushing to ../f | |
295 | searching for changes |
|
295 | searching for changes | |
296 | adding changesets |
|
296 | adding changesets | |
297 | adding manifests |
|
297 | adding manifests | |
298 | adding file changes |
|
298 | adding file changes | |
299 | added 1 changesets with 1 changes to 1 files (-1 heads) |
|
299 | added 1 changesets with 1 changes to 1 files (-1 heads) | |
300 |
|
300 | |||
301 | $ hg push -r 10 ../f |
|
301 | $ hg push -r 10 ../f | |
302 | pushing to ../f |
|
302 | pushing to ../f | |
303 | searching for changes |
|
303 | searching for changes | |
304 | adding changesets |
|
304 | adding changesets | |
305 | adding manifests |
|
305 | adding manifests | |
306 | adding file changes |
|
306 | adding file changes | |
307 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
307 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
308 |
|
308 | |||
309 |
|
309 | |||
310 | Cheating the counting algorithm: |
|
310 | Cheating the counting algorithm: | |
311 |
|
311 | |||
312 | $ hg -q up 9 |
|
312 | $ hg -q up 9 | |
313 | $ HGMERGE=true hg -q merge 2 |
|
313 | $ HGMERGE=true hg -q merge 2 | |
314 | $ hg -q ci -m 11 |
|
314 | $ hg -q ci -m 11 | |
315 | $ hg -q up 1 |
|
315 | $ hg -q up 1 | |
316 | $ echo 12 > foo |
|
316 | $ echo 12 > foo | |
317 | $ hg -q ci -m 12 |
|
317 | $ hg -q ci -m 12 | |
318 |
|
318 | |||
319 | $ hg push -r 11 -r 12 ../f |
|
319 | $ hg push -r 11 -r 12 ../f | |
320 | pushing to ../f |
|
320 | pushing to ../f | |
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 2 changesets with 2 changes to 1 files |
|
325 | added 2 changesets with 2 changes to 1 files | |
326 |
|
326 | |||
327 |
|
327 | |||
328 | Failed push of new named branch: |
|
328 | Failed push of new named branch: | |
329 |
|
329 | |||
330 | $ echo 12 > foo |
|
330 | $ echo 12 > foo | |
331 | $ hg -q ci -m 12a |
|
331 | $ hg -q ci -m 12a | |
332 | [1] |
|
332 | [1] | |
333 | $ hg -q up 11 |
|
333 | $ hg -q up 11 | |
334 | $ echo 13 > foo |
|
334 | $ echo 13 > foo | |
335 | $ hg -q branch e |
|
335 | $ hg -q branch e | |
336 | $ hg -q ci -m 13d |
|
336 | $ hg -q ci -m 13d | |
337 |
|
337 | |||
338 | $ hg push -r 12 -r 13 ../f |
|
338 | $ hg push -r 12 -r 13 ../f | |
339 | pushing to ../f |
|
339 | pushing to ../f | |
340 | searching for changes |
|
340 | searching for changes | |
341 | abort: push creates new remote branches: e! |
|
341 | abort: push creates new remote branches: e! | |
342 | (use 'hg push --new-branch' to create new remote branches) |
|
342 | (use 'hg push --new-branch' to create new remote branches) | |
343 | [255] |
|
343 | [255] | |
344 |
|
344 | |||
345 |
|
345 | |||
346 | Using --new-branch to push new named branch: |
|
346 | Using --new-branch to push new named branch: | |
347 |
|
347 | |||
348 | $ hg push --new-branch -r 12 -r 13 ../f |
|
348 | $ hg push --new-branch -r 12 -r 13 ../f | |
349 | pushing to ../f |
|
349 | pushing to ../f | |
350 | searching for changes |
|
350 | searching for changes | |
351 | adding changesets |
|
351 | adding changesets | |
352 | adding manifests |
|
352 | adding manifests | |
353 | adding file changes |
|
353 | adding file changes | |
354 | added 1 changesets with 1 changes to 1 files |
|
354 | added 1 changesets with 1 changes to 1 files | |
355 |
|
355 | |||
356 | Pushing multi headed new branch: |
|
356 | Pushing multi headed new branch: | |
357 |
|
357 | |||
358 | $ echo 14 > foo |
|
358 | $ echo 14 > foo | |
359 | $ hg -q branch f |
|
359 | $ hg -q branch f | |
360 | $ hg -q ci -m 14 |
|
360 | $ hg -q ci -m 14 | |
361 | $ echo 15 > foo |
|
361 | $ echo 15 > foo | |
362 | $ hg -q ci -m 15 |
|
362 | $ hg -q ci -m 15 | |
363 | $ hg -q up 14 |
|
363 | $ hg -q up 14 | |
364 | $ echo 16 > foo |
|
364 | $ echo 16 > foo | |
365 | $ hg -q ci -m 16 |
|
365 | $ hg -q ci -m 16 | |
366 | $ hg push --branch f --new-branch ../f |
|
366 | $ hg push --branch f --new-branch ../f | |
367 | pushing to ../f |
|
367 | pushing to ../f | |
368 | searching for changes |
|
368 | searching for changes | |
369 | abort: push creates new branch 'f' with multiple heads |
|
369 | abort: push creates new branch 'f' with multiple heads | |
370 | (merge or see "hg help push" for details about pushing new heads) |
|
370 | (merge or see "hg help push" for details about pushing new heads) | |
371 | [255] |
|
371 | [255] | |
372 | $ hg push --branch f --new-branch --force ../f |
|
372 | $ hg push --branch f --new-branch --force ../f | |
373 | pushing to ../f |
|
373 | pushing to ../f | |
374 | searching for changes |
|
374 | searching for changes | |
375 | adding changesets |
|
375 | adding changesets | |
376 | adding manifests |
|
376 | adding manifests | |
377 | adding file changes |
|
377 | adding file changes | |
378 | added 3 changesets with 3 changes to 1 files (+1 heads) |
|
378 | added 3 changesets with 3 changes to 1 files (+1 heads) | |
379 |
|
379 | |||
380 | Checking prepush logic does not allow silently pushing |
|
380 | Checking prepush logic does not allow silently pushing | |
381 | multiple new heads: |
|
381 | multiple new heads but also doesn't report too many heads: | |
382 |
|
382 | |||
383 | $ cd .. |
|
383 | $ cd .. | |
384 | $ hg init h |
|
384 | $ hg init h | |
385 | $ echo init > h/init |
|
385 | $ echo init > h/init | |
386 | $ hg -R h ci -Am init |
|
386 | $ hg -R h ci -Am init | |
387 | adding init |
|
387 | adding init | |
388 | $ echo a > h/a |
|
388 | $ echo a > h/a | |
389 | $ hg -R h ci -Am a |
|
389 | $ hg -R h ci -Am a | |
390 | adding a |
|
390 | adding a | |
391 | $ hg clone h i |
|
391 | $ hg clone h i | |
392 | updating to branch default |
|
392 | updating to branch default | |
393 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
393 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
394 | $ hg -R h up 0 |
|
394 | $ hg -R h up 0 | |
395 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
395 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
396 | $ echo b > h/b |
|
396 | $ echo b > h/b | |
397 | $ hg -R h ci -Am b |
|
397 | $ hg -R h ci -Am b | |
398 | adding b |
|
398 | adding b | |
399 | created new head |
|
399 | created new head | |
400 | $ hg -R i up 0 |
|
400 | $ hg -R i up 0 | |
401 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
401 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
402 | $ echo c > i/c |
|
402 | $ echo c > i/c | |
403 | $ hg -R i ci -Am c |
|
403 | $ hg -R i ci -Am c | |
404 | adding c |
|
404 | adding c | |
405 | created new head |
|
405 | created new head | |
406 |
|
406 | |||
|
407 | $ for i in `seq 3`; do hg -R h up -q 0; echo $i > h/b; hg -R h ci -qAm$i; done | |||
|
408 | ||||
407 | $ hg -R i push h |
|
409 | $ hg -R i push h | |
408 | pushing to h |
|
410 | pushing to h | |
409 | searching for changes |
|
411 | searching for changes | |
410 | remote has heads on branch 'default' that are not known locally: ce4212fc8847 |
|
412 | remote has heads on branch 'default' that are not known locally: 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | |
|
413 | abort: push creates new remote head 97bd0c84d346! | |||
|
414 | (pull and merge or see "hg help push" for details about pushing new heads) | |||
|
415 | [255] | |||
|
416 | $ hg -R h up -q 0; echo x > h/b; hg -R h ci -qAmx | |||
|
417 | $ hg -R i push h | |||
|
418 | pushing to h | |||
|
419 | searching for changes | |||
|
420 | remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 and 1 others | |||
|
421 | abort: push creates new remote head 97bd0c84d346! | |||
|
422 | (pull and merge or see "hg help push" for details about pushing new heads) | |||
|
423 | [255] | |||
|
424 | $ hg -R i push h -v | |||
|
425 | pushing to h | |||
|
426 | searching for changes | |||
|
427 | remote has heads on branch 'default' that are not known locally: 18ddb72c4590 534543e22c29 764f8ec07b96 afe7cc7679f5 ce4212fc8847 | |||
|
428 | new remote heads on branch 'default': | |||
|
429 | 97bd0c84d346 | |||
411 | abort: push creates new remote head 97bd0c84d346! |
|
430 | abort: push creates new remote head 97bd0c84d346! | |
412 | (pull and merge or see "hg help push" for details about pushing new heads) |
|
431 | (pull and merge or see "hg help push" for details about pushing new heads) | |
413 | [255] |
|
432 | [255] | |
414 |
|
433 | |||
415 |
|
434 | |||
416 | Check prepush logic with merged branches: |
|
435 | Check prepush logic with merged branches: | |
417 |
|
436 | |||
418 | $ hg init j |
|
437 | $ hg init j | |
419 | $ hg -R j branch a |
|
438 | $ hg -R j branch a | |
420 | marked working directory as branch a |
|
439 | marked working directory as branch a | |
421 | (branches are permanent and global, did you want a bookmark?) |
|
440 | (branches are permanent and global, did you want a bookmark?) | |
422 | $ echo init > j/foo |
|
441 | $ echo init > j/foo | |
423 | $ hg -R j ci -Am init |
|
442 | $ hg -R j ci -Am init | |
424 | adding foo |
|
443 | adding foo | |
425 | $ hg clone j k |
|
444 | $ hg clone j k | |
426 | updating to branch a |
|
445 | updating to branch a | |
427 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
446 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
428 | $ echo a1 > j/foo |
|
447 | $ echo a1 > j/foo | |
429 | $ hg -R j ci -m a1 |
|
448 | $ hg -R j ci -m a1 | |
430 | $ hg -R k branch b |
|
449 | $ hg -R k branch b | |
431 | marked working directory as branch b |
|
450 | marked working directory as branch b | |
432 | (branches are permanent and global, did you want a bookmark?) |
|
451 | (branches are permanent and global, did you want a bookmark?) | |
433 | $ echo b > k/foo |
|
452 | $ echo b > k/foo | |
434 | $ hg -R k ci -m b |
|
453 | $ hg -R k ci -m b | |
435 | $ hg -R k up 0 |
|
454 | $ hg -R k up 0 | |
436 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
455 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
437 |
|
456 | |||
438 | $ hg -R k merge b |
|
457 | $ hg -R k merge b | |
439 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
458 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
440 |
|
|
459 | (branch merge, don't forget to commit) | |
441 |
|
460 | |||
442 | $ hg -R k ci -m merge |
|
461 | $ hg -R k ci -m merge | |
443 |
|
462 | |||
444 | $ hg -R k push -r a j |
|
463 | $ hg -R k push -r a j | |
445 | pushing to j |
|
464 | pushing to j | |
446 | searching for changes |
|
465 | searching for changes | |
447 | abort: push creates new remote branches: b! |
|
466 | abort: push creates new remote branches: b! | |
448 |
(use 'hg |
|
467 | (use 'hg push --new-branch' to create new remote branches) | |
449 | [255] |
|
468 | [255] | |
450 |
|
469 | |||
451 |
|
470 | |||
452 | Prepush -r should not allow you to sneak in new heads: |
|
471 | Prepush -r should not allow you to sneak in new heads: | |
453 |
|
472 | |||
454 | $ hg init l |
|
473 | $ hg init l | |
455 | $ cd l |
|
474 | $ cd l | |
456 | $ echo a >> foo |
|
475 | $ echo a >> foo | |
457 | $ hg -q add foo |
|
476 | $ hg -q add foo | |
458 | $ hg -q branch a |
|
477 | $ hg -q branch a | |
459 | $ hg -q ci -ma |
|
478 | $ hg -q ci -ma | |
460 | $ hg -q up null |
|
479 | $ hg -q up null | |
461 | $ echo a >> foo |
|
480 | $ echo a >> foo | |
462 | $ hg -q add foo |
|
481 | $ hg -q add foo | |
463 | $ hg -q branch b |
|
482 | $ hg -q branch b | |
464 | $ hg -q ci -mb |
|
483 | $ hg -q ci -mb | |
465 | $ cd .. |
|
484 | $ cd .. | |
466 | $ hg -q clone l m -u a |
|
485 | $ hg -q clone l m -u a | |
467 | $ cd m |
|
486 | $ cd m | |
468 | $ hg -q merge b |
|
487 | $ hg -q merge b | |
469 | $ hg -q ci -mmb |
|
488 | $ hg -q ci -mmb | |
470 | $ hg -q up 0 |
|
489 | $ hg -q up 0 | |
471 | $ echo a >> foo |
|
490 | $ echo a >> foo | |
472 | $ hg -q ci -ma2 |
|
491 | $ hg -q ci -ma2 | |
473 | $ hg -q up 2 |
|
492 | $ hg -q up 2 | |
474 | $ echo a >> foo |
|
493 | $ echo a >> foo | |
475 | $ hg -q branch -f b |
|
494 | $ hg -q branch -f b | |
476 | $ hg -q ci -mb2 |
|
495 | $ hg -q ci -mb2 | |
477 | $ hg -q merge 3 |
|
496 | $ hg -q merge 3 | |
478 | $ hg -q ci -mma |
|
497 | $ hg -q ci -mma | |
479 |
|
498 | |||
480 | $ hg push ../l -b b |
|
499 | $ hg push ../l -b b | |
481 | pushing to ../l |
|
500 | pushing to ../l | |
482 | searching for changes |
|
501 | searching for changes | |
483 | abort: push creates new remote head 451211cc22b0 on branch 'a'! |
|
502 | abort: push creates new remote head 451211cc22b0 on branch 'a'! | |
484 | (merge or see "hg help push" for details about pushing new heads) |
|
503 | (merge or see "hg help push" for details about pushing new heads) | |
485 | [255] |
|
504 | [255] | |
486 |
|
505 | |||
487 | $ cd .. |
|
506 | $ cd .. | |
488 |
|
507 | |||
489 |
|
508 | |||
490 | Check prepush with new branch head on former topo non-head: |
|
509 | Check prepush with new branch head on former topo non-head: | |
491 |
|
510 | |||
492 | $ hg init n |
|
511 | $ hg init n | |
493 | $ cd n |
|
512 | $ cd n | |
494 | $ hg branch A |
|
513 | $ hg branch A | |
495 | marked working directory as branch A |
|
514 | marked working directory as branch A | |
496 | (branches are permanent and global, did you want a bookmark?) |
|
515 | (branches are permanent and global, did you want a bookmark?) | |
497 | $ echo a >a |
|
516 | $ echo a >a | |
498 | $ hg ci -Ama |
|
517 | $ hg ci -Ama | |
499 | adding a |
|
518 | adding a | |
500 | $ hg branch B |
|
519 | $ hg branch B | |
501 | marked working directory as branch B |
|
520 | marked working directory as branch B | |
502 | (branches are permanent and global, did you want a bookmark?) |
|
521 | (branches are permanent and global, did you want a bookmark?) | |
503 | $ echo b >b |
|
522 | $ echo b >b | |
504 | $ hg ci -Amb |
|
523 | $ hg ci -Amb | |
505 | adding b |
|
524 | adding b | |
506 |
|
525 | |||
507 | b is now branch head of B, and a topological head |
|
526 | b is now branch head of B, and a topological head | |
508 | a is now branch head of A, but not a topological head |
|
527 | a is now branch head of A, but not a topological head | |
509 |
|
528 | |||
510 | $ hg clone . inner |
|
529 | $ hg clone . inner | |
511 | updating to branch B |
|
530 | updating to branch B | |
512 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
531 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
513 | $ cd inner |
|
532 | $ cd inner | |
514 | $ hg up B |
|
533 | $ hg up B | |
515 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
534 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
516 | $ echo b1 >b1 |
|
535 | $ echo b1 >b1 | |
517 | $ hg ci -Amb1 |
|
536 | $ hg ci -Amb1 | |
518 | adding b1 |
|
537 | adding b1 | |
519 |
|
538 | |||
520 | in the clone b1 is now the head of B |
|
539 | in the clone b1 is now the head of B | |
521 |
|
540 | |||
522 | $ cd .. |
|
541 | $ cd .. | |
523 | $ hg up 0 |
|
542 | $ hg up 0 | |
524 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
543 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
525 | $ echo a2 >a2 |
|
544 | $ echo a2 >a2 | |
526 | $ hg ci -Ama2 |
|
545 | $ hg ci -Ama2 | |
527 | adding a2 |
|
546 | adding a2 | |
528 |
|
547 | |||
529 | a2 is now the new branch head of A, and a new topological head |
|
548 | a2 is now the new branch head of A, and a new topological head | |
530 | it replaces a former inner branch head, so it should at most warn about |
|
549 | it replaces a former inner branch head, so it should at most warn about | |
531 | A, not B |
|
550 | A, not B | |
532 |
|
551 | |||
533 | glog of local: |
|
552 | glog of local: | |
534 |
|
553 | |||
535 | $ hg log -G --template "{rev}: {branches} {desc}\n" |
|
554 | $ hg log -G --template "{rev}: {branches} {desc}\n" | |
536 | @ 2: A a2 |
|
555 | @ 2: A a2 | |
537 | | |
|
556 | | | |
538 | | o 1: B b |
|
557 | | o 1: B b | |
539 | |/ |
|
558 | |/ | |
540 | o 0: A a |
|
559 | o 0: A a | |
541 |
|
560 | |||
542 | glog of remote: |
|
561 | glog of remote: | |
543 |
|
562 | |||
544 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" |
|
563 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" | |
545 | @ 2: B b1 |
|
564 | @ 2: B b1 | |
546 | | |
|
565 | | | |
547 | o 1: B b |
|
566 | o 1: B b | |
548 | | |
|
567 | | | |
549 | o 0: A a |
|
568 | o 0: A a | |
550 |
|
569 | |||
551 | outgoing: |
|
570 | outgoing: | |
552 |
|
571 | |||
553 | $ hg out inner --template "{rev}: {branches} {desc}\n" |
|
572 | $ hg out inner --template "{rev}: {branches} {desc}\n" | |
554 | comparing with inner |
|
573 | comparing with inner | |
555 | searching for changes |
|
574 | searching for changes | |
556 | 2: A a2 |
|
575 | 2: A a2 | |
557 |
|
576 | |||
558 | $ hg push inner |
|
577 | $ hg push inner | |
559 | pushing to inner |
|
578 | pushing to inner | |
560 | searching for changes |
|
579 | searching for changes | |
561 | adding changesets |
|
580 | adding changesets | |
562 | adding manifests |
|
581 | adding manifests | |
563 | adding file changes |
|
582 | adding file changes | |
564 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
583 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
565 |
|
584 | |||
566 | $ cd .. |
|
585 | $ cd .. | |
567 |
|
586 | |||
568 |
|
587 | |||
569 | Check prepush with new branch head on former topo head: |
|
588 | Check prepush with new branch head on former topo head: | |
570 |
|
589 | |||
571 | $ hg init o |
|
590 | $ hg init o | |
572 | $ cd o |
|
591 | $ cd o | |
573 | $ hg branch A |
|
592 | $ hg branch A | |
574 | marked working directory as branch A |
|
593 | marked working directory as branch A | |
575 | (branches are permanent and global, did you want a bookmark?) |
|
594 | (branches are permanent and global, did you want a bookmark?) | |
576 | $ echo a >a |
|
595 | $ echo a >a | |
577 | $ hg ci -Ama |
|
596 | $ hg ci -Ama | |
578 | adding a |
|
597 | adding a | |
579 | $ hg branch B |
|
598 | $ hg branch B | |
580 | marked working directory as branch B |
|
599 | marked working directory as branch B | |
581 | (branches are permanent and global, did you want a bookmark?) |
|
600 | (branches are permanent and global, did you want a bookmark?) | |
582 | $ echo b >b |
|
601 | $ echo b >b | |
583 | $ hg ci -Amb |
|
602 | $ hg ci -Amb | |
584 | adding b |
|
603 | adding b | |
585 |
|
604 | |||
586 | b is now branch head of B, and a topological head |
|
605 | b is now branch head of B, and a topological head | |
587 |
|
606 | |||
588 | $ hg up 0 |
|
607 | $ hg up 0 | |
589 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
608 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
590 | $ echo a1 >a1 |
|
609 | $ echo a1 >a1 | |
591 | $ hg ci -Ama1 |
|
610 | $ hg ci -Ama1 | |
592 | adding a1 |
|
611 | adding a1 | |
593 |
|
612 | |||
594 | a1 is now branch head of A, and a topological head |
|
613 | a1 is now branch head of A, and a topological head | |
595 |
|
614 | |||
596 | $ hg clone . inner |
|
615 | $ hg clone . inner | |
597 | updating to branch A |
|
616 | updating to branch A | |
598 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
617 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
599 | $ cd inner |
|
618 | $ cd inner | |
600 | $ hg up B |
|
619 | $ hg up B | |
601 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
620 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
602 | $ echo b1 >b1 |
|
621 | $ echo b1 >b1 | |
603 | $ hg ci -Amb1 |
|
622 | $ hg ci -Amb1 | |
604 | adding b1 |
|
623 | adding b1 | |
605 |
|
624 | |||
606 | in the clone b1 is now the head of B |
|
625 | in the clone b1 is now the head of B | |
607 |
|
626 | |||
608 | $ cd .. |
|
627 | $ cd .. | |
609 | $ echo a2 >a2 |
|
628 | $ echo a2 >a2 | |
610 | $ hg ci -Ama2 |
|
629 | $ hg ci -Ama2 | |
611 | adding a2 |
|
630 | adding a2 | |
612 |
|
631 | |||
613 | a2 is now the new branch head of A, and a topological head |
|
632 | a2 is now the new branch head of A, and a topological head | |
614 | it replaces a former topological and branch head, so this should not warn |
|
633 | it replaces a former topological and branch head, so this should not warn | |
615 |
|
634 | |||
616 | glog of local: |
|
635 | glog of local: | |
617 |
|
636 | |||
618 | $ hg log -G --template "{rev}: {branches} {desc}\n" |
|
637 | $ hg log -G --template "{rev}: {branches} {desc}\n" | |
619 | @ 3: A a2 |
|
638 | @ 3: A a2 | |
620 | | |
|
639 | | | |
621 | o 2: A a1 |
|
640 | o 2: A a1 | |
622 | | |
|
641 | | | |
623 | | o 1: B b |
|
642 | | o 1: B b | |
624 | |/ |
|
643 | |/ | |
625 | o 0: A a |
|
644 | o 0: A a | |
626 |
|
645 | |||
627 | glog of remote: |
|
646 | glog of remote: | |
628 |
|
647 | |||
629 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" |
|
648 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" | |
630 | @ 3: B b1 |
|
649 | @ 3: B b1 | |
631 | | |
|
650 | | | |
632 | | o 2: A a1 |
|
651 | | o 2: A a1 | |
633 | | | |
|
652 | | | | |
634 | o | 1: B b |
|
653 | o | 1: B b | |
635 | |/ |
|
654 | |/ | |
636 | o 0: A a |
|
655 | o 0: A a | |
637 |
|
656 | |||
638 | outgoing: |
|
657 | outgoing: | |
639 |
|
658 | |||
640 | $ hg out inner --template "{rev}: {branches} {desc}\n" |
|
659 | $ hg out inner --template "{rev}: {branches} {desc}\n" | |
641 | comparing with inner |
|
660 | comparing with inner | |
642 | searching for changes |
|
661 | searching for changes | |
643 | 3: A a2 |
|
662 | 3: A a2 | |
644 |
|
663 | |||
645 | $ hg push inner |
|
664 | $ hg push inner | |
646 | pushing to inner |
|
665 | pushing to inner | |
647 | searching for changes |
|
666 | searching for changes | |
648 | adding changesets |
|
667 | adding changesets | |
649 | adding manifests |
|
668 | adding manifests | |
650 | adding file changes |
|
669 | adding file changes | |
651 | added 1 changesets with 1 changes to 1 files |
|
670 | added 1 changesets with 1 changes to 1 files | |
652 |
|
671 | |||
653 | $ cd .. |
|
672 | $ cd .. | |
654 |
|
673 | |||
655 |
|
674 | |||
656 | Check prepush with new branch head and new child of former branch head |
|
675 | Check prepush with new branch head and new child of former branch head | |
657 | but child is on different branch: |
|
676 | but child is on different branch: | |
658 |
|
677 | |||
659 | $ hg init p |
|
678 | $ hg init p | |
660 | $ cd p |
|
679 | $ cd p | |
661 | $ hg branch A |
|
680 | $ hg branch A | |
662 | marked working directory as branch A |
|
681 | marked working directory as branch A | |
663 | (branches are permanent and global, did you want a bookmark?) |
|
682 | (branches are permanent and global, did you want a bookmark?) | |
664 | $ echo a0 >a |
|
683 | $ echo a0 >a | |
665 | $ hg ci -Ama0 |
|
684 | $ hg ci -Ama0 | |
666 | adding a |
|
685 | adding a | |
667 | $ echo a1 >a |
|
686 | $ echo a1 >a | |
668 | $ hg ci -ma1 |
|
687 | $ hg ci -ma1 | |
669 | $ hg up null |
|
688 | $ hg up null | |
670 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
689 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
671 | $ hg branch B |
|
690 | $ hg branch B | |
672 | marked working directory as branch B |
|
691 | marked working directory as branch B | |
673 | (branches are permanent and global, did you want a bookmark?) |
|
692 | (branches are permanent and global, did you want a bookmark?) | |
674 | $ echo b0 >b |
|
693 | $ echo b0 >b | |
675 | $ hg ci -Amb0 |
|
694 | $ hg ci -Amb0 | |
676 | adding b |
|
695 | adding b | |
677 | $ echo b1 >b |
|
696 | $ echo b1 >b | |
678 | $ hg ci -mb1 |
|
697 | $ hg ci -mb1 | |
679 |
|
698 | |||
680 | $ hg clone . inner |
|
699 | $ hg clone . inner | |
681 | updating to branch B |
|
700 | updating to branch B | |
682 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
701 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
683 |
|
702 | |||
684 | $ hg up A |
|
703 | $ hg up A | |
685 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
704 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
686 | $ hg branch -f B |
|
705 | $ hg branch -f B | |
687 | marked working directory as branch B |
|
706 | marked working directory as branch B | |
688 | (branches are permanent and global, did you want a bookmark?) |
|
707 | (branches are permanent and global, did you want a bookmark?) | |
689 | $ echo a3 >a |
|
708 | $ echo a3 >a | |
690 | $ hg ci -ma3 |
|
709 | $ hg ci -ma3 | |
691 | created new head |
|
710 | created new head | |
692 | $ hg up 3 |
|
711 | $ hg up 3 | |
693 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
712 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
694 | $ hg branch -f A |
|
713 | $ hg branch -f A | |
695 | marked working directory as branch A |
|
714 | marked working directory as branch A | |
696 | (branches are permanent and global, did you want a bookmark?) |
|
715 | (branches are permanent and global, did you want a bookmark?) | |
697 | $ echo b3 >b |
|
716 | $ echo b3 >b | |
698 | $ hg ci -mb3 |
|
717 | $ hg ci -mb3 | |
699 | created new head |
|
718 | created new head | |
700 |
|
719 | |||
701 | glog of local: |
|
720 | glog of local: | |
702 |
|
721 | |||
703 | $ hg log -G --template "{rev}: {branches} {desc}\n" |
|
722 | $ hg log -G --template "{rev}: {branches} {desc}\n" | |
704 | @ 5: A b3 |
|
723 | @ 5: A b3 | |
705 | | |
|
724 | | | |
706 | | o 4: B a3 |
|
725 | | o 4: B a3 | |
707 | | | |
|
726 | | | | |
708 | o | 3: B b1 |
|
727 | o | 3: B b1 | |
709 | | | |
|
728 | | | | |
710 | o | 2: B b0 |
|
729 | o | 2: B b0 | |
711 | / |
|
730 | / | |
712 | o 1: A a1 |
|
731 | o 1: A a1 | |
713 | | |
|
732 | | | |
714 | o 0: A a0 |
|
733 | o 0: A a0 | |
715 |
|
734 | |||
716 | glog of remote: |
|
735 | glog of remote: | |
717 |
|
736 | |||
718 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" |
|
737 | $ hg log -G -R inner --template "{rev}: {branches} {desc}\n" | |
719 | @ 3: B b1 |
|
738 | @ 3: B b1 | |
720 | | |
|
739 | | | |
721 | o 2: B b0 |
|
740 | o 2: B b0 | |
722 |
|
741 | |||
723 | o 1: A a1 |
|
742 | o 1: A a1 | |
724 | | |
|
743 | | | |
725 | o 0: A a0 |
|
744 | o 0: A a0 | |
726 |
|
745 | |||
727 | outgoing: |
|
746 | outgoing: | |
728 |
|
747 | |||
729 | $ hg out inner --template "{rev}: {branches} {desc}\n" |
|
748 | $ hg out inner --template "{rev}: {branches} {desc}\n" | |
730 | comparing with inner |
|
749 | comparing with inner | |
731 | searching for changes |
|
750 | searching for changes | |
732 | 4: B a3 |
|
751 | 4: B a3 | |
733 | 5: A b3 |
|
752 | 5: A b3 | |
734 |
|
753 | |||
735 | $ hg push inner |
|
754 | $ hg push inner | |
736 | pushing to inner |
|
755 | pushing to inner | |
737 | searching for changes |
|
756 | searching for changes | |
738 | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! |
|
757 | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! | |
739 | (merge or see "hg help push" for details about pushing new heads) |
|
758 | (merge or see "hg help push" for details about pushing new heads) | |
740 | [255] |
|
759 | [255] | |
741 |
|
760 | |||
742 | $ hg push inner -r4 -r5 |
|
761 | $ hg push inner -r4 -r5 | |
743 | pushing to inner |
|
762 | pushing to inner | |
744 | searching for changes |
|
763 | searching for changes | |
745 | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! |
|
764 | abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'! | |
746 | (merge or see "hg help push" for details about pushing new heads) |
|
765 | (merge or see "hg help push" for details about pushing new heads) | |
747 | [255] |
|
766 | [255] | |
748 |
|
767 | |||
749 | $ hg in inner |
|
768 | $ hg in inner | |
750 | comparing with inner |
|
769 | comparing with inner | |
751 | searching for changes |
|
770 | searching for changes | |
752 | no changes found |
|
771 | no changes found | |
753 | [1] |
|
772 | [1] | |
754 |
|
773 | |||
755 | $ cd .. |
|
774 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now