diff mercurial/commands.py @ 5224:9cd6578750b9

improve error message for 'hg merge' when repo already at branchtip
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 25 Aug 2007 11:30:11 +0200
parents ce4e67533723
children 5517aa5aafb0
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1928,10 +1928,13 @@ def merge(ui, repo, node=None, force=Non
             raise util.Abort(_('repo has %d heads - '
                                'please merge with an explicit rev') %
                              len(heads))
+        parent = repo.dirstate.parents()[0]
         if len(heads) == 1:
-            raise util.Abort(_('there is nothing to merge - '
-                               'use "hg update" instead'))
-        parent = repo.dirstate.parents()[0]
+            msg = _('there is nothing to merge')
+            if parent != repo.lookup(repo.workingctx().branch()):
+                msg = _('%s - use "hg update" instead' % msg)
+            raise util.Abort(msg)
+
         if parent not in heads:
             raise util.Abort(_('working dir not at a head rev - '
                                'use "hg update" or merge with an explicit rev'))