Rev 1: Start working toward publish - get a publishing_root option in file:///home/jelmer/bzr-email/cmd/
Jelmer Vernooij
jelmer at samba.org
Wed Jul 4 01:01:14 BST 2007
At file:///home/jelmer/bzr-email/cmd/
------------------------------------------------------------
revno: 1
revision-id: robertc at robertcollins.net-20051018073912-190f2394d102b906
committer: Robert Collins <robertc at robertcollins.net>
timestamp: Tue 2005-10-18 17:39:12 +1000
message:
Start working toward publish - get a publishing_root option
added:
README README-20051018071212-c081f89570802202
__init__.py __init__.py-20051018071212-f1765ec4521cab0b
tests/ tests-20051018071212-c515cd4a3724fac1
tests/__init__.py __init__.py-20051018071212-465bf3f697dddbda
tests/testpublish.py testpublish.py-20051018071212-e3a53d78c05e0e0a
=== added file 'README'
--- a/README 1970-01-01 00:00:00 +0000
+++ b/README 2005-10-18 07:39:12 +0000
@@ -0,0 +1,8 @@
+This is a plugin to implement 'switch' for bzr.
+Switch needs to:
+ * Be able to determine the path a branch should be pushed to.
+ (bzr publish)
+ * Trigger a push if a branch is out of date. (uses bzrtools).
+ * Be able to pull down a new branches revisions. (uses standard pull).
+ * Be able to replace the revision history of this branch with
+ working_tree.pull(that_branch, clobber=True)
=== added file '__init__.py'
--- a/__init__.py 1970-01-01 00:00:00 +0000
+++ b/__init__.py 2005-10-18 07:39:12 +0000
@@ -0,0 +1,24 @@
+# Copyright (C) 2005 by Canonical Ltd
+# Authors: Robert Collins <robert.collins at canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+def test_suite():
+ from unittest import TestSuite
+ import bzrlib.plugins.switch.tests
+ result = TestSuite()
+ result.addTest(bzrlib.plugins.switch.tests.test_suite())
+ return result
+
=== added directory 'tests'
=== added file 'tests/__init__.py'
--- a/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ b/tests/__init__.py 2005-10-18 07:39:12 +0000
@@ -0,0 +1,25 @@
+# Copyright (C) 2005 by Canonical Ltd
+# Authors: Robert Collins <robert.collins at canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from unittest import TestSuite
+
+def test_suite():
+ result = TestSuite()
+ import bzrlib.plugins.switch.tests.testpublish as testpublish
+ result.addTest(testpublish.test_suite())
+ return result
+
=== added file 'tests/testpublish.py'
--- a/tests/testpublish.py 1970-01-01 00:00:00 +0000
+++ b/tests/testpublish.py 2005-10-18 07:39:12 +0000
@@ -0,0 +1,44 @@
+# Copyright (C) 2005 by Canonical Ltd
+# Authors: Robert Collins <robert.collins at canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from cStringIO import StringIO
+from unittest import TestLoader
+
+from bzrlib.branch import Branch
+import bzrlib.config as config
+from bzrlib.selftest import TestCase, TestCaseInTempDir
+from bzrlib.selftest.testconfig import FakeBranch
+
+
+def test_suite():
+ return TestLoader().loadTestsFromName(__name__)
+
+
+sample_config=("[DEFAULT]\n"
+ "publishing_root=rsync://example.com/home/archives\n")
+
+
+class TestTest(TestCaseInTempDir):
+
+ def test_get_publishing_root(self):
+ branch = FakeBranch()
+ my_config = config.BranchConfig(branch)
+ config_file = StringIO(sample_config)
+ (my_config._get_location_config().
+ _get_global_config()._get_parser(config_file))
+ self.assertEqual("rsync://example.com/home/archives",
+ my_config.get_user_option("publishing_root"))
More information about the bazaar-commits
mailing list