Chris Johnston has proposed merging 
lp:~chrisjohnston/ubuntu-django-foundations/done into 
lp:ubuntu-django-foundations.

Requested reviews:
  Django Foundations Developers (django-foundations-dev)

For more details, see:
https://code.launchpad.net/~chrisjohnston/ubuntu-django-foundations/done/+merge/65140
-- 
https://code.launchpad.net/~chrisjohnston/ubuntu-django-foundations/done/+merge/65140
Your team Django Foundations Developers is requested to review the proposed 
merge of lp:~chrisjohnston/ubuntu-django-foundations/done into 
lp:ubuntu-django-foundations.
=== added file '__init__.py'
=== added directory 'management'
=== added file 'management/__init__.py'
=== added directory 'management/commands'
=== added file 'management/commands/__init__.py'
=== added file 'management/commands/pullapps.py'
--- management/commands/pullapps.py	1970-01-01 00:00:00 +0000
+++ management/commands/pullapps.py	2011-06-19 22:07:26 +0000
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+
+from django.core.management.base import BaseCommand, NoArgsCommand
+from django.contrib.auth.models import Group
+
+from django.conf import settings
+
+import subprocess
+import sys
+import os
+
+import bzrlib
+from bzrlib.branch import Branch
+from bzrlib.revisionspec import RevisionSpec
+from bzrlib.workingtree import WorkingTree
+from bzrlib.transport import get_transport
+from bzrlib.bzrdir import BzrDir
+from django.core.exceptions import ImproperlyConfigured
+
+class Command(BaseCommand):
+    args = "<app>"
+    help = "Pulls changes to an application."
+
+    def handle(self, *args, **kargs):
+        if hasattr(settings, 'BZR_APPS'):
+            bzrapps = settings.BZR_APPS
+        else:
+            raise ImproperlyConfigured('No BZR_APPS in settings')
+            
+        if hasattr(settings, 'PROJECT_PATH'):
+            project = settings.PROJECT_PATH
+        else:
+            # assume bzr_apps is in the project root
+            cmddir = os.path.dirname(os.path.abspath(__file__))
+            project = os.path.join(cmddir, '../../..')
+        
+        if len(args) > 0:
+            apps = args
+        else:
+            apps = bzrapps.keys()
+            
+        for app in apps:
+            if bzrapps.has_key(app):
+                source, rev = bzrapps[app]
+                destination = os.path.join(project, app)
+                print "Pull revision %s from %s to %s" % (rev, source, destination)
+
+                src_branch = Branch.open(source)
+                rev_id = RevisionSpec.from_string(str(rev)).as_revision_id(src_branch)
+
+                try:
+                    dst_branch = Branch.open(destination)
+                    dst_branch.pull(source=src_branch, stop_revision=rev_id)
+                except bzrlib.errors.NotBranchError:
+                    print "Destination branch not found, cloning from source"
+                    src_branch.create_clone_on_transport(get_transport(destination), revision_id=rev_id)
+                    dst_branch = Branch.open(destination)
+                    dst_branch.set_parent(source)
+                try:
+                    dst_tree = WorkingTree.open(destination)
+                except bzrlib.errors.NoWorkingTree:
+                    print "Working tree not found, creating checkout"
+                    dst_dir = BzrDir.open(destination)
+                    dst_tree = dst_dir.create_workingtree(revision_id=rev_id, from_branch=dst_branch)
+                dst_tree.update(revision=rev_id)
+            print "done."
+            else:
+                raise ImproperlyConfigured('App path %s not in settings.BZR_APPS' % app)

=== added file 'models.py'
--- models.py	1970-01-01 00:00:00 +0000
+++ models.py	2011-06-19 22:07:26 +0000
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.

=== added file 'tests.py'
--- tests.py	1970-01-01 00:00:00 +0000
+++ tests.py	2011-06-19 22:07:26 +0000
@@ -0,0 +1,23 @@
+"""
+This file demonstrates two different styles of tests (one doctest and one
+unittest). These will both pass when you run "manage.py test".
+
+Replace these with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+class SimpleTest(TestCase):
+    def test_basic_addition(self):
+        """
+        Tests that 1 + 1 always equals 2.
+        """
+        self.failUnlessEqual(1 + 1, 2)
+
+__test__ = {"doctest": """
+Another way to test that 1 + 1 is equal to 2.
+
+>>> 1 + 1 == 2
+True
+"""}
+

=== added file 'views.py'
--- views.py	1970-01-01 00:00:00 +0000
+++ views.py	2011-06-19 22:07:26 +0000
@@ -0,0 +1,1 @@
+# Create your views here.

_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to