Rev 5075: (vila) Merge 2.1 into bzr.dev including fixes for #524560 and #449776 in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Mar 5 09:27:04 GMT 2010


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

------------------------------------------------------------
revno: 5075 [merge]
revision-id: pqm at pqm.ubuntu.com-20100305092703-xwm9tmj33i3ym5rp
parent: pqm at pqm.ubuntu.com-20100303113037-51ffw5xyk93yzgl0
parent: v.ladeuil+lp at free.fr-20100305085512-rsguvvb02fbyx7zj
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-03-05 09:27:03 +0000
message:
  (vila) Merge 2.1 into bzr.dev including fixes for #524560 and #449776
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/atomicfile.py           atomicfile.py-20050509044450-dbd24e6c564f7c66
  bzrlib/cleanup.py              cleanup.py-20090922032110-mv6i6y8t04oon9np-1
  bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/plugins/launchpad/lp_api.py lp_api.py-20090704082908-79il6zl4gugwl3wz-1
  bzrlib/plugins/launchpad/test_lp_api.py test_lp_api.py-20091217012733-8sgahbhjn35ilrbu-1
  bzrlib/tests/per_foreign_vcs/test_repository.py test_repository.py-20091014092330-i5ymtg1r2o8quut9-1
  bzrlib/tests/test_cleanup.py   test_cleanup.py-20090922032110-mv6i6y8t04oon9np-2
  bzrlib/tests/test_lockdir.py   test_lockdir.py-20060220222025-33d4221569a3d600
  bzrlib/transport/local.py      local_transport.py-20050711165921-9b1f142bfe480c24
  doc/en/conf.py                 conf.py-20090722133816-63ik5s6s5gsnz7zy-12
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
=== modified file 'NEWS'
--- a/NEWS	2010-03-03 08:25:15 +0000
+++ b/NEWS	2010-03-05 08:55:12 +0000
@@ -173,6 +173,8 @@
 Bug Fixes
 *********
 
