Rev 127: Merge in trunk, resolve some trivial conflicts. in http://bazaar.launchpad.net/~jameinel/tarmac/win32

John Arbash Meinel john at arbash-meinel.com
Fri Jul 10 22:33:44 BST 2009


At http://bazaar.launchpad.net/~jameinel/tarmac/win32

------------------------------------------------------------
revno: 127 [merge]
revision-id: john at arbash-meinel.com-20090710213331-eqnsh8vmobmuobj4
parent: john at arbash-meinel.com-20090709162923-tw0ezkqp0991y1ae
parent: paul at eventuallyanyway.com-20090710204813-nyop875jzifdbfag
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: win32
timestamp: Fri 2009-07-10 16:33:31 -0500
message:
  Merge in trunk, resolve some trivial conflicts.
added:
  tarmac-authenticate            tarmacauthenticate-20090703024703-v405rtd4rucaydvm-1
modified:
  bzrplugin/__init__.py          __init__.py-20090512011200-yty26thq3bs16pzb-2
  setup.py                       setup.py-20090221223454-3pltrb2dyi4wpuyy-1
  tarmac-lander                  lander.py-20090215104432-r6cv9vfvx9a9yrcg-1
  tarmac/__init__.py             __init__.py-20090213065514-7lry1c0dzr5v4rvc-2
  tarmac/bin.py                  bin.py-20090221030320-i8t1l5d5nd2zm7o8-1
  tarmac/branch.py               branch.py-20090516025635-aigte4qq978v7tdl-1
  tarmac/config.py               config.py-20090213070652-26z6gt4dueux9215-1
  tarmac/exceptions.py           exceptions.py-20090303060127-nbh6frj2p5d41uei-1
  tarmac/hooks.py                hooks.py-20090512023802-qj6kacrxcyjrj61s-1
  tarmac/plugin.py               plugin.py-20090628231624-w82id1n21yk4oics-1
  tarmac/plugins/__init__.py     __init__.py-20090512024308-kgcnmyi6gdp0tbzp-2
  tarmac/plugins/ciavc.py        ciavc.py-20090629053831-yofcma7km8kfubb9-1
  tarmac/plugins/commitmessage.py commitmessage.py-20090629041443-i6vwfdchl6g2139a-1
  tarmac/plugins/runtest.py      runtest.py-20090512025759-2m0d4fenpugz0u03-1
  tarmac/tests/__init__.py       __init__.py-20090303061952-k19nuj6fix33ih0v-2
  tarmac/tests/mock.py           mock.py-20090516062430-3qwtxw87e2vpqxdy-1
  tarmac/tests/test_branch.py    test_branch.py-20090516030251-2ddzyw4e8prjk6au-1
  tarmac/tests/test_scripts.py   test_scripts.py-20090303061952-k19nuj6fix33ih0v-3
  tarmac/utils.py                utils.py-20090301091504-923a1poc3m4hvqx3-1
