Rev 6442: (jelmer) Actually fetch revisions when branching into existing bzrdir. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jan 19 13:15:39 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6442 [merge]
revision-id: pqm at pqm.ubuntu.com-20120119131539-19c0a9ad8lpnvs95
parent: pqm at pqm.ubuntu.com-20120118200849-i93mg9cvcwxpvth3
parent: jelmer at samba.org-20120119120112-v5f90mqrq7dma16w
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2012-01-19 13:15:39 +0000
message:
  (jelmer) Actually fetch revisions when branching into existing bzrdir.
   (Jelmer Vernooij)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2012-01-17 10:30:33 +0000
+++ b/bzrlib/builtins.py	2012-01-19 12:01:12 +0000
@@ -1394,6 +1394,11 @@
                     from_location, revision)
                 raise errors.BzrCommandError(msg)
         else:
+            try:
+                to_repo = to_dir.open_repository()
+            except errors.NoRepositoryPresent:
+                to_repo = to_dir.create_repository()
+            to_repo.fetch(br_from.repository, revision_id=revision_id)
             branch = br_from.sprout(to_dir, revision_id=revision_id)
         _merge_tags_if_possible(br_from, branch)
         # If the source branch is stacked, the new branch may

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2012-01-02 14:41:49 +0000
+++ b/bzrlib/commands.py	2012-01-19 13:15:39 +0000
@@ -1081,7 +1081,13 @@
             argv_copy.append(a)
         i += 1
 
-    bzrlib.global_state.cmdline_overrides._from_cmdline(override_config)
+    if bzrlib.global_state is None:
+        # FIXME: Workaround for users that imported bzrlib but didn't call
+        # bzrlib.initialize -- vila 2012-01-19
+        cmdline_overrides = config.CommandLineStore()
+    else:
+        cmdline_overrides = bzrlib.global_state.cmdline_overrides
+    cmdline_overrides._from_cmdline(override_config)
 
     debug.set_debug_flags_from_config()
 
@@ -1141,7 +1147,7 @@
             trace.debug_memory('Process status after command:', short=False)
         option._verbosity_level = saved_verbosity_level
         # Reset the overrides 
-        bzrlib.global_state.cmdline_overrides._reset()
+        cmdline_overrides._reset()
 
 
 def display_command(func):

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2012-01-05 13:02:31 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2012-01-19 12:01:12 +0000
@@ -156,6 +156,12 @@
         work = branch.Branch.open('current')
         self.assertEqual(work.last_revision(), _mod_revision.NULL_REVISION)
 
+    def test_branch_into_empty_dir(self):
+        t = self.example_branch('source')
+        self.make_bzrdir('target')
+        self.run_bzr("branch source target")
+        self.assertEquals(2, len(t.branch.repository.all_revision_ids()))
+
     def test_branch_switch_checkout(self):
         # Checkout in the current directory:
         #  => new branch will be created and checkout bound to the new branch

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-01-18 19:40:10 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-01-19 13:15:39 +0000
@@ -36,6 +36,12 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* ``bzr branch`` now fetches revisions when branching into an empty
+  control directory. (Jelmer Vernooij, #905594)
+
+* Support scripts that don't call bzrlib.initialize() but still call run_bzr().
+  (Vincent Ladeuil, #917733)
+
 * Test for equality instead of object identity where ROOT_PARENT is concerned.
   (Wouter van Heyst, #881142)
 




More information about the bazaar-commits mailing list