Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c8df17b6
Kaydet (Commit)
c8df17b6
authored
May 08, 2016
tarafından
Jarek Glowacki
Kaydeden (comit)
Markus Holtermann
May 08, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Included reverse deps in showmigrations
üst
509379a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
22 deletions
+23
-22
showmigrations.py
django/core/management/commands/showmigrations.py
+15
-13
test_commands.py
tests/migrations/test_commands.py
+8
-9
No files found.
django/core/management/commands/showmigrations.py
Dosyayı görüntüle @
c8df17b6
...
...
@@ -26,7 +26,11 @@ class Command(BaseCommand):
)
formats
.
add_argument
(
'--plan'
,
'-p'
,
action
=
'store_const'
,
dest
=
'format'
,
const
=
'plan'
,
help
=
'Shows all migrations in the order they will be applied.'
,
help
=
(
'Shows all migrations in the order they will be applied. '
'With a verbosity level of 2 or above all direct migration dependencies '
'and reverse dependencies (run_before) will be included.'
)
)
parser
.
set_defaults
(
format
=
'list'
)
...
...
@@ -99,26 +103,24 @@ class Command(BaseCommand):
for
target
in
targets
:
for
migration
in
graph
.
forwards_plan
(
target
):
if
migration
not
in
seen
:
plan
.
append
(
graph
.
nodes
[
migration
])
node
=
graph
.
node_map
[
migration
]
plan
.
append
(
node
)
seen
.
add
(
migration
)
# Output
def
print_deps
(
migration
):
def
print_deps
(
node
):
out
=
[]
for
dep
in
migration
.
dependencies
:
if
dep
[
1
]
==
"__first__"
:
roots
=
graph
.
root_nodes
(
dep
[
0
])
dep
=
roots
[
0
]
if
roots
else
(
dep
[
0
],
"__first__"
)
out
.
append
(
"
%
s.
%
s"
%
dep
)
for
parent
in
sorted
(
node
.
parents
):
out
.
append
(
"
%
s.
%
s"
%
parent
.
key
)
if
out
:
return
" ... (
%
s)"
%
", "
.
join
(
out
)
return
""
for
migration
in
plan
:
for
node
in
plan
:
deps
=
""
if
self
.
verbosity
>=
2
:
deps
=
print_deps
(
migration
)
if
(
migration
.
app_label
,
migration
.
name
)
in
loader
.
applied_migrations
:
self
.
stdout
.
write
(
"[X]
%
s
%
s"
%
(
migration
,
deps
))
deps
=
print_deps
(
node
)
if
node
.
key
in
loader
.
applied_migrations
:
self
.
stdout
.
write
(
"[X]
%
s
.
%
s
%
s"
%
(
node
.
key
[
0
],
node
.
key
[
1
]
,
deps
))
else
:
self
.
stdout
.
write
(
"[ ]
%
s
%
s"
%
(
migration
,
deps
))
self
.
stdout
.
write
(
"[ ]
%
s
.
%
s
%
s"
%
(
node
.
key
[
0
],
node
.
key
[
1
]
,
deps
))
tests/migrations/test_commands.py
Dosyayı görüntüle @
c8df17b6
...
...
@@ -228,39 +228,38 @@ class MigrateTests(MigrationTestBase):
"""
out
=
six
.
StringIO
()
call_command
(
"showmigrations"
,
format
=
'plan'
,
stdout
=
out
)
self
.
assert
In
(
self
.
assert
Equal
(
"[ ] migrations.0001_initial
\n
"
"[ ] migrations.0003_third
\n
"
"[ ] migrations.0002_second"
,
"[ ] migrations.0002_second
\n
"
,
out
.
getvalue
()
.
lower
()
)
out
=
six
.
StringIO
()
call_command
(
"showmigrations"
,
format
=
'plan'
,
stdout
=
out
,
verbosity
=
2
)
self
.
assert
In
(
self
.
assert
Equal
(
"[ ] migrations.0001_initial
\n
"
"[ ] migrations.0003_third ... (migrations.0001_initial)
\n
"
"[ ] migrations.0002_second ... (migrations.0001_initial
)
"
,
"[ ] migrations.0002_second ... (migrations.0001_initial
, migrations.0003_third)
\n
"
,
out
.
getvalue
()
.
lower
()
)
call_command
(
"migrate"
,
"migrations"
,
"0003"
,
verbosity
=
0
)
out
=
six
.
StringIO
()
call_command
(
"showmigrations"
,
format
=
'plan'
,
stdout
=
out
)
self
.
assert
In
(
self
.
assert
Equal
(
"[x] migrations.0001_initial
\n
"
"[x] migrations.0003_third
\n
"
"[ ] migrations.0002_second"
,
"[ ] migrations.0002_second
\n
"
,
out
.
getvalue
()
.
lower
()
)
out
=
six
.
StringIO
()
call_command
(
"showmigrations"
,
format
=
'plan'
,
stdout
=
out
,
verbosity
=
2
)
self
.
assert
In
(
self
.
assert
Equal
(
"[x] migrations.0001_initial
\n
"
"[x] migrations.0003_third ... (migrations.0001_initial)
\n
"
"[ ] migrations.0002_second ... (migrations.0001_initial
)
"
,
"[ ] migrations.0002_second ... (migrations.0001_initial
, migrations.0003_third)
\n
"
,
out
.
getvalue
()
.
lower
()
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment