##// END OF EJS Templates
merge: when current branch has 1 or > 2 heads, actually abort....
Greg Ward -
r11353:f2b25e8e default
parent child Browse files
Show More
@@ -2561,19 +2561,20 b' def merge(ui, repo, node=None, **opts):'
2561 branch = repo.changectx(None).branch()
2561 branch = repo.changectx(None).branch()
2562 bheads = repo.branchheads(branch)
2562 bheads = repo.branchheads(branch)
2563 if len(bheads) > 2:
2563 if len(bheads) > 2:
2564 ui.warn(_("abort: branch '%s' has %d heads - "
2564 raise util.Abort(_(
2565 "please merge with an explicit rev\n")
2565 'branch \'%s\' has %d heads - '
2566 % (branch, len(bheads)))
2566 'please merge with an explicit rev\n'
2567 ui.status(_("(run 'hg heads .' to see heads)\n"))
2567 '(run \'hg heads .\' to see heads)')
2568 return False
2568 % (branch, len(bheads)))
2569
2569
2570 parent = repo.dirstate.parents()[0]
2570 parent = repo.dirstate.parents()[0]
2571 if len(bheads) == 1:
2571 if len(bheads) == 1:
2572 if len(repo.heads()) > 1:
2572 if len(repo.heads()) > 1:
2573 ui.warn(_("abort: branch '%s' has one head - "
2573 raise util.Abort(_(
2574 "please merge with an explicit rev\n" % branch))
2574 'branch \'%s\' has one head - '
2575 ui.status(_("(run 'hg heads' to see all heads)\n"))
2575 'please merge with an explicit rev\n'
2576 return False
2576 '(run \'hg heads\' to see all heads)')
2577 % branch)
2577 msg = _('there is nothing to merge')
2578 msg = _('there is nothing to merge')
2578 if parent != repo.lookup(repo[None].branch()):
2579 if parent != repo.lookup(repo[None].branch()):
2579 msg = _('%s - use "hg update" instead') % msg
2580 msg = _('%s - use "hg update" instead') % msg
General Comments 0
You need to be logged in to leave comments. Login now