# HG changeset patch # User Pierre-Yves David # Date 1499988754 -7200 # Node ID 3f27fe80be265d723f4000ee72b84f3b9f5d23b9 # Parent 66278c4d9c07946709ea8202ab14f859ea1ce059 prev: issue a proper error when reaching repository root (and adds the associated test) diff -r 66278c4d9c07 -r 3f27fe80be26 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Fri Jul 14 01:21:32 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Fri Jul 14 01:32:34 2017 +0200 @@ -2038,7 +2038,10 @@ if topic and not opts.get("no_topic", False): parents = [ctx for ctx in parents if ctx.topic() == topic] displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) - if not parents: + if wparents[0].node() == node.nullid: + ui.warn(_('already at repository root\n')) + return 1 + elif not parents and topic: ui.warn(_('no parent in topic "%s"\n') % topic) ui.warn(_('(do you want --no-topic)\n')) elif len(parents) == 1: diff -r 66278c4d9c07 -r 3f27fe80be26 tests/test-prev-next.t --- a/tests/test-prev-next.t Fri Jul 14 01:21:32 2017 +0200 +++ b/tests/test-prev-next.t Fri Jul 14 01:32:34 2017 +0200 @@ -94,6 +94,15 @@ mark 2:4e26ef31f919 no-move 2:4e26ef31f919 +test prev on root + + $ hg up null + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg prev + already at repository root + [1] + $ hg up 1 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved Behavior with local modification --------------------------------