-------------- next part --------------
=== modified file 'bzrplugin/__init__.py'
--- a/bzrplugin/__init__.py	2009-05-12 02:07:02 +0000
+++ b/bzrplugin/__init__.py	2009-07-10 15:10:28 +0000
@@ -1,3 +1,18 @@
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Bazaar Plugin for Tarmac.'''
 
 from bzrlib.lazy_import import lazy_import

=== modified file 'setup.py'
--- a/setup.py	2009-05-12 02:10:05 +0000
+++ b/setup.py	2009-07-10 20:28:47 +0000
@@ -1,5 +1,20 @@
 #!/usr/bin/env python
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+#
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
 '''Tarmac installation script.'''
 
 from distutils.core import setup
@@ -7,16 +22,18 @@
 from tarmac import __version__
 
 setup(
-    name=u'Tarmac',
+    author='Paul Hummer',
+    author_email='Paul Hummer <paul at eventuallyanyway.com',
+    name=u'tarmac',
     version=__version__,
     description=u'Tarmac - The Launchpad Lander',
     url=u'http://edge.launchpad.net/tarmac',
-    license=u'AGPLv3',
+    license=u'GPLv3',
     package_dir={
         'bzrlib.plugins.tarmac': 'bzrplugin',
         'tarmac': 'tarmac'},
-    packages=['bzrlib.plugins.tarmac', 'tarmac'],
-    scripts=['tarmac-lander'],
+    packages=['bzrlib.plugins.tarmac', 'tarmac', 'tarmac.plugins'],
+    scripts=['tarmac-lander', 'tarmac-authenticate'],
     long_description='''
         Tarmac is a series of scripts to facilitate the landing of Bazaar
         branches in Launchpad (http://edge.launchpad.net).''',

=== added file 'tarmac-authenticate'
--- a/tarmac-authenticate	1970-01-01 00:00:00 +0000
+++ b/tarmac-authenticate	2009-07-10 15:10:28 +0000
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# Copyright 2009 Paul Hummer
+#
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
+from tarmac.bin import TarmacAuthenticate
+
+if __name__ == '__main__':
+    script = TarmacAuthenticate()
+    script.main()
+

=== modified file 'tarmac-lander'
--- a/tarmac-lander	2009-07-09 16:29:23 +0000
+++ b/tarmac-lander	2009-07-10 21:33:31 +0000
@@ -1,6 +1,23 @@
 #!/usr/bin/env python
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+#
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 import sys
+
 from tarmac.bin import TarmacLander
 
 if __name__ == '__main__':

=== modified file 'tarmac/__init__.py'
--- a/tarmac/__init__.py	2009-06-29 05:33:49 +0000
+++ b/tarmac/__init__.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac - A tool for controlling the landing of Launchpad branches.'''
 
 __version__ = u'0.2a'

=== modified file 'tarmac/bin.py'
--- a/tarmac/bin.py	2009-06-29 05:35:28 +0000
+++ b/tarmac/bin.py	2009-07-10 15:20:00 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Code used by Tarmac scripts.'''
 import atexit
 import logging
@@ -53,8 +68,39 @@
         raise NotImplementedError
 
 
+class TarmacAuthenticate(TarmacScript):
+    '''Tarmac authentication script.
+
+    This script is intended do nothing but get an OAuth token from Launchpad,
+    and (optionally) output that token to a specified file.
+    '''
+    def __init__(self, test_mode=False):
+        TarmacScript.__init__(self, test_mode)
+
+        self.configuration = TarmacConfig()
+
+        try:
+            self.filename = self.args[0]
+        except IndexError:
+            self.filename = None
+
+    def _create_option_parser(self):
+        '''See `TarmacScript._create_option_parser`.'''
+        parser = OptionParser("%prog [options] <projectname>")
+        return parser
+
+    def main(self):
+        '''See `TarmacScript`.'''
+        launchpad = get_launchpad_object(self.configuration,
+            filename=self.filename)
+
+
 class TarmacLander(TarmacScript):
-    '''Tarmac script.'''
+    '''Tarmac landing script.
+
+    This script handles all landing of branches.  It does the actual work for
+    Tarmac.
+    '''
 
     def __init__(self, test_mode=False):
 
@@ -149,7 +195,9 @@
                 if self.dry_run:
                     trunk.cleanup()
                 else:
-                    trunk.commit(candidate.commit_message)
+                    trunk.commit(candidate.commit_message,
+                                 authors=source_branch.authors)
+
             except Exception, e:
                 print e
                 trunk.cleanup()

=== modified file 'tarmac/branch.py'
--- a/tarmac/branch.py	2009-07-09 16:02:56 +0000
+++ b/tarmac/branch.py	2009-07-10 21:33:31 +0000
@@ -1,10 +1,25 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac branch tools.'''
 import os
 import shutil
 import tempfile
 
-from bzrlib import branch as bzr_branch
+from bzrlib import branch as bzr_branch, revision
 
 
 class Branch(object):
@@ -18,6 +33,7 @@
 
         self.has_tree = create_tree
         self.lp_branch = lp_branch
+        self.author_list = None
         self.branch = bzr_branch.Branch.open(self.lp_branch.bzr_identity)
         if self.has_tree:
             self._set_up_working_tree()
@@ -29,6 +45,19 @@
         if os.path.exists(self.temporary_dir):
             shutil.rmtree(self.temporary_dir)
         self.tree = self.branch.create_checkout(self.temporary_dir)
+        if not self.author_list:
+            self._set_authors()
+
+    def _set_authors(self):
+        '''Get the authors from the last revision and use it.'''
+        # XXX Need to get all authors from revisions not in target
+        last_rev = self.branch.last_revision()
+        # Empty the list first since we're going to refresh it
+        self.author_list = []
+        # Only query for authors if last_rev is not null:
+        if last_rev != 'null:':
+            rev = self.branch.repository.get_revision(last_rev)
+            self.author_list.extend(rev.get_apparent_authors())
 
     def merge(self, branch):
         '''Merge from another tarmac.branch.Branch instance.'''
@@ -41,14 +70,26 @@
         if self.has_tree:
             self._set_up_working_tree()
 
-    def commit(self, commit_message):
+    def commit(self, commit_message, authors=None, **kw):
         '''Commit changes.'''
         if not self.has_tree:
             raise Exception('This branch has no working tree.')
-        self.tree.commit(commit_message)
+        if not authors:
+            authors = self.authors
+        elif not self.authors:
+            self.author_list = authors
+        else:
+            self.author_list.append(authors)
+        self.tree.commit(commit_message, committer='Tarmac', authors=authors)
+        self._set_authors()
 
     @property
     def landing_candidates(self):
         '''Wrap the LP representation of landing_candidates.'''
         return self.lp_branch.landing_candidates
 
+    @property
+    def authors(self):
+        if self.author_list is None:
+            self._set_authors()
+        return self.author_list

=== modified file 'tarmac/config.py'
--- a/tarmac/config.py	2009-07-09 14:40:49 +0000
+++ b/tarmac/config.py	2009-07-10 21:33:31 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Configuration handler.'''
 # pylint: disable-msg=C0103
 import os

=== modified file 'tarmac/exceptions.py'
--- a/tarmac/exceptions.py	2009-05-12 02:10:05 +0000
+++ b/tarmac/exceptions.py	2009-07-10 15:10:28 +0000
@@ -1,2 +1,17 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac specific exceptions.'''

=== modified file 'tarmac/hooks.py'
--- a/tarmac/hooks.py	2009-05-16 01:59:34 +0000
+++ b/tarmac/hooks.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Hooks for Tarmac.'''
 
 from bzrlib import hooks

=== modified file 'tarmac/plugin.py'
--- a/tarmac/plugin.py	2009-06-29 04:22:00 +0000
+++ b/tarmac/plugin.py	2009-07-10 15:10:28 +0000
@@ -1,3 +1,18 @@
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Plugin utilities for Tarmac.'''
 # pylint: disable-msg=W0122,W0612
 

=== modified file 'tarmac/plugins/__init__.py'
--- a/tarmac/plugins/__init__.py	2009-05-12 02:46:16 +0000
+++ b/tarmac/plugins/__init__.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac supported plugins.'''
 
 

=== modified file 'tarmac/plugins/ciavc.py'
--- a/tarmac/plugins/ciavc.py	2009-06-29 19:09:49 +0000
+++ b/tarmac/plugins/ciavc.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac plugin for enforcing a commit message format.
 
 This code is derived from Jelmer Vernooij's CIA script for Bazaar that is found

=== modified file 'tarmac/plugins/commitmessage.py'
--- a/tarmac/plugins/commitmessage.py	2009-06-29 04:27:59 +0000
+++ b/tarmac/plugins/commitmessage.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac plugin for enforcing a commit message format.'''
 from tarmac.hooks import tarmac_hooks
 from tarmac.plugins import TarmacPlugin

=== modified file 'tarmac/plugins/runtest.py'
--- a/tarmac/plugins/runtest.py	2009-06-29 04:32:38 +0000
+++ b/tarmac/plugins/runtest.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tarmac plugin for running tests pre-commit.'''
 import os
 import subprocess

=== modified file 'tarmac/tests/__init__.py'
--- a/tarmac/tests/__init__.py	2009-05-12 02:10:05 +0000
+++ b/tarmac/tests/__init__.py	2009-07-10 15:10:28 +0000
@@ -1,2 +1,17 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tests for Tarmac!'''

=== modified file 'tarmac/tests/mock.py'
--- a/tarmac/tests/mock.py	2009-05-16 06:24:35 +0000
+++ b/tarmac/tests/mock.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Mock objects for Tarmac!'''
 from base64 import b64encode
 import math

=== modified file 'tarmac/tests/test_branch.py'
--- a/tarmac/tests/test_branch.py	2009-06-29 04:44:23 +0000
+++ b/tarmac/tests/test_branch.py	2009-07-10 15:20:00 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tests for tarmac.branch'''
 import os
 import unittest
@@ -13,6 +28,11 @@
 class TestBranch(unittest.TestCase):
     '''Test for Tarmac.branch.Branch.'''
 
+    def setUp(self):
+        '''Set up the test environment.'''
+        temp_dir = os.path.join(os.getcwd(), "_trial_temp")
+        os.environ['BZR_HOME'] = temp_dir
+
     def test_create(self):
         '''Test the creation of a TarmacBranch instance.'''
         a_branch = branch.Branch(MockLPBranch())
@@ -49,6 +69,16 @@
         # XXX: Find a way to generate dummy revisions for the second branch.
         self.assertRaises(NoCommits, a_branch.merge, another_branch)
 
+    def test_merge_with_authors(self):
+        '''A merge from a branch with authors'''
+        branch1 = branch.Branch(MockLPBranch(), create_tree=True)
+        branch2 = branch.Branch(MockLPBranch(), create_tree=True)
+        authors = [ 'author1', 'author2' ]
+        branch1.commit('Authors test', authors=authors)
+        branch2.merge(branch1)
+        branch2.commit('Authors Merge test', authors=branch1.authors)
+        self.assertEquals(branch2.authors.sort(), authors.sort())
+
     def DISABLEDtest_cleanup(self):
         '''The branch object should clean up after itself.'''
         a_branch = branch.Branch(MockLPBranch(), create_tree=True)

=== modified file 'tarmac/tests/test_scripts.py'
--- a/tarmac/tests/test_scripts.py	2009-06-29 04:39:46 +0000
+++ b/tarmac/tests/test_scripts.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Tests for Tarmac scripts.'''
 # pylint: disable-msg=W0212,W0223
 __metaclass__ = type

=== modified file 'tarmac/utils.py'
--- a/tarmac/utils.py	2009-05-16 05:26:11 +0000
+++ b/tarmac/utils.py	2009-07-10 15:10:28 +0000
@@ -1,4 +1,19 @@
-# Copyright 2009 Paul Hummer - See LICENSE
+# Copyright 2009 Paul Hummer
+# This file is part of Tarmac.
+#
+# Tarmac is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by
+# the Free Software Foundation.
+#
+# Tarmac is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Tarmac.  If not, see <http://www.gnu.org/licenses/>.
+
 '''Utilities for Tarmac, mostly dealing with Launchpad.'''
 import os
 
@@ -6,20 +21,23 @@
     STAGING_SERVICE_ROOT)
 
 
-def get_launchpad_object(config, staging=False):
+def get_launchpad_object(config, filename=None, staging=False):
     '''Return an autheticated launchpad API object.'''
+    if not filename:
+        filename = config.CREDENTIALS
+
     if staging:
         SERVICE_ROOT = STAGING_SERVICE_ROOT
     else:
         SERVICE_ROOT = EDGE_SERVICE_ROOT
 
-    if not os.path.exists(config.CREDENTIALS):
+    if not os.path.exists(filename):
         launchpad = Launchpad.get_token_and_login('Tarmac',
             SERVICE_ROOT, config.CACHEDIR)
-        launchpad.credentials.save(file(config.CREDENTIALS, 'w'))
+        launchpad.credentials.save(file(filename, 'w'))
     else:
         credentials = Credentials()
-        credentials.load(open(config.CREDENTIALS))
+        credentials.load(open(filename))
         launchpad = Launchpad(credentials, SERVICE_ROOT,
             config.CACHEDIR)
 



More information about the bazaar-commits mailing list