From c044ef8de0053a1305a6b7ddc369bf122d3850d0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves David Date: Thu, 18 Apr 2013 15:27:50 +0200 Subject: [PATCH] histedit: more precise user message when changeset is missing Now that we explicitly detect duplicated changesets, we can explicitly detect missing ones. We cover the same cases as before, some others and we offer a better error message in all cases. --- hgext/histedit.py | 6 ++++-- tests/test-histedit-arguments.t | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hgext/histedit.py b/hgext/histedit.py index fdc0698179..64ca670945 100644 --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -718,8 +718,6 @@ def verifyrules(rules, repo, ctxs): parsed = [] expected = set(str(c) for c in ctxs) seen = set() - if len(rules) != len(expected): - raise util.Abort(_('must specify a rule for each changeset once')) for r in rules: if ' ' not in r: raise util.Abort(_('malformed line "%s"') % r) @@ -738,6 +736,10 @@ def verifyrules(rules, repo, ctxs): if action not in actiontable: raise util.Abort(_('unknown action "%s"') % action) parsed.append([action, ha]) + missing = sorted(expected - seen) # sort to stabilize output + if missing: + raise util.Abort(_('missing rules for changeset %s') % missing[0], + hint=_('do you want to use the drop action?')) return parsed def processreplacement(repo, replacements): diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t index c2a4473e1a..8d51376c16 100644 --- a/tests/test-histedit-arguments.t +++ b/tests/test-histedit-arguments.t @@ -77,7 +77,8 @@ Test that missing revisions are detected > pick eb57da33312f 2 three > pick 08d98a8350f3 4 five > EOF - abort: must specify a rule for each changeset once + abort: missing rules for changeset c8e68270e35a + (do you want to use the drop action?) [255] Test that extra revisions are detected