diff mbox

Fully automating patch state updates

Message ID 20110321211341.11328.95472.stgit@localhost6.localdomain6
State Superseded
Headers show

Commit Message

Guilherme Salgado March 21, 2011, 9:26 p.m. UTC
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?

Cheers,

---

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

Comments

Jeremy Kerr March 25, 2011, 8:02 a.m. UTC | #1
Hi Guilherme,

> 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.

OK, this makes sense. I'd suggest calling this "source_tree" instead, with the 
intention of using any VCS URL there; "branch" means different things to 
different VCSes.

> 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?

Yes, they have to be applied manually at the moment. I'll add DB versioning 
soon.

> Is there anything I've missed
> or would this be everything that's needed to add a new field to a model
> class?

Yep, you've got it all :)

Cheers,


Jeremy
Guilherme Salgado March 25, 2011, 6:46 p.m. UTC | #2
On Fri, 2011-03-25 at 16:02 +0800, Jeremy Kerr wrote:
> Hi Guilherme,
> 
> > 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.
> 
> OK, this makes sense. I'd suggest calling this "source_tree" instead, with the 
> intention of using any VCS URL there; "branch" means different things to 
> different VCSes.

Fair enough, I've renamed it and submitted again, this time signed as
well.

Cheers,
diff mbox

Patch

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 @@ 
+BEGIN;
+ALTER TABLE patchwork_project ADD column master_branch varchar(300);
+COMMIT;