Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 5242: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 |
comparison
equal
deleted
inserted
replaced
5238:2b8373bda032 | 5242:9cd6578750b9 |
---|---|
1926 heads = repo.heads() | 1926 heads = repo.heads() |
1927 if len(heads) > 2: | 1927 if len(heads) > 2: |
1928 raise util.Abort(_('repo has %d heads - ' | 1928 raise util.Abort(_('repo has %d heads - ' |
1929 'please merge with an explicit rev') % | 1929 'please merge with an explicit rev') % |
1930 len(heads)) | 1930 len(heads)) |
1931 parent = repo.dirstate.parents()[0] | |
1931 if len(heads) == 1: | 1932 if len(heads) == 1: |
1932 raise util.Abort(_('there is nothing to merge - ' | 1933 msg = _('there is nothing to merge') |
1933 'use "hg update" instead')) | 1934 if parent != repo.lookup(repo.workingctx().branch()): |
1934 parent = repo.dirstate.parents()[0] | 1935 msg = _('%s - use "hg update" instead' % msg) |
1936 raise util.Abort(msg) | |
1937 | |
1935 if parent not in heads: | 1938 if parent not in heads: |
1936 raise util.Abort(_('working dir not at a head rev - ' | 1939 raise util.Abort(_('working dir not at a head rev - ' |
1937 'use "hg update" or merge with an explicit rev')) | 1940 'use "hg update" or merge with an explicit rev')) |
1938 node = parent == heads[0] and heads[-1] or heads[0] | 1941 node = parent == heads[0] and heads[-1] or heads[0] |
1939 return hg.merge(repo, node, force=force) | 1942 return hg.merge(repo, node, force=force) |