+* Merge correctly when this_tree is not a WorkingTree.  (Aaron Bentley)
+
 * Register SIGWINCH handler only when creating a ``TextUIFactory``; avoids
   problems importing bzrlib from a non-main thread.
   (Elliot Murphy, #521989)
@@ -180,7 +182,10 @@
 * Standardize the error handling when creating a new ``StaticTuple``
   (problems will raise TypeError). (Matt Nordhoff, #457979)
 
-* Merge correctly when this_tree is not a WorkingTree.  (Aaron Bentley)
+* Warn if pyrex is too old to compile the new ``SimpleSet`` and
+  ``StaticTuple`` extensions, rather than having the build fail randomly.
+  (John Arbash Meinel, #449776)
+
 
 Documentation
 *************
@@ -192,6 +197,7 @@
 * Drop Google Analytics from the core docs as they caused problems
   in the CHM files. (Ian Clatworthy, #502010)
 
+
 bzr 2.1.0
 #########
 
@@ -588,6 +594,10 @@
   version number along with rest of the help text.
   (Parth Malwankar, #369501)
 
+* Use osutils.O_NOINHERIT for some files on win32 to avoid PermissionDenied
+  errors.
+  (Inada Naoki, #524560)
+
 Documentation
 *************
 

=== modified file 'bzrlib/atomicfile.py'
--- a/bzrlib/atomicfile.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/atomicfile.py	2010-02-22 08:28:41 +0000
@@ -60,7 +60,7 @@
 
         self.realfilename = filename
 
-        flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY
+        flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY | osutils.O_NOINHERIT
         if mode == 'wb':
             flags |= osutils.O_BINARY
         elif mode != 'wt':

=== modified file 'bzrlib/cleanup.py'
--- a/bzrlib/cleanup.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/cleanup.py	2010-03-03 22:59:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Canonical Ltd
+# Copyright (C) 2009, 2010 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

=== modified file 'bzrlib/lockdir.py'
--- a/bzrlib/lockdir.py	2010-03-01 21:51:57 +0000
+++ b/bzrlib/lockdir.py	2010-03-03 22:59:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2008, 2010 Canonical Ltd
+# Copyright (C) 2006-2010 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

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/osutils.py	2010-03-05 08:55:12 +0000
@@ -85,8 +85,11 @@
 # be opened in binary mode, rather than text mode.
 # On other platforms, O_BINARY doesn't exist, because
 # they always open in binary mode, so it is okay to
-# OR with 0 on those platforms
+# OR with 0 on those platforms.
+# O_NOINHERIT and O_TEXT exists only on win32 too.
 O_BINARY = getattr(os, 'O_BINARY', 0)
+O_TEXT = getattr(os, 'O_TEXT', 0)
+O_NOINHERIT = getattr(os, 'O_NOINHERIT', 0)
 
 
 def get_unicode_argv():
@@ -663,7 +666,7 @@
 def sha_file_by_name(fname):
     """Calculate the SHA1 of a file by reading the full text"""
     s = sha()
-    f = os.open(fname, os.O_RDONLY | O_BINARY)
+    f = os.open(fname, os.O_RDONLY | O_BINARY | O_NOINHERIT)
     try:
         while True:
             b = os.read(f, 1<<16)
@@ -2117,3 +2120,46 @@
         else:
             data, _ = self.encode(object, self.errors)
             self.stream.write(data)
+
+if sys.platform == 'win32':
+    def open_file(filename, mode='r', bufsize=-1):
+        """This function is used to override the ``open`` builtin.
+        
+        But it uses O_NOINHERIT flag so the file handle is not inherited by
+        child processes.  Deleting or renaming a closed file opened with this
+        function is not blocking child processes.
+        """
+        writing = 'w' in mode
+        appending = 'a' in mode
+        updating = '+' in mode
+        binary = 'b' in mode
+
+        flags = O_NOINHERIT
+        # see http://msdn.microsoft.com/en-us/library/yeby3zcb%28VS.71%29.aspx
+        # for flags for each modes.
+        if binary:
+            flags |= O_BINARY
+        else:
+            flags |= O_TEXT
+
+        if writing:
+            if updating:
+                flags |= os.O_RDWR
+            else:
+                flags |= os.O_WRONLY
+            flags |= os.O_CREAT | os.O_TRUNC
+        elif appending:
+            if updating:
+                flags |= os.O_RDWR
+            else:
+                flags |= os.O_WRONLY
+            flags |= os.O_CREAT | os.O_APPEND
+        else: #reading
+            if updating:
+                flags |= os.O_RDWR
+            else:
+                flags |= os.O_RDONLY
+
+        return os.fdopen(os.open(filename, flags), mode, bufsize)
+else:
+    open_file = open

=== modified file 'bzrlib/plugins/launchpad/lp_api.py'
--- a/bzrlib/plugins/launchpad/lp_api.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/plugins/launchpad/lp_api.py	2010-03-05 08:55:12 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Canonical Ltd
+# Copyright (C) 2009, 2010 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

=== modified file 'bzrlib/plugins/launchpad/test_lp_api.py'
--- a/bzrlib/plugins/launchpad/test_lp_api.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_api.py	2010-03-05 08:55:12 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Canonical Ltd
+# Copyright (C) 2009, 2010 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

=== modified file 'bzrlib/tests/per_foreign_vcs/test_repository.py'
--- a/bzrlib/tests/per_foreign_vcs/test_repository.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/per_foreign_vcs/test_repository.py	2010-03-03 22:59:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Canonical Ltd
+# Copyright (C) 2009, 2010 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

=== modified file 'bzrlib/tests/test_cleanup.py'
--- a/bzrlib/tests/test_cleanup.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/test_cleanup.py	2010-03-03 22:59:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Canonical Ltd
+# Copyright (C) 2009, 2010 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

=== modified file 'bzrlib/tests/test_lockdir.py'
--- a/bzrlib/tests/test_lockdir.py	2010-03-01 21:51:57 +0000
+++ b/bzrlib/tests/test_lockdir.py	2010-03-03 22:59:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2008, 2010 Canonical Ltd
+# Copyright (C) 2006-2010 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

=== modified file 'bzrlib/transport/local.py'
--- a/bzrlib/transport/local.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/transport/local.py	2010-03-05 08:55:12 +0000
@@ -42,8 +42,8 @@
 from bzrlib import transport
 
 
-_append_flags = os.O_CREAT | os.O_APPEND | os.O_WRONLY | osutils.O_BINARY
-_put_non_atomic_flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | osutils.O_BINARY
+_append_flags = os.O_CREAT | os.O_APPEND | os.O_WRONLY | osutils.O_BINARY | osutils.O_NOINHERIT
+_put_non_atomic_flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | osutils.O_BINARY | osutils.O_NOINHERIT
 
 
 class LocalTransport(transport.Transport):
@@ -160,7 +160,7 @@
             transport._file_streams[canonical_url].flush()
         try:
             path = self._abspath(relpath)
-            return open(path, 'rb')
+            return osutils.open_file(path, 'rb')
         except (IOError, OSError),e:
             if e.errno == errno.EISDIR:
                 return LateReadError(relpath)
@@ -329,7 +329,7 @@
         # initialise the file
         self.put_bytes_non_atomic(relpath, "", mode=mode)
         abspath = self._abspath(relpath)
-        handle = open(abspath, 'wb')
+        handle = osutils.open_file(abspath, 'wb')
         if mode is not None:
             self._check_mode_and_size(abspath, handle.fileno(), mode)
         transport._file_streams[self.abspath(relpath)] = handle

=== modified file 'doc/en/conf.py'
--- a/doc/en/conf.py	2009-12-07 21:51:01 +0000
+++ b/doc/en/conf.py	2010-03-03 04:18:28 +0000
@@ -28,10 +28,12 @@
         u'Bazaar User Reference': None,
         u'Bazaar Release Notes': None,
         u'Bazaar Upgrade Guide': None,
+        u"Bazaar System Administrator's Guide": None,
         u'Bazaar in five minutes': None,
         u'Bazaar Tutorial': None,
         u'Using Bazaar With Launchpad': None,
         u'Centralized Workflow Tutorial': None,
+        u"What's New in Bazaar 2.1?": None,
     }
 def bzr_title(s):
     return bzr_titles.get(s) or s
@@ -58,6 +60,8 @@
     bzr_title(u'Bazaar Release Notes'), bzr_team, 'manual'),
   ('upgrade-guide/index', 'bzr-%s-upgrade-guide.tex' % (bzr_locale,),
     bzr_title(u'Bazaar Upgrade Guide'), bzr_team, 'manual'),
+  ('admin-guide/index', 'bzr-%s-admin-guide.tex' % (bzr_locale,),
+    bzr_title(u"Bazaar System Administrator's Guide"), bzr_team, 'manual'),
   # Tutorials
   ('mini-tutorial/index', 'bzr-%s-tutorial-mini.tex' % (bzr_locale,),
     bzr_title(u'Bazaar in five minutes'), bzr_team, 'howto'),
@@ -69,6 +73,8 @@
   ('tutorials/centralized_workflow',
     'bzr-%s-tutorial-centralized.tex' % (bzr_locale,),
     bzr_title(u'Centralized Workflow Tutorial'), bzr_team, 'howto'),
+  ('whats-new/whats-new-in-2.1', 'bzr-%s-whats-new.tex' % (bzr_locale,),
+    bzr_title(u"What's New in Bazaar 2.1?"), bzr_team, 'howto'),
 ]
 
 # List of documents that shouldn't be included in the build.

=== modified file 'setup.py'
--- a/setup.py	2010-01-29 10:36:23 +0000
+++ b/setup.py	2010-03-05 08:55:12 +0000
@@ -186,6 +186,7 @@
     from distutils.command.build_ext import build_ext
 else:
     have_pyrex = True
+    pyrex_version_info = tuple(map(int, pyrex_version.split('.')))
 
 
 class build_ext_if_possible(build_ext):
@@ -282,7 +283,7 @@
     add_pyrex_extension('bzrlib._walkdirs_win32')
     z_lib = 'zdll'
 else:
-    if have_pyrex and pyrex_version.startswith('0.9.4'):
+    if have_pyrex and pyrex_version_info[:3] == (0,9,4):
         # Pyrex 0.9.4.1 fails to compile this extension correctly
         # The code it generates re-uses a "local" pointer and
         # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
@@ -301,9 +302,20 @@
 add_pyrex_extension('bzrlib._chk_map_pyx', libraries=[z_lib])
 ext_modules.append(Extension('bzrlib._patiencediff_c',
                              ['bzrlib/_patiencediff_c.c']))
-add_pyrex_extension('bzrlib._simple_set_pyx')
-ext_modules.append(Extension('bzrlib._static_tuple_c',
-                             ['bzrlib/_static_tuple_c.c']))
+if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
+    print
+    print 'Your Pyrex/Cython version %s is too old to build the simple_set' % (
+        pyrex_version)
+    print 'and static_tuple extensions.'
+    print 'Please upgrade to at least Pyrex 0.9.6.3'
+    print
+    # TODO: Should this be a fatal error?
+else:
+    # We only need 0.9.6.3 to build _simple_set_pyx, but static_tuple depends
+    # on simple_set
+    add_pyrex_extension('bzrlib._simple_set_pyx')
+    ext_modules.append(Extension('bzrlib._static_tuple_c',
+                                 ['bzrlib/_static_tuple_c.c']))
 add_pyrex_extension('bzrlib._btree_serializer_pyx')
 
 




More information about the bazaar-commits mailing list