Rev 2848: win32-specific fixes (bialix) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Sep 22 18:02:28 BST 2007


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

------------------------------------------------------------
revno: 2848
revision-id: pqm at pqm.ubuntu.com-20070922170226-ex2ydmlyboaoj87c
parent: pqm at pqm.ubuntu.com-20070922162518-jn1nr11x32ep32mv
parent: bialix at ukr.net-20070922162037-d1ym5gbli9utowto
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-09-22 18:02:26 +0100
message:
  win32-specific fixes (bialix)
modified:
  bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
  bzrlib/multiparent.py          __init__.py-20070410133617-n1jdhcc1n1mibarp-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
  bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
    ------------------------------------------------------------
    revno: 2846.2.1
    merged: bialix at ukr.net-20070922162037-d1ym5gbli9utowto
    parent: pqm at pqm.ubuntu.com-20070921081743-jhdchcp1wiwmw0jv
    parent: bialix at ukr.net-20070920213249-z3v3qop4mhyj6lir
    parent: bialix at ukr.net-20070920214615-v1a3x1f05sgtrop2
    parent: bialix at ukr.net-20070921123048-l12m4d9h4tj8rzg6
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: approved.branch5
    timestamp: Sat 2007-09-22 19:20:37 +0300
    message:
      merge approved chunks
        ------------------------------------------------------------
        revno: 2839.4.1
        merged: bialix at ukr.net-20070920214615-v1a3x1f05sgtrop2
        parent: pqm at pqm.ubuntu.com-20070920125023-upjqmzln7mjtvj1h
        committer: Alexander Belchenko <bialix at ukr.net>
        branch nick: 2
        timestamp: Fri 2007-09-21 00:46:15 +0300
        message:
          provide non-empty locations.conf for test_branch.TestBranchFormat5.test_set_push_location
        ------------------------------------------------------------
        revno: 2839.3.1
        merged: bialix at ukr.net-20070921123048-l12m4d9h4tj8rzg6
        parent: pqm at pqm.ubuntu.com-20070920125023-upjqmzln7mjtvj1h
        committer: Alexander Belchenko <bialix at ukr.net>
        branch nick: 5
        timestamp: Fri 2007-09-21 15:30:48 +0300
        message:
          using functions from osutils instead of os.path.*
    ------------------------------------------------------------
    revno: 2839.2.1
    merged: bialix at ukr.net-20070920213249-z3v3qop4mhyj6lir
    parent: pqm at pqm.ubuntu.com-20070920125023-upjqmzln7mjtvj1h
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: 1
    timestamp: Fri 2007-09-21 00:32:49 +0300
    message:
      multiparent.py: workaround for windows bug: .tell() for files opened in 'ab' mode before any write returns 0
=== modified file 'bzrlib/info.py'
--- a/bzrlib/info.py	2007-08-15 04:33:34 +0000
+++ b/bzrlib/info.py	2007-09-21 12:30:48 +0000
@@ -131,13 +131,13 @@
 def _show_location_info(locs):
     """Show known locations for working, branch and repository."""
     print 'Location:'
-    path_list = LocationList(os.getcwd())
+    path_list = LocationList(osutils.getcwd())
     for name, loc in locs:
         path_list.add_url(name, loc)
     sys.stdout.writelines(path_list.get_lines())
 
 def _gather_related_branches(branch):
-    locs = LocationList(os.getcwd())
+    locs = LocationList(osutils.getcwd())
     locs.add_url('public branch', branch.get_public_branch())
     locs.add_url('push branch', branch.get_push_location())
     locs.add_url('parent branch', branch.get_parent())

=== modified file 'bzrlib/multiparent.py'
--- a/bzrlib/multiparent.py	2007-07-24 16:25:33 +0000
+++ b/bzrlib/multiparent.py	2007-09-20 21:32:49 +0000
@@ -540,6 +540,9 @@
     def add_diff(self, diff, version_id, parent_ids):
         outfile = open(self._filename + '.mpknit', 'ab')
         try:
+            outfile.seek(0, 2)      # workaround for windows bug:
+                                    # .tell() for files opened in 'ab' mode
+                                    # before any write returns 0
             start = outfile.tell()
             try:
                 zipfile = GzipFile(None, mode='ab', fileobj=outfile)

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-09-13 01:54:49 +0000
+++ b/bzrlib/tests/__init__.py	2007-09-21 12:30:48 +0000
@@ -72,7 +72,6 @@
     pass
 from bzrlib.merge import merge_inner
 import bzrlib.merge3
-import bzrlib.osutils
 import bzrlib.plugin
 from bzrlib.revision import common_ancestor
 import bzrlib.store
@@ -1878,7 +1877,7 @@
     def _make_test_root(self):
         if TestCaseWithMemoryTransport.TEST_ROOT is not None:
             return
-        root = tempfile.mkdtemp(prefix='testbzr-', suffix='.tmp')
+        root = osutils.mkdtemp(prefix='testbzr-', suffix='.tmp')
         TestCaseWithMemoryTransport.TEST_ROOT = root
         
         # make a fake bzr directory there to prevent any tests propagating
