Rev 4714: Merge bzr.stable 4713, resolve NEWS in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-495000-win32-autopack

John Arbash Meinel john at arbash-meinel.com
Mon Dec 21 16:45:49 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-495000-win32-autopack

------------------------------------------------------------
revno: 4714 [merge]
revision-id: john at arbash-meinel.com-20091221164539-5xz1zy24f4ca1c07
parent: john at arbash-meinel.com-20091216220231-fstjwhwjil07slkd
parent: pqm at pqm.ubuntu.com-20091221020607-39aj3xnhja6hjfqe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-495000-win32-autopack
timestamp: Mon 2009-12-21 10:45:39 -0600
message:
  Merge bzr.stable 4713, resolve NEWS
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_bencode_pyx.pyx        bencode.pyx-20070806220735-j75g4ebfnado2i60-3
  bzrlib/export/dir_exporter.py  dir_exporter.py-20051114235828-b51397f56bc7b117
  doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-12-16 22:02:31 +0000
+++ b/NEWS	2009-12-21 16:45:39 +0000
@@ -8,7 +8,7 @@
 bzr 2.0.4 (not released yet)
 ############################
 
-:Codename: template
+:Codename:
 :2.0.4: ???
 
 Compatibility Breaks
@@ -20,6 +20,17 @@
 Bug Fixes
 *********
 
+* ``bzr export dir`` now requests all file content as a record stream,
+  rather than requsting the file content one file-at-a-time. This can make
+  exporting over the network significantly faster (54min => 9min in one
+  case). (John Arbash Meinel, #343218)
+
+* ``bzr serve`` no longer slowly leaks memory. The compiled
+  ``bzrlib.bencode.Encoder()`` class was using ``__del__`` to cleanup and
+  free resources, and it should have been using ``__dealloc__``.
+  This will likely have an impact on any other process that is serving for
+  an extended period of time.  (John Arbash Meinel, #494406)
+
 * The 2a format wasn't properly restarting autopacks when something
   changed underneath it (like another autopack). Now concurrent
   autopackers will properly succeed. (John Arbash Meinel, #495000)

=== modified file 'bzrlib/_bencode_pyx.pyx'
--- a/bzrlib/_bencode_pyx.pyx	2009-06-05 01:48:32 +0000
+++ b/bzrlib/_bencode_pyx.pyx	2009-12-18 21:58:32 +0000
@@ -261,7 +261,7 @@
         self.maxsize = maxsize
         self.tail = p
 
-    def __del__(self):
+    def __dealloc__(self):
         free(self.buffer)
         self.buffer = NULL
         self.maxsize = 0

=== modified file 'bzrlib/export/dir_exporter.py'
--- a/bzrlib/export/dir_exporter.py	2009-07-29 13:46:55 +0000
+++ b/bzrlib/export/dir_exporter.py	2009-12-18 05:38:40 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
+# Copyright (C) 2005, 2009 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
@@ -52,21 +52,17 @@
                 raise errors.BzrError("Can't export tree to non-empty directory.")
         else:
             raise
+    # Iterate everything, building up the files we will want to export, and
+    # creating the directories and symlinks that we need.
+    # This tracks (file_id, (destination_path, executable))
+    # This matches the api that tree.iter_files_bytes() wants
+    # Note in the case of revision trees, this does trigger a double inventory
+    # lookup, hopefully it isn't too expensive.
+    to_fetch = []
     for dp, ie in _export_iter_entries(tree, subdir):
         fullpath = osutils.pathjoin(dest, dp)
         if ie.kind == "file":
-            if filtered:
-                chunks = tree.get_file_lines(ie.file_id)
-                filters = tree._content_filter_stack(dp)
-                context = ContentFilterContext(dp, tree, ie)
-                contents = filtered_output_bytes(chunks, filters, context)
-                content = ''.join(contents)
-                fileobj = StringIO.StringIO(content)
-            else:
-                fileobj = tree.get_file(ie.file_id)
-            osutils.pumpfile(fileobj, file(fullpath, 'wb'))
-            if tree.is_executable(ie.file_id):
-                os.chmod(fullpath, 0755)
+            to_fetch.append((ie.file_id, (dp, tree.is_executable(ie.file_id))))
         elif ie.kind == "directory":
             os.mkdir(fullpath)
         elif ie.kind == "symlink":
@@ -80,3 +76,21 @@
         else:
             raise errors.BzrError("don't know how to export {%s} of kind %r" %
                (ie.file_id, ie.kind))
+    # The data returned here can be in any order, but we've already created all
+    # the directories
+    flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | getattr(os, 'O_BINARY', 0)
+    for (relpath, executable), chunks in tree.iter_files_bytes(to_fetch):
+        if filtered:
+            filters = tree._content_filter_stack(relpath)
+            context = ContentFilterContext(relpath, tree, ie)
+            chunks = filtered_output_bytes(chunks, filters, context)
+        fullpath = osutils.pathjoin(dest, relpath)
+        # We set the mode and let the umask sort out the file info
+        mode = 0666
+        if executable:
+            mode = 0777
+        out = os.fdopen(os.open(fullpath, flags, mode), 'wb')
+        try:
+            out.writelines(chunks)
+        finally:
+            out.close()

=== modified file 'doc/en/user-guide/introducing_bazaar.txt'
--- a/doc/en/user-guide/introducing_bazaar.txt	2009-06-01 22:45:06 +0000
+++ b/doc/en/user-guide/introducing_bazaar.txt	2009-12-17 04:54:32 +0000
@@ -135,7 +135,7 @@
 
 .. _Bazaar in five minutes: ../mini-tutorial/index.html
 .. _Bazaar Quick Start Card: ../quick-reference/quick-start-summary.svg
-.. _Bazaar User Reference: ../user-reference/bzr_man.html
+.. _Bazaar User Reference: ../user-reference/index.html
 
 We hope you find this manual useful. If you have suggestions on how it
 or the rest of Bazaar's documentation can be improved, please contact



More information about the bazaar-commits mailing list