Rev 5488: Merge lp:~mgordon/bzr/506730-add-no-tree-to-bzr-push resolving conflicts and fixing NEWS entry in http://bazaar.launchpad.net/~vila/bzr/integration/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Oct 12 10:46:38 BST 2010


At http://bazaar.launchpad.net/~vila/bzr/integration/

------------------------------------------------------------
revno: 5488 [merge]
revision-id: v.ladeuil+lp at free.fr-20101012094637-bfb8q6oa9njthqks
parent: pqm at pqm.ubuntu.com-20101012090258-dxr8yxh0wnpv8jh2
parent: mgordon at ivs3d.com-20101002020836-k25jrewx9aai5een
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Tue 2010-10-12 11:46:37 +0200
message:
  Merge lp:~mgordon/bzr/506730-add-no-tree-to-bzr-push resolving conflicts and fixing NEWS entry
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/push.py                 push.py-20080606021927-5fe39050e8xne9un-1
  bzrlib/tests/blackbox/test_init.py test_init.py-20060309032856-a292116204d86eb7
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-10-12 09:02:58 +0000
+++ b/NEWS	2010-10-12 09:46:37 +0000
@@ -16,6 +16,10 @@
 New Features
 ************
 
+* Add --no-tree option to 'bzr push' and 'bzr init' for creating a
+  new or mirrored branch without working trees.
+  (Matthew Gordon, #506730)
+
 * New shortcut url schemes ``ubuntu:`` and ``debianlp:`` access source
   branches on Launchpad.  E.g. ``bzr branch ubuntu:foo`` gives you the source
   branch for project ``foo`` in the current distroseries for Ubuntu while

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-09-28 18:51:47 +0000
+++ b/bzrlib/branch.py	2010-10-12 09:46:37 +0000
@@ -1372,7 +1372,8 @@
         return format
 
     def create_clone_on_transport(self, to_transport, revision_id=None,
-        stacked_on=None, create_prefix=False, use_existing_dir=False):
+        stacked_on=None, create_prefix=False, use_existing_dir=False,
+        no_tree=None):
         """Create a clone of this branch and its bzrdir.
 
         :param to_transport: The transport to clone onto.
@@ -1391,7 +1392,8 @@
             revision_id = self.last_revision()
         dir_to = self.bzrdir.clone_on_transport(to_transport,
             revision_id=revision_id, stacked_on=stacked_on,
-            create_prefix=create_prefix, use_existing_dir=use_existing_dir)
+            create_prefix=create_prefix, use_existing_dir=use_existing_dir,
+            no_tree=no_tree)
         return dir_to.open_branch()
 
     def create_checkout(self, to_location, revision_id=None,

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-10-11 15:18:38 +0000
+++ b/bzrlib/builtins.py	2010-10-12 09:46:37 +0000
@@ -1069,6 +1069,9 @@
         Option('strict',
                help='Refuse to push if there are uncommitted changes in'
                ' the working tree, --no-strict disables the check.'),
+        Option('no-tree',
+               help="Don't populate the working tree, even for protocols"
+               " that support it."),
         ]
     takes_args = ['location?']
     encoding_type = 'replace'
@@ -1076,7 +1079,7 @@
     def run(self, location=None, remember=False, overwrite=False,
         create_prefix=False, verbose=False, revision=None,
         use_existing_dir=False, directory=None, stacked_on=None,
-        stacked=False, strict=None):
+        stacked=False, strict=None, no_tree=False):
         from bzrlib.push import _show_push_branch
 
         if directory is None:
@@ -1128,7 +1131,7 @@
         _show_push_branch(br_from, revision_id, location, self.outf,
             verbose=verbose, overwrite=overwrite, remember=remember,
             stacked_on=stacked_on, create_prefix=create_prefix,
-            use_existing_dir=use_existing_dir)
+            use_existing_dir=use_existing_dir, no_tree=no_tree)
 
 
 class cmd_branch(Command):
@@ -1712,10 +1715,12 @@
                 ),
          Option('append-revisions-only',
                 help='Never change revnos or the existing log.'
-                '  Append revisions to it only.')
+                '  Append revisions to it only.'),
+         Option('no-tree',
+                'Create a branch without a working tree.')
          ]
     def run(self, location=None, format=None, append_revisions_only=False,
-            create_prefix=False):
+            create_prefix=False, no_tree=False):
         if format is None:
             format = bzrdir.format_registry.make_bzrdir('default')
         if location is None:
@@ -1744,8 +1749,13 @@
         except errors.NotBranchError:
             # really a NotBzrDir error...
             create_branch = bzrdir.BzrDir.create_branch_convenience
+            if no_tree:
+                force_new_tree = False
+            else:
+                force_new_tree = None
             branch = create_branch(to_transport.base, format=format,
-                                   possible_transports=[to_transport])
+                                   possible_transports=[to_transport],
+                                   force_new_tree=force_new_tree)
             a_bzrdir = branch.bzrdir
         else:
             from bzrlib.transport.local import LocalTransport
@@ -1755,7 +1765,8 @@
                         raise errors.BranchExistsWithoutWorkingTree(location)
                 raise errors.AlreadyBranchError(location)
             branch = a_bzrdir.create_branch()
-            a_bzrdir.create_workingtree()
+            if not no_tree:
+                a_bzrdir.create_workingtree()
         if append_revisions_only:
             try:
                 branch.set_append_revisions_only(True)

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2010-09-29 05:35:26 +0000
+++ b/bzrlib/bzrdir.py	2010-10-12 09:46:37 +0000
@@ -167,7 +167,7 @@
 
     def clone_on_transport(self, transport, revision_id=None,
         force_new_repo=False, preserve_stacking=False, stacked_on=None,
-        create_prefix=False, use_existing_dir=True):
+        create_prefix=False, use_existing_dir=True, no_tree=False):
         """Clone this bzrdir and its contents to transport verbatim.
 
         :param transport: The transport for the location to produce the clone
