Rev 3153: (bialix) fix #90847: fix problem with parent location on another in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 2 19:52:33 GMT 2008


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

------------------------------------------------------------
revno: 3153
revision-id:pqm at pqm.ubuntu.com-20080102195223-2kpjtcoeqvvcrcki
parent: pqm at pqm.ubuntu.com-20080102154906-hqiq6x2eammznjtg
parent: bialix at ukr.net-20080102184754-wig6a9133t410ms7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-01-02 19:52:23 +0000
message:
  (bialix) fix #90847: fix problem with parent location on another
   logical drive
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/branch_implementations/test_parent.py test_parent.py-20050830052751-5e62766623c32222
  bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
  bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
    ------------------------------------------------------------
    revno: 3139.2.2
    revision-id:bialix at ukr.net-20080102184754-wig6a9133t410ms7
    parent: bialix at ukr.net-20071221172637-n6ndcccrp5du903x
    parent: pqm at pqm.ubuntu.com-20080102154906-hqiq6x2eammznjtg
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: fix.90847
    timestamp: Wed 2008-01-02 20:47:54 +0200
    message:
      merge bzr.dev
    added:
      doc/en/tutorials/using_bazaar_with_launchpad.txt using_bazaar_with_lp-20071211073140-7msh8uf9a9h4y9hb-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
    ------------------------------------------------------------
    revno: 3139.2.1
    revision-id:bialix at ukr.net-20071221172637-n6ndcccrp5du903x
    parent: pqm at pqm.ubuntu.com-20071221145325-erktp9le86ik56j1
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: fix.90847
    timestamp: Fri 2007-12-21 19:26:37 +0200
    message:
      bugfix #90847: fix problem with parent location on another logical drive
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/branch_implementations/test_parent.py test_parent.py-20050830052751-5e62766623c32222
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
=== modified file 'NEWS'
--- a/NEWS	2008-01-02 15:49:06 +0000
+++ b/NEWS	2008-01-02 18:47:54 +0000
@@ -73,6 +73,10 @@
    * Fix traceback when sending large response bodies over the smart protocol
      on Windows. (Andrew Bennetts, #115781)
 
+   * Fix ``urlutils.relative_url`` for the case of two ``file:///`` URLs
+     pointed to different logical drives on Windows.
+     (Alexander Belchenko, #90847)
+
    * _KnitParentsProvider.get_parent_map now handles requests for ghosts
      correctly, instead of erroring or attributing incorrect parents to ghosts.
      (Aaron Bentley)

=== modified file 'bzrlib/tests/branch_implementations/test_parent.py'
--- a/bzrlib/tests/branch_implementations/test_parent.py	2007-04-18 05:38:31 +0000
+++ b/bzrlib/tests/branch_implementations/test_parent.py	2007-12-21 17:26:37 +0000
@@ -19,7 +19,11 @@
 
 import bzrlib.errors
 from bzrlib.osutils import getcwd
-from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests import (
+    TestCaseWithTransport,
+    TestNotApplicable,
+    TestSkipped,
+    )
 from bzrlib import urlutils
 
 
@@ -84,3 +88,16 @@
         # With an invalid branch parent, just return None
         self.assertRaises(bzrlib.errors.InaccessibleParent, b.get_parent)
 
+    def test_win32_set_parent_on_another_drive(self):
+        if sys.platform != 'win32':
+            raise TestSkipped('windows-specific test')
+        b = self.make_branch('.')
+        base_url = b.abspath('.')
+        if not base_url.startswith('file:///'):
+            raise TestNotApplicable('this test should be run with local base')
+        base = urlutils.local_path_from_url(base_url)
+        other = 'file:///B:/path'
+        if base[0] != 'C':
+            other = 'file:///C:/path'
+        b.set_parent(other)
+        self.assertEquals(other, b._get_parent_location())

=== modified file 'bzrlib/tests/test_urlutils.py'
--- a/bzrlib/tests/test_urlutils.py	2007-06-06 14:06:14 +0000
+++ b/bzrlib/tests/test_urlutils.py	2007-12-21 17:26:37 +0000
@@ -541,6 +541,29 @@
         #test('.', 'http://host/', 'http://host')
         test('http://host', 'http://host/', 'http://host')
 
+        # On Windows file:///C:/path/to and file:///D:/other/path
+        # should not use relative url over the non-existent '/' directory.
+        if sys.platform == 'win32':
+            # on the same drive
+            test('../../other/path',
+                'file:///C:/path/to', 'file:///C:/other/path')
+            #~next two tests is failed, i.e. urlutils.relative_url expects
+            #~to see normalized file URLs?
+            #~test('../../other/path',
+            #~    'file:///C:/path/to', 'file:///c:/other/path')
+            #~test('../../other/path',
+            #~    'file:///C:/path/to', 'file:///C|/other/path')
+
+            # check UNC paths too
+            test('../../other/path',
+                'file://HOST/base/path/to', 'file://HOST/base/other/path')
+            # on different drives
+            test('file:///D:/other/path',
+                'file:///C:/path/to', 'file:///D:/other/path')
+            # TODO: strictly saying in UNC path //HOST/base is full analog
+            # of drive letter for hard disk, and this situation is also
+            # should be exception from rules. [bialix 20071221]
+
 
 class TestCwdToURL(TestCaseInTempDir):
     """Test that local_path_to_url works base on the cwd"""

=== modified file 'bzrlib/urlutils.py'
--- a/bzrlib/urlutils.py	2007-06-06 14:06:14 +0000
+++ b/bzrlib/urlutils.py	2007-12-21 17:26:37 +0000
@@ -370,6 +370,11 @@
     other_scheme = other[:other_first_slash]
     if base_scheme != other_scheme:
         return other
+    elif sys.platform == 'win32' and base_scheme == 'file://':
+        base_drive = base[base_first_slash+1:base_first_slash+3]
+        other_drive = other[other_first_slash+1:other_first_slash+3]
+        if base_drive != other_drive:
+            return other
 
     base_path = base[base_first_slash+1:]
     other_path = other[other_first_slash+1:]




More information about the bazaar-commits mailing list