Fully automating patch state updates

Guilherme Salgado guilherme.salgado at linaro.org
Tue Mar 22 08:26:46 EST 2011

I've seen the tools/patchwork-update-commits script and I'm planning to work
on making a fully automated version of it, which fetches the master branch,
scans the commits on it and updates the state of patches. I think this would
be a nice addition to Patchwork.

For that to work, though, the first thing we need is to know where's the
master branch of a project.  The patch below makes that possible by adding a
free form char field to store the URL to the project's master branch. It's not
a URLField because that only allows http[s] URLs, which is not what we want.

I couldn't find anything about how Patchwork deals with DB schema migrations,
but I wrote a migration script together with the other ones, which, AFAICT
have to be applied manually?  Is there anything I've missed or would this be
everything that's needed to add a new field to a model class?



 apps/patchwork/models.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py
index 3d3490d..0f29157 100644
--- a/apps/patchwork/models.py
+++ b/apps/patchwork/models.py
@@ -64,6 +64,7 @@ class Project(models.Model):
     name = models.CharField(max_length=255, unique=True)
     listid = models.CharField(max_length=255, unique=True)
     listemail = models.CharField(max_length=200)
+    master_branch = models.CharField(max_length=300, blank=True, null=True)
     def __unicode__(self):
         return self.name
diff --git a/lib/sql/migration/008-project-master-branch.sql b/lib/sql/migration/008-project-master-branch.sql
new file mode 100644
index 0000000..73ae974
--- /dev/null
+++ b/lib/sql/migration/008-project-master-branch.sql
@@ -0,0 +1,3 @@
+ALTER TABLE patchwork_project ADD column master_branch varchar(300);

More information about the Patchwork mailing list