diff mbox

Add a source_tree field to Project.

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

Commit Message

Guilherme Salgado March 25, 2011, 6:44 p.m. UTC
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org>
---
 apps/patchwork/models.py                      |    1 +
 lib/sql/migration/008-project-source-tree.sql |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
 create mode 100644 lib/sql/migration/008-project-source-tree.sql

Comments

Jeremy Kerr March 30, 2011, 4:10 a.m. UTC | #1
Hi Guilherme,

>  apps/patchwork/models.py                      |    1 +
>  lib/sql/migration/008-project-source-tree.sql |    3 +++
>  2 files changed, 4 insertions(+), 0 deletions(-)
>  create mode 100644 lib/sql/migration/008-project-source-tree.sql

Looks good. I'd like to wait until there is a user of this field before 
merging the change though - or are you using this for linaro-internal things?

Cheers,


Jeremy
Janne Grunau March 30, 2011, 6:40 a.m. UTC | #2
On Wed, Mar 30, 2011 at 12:10:14PM +0800, Jeremy Kerr wrote:
> Hi Guilherme,
> 
> >  apps/patchwork/models.py                      |    1 +
> >  lib/sql/migration/008-project-source-tree.sql |    3 +++
> >  2 files changed, 4 insertions(+), 0 deletions(-)
> >  create mode 100644 lib/sql/migration/008-project-source-tree.sql
> 
> Looks good. I'd like to wait until there is a user of this field before 
> merging the change though - or are you using this for linaro-internal things?

I would like to use it for patches.libav.org to link the commit hash to
that commit in gitweb. see http://patches.libav.org/patch/1927/ for an
example. That is currently hardcoded.
It probably needs another field to construct the full URL from source
tree and commit_ref.

Janne
Jeremy Kerr March 30, 2011, 6:56 a.m. UTC | #3
Hi Janne,

> I would like to use it for patches.libav.org to link the commit hash to
> that commit in gitweb. see http://patches.libav.org/patch/1927/ for an
> example.

Hm, good idea.

> It probably needs another field to construct the full URL from source
> tree and commit_ref.

I think this could be fairly independent of the source tree: I'd imagine that 
this could be implemented with a format-string style field on the Project 
instance:

 commit_url = 'http://git.ozlabs.org/?p=patchwork;a=commitdiff;h=%s'

- we then format with (project.commit_url % patch.commit_ref) to create the 
link.

I'm happy to add this, but I think it's a separate change to the one that 
Guilherme is planning. Guilherme - do you agree?

Cheers,


Jeremy
Janne Grunau March 30, 2011, 10:59 a.m. UTC | #4
Hej,

On Wed, Mar 30, 2011 at 02:56:35PM +0800, Jeremy Kerr wrote:
> 
> > I would like to use it for patches.libav.org to link the commit hash to
> > that commit in gitweb. see http://patches.libav.org/patch/1927/ for an
> > example.
> 
> Hm, good idea.
> 
> > It probably needs another field to construct the full URL from source
> > tree and commit_ref.
> 
> I think this could be fairly independent of the source tree: I'd imagine that 
> this could be implemented with a format-string style field on the Project 
> instance:
> 
>  commit_url = 'http://git.ozlabs.org/?p=patchwork;a=commitdiff;h=%s'
> 
> - we then format with (project.commit_url % patch.commit_ref) to create the 
> link.
> 
> I'm happy to add this, but I think it's a separate change to the one that 
> Guilherme is planning. Guilherme - do you agree?

That would work too and is cleaner.

Janne
Guilherme Salgado March 30, 2011, 2:33 p.m. UTC | #5
On Wed, 2011-03-30 at 14:56 +0800, Jeremy Kerr wrote:
> Hi Janne,
> 
> > I would like to use it for patches.libav.org to link the commit hash to
> > that commit in gitweb. see http://patches.libav.org/patch/1927/ for an
> > example.
> 
> Hm, good idea.
> 
> > It probably needs another field to construct the full URL from source
> > tree and commit_ref.
> 
> I think this could be fairly independent of the source tree: I'd imagine that 
> this could be implemented with a format-string style field on the Project 
> instance:
> 
>  commit_url = 'http://git.ozlabs.org/?p=patchwork;a=commitdiff;h=%s'
> 
> - we then format with (project.commit_url % patch.commit_ref) to create the 
> link.
> 
> I'm happy to add this, but I think it's a separate change to the one that 
> Guilherme is planning. Guilherme - do you agree?

I think so.  We could do some tricks to generate the base commit URL
from the source_tree, but that'd be fragile at best, so I agree it makes
sense to use a separate field for the commit URL.

Cheers,
diff mbox

Patch

diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py
index 3d3490d..14d6ba7 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)
+    source_tree = models.CharField(max_length=300, blank=True, null=True)
 
     def __unicode__(self):
         return self.name
diff --git a/lib/sql/migration/008-project-source-tree.sql b/lib/sql/migration/008-project-source-tree.sql
new file mode 100644
index 0000000..1e8bd52
--- /dev/null
+++ b/lib/sql/migration/008-project-source-tree.sql
@@ -0,0 +1,3 @@ 
+BEGIN;
+ALTER TABLE patchwork_project ADD column source_tree varchar(300);
+COMMIT;