##// END OF EJS Templates
merge: give priority to "not at head" failures for bare 'hg merge'...
Pierre-Yves David -
r28103:7d852bb4 default
parent child Browse files
Show More
@@ -193,31 +193,33 b' def _destmergebook(repo):'
193 def _destmergebranch(repo):
193 def _destmergebranch(repo):
194 """find merge destination based on branch heads"""
194 """find merge destination based on branch heads"""
195 node = None
195 node = None
196 parent = repo.dirstate.p1()
196 branch = repo[None].branch()
197 branch = repo[None].branch()
197 bheads = repo.branchheads(branch)
198 bheads = repo.branchheads(branch)
198 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
199 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
199
200
201 if parent not in bheads:
202 if len(repo.heads()) <= 1:
203 msg, hint = msgdestmerge['nootherheadsbehind']
204 else:
205 msg, hint = msgdestmerge['notatheads']
206 raise error.Abort(msg, hint=hint)
207
200 if len(nbhs) > 2:
208 if len(nbhs) > 2:
201 msg, hint = msgdestmerge['toomanyheads']
209 msg, hint = msgdestmerge['toomanyheads']
202 msg %= (branch, len(bheads))
210 msg %= (branch, len(bheads))
203 raise error.Abort(msg, hint=hint)
211 raise error.Abort(msg, hint=hint)
204
212
205 parent = repo.dirstate.p1()
206 if len(nbhs) <= 1:
213 if len(nbhs) <= 1:
207 if len(bheads) > 1:
214 if len(bheads) > 1:
208 msg, hint = msgdestmerge['bookmarkedheads']
215 msg, hint = msgdestmerge['bookmarkedheads']
209 elif len(repo.heads()) > 1:
216 elif len(repo.heads()) > 1:
210 msg, hint = msgdestmerge['nootherbranchheads']
217 msg, hint = msgdestmerge['nootherbranchheads']
211 msg %= branch
218 msg %= branch
212 elif parent != repo.lookup(branch):
213 msg, hint = msgdestmerge['nootherheadsbehind']
214 else:
219 else:
215 msg, hint = msgdestmerge['nootherheads']
220 msg, hint = msgdestmerge['nootherheads']
216 raise error.Abort(msg, hint=hint)
221 raise error.Abort(msg, hint=hint)
217
222
218 if parent not in bheads:
219 msg, hint = msgdestmerge['notatheads']
220 raise error.Abort(msg, hint=hint)
221 if parent == nbhs[0]:
223 if parent == nbhs[0]:
222 node = nbhs[-1]
224 node = nbhs[-1]
223 else:
225 else:
@@ -27,8 +27,8 b''
27 Should fail because not at a head:
27 Should fail because not at a head:
28
28
29 $ hg merge
29 $ hg merge
30 abort: branch 'default' has 3 heads - please merge with an explicit rev
30 abort: working directory not at a head revision
31 (run 'hg heads .' to see heads)
31 (use 'hg update' or merge with an explicit revision)
32 [255]
32 [255]
33
33
34 $ hg up
34 $ hg up
General Comments 0
You need to be logged in to leave comments. Login now