- restore the starting arg error back to the original intent
This commit is contained in:
parent
45d77d0d4c
commit
ce3abfa790
|
@ -179,10 +179,14 @@ class EnvironmentContext(object):
|
||||||
if self._migration_context is not None:
|
if self._migration_context is not None:
|
||||||
return self.script.as_revision_number(
|
return self.script.as_revision_number(
|
||||||
self.get_context()._start_from_rev)
|
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(
|
return self.script.as_revision_number(
|
||||||
self.context_opts['starting_rev'])
|
self.context_opts['starting_rev'])
|
||||||
else:
|
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(
|
raise util.CommandError(
|
||||||
"No starting revision argument is available.")
|
"No starting revision argument is available.")
|
||||||
|
|
||||||
|
|
|
@ -53,14 +53,14 @@ assert context.get_starting_revision_argument() == 'x'
|
||||||
command.upgrade(self.cfg, "x:y", sql=True)
|
command.upgrade(self.cfg, "x:y", sql=True)
|
||||||
command.downgrade(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("""
|
env_file_fixture("""
|
||||||
assert context.get_starting_revision_argument() == 'x'
|
assert context.get_starting_revision_argument() == 'x'
|
||||||
""")
|
""")
|
||||||
assert_raises_message(
|
assert_raises_message(
|
||||||
util.CommandError,
|
util.CommandError,
|
||||||
"No starting revision argument is available.",
|
"No starting revision argument is available.",
|
||||||
command.stamp, self.cfg, a)
|
command.current, self.cfg)
|
||||||
|
|
||||||
def test_starting_rev_current_pre_context(self):
|
def test_starting_rev_current_pre_context(self):
|
||||||
env_file_fixture("""
|
env_file_fixture("""
|
||||||
|
|
Loading…
Reference in New Issue