[Pkg-bazaar-commits] ./bzrtools/unstable r682: New upstream release.

Jelmer Vernooij jelmer at samba.org
Thu Jun 18 10:55:57 UTC 2009


------------------------------------------------------------
revno: 682
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: unstable
timestamp: Thu 2009-06-18 12:55:57 +0200
message:
  New upstream release.
added:
  mirror.py
  tests/test_fetch_ghosts.py
  tests/test_mirror.py
modified:
  NEWS
  __init__.py
  command_classes.py
  debian/changelog
  debian/control
  tests/blackbox.py
  version.py
    ------------------------------------------------------------
    revno: 659.1.50
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzrtools
    timestamp: Tue 2009-06-02 07:33:28 -0400
    message:
      Add test_fetch_ghosts
    added:
      tests/test_fetch_ghosts.py
    ------------------------------------------------------------
    revno: 659.1.51
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzrtools
    timestamp: Wed 2009-06-10 21:47:16 -0400
    message:
      Increment version to 1.16.0
    modified:
      version.py
    ------------------------------------------------------------
    revno: 659.1.52
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzrtools
    timestamp: Wed 2009-06-10 22:05:44 -0400
    message:
      Implement create-mirror command
    added:
      mirror.py
      tests/test_mirror.py
    modified:
      NEWS
      __init__.py
      command_classes.py
      tests/blackbox.py
    ------------------------------------------------------------
    revno: 659.1.53
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzrtools
    timestamp: Thu 2009-06-11 19:40:26 -0400
    message:
      Copy submit branch in create_mirror.
    modified:
      command_classes.py
      mirror.py
      tests/test_mirror.py
    ------------------------------------------------------------
    revno: 659.1.54
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzrtools
    timestamp: Fri 2009-06-12 17:17:29 -0400
    message:
      Update NEWS for release
    modified:
      NEWS
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-05-27 18:58:58 +0000
+++ b/NEWS	2009-06-12 21:17:29 +0000
@@ -1,3 +1,9 @@
+June 12 2009
+* RELEASE: bzrtools 1.16.0
+
+June 10 2009
+* Implement create-mirror command
+
 May 27 2009
 * Fix fetch-ghosts command for bzr 1.15
 * RELEASE: bzrtools 1.15.0

=== modified file '__init__.py'
--- a/__init__.py	2009-05-27 18:57:14 +0000
+++ b/__init__.py	2009-06-11 02:05:44 +0000
@@ -32,6 +32,7 @@
     'cmd_cbranch': [],
     'cmd_cdiff': [],
     'cmd_conflict_diff': [],
+    'cmd_create_mirror': [],
     'cmd_fetch_ghosts': ['fetch-missing'],
     'cmd_graph_ancestry': [],
     'cmd_import': [],
@@ -81,6 +82,7 @@
     import tests.test_link_tree
     import tests.test_patch
     import tests.test_rspush
+    import tests.test_mirror
     import tests.upstream_import
     import zap
     import tests.blackbox
@@ -100,4 +102,5 @@
     result.addTest(TestLoader().loadTestsFromModule(tests.test_rspush))
     result.addTest(TestLoader().loadTestsFromModule(tests.test_cbranch))
     result.addTest(TestLoader().loadTestsFromModule(tests.test_conflict_diff))
+    result.addTest(TestLoader().loadTestsFromModule(tests.test_mirror))
     return result

=== modified file 'command_classes.py'
--- a/command_classes.py	2009-05-27 18:57:14 +0000
+++ b/command_classes.py	2009-06-11 23:40:26 +0000
@@ -579,3 +579,20 @@
                 source_tree.unlock()
         finally:
             target_tree.unlock()
+
+
+class cmd_create_mirror(BzrToolsCommand):
+    """Create a mirror of another branch.
+
+    This is similar to `bzr branch`, but copies more settings, including the
+    submit branch and nickname.
+
+    It sets the public branch and parent of the target to the source location.
+    """
+
+    takes_args = ['source', 'target']
+
+    def run(self, source, target):
+        source_branch = Branch.open(source)
+        from bzrlib.plugins.bzrtools.mirror import create_mirror
+        create_mirror(source_branch, target, [])