@@ -215,7 +215,7 @@
         # we should look up the policy needs first, or just use it as a hint,
         # or something.
         if local_repo:
-            make_working_trees = local_repo.make_working_trees()
+            make_working_trees = local_repo.make_working_trees() and not no_tree
             want_shared = local_repo.is_shared()
             repo_format_name = format.repository_format.network_name()
         else:

=== modified file 'bzrlib/push.py'
--- a/bzrlib/push.py	2010-04-30 11:03:59 +0000
+++ b/bzrlib/push.py	2010-09-29 01:57:02 +0000
@@ -57,7 +57,7 @@
 
 def _show_push_branch(br_from, revision_id, location, to_file, verbose=False,
     overwrite=False, remember=False, stacked_on=None, create_prefix=False,
-    use_existing_dir=False):
+    use_existing_dir=False, no_tree=False):
     """Push a branch to a location.
 
     :param br_from: the source branch
@@ -87,7 +87,8 @@
         try:
             br_to = br_from.create_clone_on_transport(to_transport,
                 revision_id=revision_id, stacked_on=stacked_on,
-                create_prefix=create_prefix, use_existing_dir=use_existing_dir)
+                create_prefix=create_prefix, use_existing_dir=use_existing_dir,
+                no_tree=no_tree)
         except errors.FileExists, err:
             if err.path.endswith('/.bzr'):
                 raise errors.BzrCommandError(

=== modified file 'bzrlib/tests/blackbox/test_init.py'
--- a/bzrlib/tests/blackbox/test_init.py	2010-10-11 14:28:19 +0000
+++ b/bzrlib/tests/blackbox/test_init.py	2010-10-12 09:46:37 +0000
@@ -15,7 +15,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 
-"""Test "bzr init"""
+"""Test 'bzr init'"""
 
 import os
 import re
@@ -173,6 +173,11 @@
         out, err = self.run_bzr_subprocess('init')
         self.assertContainsRe(out, '1.9')
 
+    def test_init_no_tree(self):
+        """'bzr init --no-tree' creates a branch with no working tree."""
+        out, err = self.run_bzr('init --no-tree')
+        self.assertStartsWith(out, 'Created a standalone branch')
+
 
 class TestSFTPInit(TestCaseWithSFTPServer):
 
@@ -226,3 +231,4 @@
         out, err = self.run_bzr(['init', 'foo'])
         self.assertEqual(err, '')
         self.assertTrue(os.path.exists('foo'))
+        

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2010-06-11 07:32:12 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2010-09-29 02:57:33 +0000
@@ -146,6 +146,17 @@
         b2 = branch.Branch.open('pushed-location')
         self.assertEndsWith(b2.base, 'pushed-location/')
 
+    def test_push_no_tree(self):
+        # bzr push --no-tree of a branch with working trees
+        b = self.make_branch_and_tree('push-from')
+        self.build_tree(['push-from/file'])
+        b.add('file')
+        b.commit('commit 1')
+        out, err = self.run_bzr('push --no-tree -d push-from push-to')
+        self.assertEqual('', out)
+        self.assertEqual('Created new branch.\n', err)
+        self.failIfExists('push-to/file')
+
     def test_push_new_branch_revision_count(self):
         # bzr push of a branch with revisions to a new location
         # should print the number of revisions equal to the length of the



More information about the bazaar-commits mailing list