# HG changeset patch # User Alexis S. L. Carvalho # Date 1174015379 10800 # Node ID 83153299aab5648c7fc8e8f99c6ad2e2739e2cad # Parent c93562fb12cc5cc56b71515504ec714c3a3b9096 avoid a traceback with hg branch newbranch; hg up diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2563,7 +2563,10 @@ def _lookup(repo, node, branch=None): node = repo.lookup(node) else: wc = repo.workingctx() - node = repo.branchtags()[wc.branch()] + try: + node = repo.branchtags()[wc.branch()] + except KeyError: + raise util.Abort(_("branch %s not found") % wc.branch()) return node def verify(ui, repo): diff --git a/tests/test-newbranch b/tests/test-newbranch --- a/tests/test-newbranch +++ b/tests/test-newbranch @@ -46,3 +46,7 @@ hg id hg up -q 1 hg up -q hg id +hg branch foobar +hg up + +exit 0 diff --git a/tests/test-newbranch.out b/tests/test-newbranch.out --- a/tests/test-newbranch.out +++ b/tests/test-newbranch.out @@ -81,3 +81,4 @@ 67ec16bde7f1575d523313b9bca000f6a6f12dca % update with no arguments: tipmost revision of the current branch bf1bc2f45e83 4909a3732169 (foo) tip +abort: branch foobar not found