comparison mercurial/commands.py @ 10355:a5576908b589

merge: add hints about the use of 'hg heads' to find the rev to merge
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 07 Feb 2010 00:51:59 +0100
parents fd511e9eeea6
children de1e7099d100
comparison
equal deleted inserted replaced
10354:844d83da2da9 10355:a5576908b589
2134 2134
2135 if not node: 2135 if not node:
2136 branch = repo.changectx(None).branch() 2136 branch = repo.changectx(None).branch()
2137 bheads = repo.branchheads(branch) 2137 bheads = repo.branchheads(branch)
2138 if len(bheads) > 2: 2138 if len(bheads) > 2:
2139 raise util.Abort(_("branch '%s' has %d heads - " 2139 ui.warn(_("abort: branch '%s' has %d heads - "
2140 "please merge with an explicit rev") % 2140 "please merge with an explicit rev\n")
2141 (branch, len(bheads))) 2141 % (branch, len(bheads)))
2142 ui.status(_("(run 'hg heads .' to see heads)\n"))
2143 return False
2142 2144
2143 parent = repo.dirstate.parents()[0] 2145 parent = repo.dirstate.parents()[0]
2144 if len(bheads) == 1: 2146 if len(bheads) == 1:
2145 if len(repo.heads()) > 1: 2147 if len(repo.heads()) > 1:
2146 raise util.Abort(_("branch '%s' has one head - " 2148 ui.warn(_("abort: branch '%s' has one head - "
2147 "please merge with an explicit rev") % 2149 "please merge with an explicit rev\n" % branch))
2148 branch) 2150 ui.status(_("(run 'hg heads' to see all heads)\n"))
2151 return False
2149 msg = _('there is nothing to merge') 2152 msg = _('there is nothing to merge')
2150 if parent != repo.lookup(repo[None].branch()): 2153 if parent != repo.lookup(repo[None].branch()):
2151 msg = _('%s - use "hg update" instead') % msg 2154 msg = _('%s - use "hg update" instead') % msg
2152 raise util.Abort(msg) 2155 raise util.Abort(msg)
2153 2156