[Pkg-bazaar-commits] ./bzr/unstable r905: - merge aaron's append_multiple.patch

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:24 UTC 2009


------------------------------------------------------------
revno: 905
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-07-11 17:05:34 +1000
message:
  - merge aaron's append_multiple.patch
added:
  bzrlib/selftest/testbranch.py
modified:
  bzrlib/branch.py
  bzrlib/selftest/__init__.py
  bzrlib/selftest/blackbox.py
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2005-07-11 06:46:11 +0000
+++ b/bzrlib/branch.py	2005-07-11 07:05:34 +0000
@@ -549,11 +549,14 @@
         return self.working_tree().unknowns()
 
 
-    def append_revision(self, revision_id):
+    def append_revision(self, *revision_ids):
         from bzrlib.atomicfile import AtomicFile
 
-        mutter("add {%s} to revision-history" % revision_id)
-        rev_history = self.revision_history() + [revision_id]
+        for revision_id in revision_ids:
+            mutter("add {%s} to revision-history" % revision_id)
+
+        rev_history = self.revision_history()
+        rev_history.extend(revision_ids)
 
         f = AtomicFile(self.controlfilename('revision-history'))
         try:

=== modified file 'bzrlib/selftest/__init__.py'
--- a/bzrlib/selftest/__init__.py	2005-07-11 06:13:18 +0000
+++ b/bzrlib/selftest/__init__.py	2005-07-11 07:05:34 +0000
@@ -32,6 +32,7 @@
     import bzrlib.selftest.testmerge3
     import bzrlib.selftest.testhashcache
     import bzrlib.selftest.testrevisionnamespaces
+    import bzrlib.selftest.testbranch
     import bzrlib.merge_core
     from doctest import DocTestSuite
     import os
@@ -52,6 +53,7 @@
               bzrlib.selftest.blackbox,
               bzrlib.selftest.testhashcache,
               bzrlib.selftest.testrevisionnamespaces,
+              bzrlib.selftest.testbranch,
               ):
         if m not in MODULES_TO_TEST:
             MODULES_TO_TEST.append(m)
@@ -76,13 +78,6 @@
     for m in (MODULES_TO_DOCTEST):
         suite.addTest(DocTestSuite(m))
 
-#     for cl in (bzrlib.selftest.whitebox.TEST_CLASSES 
-#                + bzrlib.selftest.versioning.TEST_CLASSES
-#                + bzrlib.selftest.testmerge3.TEST_CLASSES
-#                + bzrlib.selftest.testhashcache.TEST_CLASSES
-#                + bzrlib.selftest.blackbox.TEST_CLASSES):
-#         suite.addTest(cl())
-
     suite.addTest(unittest.makeSuite(bzrlib.merge_core.MergeTest, 'test_'))
 
     return run_suite(suite, 'testbzr')

=== modified file 'bzrlib/selftest/blackbox.py'
--- a/bzrlib/selftest/blackbox.py	2005-07-11 06:58:16 +0000
+++ b/bzrlib/selftest/blackbox.py	2005-07-11 07:05:34 +0000
@@ -398,7 +398,6 @@
                 InitBranch,
                 HelpCommands,
                 UserIdentity,
-                AddWithId,
                 InvalidCommands,
                 RevertCommand,
                 OldTests,

=== added file 'bzrlib/selftest/testbranch.py'
--- a/bzrlib/selftest/testbranch.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/selftest/testbranch.py	2005-07-11 07:05:34 +0000
@@ -0,0 +1,35 @@
+# (C) 2005 Canonical Ltd
+
+# 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 bzrlib.selftest import InTempDir
+
+
+
+class TestAppendRevisions(InTempDir):
+    """Test appending more than one revision"""
+    def runTest(self):
+        from bzrlib.branch import Branch
+        br = Branch(".", init=True)
+        br.append_revision("rev1")
+        self.assertEquals(br.revision_history(), ["rev1",])
+        br.append_revision("rev2", "rev3")
+        self.assertEquals(br.revision_history(), ["rev1", "rev2", "rev3"])
+        
+
+
+TEST_CLASSES = [
+    TestAppendRevisions,
+    ]



More information about the Pkg-bazaar-commits mailing list