diff options
39 files changed, 991 insertions, 344 deletions
diff --git a/patchwork/migrations/0001_initial.py b/patchwork/migrations/0001_initial.py index 374b188..295fa76 100644 --- a/patchwork/migrations/0001_initial.py +++ b/patchwork/migrations/0001_initial.py @@ -18,96 +18,207 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Bundle', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('name', models.CharField(max_length=50)), ('public', models.BooleanField(default=False)), - ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + 'owner', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( name='BundlePatch', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('order', models.IntegerField()), - ('bundle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Bundle')), + ( + 'bundle', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Bundle', + ), + ), ], - options={ - 'ordering': ['order'], - }, + options={'ordering': ['order']}, ), migrations.CreateModel( name='Comment', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('msgid', models.CharField(max_length=255)), ('date', models.DateTimeField(default=datetime.datetime.now)), ('headers', models.TextField(blank=True)), ('content', models.TextField()), ], - options={ - 'ordering': ['date'], - }, + options={'ordering': ['date']}, ), migrations.CreateModel( name='EmailConfirmation', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('type', models.CharField(max_length=20, choices=[(b'userperson', b'User-Person association'), (b'registration', b'Registration'), (b'optout', b'Email opt-out')])), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), + ( + 'type', + models.CharField( + max_length=20, + choices=[ + (b'userperson', b'User-Person association'), + (b'registration', b'Registration'), + (b'optout', b'Email opt-out'), + ], + ), + ), ('email', models.CharField(max_length=200)), ('key', patchwork.models.HashField(max_length=40)), ('date', models.DateTimeField(default=datetime.datetime.now)), ('active', models.BooleanField(default=True)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, null=True)), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + null=True, + ), + ), ], ), migrations.CreateModel( name='EmailOptout', fields=[ - ('email', models.CharField(max_length=200, serialize=False, primary_key=True)), + ( + 'email', + models.CharField( + max_length=200, serialize=False, primary_key=True + ), + ), ], ), migrations.CreateModel( name='Patch', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('msgid', models.CharField(max_length=255)), ('name', models.CharField(max_length=255)), ('date', models.DateTimeField(default=datetime.datetime.now)), ('archived', models.BooleanField(default=False)), ('headers', models.TextField(blank=True)), ('content', models.TextField(null=True, blank=True)), - ('pull_url', models.CharField(max_length=255, null=True, blank=True)), - ('commit_ref', models.CharField(max_length=255, null=True, blank=True)), - ('hash', patchwork.models.HashField(max_length=40, null=True, blank=True)), + ( + 'pull_url', + models.CharField(max_length=255, null=True, blank=True), + ), + ( + 'commit_ref', + models.CharField(max_length=255, null=True, blank=True), + ), + ( + 'hash', + patchwork.models.HashField( + max_length=40, null=True, blank=True + ), + ), ], - options={ - 'ordering': ['date'], - 'verbose_name_plural': 'Patches', - }, + options={'ordering': ['date'], 'verbose_name_plural': 'Patches'}, ), migrations.CreateModel( name='PatchTag', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('count', models.IntegerField(default=1)), ], ), migrations.CreateModel( name='Person', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('email', models.CharField(unique=True, max_length=255)), - ('name', models.CharField(max_length=255, null=True, blank=True)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ( + 'name', + models.CharField(max_length=255, null=True, blank=True), + ), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.SET_NULL, + blank=True, + to=settings.AUTH_USER_MODEL, + null=True, + ), + ), ], - options={ - 'verbose_name_plural': 'People', - }, + options={'verbose_name_plural': 'People'}, ), migrations.CreateModel( name='Project', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('linkname', models.CharField(unique=True, max_length=255)), ('name', models.CharField(unique=True, max_length=255)), ('listid', models.CharField(unique=True, max_length=255)), @@ -118,131 +229,247 @@ class Migration(migrations.Migration): ('send_notifications', models.BooleanField(default=False)), ('use_tags', models.BooleanField(default=True)), ], - options={ - 'ordering': ['linkname'], - }, + options={'ordering': ['linkname']}, ), migrations.CreateModel( name='State', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('name', models.CharField(max_length=100)), ('ordering', models.IntegerField(unique=True)), ('action_required', models.BooleanField(default=True)), ], - options={ - 'ordering': ['ordering'], - }, + options={'ordering': ['ordering']}, ), migrations.CreateModel( name='Tag', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('name', models.CharField(max_length=20)), - ('pattern', models.CharField(help_text=b'A simple regex to match the tag in the content of a message. Will be used with MULTILINE and IGNORECASE flags. eg. ^Acked-by:', max_length=50)), - ('abbrev', models.CharField(help_text=b'Short (one-or-two letter) abbreviation for the tag, used in table column headers', unique=True, max_length=2)), + ( + 'pattern', + models.CharField( + help_text=b'A simple regex to match the tag in the ' + b'content of a message. Will be used with ' + b'MULTILINE and IGNORECASE flags. eg. ' + b'^Acked-by:', + max_length=50, + ), + ), + ( + 'abbrev', + models.CharField( + help_text=b'Short (one-or-two letter) abbreviation ' + b'for the tag, used in table column headers', + unique=True, + max_length=2, + ), + ), ], - options={ - 'ordering': ['abbrev'], - }, + options={'ordering': ['abbrev']}, ), migrations.CreateModel( name='UserProfile', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('send_email', models.BooleanField(default=False, help_text=b'Selecting this option allows patchwork to send email on your behalf')), - ('patches_per_page', models.PositiveIntegerField(default=100, help_text=b'Number of patches to display per page')), - ('maintainer_projects', models.ManyToManyField(related_name='maintainer_project', to='patchwork.Project')), - ('primary_project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to='patchwork.Project', null=True)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), + ( + 'send_email', + models.BooleanField( + default=False, + help_text=b'Selecting this option allows patchwork to ' + b'send email on your behalf', + ), + ), + ( + 'patches_per_page', + models.PositiveIntegerField( + default=100, + help_text=b'Number of patches to display per page', + ), + ), + ( + 'maintainer_projects', + models.ManyToManyField( + related_name='maintainer_project', + to='patchwork.Project', + ), + ), + ( + 'primary_project', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + blank=True, + to='patchwork.Project', + null=True, + ), + ), + ( + 'user', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + related_name='profile', + to=settings.AUTH_USER_MODEL, + ), + ), ], ), migrations.CreateModel( name='PatchChangeNotification', fields=[ - ('patch', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='patchwork.Patch')), - ('last_modified', models.DateTimeField(default=datetime.datetime.now)), - ('orig_state', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.State')), + ( + 'patch', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + primary_key=True, + serialize=False, + to='patchwork.Patch', + ), + ), + ( + 'last_modified', + models.DateTimeField(default=datetime.datetime.now), + ), + ( + 'orig_state', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.State', + ), + ), ], ), migrations.AddField( model_name='patchtag', name='patch', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Patch'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Patch', + ), ), migrations.AddField( model_name='patchtag', name='tag', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Tag'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to='patchwork.Tag' + ), ), migrations.AddField( model_name='patch', name='delegate', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + blank=True, + to=settings.AUTH_USER_MODEL, + null=True, + ), ), migrations.AddField( model_name='patch', name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Project'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Project', + ), ), migrations.AddField( model_name='patch', name='state', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.State'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.State', + ), ), migrations.AddField( model_name='patch', name='submitter', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Person'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Person', + ), ), migrations.AddField( model_name='patch', name='tags', - field=models.ManyToManyField(to='patchwork.Tag', through='patchwork.PatchTag'), + field=models.ManyToManyField( + to='patchwork.Tag', through='patchwork.PatchTag' + ), ), migrations.AddField( model_name='comment', name='patch', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Patch'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Patch', + ), ), migrations.AddField( model_name='comment', name='submitter', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Person'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Person', + ), ), migrations.AddField( model_name='bundlepatch', name='patch', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Patch'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Patch', + ), ), migrations.AddField( model_name='bundle', name='patches', - field=models.ManyToManyField(to='patchwork.Patch', through='patchwork.BundlePatch'), + field=models.ManyToManyField( + to='patchwork.Patch', through='patchwork.BundlePatch' + ), ), migrations.AddField( model_name='bundle', name='project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Project'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Project', + ), ), migrations.AlterUniqueTogether( - name='patchtag', - unique_together=set([('patch', 'tag')]), + name='patchtag', unique_together=set([('patch', 'tag')]), ), migrations.AlterUniqueTogether( - name='patch', - unique_together=set([('msgid', 'project')]), + name='patch', unique_together=set([('msgid', 'project')]), ), migrations.AlterUniqueTogether( - name='comment', - unique_together=set([('msgid', 'patch')]), + name='comment', unique_together=set([('msgid', 'patch')]), ), migrations.AlterUniqueTogether( - name='bundlepatch', - unique_together=set([('bundle', 'patch')]), + name='bundlepatch', unique_together=set([('bundle', 'patch')]), ), migrations.AlterUniqueTogether( - name='bundle', - unique_together=set([('owner', 'name')]), + name='bundle', unique_together=set([('owner', 'name')]), ), ] diff --git a/patchwork/migrations/0002_fix_patch_state_default_values.py b/patchwork/migrations/0002_fix_patch_state_default_values.py index d187dff..f02c507 100644 --- a/patchwork/migrations/0002_fix_patch_state_default_values.py +++ b/patchwork/migrations/0002_fix_patch_state_default_values.py @@ -15,6 +15,10 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='patch', name='state', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.State', null=True), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.State', + null=True, + ), ), ] diff --git a/patchwork/migrations/0003_add_check_model.py b/patchwork/migrations/0003_add_check_model.py index 8be9631..d296e91 100644 --- a/patchwork/migrations/0003_add_check_model.py +++ b/patchwork/migrations/0003_add_check_model.py @@ -18,17 +18,74 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Check', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('date', models.DateTimeField(default=datetime.datetime.now)), - ('state', models.SmallIntegerField(default=0, help_text=b'The state of the check.', choices=[(0, b'pending'), (1, b'success'), (2, b'warning'), (3, b'fail')])), - ('target_url', models.URLField(help_text=b'The target URL to associate with this check. This should be specific to the patch.', null=True, blank=True)), - ('description', models.TextField(help_text=b'A brief description of the check.', null=True, blank=True)), - ('context', models.CharField(default=b'default', max_length=255, null=True, help_text=b'A label to discern check from checks of other testing systems.', blank=True)), - ('patch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Patch')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + 'state', + models.SmallIntegerField( + default=0, + help_text=b'The state of the check.', + choices=[ + (0, b'pending'), + (1, b'success'), + (2, b'warning'), + (3, b'fail'), + ], + ), + ), + ( + 'target_url', + models.URLField( + help_text=b'The target URL to associate with this ' + b'check. This should be specific to the ' + b'patch.', + null=True, + blank=True, + ), + ), + ( + 'description', + models.TextField( + help_text=b'A brief description of the check.', + null=True, + blank=True, + ), + ), + ( + 'context', + models.CharField( + default=b'default', + max_length=255, + null=True, + help_text=b'A label to discern check from checks of ' + b'other testing systems.', + blank=True, + ), + ), + ( + 'patch', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Patch', + ), + ), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], - options={ - }, + options={}, bases=(models.Model,), ), ] diff --git a/patchwork/migrations/0004_add_delegation_rule_model.py b/patchwork/migrations/0004_add_delegation_rule_model.py index 7fd0bc9..717c10d 100644 --- a/patchwork/migrations/0004_add_delegation_rule_model.py +++ b/patchwork/migrations/0004_add_delegation_rule_model.py @@ -17,18 +17,35 @@ class Migration(migrations.Migration): migrations.CreateModel( name='DelegationRule', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField( + verbose_name='ID', + serialize=False, + auto_created=True, + primary_key=True, + ), + ), ('path', models.CharField(max_length=255)), ('priority', models.IntegerField(default=0)), - ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Project')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + 'project', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Project', + ), + ), + ( + 'user', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], - options={ - 'ordering': ['-priority', 'path'], - }, + options={'ordering': ['-priority', 'path']}, ), migrations.AlterUniqueTogether( - name='delegationrule', - unique_together=set([('path', 'project')]), + name='delegationrule', unique_together=set([('path', 'project')]), ), ] diff --git a/patchwork/migrations/0005_unselectable_maintainer_projects.py b/patchwork/migrations/0005_unselectable_maintainer_projects.py index d7b66b3..7d6be1b 100644 --- a/patchwork/migrations/0005_unselectable_maintainer_projects.py +++ b/patchwork/migrations/0005_unselectable_maintainer_projects.py @@ -14,6 +14,10 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='userprofile', name='maintainer_projects', - field=models.ManyToManyField(related_name='maintainer_project', to='patchwork.Project', blank=True), + field=models.ManyToManyField( + related_name='maintainer_project', + to='patchwork.Project', + blank=True, + ), ), ] diff --git a/patchwork/migrations/0006_add_patch_diff.py b/patchwork/migrations/0006_add_patch_diff.py index 73fc6ac..118cf13 100644 --- a/patchwork/migrations/0006_add_patch_diff.py +++ b/patchwork/migrations/0006_add_patch_diff.py @@ -13,9 +13,7 @@ class Migration(migrations.Migration): operations = [ migrations.RenameField( - model_name='patch', - old_name='content', - new_name='diff', + model_name='patch', old_name='content', new_name='diff', ), migrations.AddField( model_name='patch', @@ -29,6 +27,7 @@ class Migration(migrations.Migration): on_delete=django.db.models.deletion.CASCADE, related_query_name=b'comment', related_name='comments', - to='patchwork.Patch'), + to='patchwork.Patch', + ), ), ] diff --git a/patchwork/migrations/0007_move_comment_content_to_patch_content.py b/patchwork/migrations/0007_move_comment_content_to_patch_content.py index f6ad057..45776a3 100644 --- a/patchwork/migrations/0007_move_comment_content_to_patch_content.py +++ b/patchwork/migrations/0007_move_comment_content_to_patch_content.py @@ -6,20 +6,24 @@ from django.db import connection, migrations def copy_comment_field(apps, schema_editor): if connection.vendor == 'postgresql': - schema_editor.execute(''' + schema_editor.execute( + ''' UPDATE patchwork_patch SET content = patchwork_comment.content FROM patchwork_comment WHERE patchwork_patch.id=patchwork_comment.patch_id AND patchwork_patch.msgid=patchwork_comment.msgid - ''') + ''' + ) elif connection.vendor == 'mysql': - schema_editor.execute(''' + schema_editor.execute( + ''' UPDATE patchwork_patch, patchwork_comment SET patchwork_patch.content = patchwork_comment.content WHERE patchwork_patch.id=patchwork_comment.patch_id AND patchwork_patch.msgid=patchwork_comment.msgid - ''') + ''' + ) else: Comment = apps.get_model('patchwork', 'Comment') Patch = apps.get_model('patchwork', 'Patch') @@ -39,19 +43,23 @@ def copy_comment_field(apps, schema_editor): def remove_duplicate_comments(apps, schema_editor): if connection.vendor == 'postgresql': - schema_editor.execute(''' + schema_editor.execute( + ''' DELETE FROM patchwork_comment USING patchwork_patch WHERE patchwork_patch.id=patchwork_comment.patch_id AND patchwork_patch.msgid=patchwork_comment.msgid - ''') + ''' + ) elif connection.vendor == 'mysql': - schema_editor.execute(''' + schema_editor.execute( + ''' DELETE FROM patchwork_comment USING patchwork_patch, patchwork_comment WHERE patchwork_patch.id=patchwork_comment.patch_id AND patchwork_patch.msgid=patchwork_comment.msgid - ''') + ''' + ) else: Comment = apps.get_model('patchwork', 'Comment') Patch = apps.get_model('patchwork', 'Patch') @@ -78,9 +86,14 @@ def recreate_comments(apps, schema_editor): for patch in Patch.objects.all(): if patch.content: - comment = Comment(patch=patch, msgid=patch.msgid, date=patch.date, - headers=patch.headers, submitter=patch.submitter, - content=patch.content) + comment = Comment( + patch=patch, + msgid=patch.msgid, + date=patch.date, + headers=patch.headers, + submitter=patch.submitter, + content=patch.content, + ) comment.save() @@ -91,8 +104,10 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(copy_comment_field, uncopy_comment_field, - atomic=False), - migrations.RunPython(remove_duplicate_comments, recreate_comments, - atomic=False), + migrations.RunPython( + copy_comment_field, uncopy_comment_field, atomic=False + ), + migrations.RunPython( + remove_duplicate_comments, recreate_comments, atomic=False + ), ] diff --git a/patchwork/migrations/0009_add_submission_model.py b/patchwork/migrations/0009_add_submission_model.py index ebd85f9..f3468e6 100644 --- a/patchwork/migrations/0009_add_submission_model.py +++ b/patchwork/migrations/0009_add_submission_model.py @@ -16,24 +16,16 @@ class Migration(migrations.Migration): operations = [ # Rename the 'Patch' to 'Submission' - migrations.RenameModel( - old_name='Patch', - new_name='Submission' - ), + migrations.RenameModel(old_name='Patch', new_name='Submission'), migrations.AlterModelOptions( - name='submission', - options={'ordering': ['date']}, + name='submission', options={'ordering': ['date']}, ), - # Rename the non-Patch specific references to point to Submission migrations.RenameField( - model_name='comment', - old_name='patch', - new_name='submission', + model_name='comment', old_name='patch', new_name='submission', ), migrations.AlterUniqueTogether( - name='comment', - unique_together=set([('msgid', 'submission')]), + name='comment', unique_together=set([('msgid', 'submission')]), ), migrations.RenameField( model_name='userprofile', @@ -44,42 +36,68 @@ class Migration(migrations.Migration): model_name='userprofile', name='items_per_page', field=models.PositiveIntegerField( - default=100, - help_text=b'Number of items to display per page'), + default=100, help_text=b'Number of items to display per page' + ), ), - # Recreate the 'Patch' model as a subclass of 'Submission'. Each field # is given a unique name to prevent it conflicting with the same field # found in the 'Submission' "super model". We will fix this later. migrations.CreateModel( name='Patch', fields=[ - ('submission_ptr', models.OneToOneField( - parent_link=True, auto_created=True, primary_key=True, - on_delete=django.db.models.deletion.CASCADE, - serialize=False, to='patchwork.Submission')), + ( + 'submission_ptr', + models.OneToOneField( + parent_link=True, + auto_created=True, + primary_key=True, + on_delete=django.db.models.deletion.CASCADE, + serialize=False, + to='patchwork.Submission', + ), + ), ('diff2', models.TextField(null=True, blank=True)), - ('commit_ref2', models.CharField( - max_length=255, null=True, blank=True)), - ('pull_url2', models.CharField( - max_length=255, null=True, blank=True)), + ( + 'commit_ref2', + models.CharField(max_length=255, null=True, blank=True), + ), + ( + 'pull_url2', + models.CharField(max_length=255, null=True, blank=True), + ), # we won't migrate the data of this, seeing as it's # automatically recreated every time we save a Patch - ('tags2', models.ManyToManyField( - to='patchwork.Tag', through='patchwork.PatchTag')), - ('delegate2', models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - blank=True, to=settings.AUTH_USER_MODEL, null=True)), - ('state2', models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to='patchwork.State')), + ( + 'tags2', + models.ManyToManyField( + to='patchwork.Tag', through='patchwork.PatchTag' + ), + ), + ( + 'delegate2', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + blank=True, + to=settings.AUTH_USER_MODEL, + null=True, + ), + ), + ( + 'state2', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.State', + ), + ), ('archived2', models.BooleanField(default=False)), - ('hash2', patchwork.models.HashField( - max_length=40, null=True, blank=True)), + ( + 'hash2', + patchwork.models.HashField( + max_length=40, null=True, blank=True + ), + ), ], - options={ - 'verbose_name_plural': 'Patches', - }, + options={'verbose_name_plural': 'Patches'}, bases=('patchwork.submission',), ), ] diff --git a/patchwork/migrations/0010_migrate_data_from_submission_to_patch.py b/patchwork/migrations/0010_migrate_data_from_submission_to_patch.py index fe4291b..c3e25b9 100644 --- a/patchwork/migrations/0010_migrate_data_from_submission_to_patch.py +++ b/patchwork/migrations/0010_migrate_data_from_submission_to_patch.py @@ -25,6 +25,6 @@ class Migration(migrations.Migration): archived=archived2, hash=hash2 FROM patchwork_patch WHERE patchwork_submission.id = patchwork_patch.submission_ptr_id - ''' + ''', ), ] diff --git a/patchwork/migrations/0011_remove_temp_fields.py b/patchwork/migrations/0011_remove_temp_fields.py index 57475f9..ffe73da 100644 --- a/patchwork/migrations/0011_remove_temp_fields.py +++ b/patchwork/migrations/0011_remove_temp_fields.py @@ -13,119 +13,87 @@ class Migration(migrations.Migration): operations = [ # Remove duplicate fields from 'Submission' and rename 'Patch' version - migrations.RemoveField( - model_name='submission', - name='diff', - ), + migrations.RemoveField(model_name='submission', name='diff',), migrations.RenameField( - model_name='patch', - old_name='diff2', - new_name='diff', - ), - migrations.RemoveField( - model_name='submission', - name='commit_ref', + model_name='patch', old_name='diff2', new_name='diff', ), + migrations.RemoveField(model_name='submission', name='commit_ref',), migrations.RenameField( - model_name='patch', - old_name='commit_ref2', - new_name='commit_ref', - ), - migrations.RemoveField( - model_name='submission', - name='pull_url', + model_name='patch', old_name='commit_ref2', new_name='commit_ref', ), + migrations.RemoveField(model_name='submission', name='pull_url',), migrations.RenameField( - model_name='patch', - old_name='pull_url2', - new_name='pull_url', - ), - migrations.RemoveField( - model_name='submission', - name='tags', + model_name='patch', old_name='pull_url2', new_name='pull_url', ), + migrations.RemoveField(model_name='submission', name='tags',), migrations.RenameField( - model_name='patch', - old_name='tags2', - new_name='tags', - ), - migrations.RemoveField( - model_name='submission', - name='delegate', + model_name='patch', old_name='tags2', new_name='tags', ), + migrations.RemoveField(model_name='submission', name='delegate',), migrations.RenameField( - model_name='patch', - old_name='delegate2', - new_name='delegate', - ), - migrations.RemoveField( - model_name='submission', - name='state', + model_name='patch', old_name='delegate2', new_name='delegate', ), + migrations.RemoveField(model_name='submission', name='state',), migrations.RenameField( - model_name='patch', - old_name='state2', - new_name='state', - ), - migrations.RemoveField( - model_name='submission', - name='archived', + model_name='patch', old_name='state2', new_name='state', ), + migrations.RemoveField(model_name='submission', name='archived',), migrations.RenameField( - model_name='patch', - old_name='archived2', - new_name='archived', - ), - migrations.RemoveField( - model_name='submission', - name='hash', + model_name='patch', old_name='archived2', new_name='archived', ), + migrations.RemoveField(model_name='submission', name='hash',), migrations.RenameField( - model_name='patch', - old_name='hash2', - new_name='hash', + model_name='patch', old_name='hash2', new_name='hash', ), # Update any many-to-many fields to point to Patch now migrations.AlterField( model_name='bundle', name='patches', - field=models.ManyToManyField(to='patchwork.Patch', - through='patchwork.BundlePatch'), + field=models.ManyToManyField( + to='patchwork.Patch', through='patchwork.BundlePatch' + ), ), migrations.AlterField( model_name='bundlepatch', name='patch', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, - to='patchwork.Patch'), + to='patchwork.Patch', + ), ), migrations.AlterField( model_name='check', name='patch', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, - to='patchwork.Patch'), + to='patchwork.Patch', + ), ), migrations.AlterField( model_name='patch', name='state', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, - to='patchwork.State', null=True), + to='patchwork.State', + null=True, + ), ), migrations.AlterField( model_name='patchchangenotification', name='patch', field=models.OneToOneField( - primary_key=True, serialize=False, + primary_key=True, + serialize=False, on_delete=django.db.models.deletion.CASCADE, - to='patchwork.Patch'), + to='patchwork.Patch', + ), ), migrations.AlterField( model_name='patchtag', name='patch', field=models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, - to='patchwork.Patch'), + to='patchwork.Patch', + ), ), ] diff --git a/patchwork/migrations/0012_add_coverletter_model.py b/patchwork/migrations/0012_add_coverletter_model.py index 819cee9..a89cabd 100644 --- a/patchwork/migrations/0012_add_coverletter_model.py +++ b/patchwork/migrations/0012_add_coverletter_model.py @@ -15,11 +15,19 @@ class Migration(migrations.Migration): migrations.CreateModel( name='CoverLetter', fields=[ - ('submission_ptr', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, auto_created=True, primary_key=True, serialize=False, to='patchwork.Submission')), + ( + 'submission_ptr', + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + auto_created=True, + primary_key=True, + serialize=False, + to='patchwork.Submission', + ), + ), ], - options={ - 'abstract': False, - }, + options={'abstract': False}, bases=('patchwork.submission',), ), ] diff --git a/patchwork/migrations/0013_slug_check_context.py b/patchwork/migrations/0013_slug_check_context.py index 17e33aa..c20ed73 100644 --- a/patchwork/migrations/0013_slug_check_context.py +++ b/patchwork/migrations/0013_slug_check_context.py @@ -14,6 +14,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='check', name='context', - field=models.SlugField(default=b'default', help_text=b'A label to discern check from checks of other testing systems.', max_length=255), + field=models.SlugField( + default=b'default', + help_text=b'A label to discern check from checks of other ' + b'testing systems.', + max_length=255, + ), ), ] diff --git a/patchwork/migrations/0014_remove_userprofile_primary_project.py b/patchwork/migrations/0014_remove_userprofile_primary_project.py index 0f875bd..6c6dc43 100644 --- a/patchwork/migrations/0014_remove_userprofile_primary_project.py +++ b/patchwork/migrations/0014_remove_userprofile_primary_project.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import migrations, models +from django.db import migrations class Migration(migrations.Migration): @@ -12,7 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.RemoveField( - model_name='userprofile', - name='primary_project', + model_name='userprofile', name='primary_project', ), ] diff --git a/patchwork/migrations/0015_add_series_models.py b/patchwork/migrations/0015_add_series_models.py index 7222390..32596c3 100644 --- a/patchwork/migrations/0015_add_series_models.py +++ b/patchwork/migrations/0015_add_series_models.py @@ -15,50 +15,131 @@ class Migration(migrations.Migration): migrations.CreateModel( name='SeriesReference', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), ('msgid', models.CharField(max_length=255, unique=True)), ], ), migrations.CreateModel( name='Series', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(blank=True, help_text=b'An optional name to associate with the series, e.g. "John\'s PCI series".', max_length=255, null=True)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + blank=True, + help_text=b'An optional name to associate with the ' + b'series, e.g. "John\'s PCI series".', + max_length=255, + null=True, + ), + ), ('date', models.DateTimeField()), - ('version', models.IntegerField(default=1, help_text=b'Version of series as indicated by the subject prefix(es)')), - ('total', models.IntegerField(help_text=b'Number of patches in series as indicated by the subject prefix(es)')), - ('cover_letter', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='series', to='patchwork.CoverLetter')), + ( + 'version', + models.IntegerField( + default=1, + help_text=b'Version of series as indicated by the ' + b'subject prefix(es)', + ), + ), + ( + 'total', + models.IntegerField( + help_text=b'Number of patches in series as indicated ' + b'by the subject prefix(es)' + ), + ), + ( + 'cover_letter', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='series', + to='patchwork.CoverLetter', + ), + ), ], - options={ - 'ordering': ('date',), - }, + options={'ordering': ('date',)}, ), migrations.CreateModel( name='SeriesPatch', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('number', models.PositiveSmallIntegerField(help_text=b'The number assigned to this patch in the series')), - ('patch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Patch')), - ('series', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Series')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'number', + models.PositiveSmallIntegerField( + help_text=b'The number assigned to this patch in the ' + b'series' + ), + ), + ( + 'patch', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Patch', + ), + ), + ( + 'series', + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Series', + ), + ), ], - options={ - 'ordering': ['number'], - }, + options={'ordering': ['number']}, ), migrations.AddField( model_name='series', name='patches', - field=models.ManyToManyField(related_name='series', through='patchwork.SeriesPatch', to='patchwork.Patch'), + field=models.ManyToManyField( + related_name='series', + through='patchwork.SeriesPatch', + to='patchwork.Patch', + ), ), migrations.AddField( model_name='series', name='submitter', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Person'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Person', + ), ), migrations.AddField( model_name='seriesreference', name='series', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='references', related_query_name=b'reference', to='patchwork.Series'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='references', + related_query_name=b'reference', + to='patchwork.Series', + ), ), migrations.AlterUniqueTogether( name='seriespatch', diff --git a/patchwork/migrations/0016_series_project.py b/patchwork/migrations/0016_series_project.py index f298b12..8f28ea7 100644 --- a/patchwork/migrations/0016_series_project.py +++ b/patchwork/migrations/0016_series_project.py @@ -46,7 +46,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='series', name='project', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='series', to='patchwork.Project'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='series', + to='patchwork.Project', + ), ), migrations.RunPython(forward, reverse, atomic=False), migrations.AlterField( @@ -55,7 +61,6 @@ class Migration(migrations.Migration): field=models.CharField(max_length=255), ), migrations.AlterUniqueTogether( - name='seriesreference', - unique_together=set([('series', 'msgid')]), + name='seriesreference', unique_together=set([('series', 'msgid')]), ), ] diff --git a/patchwork/migrations/0017_improved_delegation_rule_docs.py b/patchwork/migrations/0017_improved_delegation_rule_docs.py index 9d70806..95ae854 100644 --- a/patchwork/migrations/0017_improved_delegation_rule_docs.py +++ b/patchwork/migrations/0017_improved_delegation_rule_docs.py @@ -16,16 +16,29 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='delegationrule', name='path', - field=models.CharField(help_text=b'An fnmatch-style pattern to match filenames against.', max_length=255), + field=models.CharField( + help_text=b'An fnmatch-style pattern to match filenames ' + b'against.', + max_length=255, + ), ), migrations.AlterField( model_name='delegationrule', name='priority', - field=models.IntegerField(default=0, help_text=b'The priority of the rule. Rules with a higher priority will override rules with lower priorities'), + field=models.IntegerField( + default=0, + help_text=b'The priority of the rule. Rules with a higher ' + b'priority will override rules with lower ' + b'priorities', + ), ), migrations.AlterField( model_name='delegationrule', name='user', - field=models.ForeignKey(help_text=b'A user to delegate the patch to.', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + field=models.ForeignKey( + help_text=b'A user to delegate the patch to.', + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/patchwork/migrations/0018_add_event_model.py b/patchwork/migrations/0018_add_event_model.py index 4d73353..e03cc40 100644 --- a/patchwork/migrations/0018_add_event_model.py +++ b/patchwork/migrations/0018_add_event_model.py @@ -18,21 +18,136 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Event', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('category', models.CharField(choices=[(b'cover-created', b'Cover Letter Created'), (b'patch-created', b'Patch Created'), (b'patch-completed', b'Patch Completed'), (b'patch-state-changed', b'Patch State Changed'), (b'patch-delegated', b'Patch Delegate Changed'), (b'check-created', b'Check Created'), (b'series-created', b'Series Created'), (b'series-completed', b'Series Completed')], db_index=True, help_text=b'The category of the event.', max_length=20)), - ('date', models.DateTimeField(default=datetime.datetime.now, help_text=b'The time this event was created.')), - ('cover', models.ForeignKey(blank=True, help_text=b'The cover letter that this event was created for.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.CoverLetter')), - ('created_check', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.Check')), - ('current_delegate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)), - ('current_state', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.State')), - ('patch', models.ForeignKey(blank=True, help_text=b'The patch that this event was created for.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.Patch')), - ('previous_delegate', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to=settings.AUTH_USER_MODEL)), - ('previous_state', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.State')), - ('project', models.ForeignKey(help_text=b'The project that the events belongs to.', on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.Project')), - ('series', models.ForeignKey(blank=True, help_text=b'The series that this event was created for.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.Series')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'category', + models.CharField( + choices=[ + (b'cover-created', b'Cover Letter Created'), + (b'patch-created', b'Patch Created'), + (b'patch-completed', b'Patch Completed'), + (b'patch-state-changed', b'Patch State Changed'), + (b'patch-delegated', b'Patch Delegate Changed'), + (b'check-created', b'Check Created'), + (b'series-created', b'Series Created'), + (b'series-completed', b'Series Completed'), + ], + db_index=True, + help_text=b'The category of the event.', + max_length=20, + ), + ), + ( + 'date', + models.DateTimeField( + default=datetime.datetime.now, + help_text=b'The time this event was created.', + ), + ), + ( + 'cover', + models.ForeignKey( + blank=True, + help_text=b'The cover letter that this event was ' + b'created for.', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.CoverLetter', + ), + ), + ( + 'created_check', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.Check', + ), + ), + ( + 'current_delegate', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to=settings.AUTH_USER_MODEL, + ), + ), + ( + 'current_state', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.State', + ), + ), + ( + 'patch', + models.ForeignKey( + blank=True, + help_text=b'The patch that this event was created ' + b'for.', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.Patch', + ), + ), + ( + 'previous_delegate', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to=settings.AUTH_USER_MODEL, + ), + ), + ( + 'previous_state', + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.State', + ), + ), + ( + 'project', + models.ForeignKey( + help_text=b'The project that the events belongs to.', + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.Project', + ), + ), + ( + 'series', + models.ForeignKey( + blank=True, + help_text=b'The series that this event was created ' + b'for.', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.Series', + ), + ), ], - options={ - 'ordering': ['-date'], - }, + options={'ordering': ['-date']}, ), ] diff --git a/patchwork/migrations/0019_userprofile_show_ids.py b/patchwork/migrations/0019_userprofile_show_ids.py index d924184..b7563b3 100644 --- a/patchwork/migrations/0019_userprofile_show_ids.py +++ b/patchwork/migrations/0019_userprofile_show_ids.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.6 on 2017-03-26 20:59 from __future__ import unicode_literals from django.db import migrations, models @@ -15,6 +14,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='userprofile', name='show_ids', - field=models.BooleanField(default=False, help_text=b'Show click-to-copy patch IDs in the list view'), + field=models.BooleanField( + default=False, + help_text=b'Show click-to-copy patch IDs in the list view', + ), ), ] diff --git a/patchwork/migrations/0020_tag_show_column.py b/patchwork/migrations/0020_tag_show_column.py index 62fe80a..e191ca6 100644 --- a/patchwork/migrations/0020_tag_show_column.py +++ b/patchwork/migrations/0020_tag_show_column.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.8 on 2017-12-19 04:03 from __future__ import unicode_literals from django.db import migrations, models @@ -15,6 +14,10 @@ class Migration(migrations.Migration): migrations.AddField( model_name='tag', name='show_column', - field=models.BooleanField(default=True, help_text=b"Show a column displaying this tag's count in the patch list view"), + field=models.BooleanField( + default=True, + help_text=b"Show a column displaying this tag's count in the " + b"patch list view", + ), ), ] diff --git a/patchwork/migrations/0021_django_1_10_fixes.py b/patchwork/migrations/0021_django_1_10_fixes.py index ff1d887..79e7726 100644 --- a/patchwork/migrations/0021_django_1_10_fixes.py +++ b/patchwork/migrations/0021_django_1_10_fixes.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import django from django.db import migrations @@ -21,6 +20,9 @@ class Migration(migrations.Migration): operations += [ migrations.AlterModelOptions( name='patch', - options={'base_manager_name': 'objects', 'verbose_name_plural': 'Patches'}, + options={ + 'base_manager_name': 'objects', + 'verbose_name_plural': 'Patches', + }, ), ] diff --git a/patchwork/migrations/0022_add_subject_match_to_project.py b/patchwork/migrations/0022_add_subject_match_to_project.py index cef3fb6..9ca8224 100644 --- a/patchwork/migrations/0022_add_subject_match_to_project.py +++ b/patchwork/migrations/0022_add_subject_match_to_project.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.8 on 2018-01-19 18:16 from __future__ import unicode_literals from django.db import migrations, models @@ -15,7 +14,18 @@ class Migration(migrations.Migration): migrations.AddField( model_name='project', name='subject_match', - field=models.CharField(blank=True, default=b'', help_text=b'Regex to match the subject against if only part of emails sent to the list belongs to this project. Will be used with IGNORECASE and MULTILINE flags. If rules for more projects match the first one returned from DB is chosen; empty field serves as a default for every email which has no other match.', max_length=64), + field=models.CharField( + blank=True, + default=b'', + help_text=b'Regex to match the subject against if only part ' + b'of emails sent to the list belongs to this ' + b'project. Will be used with IGNORECASE and ' + b'MULTILINE flags. If rules for more projects match ' + b'the first one returned from DB is chosen; empty ' + b'field serves as a default for every email which ' + b'has no other match.', + max_length=64, + ), ), migrations.AlterField( model_name='project', @@ -23,7 +33,6 @@ class Migration(migrations.Migration): field=models.CharField(max_length=255), ), migrations.AlterUniqueTogether( - name='project', - unique_together=set([('listid', 'subject_match')]), + name='project', unique_together=set([('listid', 'subject_match')]), ), ] diff --git a/patchwork/migrations/0023_timezone_unify.py b/patchwork/migrations/0023_timezone_unify.py index 8a84ab8..c73d324 100644 --- a/patchwork/migrations/0023_timezone_unify.py +++ b/patchwork/migrations/0023_timezone_unify.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.8 on 2018-02-22 23:11 from __future__ import unicode_literals import datetime + from django.db import migrations, models @@ -31,7 +31,10 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='event', name='date', - field=models.DateTimeField(default=datetime.datetime.utcnow, help_text=b'The time this event was created.'), + field=models.DateTimeField( + default=datetime.datetime.utcnow, + help_text=b'The time this event was created.', + ), ), migrations.AlterField( model_name='patchchangenotification', diff --git a/patchwork/migrations/0024_patch_patch_project.py b/patchwork/migrations/0024_patch_patch_project.py index 76d8f14..7e5f097 100644 --- a/patchwork/migrations/0024_patch_patch_project.py +++ b/patchwork/migrations/0024_patch_patch_project.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.10 on 2018-03-08 01:51 from __future__ import unicode_literals from django.db import migrations, models @@ -8,7 +7,8 @@ import django.db.models.deletion class Migration(migrations.Migration): # per migration 16, but note this seems to be going away - # in new PostgreSQLs (https://stackoverflow.com/questions/12838111/south-cannot-alter-table-because-it-has-pending-trigger-events#comment44629663_12838113) + # in new PostgreSQLs + # https://stackoverflow.com/q/12838111#comment44629663_12838113 atomic = False dependencies = [ @@ -19,21 +19,27 @@ class Migration(migrations.Migration): migrations.AddField( model_name='patch', name='patch_project', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='patchwork.Project'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Project', + ), preserve_default=False, ), - # as with 10, this will break if you use non-default table names - migrations.RunSQL('''UPDATE patchwork_patch SET patch_project_id = + migrations.RunSQL( + '''UPDATE patchwork_patch SET patch_project_id = (SELECT project_id FROM patchwork_submission WHERE patchwork_submission.id = patchwork_patch.submission_ptr_id);''' ), - migrations.AlterField( model_name='patch', name='patch_project', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='patchwork.Project'), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Project', + ), ), - ] diff --git a/patchwork/migrations/0025_add_regex_validators.py b/patchwork/migrations/0025_add_regex_validators.py index adbc66d..145ae38 100644 --- a/patchwork/migrations/0025_add_regex_validators.py +++ b/patchwork/migrations/0025_add_regex_validators.py @@ -15,11 +15,29 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='project', name='subject_match', - field=models.CharField(blank=True, default=b'', help_text=b'Regex to match the subject against if only part of emails sent to the list belongs to this project. Will be used with IGNORECASE and MULTILINE flags. If rules for more projects match the first one returned from DB is chosen; empty field serves as a default for every email which has no other match.', max_length=64, validators=[patchwork.models.validate_regex_compiles]), + field=models.CharField( + blank=True, + default=b'', + help_text=b'Regex to match the subject against if only part ' + b'of emails sent to the list belongs to this ' + b'project. Will be used with IGNORECASE and ' + b'MULTILINE flags. If rules for more projects match ' + b'the first one returned from DB is chosen; empty ' + b'field serves as a default for every email which ' + b'has no other match.', + max_length=64, + validators=[patchwork.models.validate_regex_compiles], + ), ), migrations.AlterField( model_name='tag', name='pattern', - field=models.CharField(help_text=b'A simple regex to match the tag in the content of a message. Will be used with MULTILINE and IGNORECASE flags. eg. ^Acked-by:', max_length=50, validators=[patchwork.models.validate_regex_compiles]), + field=models.CharField( + help_text=b'A simple regex to match the tag in the content of ' + b'a message. Will be used with MULTILINE and ' + b'IGNORECASE flags. eg. ^Acked-by:', + max_length=50, + validators=[patchwork.models.validate_regex_compiles], + ), ), ] diff --git a/patchwork/migrations/0026_add_user_bundles_backref.py b/patchwork/migrations/0026_add_user_bundles_backref.py index e3dbf80..fc233b6 100644 --- a/patchwork/migrations/0026_add_user_bundles_backref.py +++ b/patchwork/migrations/0026_add_user_bundles_backref.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.10 on 2018-04-12 11:59 from __future__ import unicode_literals from django.conf import settings @@ -17,6 +16,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='bundle', name='owner', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='bundles', related_query_name='bundle', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name='bundles', + related_query_name='bundle', + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/patchwork/migrations/0027_remove_series_ordering.py b/patchwork/migrations/0027_remove_series_ordering.py index 6eec3a2..ef6c169 100644 --- a/patchwork/migrations/0027_remove_series_ordering.py +++ b/patchwork/migrations/0027_remove_series_ordering.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.15 on 2018-08-31 23:42 from __future__ import unicode_literals from django.db import migrations @@ -13,7 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( - name='series', - options={'verbose_name_plural': 'Series'}, + name='series', options={'verbose_name_plural': 'Series'}, ), ] diff --git a/patchwork/migrations/0028_add_comment_date_index.py b/patchwork/migrations/0028_add_comment_date_index.py index 69a35c2..e6fd807 100644 --- a/patchwork/migrations/0028_add_comment_date_index.py +++ b/patchwork/migrations/0028_add_comment_date_index.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.15 on 2018-08-31 23:44 from __future__ import unicode_literals from django.db import migrations, models @@ -14,6 +13,8 @@ class Migration(migrations.Migration): operations = [ migrations.AddIndex( model_name='comment', - index=models.Index(fields=['submission', 'date'], name='submission_date_idx'), + index=models.Index( + fields=['submission', 'date'], name='submission_date_idx' + ), ), ] diff --git a/patchwork/migrations/0029_add_list_covering_index.py b/patchwork/migrations/0029_add_list_covering_index.py index 8f26b26..c7c19f5 100644 --- a/patchwork/migrations/0029_add_list_covering_index.py +++ b/patchwork/migrations/0029_add_list_covering_index.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.15 on 2018-08-31 23:46 from __future__ import unicode_literals from django.db import migrations, models @@ -14,6 +13,9 @@ class Migration(migrations.Migration): operations = [ migrations.AddIndex( model_name='patch', - index=models.Index(fields=['archived', 'patch_project', 'state', 'delegate'], name='patch_list_covering_idx'), + index=models.Index( + fields=['archived', 'patch_project', 'state', 'delegate'], + name='patch_list_covering_idx', + ), ), ] diff --git a/patchwork/migrations/0030_add_submission_covering_index.py b/patchwork/migrations/0030_add_submission_covering_index.py index e74c0cc..3cf009b 100644 --- a/patchwork/migrations/0030_add_submission_covering_index.py +++ b/patchwork/migrations/0030_add_submission_covering_index.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.15 on 2018-08-31 23:47 from __future__ import unicode_literals from django.db import migrations, models @@ -14,6 +13,9 @@ class Migration(migrations.Migration): operations = [ migrations.AddIndex( model_name='submission', - index=models.Index(fields=['date', 'project', 'submitter', 'name'], name='submission_covering_idx'), + index=models.Index( + fields=['date', 'project', 'submitter', 'name'], + name='submission_covering_idx', + ), ), ] diff --git a/patchwork/migrations/0031_add_patch_series_fields.py b/patchwork/migrations/0031_add_patch_series_fields.py index bfe4385..2f31e56 100644 --- a/patchwork/migrations/0031_add_patch_series_fields.py +++ b/patchwork/migrations/0031_add_patch_series_fields.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals from django.db import migrations, models -from django.db.models import Count import django.db.models.deletion @@ -18,15 +17,23 @@ class Migration(migrations.Migration): migrations.AddField( model_name='patch', name='number', - field=models.PositiveSmallIntegerField(default=None, help_text=b'The number assigned to this patch in the series', null=True), + field=models.PositiveSmallIntegerField( + default=None, + help_text=b'The number assigned to this patch in the series', + null=True, + ), ), migrations.AddField( model_name='patch', name='series_alt', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='patchwork.Series'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to='patchwork.Series', + ), ), migrations.AlterUniqueTogether( - name='patch', - unique_together=set([('series_alt', 'number')]), + name='patch', unique_together=set([('series_alt', 'number')]), ), ] diff --git a/patchwork/migrations/0032_migrate_data_from_series_patch_to_patch.py b/patchwork/migrations/0032_migrate_data_from_series_patch_to_patch.py index 78e8642..4083847 100644 --- a/patchwork/migrations/0032_migrate_data_from_series_patch_to_patch.py +++ b/patchwork/migrations/0032_migrate_data_from_series_patch_to_patch.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import migrations, models -from django.db.models import Count -import django.db.models.deletion +from django.db import migrations class Migration(migrations.Migration): diff --git a/patchwork/migrations/0033_remove_patch_series_model.py b/patchwork/migrations/0033_remove_patch_series_model.py index a9ea2e2..45bd422 100644 --- a/patchwork/migrations/0033_remove_patch_series_model.py +++ b/patchwork/migrations/0033_remove_patch_series_model.py @@ -14,45 +14,42 @@ class Migration(migrations.Migration): operations = [ # Remove SeriesPatch migrations.AlterUniqueTogether( - name='seriespatch', - unique_together=set([]), - ), - migrations.RemoveField( - model_name='seriespatch', - name='patch', - ), - migrations.RemoveField( - model_name='seriespatch', - name='series', - ), - migrations.RemoveField( - model_name='series', - name='patches', - ), - migrations.DeleteModel( - name='SeriesPatch', + name='seriespatch', unique_together=set([]), ), + migrations.RemoveField(model_name='seriespatch', name='patch',), + migrations.RemoveField(model_name='seriespatch', name='series',), + migrations.RemoveField(model_name='series', name='patches',), + migrations.DeleteModel(name='SeriesPatch',), # Now that SeriesPatch has been removed, we can use the now-unused # Patch.series field and add a backreference migrations.RenameField( - model_name='patch', - old_name='series_alt', - new_name='series', + model_name='patch', old_name='series_alt', new_name='series', ), migrations.AlterField( model_name='patch', name='series', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='patches', related_query_name='patch', to='patchwork.Series'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='patches', + related_query_name='patch', + to='patchwork.Series', + ), ), migrations.AlterUniqueTogether( - name='patch', - unique_together=set([('series', 'number')]), + name='patch', unique_together=set([('series', 'number')]), ), # Migrate CoverLetter to OneToOneField as a cover letter can no longer # be assigned to multiple series migrations.AlterField( model_name='series', name='cover_letter', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='series', to='patchwork.CoverLetter'), + field=models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='series', + to='patchwork.CoverLetter', + ), ), ] diff --git a/patchwork/migrations/0034_project_list_archive_url.py b/patchwork/migrations/0034_project_list_archive_url.py index 70d1b2b..a9e903f 100644 --- a/patchwork/migrations/0034_project_list_archive_url.py +++ b/patchwork/migrations/0034_project_list_archive_url.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.21 on 2019-07-01 12:30 from __future__ import unicode_literals from django.db import migrations, models diff --git a/patchwork/migrations/0035_project_list_archive_url_format.py b/patchwork/migrations/0035_project_list_archive_url_format.py index 376d6ed..f2353bb 100644 --- a/patchwork/migrations/0035_project_list_archive_url_format.py +++ b/patchwork/migrations/0035_project_list_archive_url_format.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.21 on 2019-07-01 12:57 from __future__ import unicode_literals from django.db import migrations, models @@ -15,6 +14,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='project', name='list_archive_url_format', - field=models.CharField(blank=True, help_text=b"URL format for the list archive's Message-ID redirector. {} will be replaced by the Message-ID.", max_length=2000), + field=models.CharField( + blank=True, + help_text=b"URL format for the list archive's Message-ID " + b"redirector. {} will be replaced by the " + b"Message-ID.", + max_length=2000, + ), ), ] diff --git a/patchwork/migrations/0036_project_commit_url_format.py b/patchwork/migrations/0036_project_commit_url_format.py index ab296d2..988b365 100644 --- a/patchwork/migrations/0036_project_commit_url_format.py +++ b/patchwork/migrations/0036_project_commit_url_format.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.11.22 on 2019-08-23 17:16 from __future__ import unicode_literals from django.db import migrations, models @@ -15,6 +14,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='project', name='commit_url_format', - field=models.CharField(blank=True, help_text=b'URL format for a particular commit. {} will be replaced by the commit SHA.', max_length=2000), + field=models.CharField( + blank=True, + help_text=b'URL format for a particular commit. {} will be ' + b'replaced by the commit SHA.', + max_length=2000, + ), ), ] diff --git a/patchwork/migrations/0037_event_actor.py b/patchwork/migrations/0037_event_actor.py index 719f514..1ce71e9 100644 --- a/patchwork/migrations/0037_event_actor.py +++ b/patchwork/migrations/0037_event_actor.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.6 on 2019-10-08 04:21 +# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models @@ -16,6 +16,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='event', name='actor', - field=models.ForeignKey(blank=True, help_text=b'The user that caused/created this event.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey( + blank=True, + help_text=b'The user that caused/created this event.', + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='+', + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/patchwork/migrations/0038_state_slug.py b/patchwork/migrations/0038_state_slug.py index 500624d..b723208 100644 --- a/patchwork/migrations/0038_state_slug.py +++ b/patchwork/migrations/0038_state_slug.py @@ -15,15 +15,17 @@ def validate_uniqueness(apps, schema_editor): State = apps.get_model('patchwork', 'State') total_count = State.objects.count() - slugs_count = len(set([ - slugify(state.name) for state in State.objects.all()])) + slugs_count = len( + set([slugify(state.name) for state in State.objects.all()]) + ) if slugs_count != total_count: raise Exception( 'You have non-unique States entries that need to be combined ' 'before you can run this migration. This migration must be done ' 'by hand. If you need assistance, please contact ' - 'patchwork@ozlabs.org') + 'patchwork@ozlabs.org' + ) def populate_slug_field(apps, schema_editor): @@ -55,7 +57,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='state', name='slug', - field=models.SlugField(blank=True, max_length=100, null=True, unique=True), + field=models.SlugField( + blank=True, max_length=100, null=True, unique=True + ), ), # Populate the 'State.slug' field migrations.RunPython(populate_slug_field, migrations.RunPython.noop), diff --git a/patchwork/migrations/0040_add_related_patches.py b/patchwork/migrations/0040_add_related_patches.py index fc2994d..b2bc249 100644 --- a/patchwork/migrations/0040_add_related_patches.py +++ b/patchwork/migrations/0040_add_related_patches.py @@ -15,27 +15,69 @@ class Migration(migrations.Migration): migrations.CreateModel( name='PatchRelation', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), ], ), migrations.AlterField( model_name='event', name='category', - field=models.CharField(choices=[(b'cover-created', b'Cover Letter Created'), (b'patch-created', b'Patch Created'), (b'patch-completed', b'Patch Completed'), (b'patch-state-changed', b'Patch State Changed'), (b'patch-delegated', b'Patch Delegate Changed'), (b'patch-relation-changed', b'Patch Relation Changed'), (b'check-created', b'Check Created'), (b'series-created', b'Series Created'), (b'series-completed', b'Series Completed')], db_index=True, help_text=b'The category of the event.', max_length=25), + field=models.CharField( + choices=[ + (b'cover-created', b'Cover Letter Created'), + (b'patch-created', b'Patch Created'), + (b'patch-completed', b'Patch Completed'), + (b'patch-state-changed', b'Patch State Changed'), + (b'patch-delegated', b'Patch Delegate Changed'), + (b'patch-relation-changed', b'Patch Relation Changed'), + (b'check-created', b'Check Created'), + (b'series-created', b'Series Created'), + (b'series-completed', b'Series Completed'), + ], + db_index=True, + help_text=b'The category of the event.', + max_length=25, + ), ), migrations.AddField( model_name='event', name='current_relation', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.PatchRelation'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.PatchRelation', + ), ), migrations.AddField( model_name='event', name='previous_relation', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='patchwork.PatchRelation'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='+', + to='patchwork.PatchRelation', + ), ), migrations.AddField( model_name='patch', name='related', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='patches', related_query_name='patch', to='patchwork.PatchRelation'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name='patches', + related_query_name='patch', + to='patchwork.PatchRelation', + ), ), ] @@ -54,7 +54,6 @@ commands = flake8 {posargs:patchwork manage.py} # F405 'name' may be undefined, or defined from star imports: 'module' # W504 line break after binary operator ignore = E129, F405, W504 -exclude = ./patchwork/migrations [testenv:docs] deps = |