Rev 4952: (igc) branch --bind option in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 12 08:34:00 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4952 [merge]
revision-id: pqm at pqm.ubuntu.com-20100112083358-3q0c7ngiwtja7qba
parent: pqm at pqm.ubuntu.com-20100112080328-cb0tvu90uglxlrw0
parent: ian.clatworthy at canonical.com-20100112063906-5o1siotm9khqfcf8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-01-12 08:33:58 +0000
message:
  (igc) branch --bind option
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
=== modified file 'NEWS'
--- a/NEWS	2010-01-12 08:03:28 +0000
+++ b/NEWS	2010-01-12 08:33:58 +0000
@@ -20,6 +20,9 @@
 * Add bug information to log output when available.
   (Neil Martinsen-Burrell, Guillermo Gonzalez, #251729)
 
+* ``bzr branch`` now takes a ``--bind`` option. This lets you
+  branch and bind all in one command. (Ian Clatworthy)
+
 * ``bzr update`` now takes a ``--revision`` argument. This lets you
   change the revision of the working tree to any revision in the
   ancestry of the current or master branch. (Matthieu Moy, Mark Hammond,
@@ -35,7 +38,6 @@
   ``locations.conf`` or ``branch.conf``.
   (Ted Gould, Matthew Fuller, Vincent Ladeuil)
 
-
 Bug Fixes
 *********
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-01-12 06:30:41 +0000
+++ b/bzrlib/builtins.py	2010-01-12 08:33:58 +0000
@@ -1180,12 +1180,14 @@
                     ' directory exists, but does not already'
                     ' have a control directory.  This flag will'
                     ' allow branch to proceed.'),
+        Option('bind',
+            help="Bind new branch to from location."),
         ]
     aliases = ['get', 'clone']
 
     def run(self, from_location, to_location=None, revision=None,
             hardlink=False, stacked=False, standalone=False, no_tree=False,
-            use_existing_dir=False, switch=False):
+            use_existing_dir=False, switch=False, bind=False):
         from bzrlib import switch as _mod_switch
         from bzrlib.tag import _merge_tags_if_possible
         accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
@@ -1244,6 +1246,11 @@
         except (errors.NotStacked, errors.UnstackableBranchFormat,
             errors.UnstackableRepositoryFormat), e:
             note('Branched %d revision(s).' % branch.revno())
+        if bind:
+            # Bind to the parent
+            parent_branch = Branch.open(from_location)
+            branch.bind(parent_branch)
+            note('New branch bound to %s' % from_location)
         if switch:
             # Switch to the new branch
             wt, _ = WorkingTree.open_containing('.')

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2009-11-27 00:34:40 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2010-01-12 06:39:06 +0000
@@ -209,6 +209,13 @@
         self.assertEqual('', out)
         self.assertEqual('bzr: ERROR: Already a branch: "b".\n', err)
 
+    def test_branch_bind(self):
+        self.example_branch('a')
+        out, err = self.run_bzr('branch a b --bind')
+        self.assertEndsWith(err, "New branch bound to a\n")
+        b = branch.Branch.open('b')
+        self.assertEndsWith(b.get_bound_location(), '/a/')
+
 
 class TestBranchStacked(ExternalBase):
     """Tests for branch --stacked"""




More information about the bazaar-commits mailing list