##// END OF EJS Templates
destutil: remove current head from list of candidates early...
Pierre-Yves David -
r28138:5ad20174 default
parent child Browse files
Show More
@@ -212,7 +212,6 b" def _destmergebranch(repo, action='merge"
212 parent = repo.dirstate.p1()
212 parent = repo.dirstate.p1()
213 branch = repo.dirstate.branch()
213 branch = repo.dirstate.branch()
214 bheads = repo.branchheads(branch)
214 bheads = repo.branchheads(branch)
215 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
216
215
217 if parent not in bheads:
216 if parent not in bheads:
218 # Case A: working copy if not on a head.
217 # Case A: working copy if not on a head.
@@ -223,21 +222,25 b" def _destmergebranch(repo, action='merge"
223 else:
222 else:
224 msg, hint = msgdestmerge['notatheads'][action]
223 msg, hint = msgdestmerge['notatheads'][action]
225 raise error.Abort(msg, hint=hint)
224 raise error.Abort(msg, hint=hint)
226 elif len(nbhs) > 2:
225 # remove current head from the set
227 # Case B: There is more than 2 anonymous heads
226 bheads = [bh for bh in bheads if bh != parent]
227 # filters out bookmarked heads
228 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
229 if len(nbhs) > 1:
230 # Case B: There is more than 1 other anonymous heads
228 #
231 #
229 # This means that there will be more than 1 candidate. This is
232 # This means that there will be more than 1 candidate. This is
230 # ambiguous. We abort asking the user to pick as explicit destination
233 # ambiguous. We abort asking the user to pick as explicit destination
231 # instead.
234 # instead.
232 msg, hint = msgdestmerge['toomanyheads'][action]
235 msg, hint = msgdestmerge['toomanyheads'][action]
233 msg %= (branch, len(bheads))
236 msg %= (branch, len(bheads) + 1)
234 raise error.Abort(msg, hint=hint)
237 raise error.Abort(msg, hint=hint)
235 elif len(nbhs) <= 1:
238 elif not nbhs:
236 # Case B: There is no other anonymous head that the one we are one
239 # Case B: There is no other anonymous heads
237 #
240 #
238 # This means that there is no natural candidate to merge with.
241 # This means that there is no natural candidate to merge with.
239 # We abort, with various messages for various cases.
242 # We abort, with various messages for various cases.
240 if len(bheads) > 1:
243 if bheads:
241 msg, hint = msgdestmerge['bookmarkedheads'][action]
244 msg, hint = msgdestmerge['bookmarkedheads'][action]
242 elif len(repo.heads()) > 1:
245 elif len(repo.heads()) > 1:
243 msg, hint = msgdestmerge['nootherbranchheads'][action]
246 msg, hint = msgdestmerge['nootherbranchheads'][action]
@@ -245,8 +248,6 b" def _destmergebranch(repo, action='merge"
245 else:
248 else:
246 msg, hint = msgdestmerge['nootherheads'][action]
249 msg, hint = msgdestmerge['nootherheads'][action]
247 raise error.Abort(msg, hint=hint)
250 raise error.Abort(msg, hint=hint)
248 elif parent == nbhs[0]:
249 node = nbhs[-1]
250 else:
251 else:
251 node = nbhs[0]
252 node = nbhs[0]
252 assert node is not None
253 assert node is not None
General Comments 0
You need to be logged in to leave comments. Login now