summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-12-31 08:52:42 -0500
committerTim Graham <timograham@gmail.com>2017-01-17 20:52:01 -0500
commite0910dcc9283cd8f782cb97836c291f6f395f3f0 (patch)
tree89310a2e660510adf218328cd8b7151ed0fb6c97
parentff419de263138e905dff44c5cb806310c70f32aa (diff)
Refs #25604 -- Removed makemigrations --exit option per deprecation timeline.
-rw-r--r--django/core/management/commands/makemigrations.py17
-rw-r--r--docs/ref/django-admin.txt6
-rw-r--r--docs/releases/1.8.txt2
-rw-r--r--docs/releases/2.0.txt2
-rw-r--r--tests/migrations/test_commands.py16
5 files changed, 4 insertions, 39 deletions
diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py
index 50460691d8..b6a31d16fd 100644
--- a/django/core/management/commands/makemigrations.py
+++ b/django/core/management/commands/makemigrations.py
@@ -1,7 +1,6 @@
import io
import os
import sys
-import warnings
from itertools import takewhile
from django.apps import apps
@@ -18,7 +17,6 @@ from django.db.migrations.questioner import (
from django.db.migrations.state import ProjectState
from django.db.migrations.utils import get_migration_name_timestamp
from django.db.migrations.writer import MigrationWriter
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.six import iteritems
from django.utils.six.moves import zip
@@ -53,11 +51,6 @@ class Command(BaseCommand):
help="Use this name for migration file(s).",
)
parser.add_argument(
- '-e', '--exit', action='store_true', dest='exit_code', default=False,
- help='Exit with error code 1 if no changes needing migrations are found. '
- 'Deprecated, use the --check option instead.',
- )
- parser.add_argument(
'--check', action='store_true', dest='check_changes',
help='Exit with a non-zero status if model changes are missing migrations.',
)
@@ -69,15 +62,8 @@ class Command(BaseCommand):
self.merge = options['merge']
self.empty = options['empty']
self.migration_name = options['name']
- self.exit_code = options['exit_code']
check_changes = options['check_changes']
- if self.exit_code:
- warnings.warn(
- "The --exit option is deprecated in favor of the --check option.",
- RemovedInDjango20Warning
- )
-
# Make sure the app they asked for exists
app_labels = set(app_labels)
bad_app_labels = set()
@@ -186,9 +172,6 @@ class Command(BaseCommand):
self.stdout.write("No changes detected in apps '%s'" % ("', '".join(app_labels)))
else:
self.stdout.write("No changes detected")
-
- if self.exit_code:
- sys.exit(1)
else:
self.write_migration_files(changes)
if check_changes:
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 47cff8e8c6..2a70803640 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -704,12 +704,6 @@ Enables fixing of migration conflicts.
Allows naming the generated migration(s) instead of using a generated name.
-.. django-admin-option:: --exit, -e
-
-.. deprecated:: 1.10
-
- Use the ``--check`` option instead.
-
Makes ``makemigrations`` exit with error code 1 when no migrations are created
(or would have been created, if combined with ``--dry-run``).
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 5cb91427c7..6c45b455ec 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -445,7 +445,7 @@ Management Commands
:setting:`FIXTURE_DIRS` contains duplicates or a default fixture directory
path (``app_name/fixtures``), an exception is raised.
-* The new :option:`makemigrations --exit` option allows exiting with an error
+* The new ``makemigrations --exit`` option allows exiting with an error
code if no migrations are created.
* The new :djadmin:`showmigrations` command allows listing all migrations and
diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt
index 5a57c22899..4c9347d554 100644
--- a/docs/releases/2.0.txt
+++ b/docs/releases/2.0.txt
@@ -319,3 +319,5 @@ these features.
* The ``django.template.loader.LoaderOrigin`` and
``django.template.base.StringOrigin`` aliases for
``django.template.base.Origin`` are removed.
+
+* The ``makemigrations --exit`` option is removed.
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index 6477873e0d..fd483b7f85 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -17,9 +17,8 @@ from django.db.migrations.exceptions import (
InconsistentMigrationHistory, MigrationSchemaMissing,
)
from django.db.migrations.recorder import MigrationRecorder
-from django.test import ignore_warnings, mock, override_settings
+from django.test import mock, override_settings
from django.utils import six
-from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.encoding import force_text
from .models import UnicodeModel, UnserializableModel
@@ -1232,19 +1231,6 @@ class MakeMigrationsTests(MigrationTestBase):
self.assertIn("dependencies=[\n('migrations','0001_%s'),\n]" % migration_name_0001, content)
self.assertIn("operations=[\n]", content)
- @ignore_warnings(category=RemovedInDjango20Warning)
- def test_makemigrations_exit(self):
- """
- makemigrations --exit should exit with sys.exit(1) when there are no
- changes to an app.
- """
- with self.temporary_migration_module():
- call_command("makemigrations", "--exit", "migrations", verbosity=0)
-
- with self.temporary_migration_module(module="migrations.test_migrations_no_changes"):
- with self.assertRaises(SystemExit):
- call_command("makemigrations", "--exit", "migrations", verbosity=0)
-
def test_makemigrations_check(self):
"""
makemigrations --check should exit with a non-zero status when