@@ -1994,7 +1993,7 @@
         name and then create two subdirs - test and home under it.
         """
         # create a directory within the top level test directory
-        candidate_dir = tempfile.mkdtemp(dir=self.TEST_ROOT)
+        candidate_dir = osutils.mkdtemp(dir=self.TEST_ROOT)
         # now create test and home directories within this dir
         self.test_base_dir = candidate_dir
         self.test_home_dir = self.test_base_dir + '/home'

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2007-09-21 04:22:53 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2007-09-22 16:20:37 +0000
@@ -20,6 +20,7 @@
 import os
 
 from bzrlib import (
+    osutils,
     ignores,
     )
 from bzrlib.bzrdir import BzrDir
@@ -154,7 +155,7 @@
         a_tree.commit(message='Initial message')
 
         b_tree = a_tree.branch.create_checkout('b')
-        expected = "%s/" % (os.path.abspath('a'), )
+        expected = "%s/" % (osutils.abspath('a'), )
         out, err = self.run_bzr('commit -m blah --unchanged', working_dir='b')
         self.assertEqual(err, 'Committing revision 2 to "%s".\n'
                          'Committed revision 2.\n' % expected)
@@ -212,7 +213,7 @@
         os.chdir('this')
         out,err = self.run_bzr('commit -m added')
         self.assertEqual('', out)
-        expected = '%s/' % (os.getcwd(), )
+        expected = '%s/' % (osutils.getcwd(), )
         self.assertEqualDiff(
             'Committing revision 2 to "%s".\n'
             'modified filetomodify\n'

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2007-08-23 14:10:48 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2007-09-21 12:30:48 +0000
@@ -1131,7 +1131,7 @@
         def friendly_location(url):
             path = urlutils.unescape_for_display(url, 'ascii')
             try:
-                return osutils.relpath(os.getcwd(), path)
+                return osutils.relpath(osutils.getcwd(), path)
             except errors.PathNotChild:
                 return path
 

=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2007-08-27 03:21:16 +0000
+++ b/bzrlib/tests/test_branch.py	2007-09-20 21:46:15 +0000
@@ -107,10 +107,20 @@
                                    ensure_config_dir_exists)
         ensure_config_dir_exists()
         fn = locations_config_filename()
+        # write correct newlines to locations.conf
+        # by default ConfigObj uses native line-endings for new files
+        # but uses already existing line-endings if file is not empty
+        f = open(fn, 'wb')
+        try:
+            f.write('# comment\n')
+        finally:
+            f.close()
+
         branch = self.make_branch('.', format='knit')
         branch.set_push_location('foo')
         local_path = urlutils.local_path_from_url(branch.base[:-1])
-        self.assertFileEqual("[%s]\n"
+        self.assertFileEqual("# comment\n"
+                             "[%s]\n"
                              "push_location = foo\n"
                              "push_location:policy = norecurse" % local_path,
                              fn)

=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py	2007-08-29 01:16:53 +0000
+++ b/bzrlib/tests/test_plugins.py	2007-09-21 12:30:48 +0000
@@ -32,7 +32,7 @@
 import bzrlib.help
 from bzrlib.symbol_versioning import zero_ninetyone
 from bzrlib.tests import TestCase, TestCaseInTempDir
-from bzrlib.osutils import pathjoin, abspath
+from bzrlib.osutils import pathjoin, abspath, normpath
 
 
 PLUGIN_TEXT = """\
@@ -241,7 +241,7 @@
         plugins = bzrlib.plugin.plugins()
         plugin = plugins['plugin']
         plugin_path = self.test_dir + '/plugin.py'
-        self.assertEqual(plugin_path, plugin.path())
+        self.assertEqual(plugin_path, normpath(plugin.path()))
 
     def test_no_test_suite_gives_None_for_test_suite(self):
         self.setup_plugin()

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2007-08-19 20:38:10 +0000
+++ b/bzrlib/tests/test_transport.py	2007-09-21 12:30:48 +0000
@@ -23,6 +23,7 @@
 import bzrlib
 from bzrlib import (
     errors,
+    osutils,
     urlutils,
     )
 from bzrlib.errors import (ConnectionError,
@@ -572,26 +573,26 @@
 class TestLocalTransports(TestCase):
 
     def test_get_transport_from_abspath(self):
-        here = os.path.abspath('.')
+        here = osutils.abspath('.')
         t = get_transport(here)
         self.assertIsInstance(t, LocalTransport)
         self.assertEquals(t.base, urlutils.local_path_to_url(here) + '/')
 
     def test_get_transport_from_relpath(self):
-        here = os.path.abspath('.')
+        here = osutils.abspath('.')
         t = get_transport('.')
         self.assertIsInstance(t, LocalTransport)
         self.assertEquals(t.base, urlutils.local_path_to_url('.') + '/')
 
     def test_get_transport_from_local_url(self):
-        here = os.path.abspath('.')
+        here = osutils.abspath('.')
         here_url = urlutils.local_path_to_url(here) + '/'
         t = get_transport(here_url)
         self.assertIsInstance(t, LocalTransport)
         self.assertEquals(t.base, here_url)
 
     def test_local_abspath(self):
-        here = os.path.abspath('.')
+        here = osutils.abspath('.')
         t = get_transport(here)
         self.assertEquals(t.local_abspath(''), here)
 




More information about the bazaar-commits mailing list