- restore the starting arg error back to the original intent

This commit is contained in:
Mike Bayer 2014-11-17 17:51:59 -05:00
parent 45d77d0d4c
commit ce3abfa790
2 changed files with 7 additions and 3 deletions

View File

@ -179,10 +179,14 @@ class EnvironmentContext(object):
if self._migration_context is not None:
return self.script.as_revision_number(
self.get_context()._start_from_rev)
elif self.context_opts.get('starting_rev') is not None:
elif 'starting_rev' in self.context_opts:
return self.script.as_revision_number(
self.context_opts['starting_rev'])
else:
# this should raise only in the case that a command
# is being run where the "starting rev" is never applicable;
# this is to catch scripts which rely upon this in
# non-sql mode or similar
raise util.CommandError(
"No starting revision argument is available.")

View File

@ -53,14 +53,14 @@ assert context.get_starting_revision_argument() == 'x'
command.upgrade(self.cfg, "x:y", sql=True)
command.downgrade(self.cfg, "x:y", sql=True)
def test_starting_rev_pre_context_stamp(self):
def test_starting_rev_pre_context_cmd_w_no_startrev(self):
env_file_fixture("""
assert context.get_starting_revision_argument() == 'x'
""")
assert_raises_message(
util.CommandError,
"No starting revision argument is available.",
command.stamp, self.cfg, a)
command.current, self.cfg)
def test_starting_rev_current_pre_context(self):
env_file_fixture("""