=== modified file 'debian/changelog'
--- a/debian/changelog	2009-05-29 07:35:18 +0000
+++ b/debian/changelog	2009-06-18 10:55:57 +0000
@@ -1,3 +1,9 @@
+bzrtools (1.16.0-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Jelmer Vernooij <jelmer at debian.org>  Thu, 18 Jun 2009 12:55:45 +0200
+
 bzrtools (1.15.0-1) unstable; urgency=low
 
   [ Adeodato Sim? ]

=== modified file 'debian/control'
--- a/debian/control	2009-05-29 07:35:18 +0000
+++ b/debian/control	2009-06-18 10:55:57 +0000
@@ -13,7 +13,7 @@
 
 Package: bzrtools
 Architecture: all
-Depends: ${python:Depends}, bzr (>= 1.15~), bzr (<< 1.16~), patch, ${misc:Depends}
+Depends: ${python:Depends}, bzr (>= 1.16~), bzr (<< 1.17~), patch, ${misc:Depends}
 Recommends: rsync
 Suggests: librsvg2-bin, graphviz
 XB-Python-Version: ${python:Versions}

=== added file 'mirror.py'
--- a/mirror.py	1970-01-01 00:00:00 +0000
+++ b/mirror.py	2009-06-11 23:40:26 +0000
@@ -0,0 +1,13 @@
+from bzrlib.transport import get_transport
+
+
+def create_mirror(source_branch, target_location, possible_transports):
+    possible_transports.append(source_branch.bzrdir.root_transport)
+    t = get_transport(target_location, possible_transports)
+    mirror = source_branch.bzrdir.clone_on_transport(t).open_branch()
+    mirror.set_public_branch(source_branch.base)
+    mirror.set_parent(source_branch.base)
+    if source_branch.get_config().has_explicit_nickname():
+        mirror.nick = source_branch.nick
+    mirror.set_submit_branch(source_branch.get_submit_branch())
+    return mirror

=== modified file 'tests/blackbox.py'
--- a/tests/blackbox.py	2009-03-11 02:13:43 +0000
+++ b/tests/blackbox.py	2009-06-11 02:05:44 +0000
@@ -169,6 +169,14 @@
         self.assertEqual(os.lstat(checkout2.abspath('file')).st_ino,
                          os.lstat(source.abspath('file')).st_ino)
 
+    def test_create_mirror(self):
+        source = self.make_branch_and_tree('source')
+        source.commit('message')
+        self.run_bzr('create-mirror source target')
+        target = branch.Branch.open('target')
+        self.assertEqual(source.last_revision(), target.last_revision())
+        self.assertEqual(source.branch.base, target.get_public_branch())
+
 
 def test_suite():
     return makeSuite(TestBzrTools)

=== added file 'tests/test_fetch_ghosts.py'
--- a/tests/test_fetch_ghosts.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_fetch_ghosts.py	2009-06-02 11:33:28 +0000
@@ -0,0 +1,25 @@
+from bzrlib.plugins.bzrtools.fetch_ghosts import GhostFetcher
+from bzrlib.tests import TestCaseWithTransport
+
+
+class TestFetchGhosts(TestCaseWithTransport):
+
+    def prepare_with_ghosts(self):
+        tree = self.make_branch_and_tree('.')
+        tree.commit('rev1', rev_id='rev1-id')
+        tree.set_parent_ids(['rev1-id', 'ghost-id'])
+        tree.commit('rev2')
+        return tree
+
+    def test_fetch_ghosts_failure(self):
+        tree = self.prepare_with_ghosts()
+        branch = self.make_branch('branch')
+        GhostFetcher(tree.branch, branch).run()
+        self.assertFalse(tree.branch.repository.has_revision('ghost-id'))
+
+    def test_fetch_ghosts_success(self):
+        tree = self.prepare_with_ghosts()
+        ghost_tree = self.make_branch_and_tree('ghost_tree')
+        ghost_tree.commit('ghost', rev_id='ghost-id')
+        GhostFetcher(tree.branch, ghost_tree.branch).run()
+        self.assertTrue(tree.branch.repository.has_revision('ghost-id'))

=== added file 'tests/test_mirror.py'
--- a/tests/test_mirror.py	1970-01-01 00:00:00 +0000
+++ b/tests/test_mirror.py	2009-06-11 23:40:26 +0000
@@ -0,0 +1,52 @@
+from bzrlib import revision, transform
+from bzrlib.tests import TestCaseWithTransport
+
+from bzrlib.plugins.bzrtools.mirror import create_mirror
+
+class TestMirror(TestCaseWithTransport):
+
+    def commit_transform(self, branch, tt):
+        base_revno, base_revision = branch.last_revision_info()
+        if base_revision == revision.NULL_REVISION:
+            parents = []
+        else:
+            parents = [base_revision]
+        preview = tt.get_preview_tree()
+        preview.set_parent_ids(parents)
+        changes = tt.iter_changes()
+        builder = branch.get_commit_builder(parents)
+        try:
+            list(builder.record_iter_changes(preview, base_revision, changes))
+            builder.finish_inventory()
+            revision_id = builder.commit('message')
+        except:
+            builder.abort()
+            raise
+        branch.set_last_revision_info(base_revno + 1, revision_id)
+
+    def make_transform(self, branch):
+        base = branch.basis_tree()
+        tt = transform.TransformPreview(base)
+        self.addCleanup(tt.finalize)
+        root = tt.new_directory('', transform.ROOT_PARENT, 'root-id')
+        tt._new_root = root
+        return tt
+
+    def test_create_mirror(self):
+        source = self.make_branch('source')
+        source.lock_write()
+        self.addCleanup(source.unlock)
+        source.nick = 'my special nick'
+        source.set_submit_branch(':submit:')
+        self.commit_transform(source, self.make_transform(source))
+        mirror = create_mirror(source, 'target', [])
+        self.assertEqual(source.last_revision(), mirror.last_revision())
+        self.assertEqual(source.base, mirror.get_public_branch())
+        self.assertEqual(source.base, mirror.get_parent())
+        self.assertEqual('my special nick', mirror.nick)
+        self.assertEqual(':submit:', mirror.get_submit_branch())
+
+    def test_nonexplict_nick(self):
+        source = self.make_branch('source')
+        mirror = create_mirror(source, 'target', [])
+        self.assertEqual('target', mirror.nick)

=== modified file 'version.py'
--- a/version.py	2009-05-20 10:30:15 +0000
+++ b/version.py	2009-06-11 01:47:16 +0000
@@ -1,2 +1,2 @@
-__version__ = '1.15.0'
+__version__ = '1.16.0'
 version_info = tuple(int(n) for n in __version__.split('.'))



More information about the Pkg-bazaar-commits mailing list