Rev 3761: (jam) Simple fix for bug #276436, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 2 17:01:48 BST 2008


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

------------------------------------------------------------
revno: 3761
revision-id: pqm at pqm.ubuntu.com-20081002160145-vrwbzkinptlkk5az
parent: pqm at pqm.ubuntu.com-20081002151718-hd9avrlfo0o2wf8j
parent: john at arbash-meinel.com-20081001141438-goh72dzp4zmd69fr
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-02 17:01:45 +0100
message:
  (jam) Simple fix for bug #276436,
  	WT.open() should use osutils.getcwd()
modified:
  bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
    ------------------------------------------------------------
    revno: 3753.1.2
    revision-id: john at arbash-meinel.com-20081001141438-goh72dzp4zmd69fr
    parent: john at arbash-meinel.com-20080930203004-sf06gl9iaovamxzl
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: trivial_276436
    timestamp: Wed 2008-10-01 09:14:38 -0500
    message:
      Switch to using the class attribute, rather than the instance
    modified:
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
    ------------------------------------------------------------
    revno: 3753.1.1
    revision-id: john at arbash-meinel.com-20080930203004-sf06gl9iaovamxzl
    parent: pqm at pqm.ubuntu.com-20080930002605-dfe533l96sx35va8
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: trivial_276436
    timestamp: Tue 2008-09-30 15:30:04 -0500
    message:
      Add some simple direct tests for WT.open and WT.open_containing.
      Fixes bug #276436.
    modified:
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py	2008-05-12 04:07:49 +0000
+++ b/bzrlib/tests/test_workingtree.py	2008-10-01 14:14:38 +0000
@@ -81,6 +81,25 @@
             workingtree.WorkingTreeFormat.set_default_format(old_format)
         self.assertEqual(old_format, workingtree.WorkingTreeFormat.get_default_format())
 
+    def test_open(self):
+        tree = self.make_branch_and_tree('.')
+        open_direct = workingtree.WorkingTree.open('.')
+        self.assertEqual(tree.basedir, open_direct.basedir)
+        open_no_args = workingtree.WorkingTree.open()
+        self.assertEqual(tree.basedir, open_no_args.basedir)
+
+    def test_open_containing(self):
+        tree = self.make_branch_and_tree('.')
+        open_direct, relpath = workingtree.WorkingTree.open_containing('.')
+        self.assertEqual(tree.basedir, open_direct.basedir)
+        self.assertEqual('', relpath)
+        open_no_args, relpath = workingtree.WorkingTree.open_containing()
+        self.assertEqual(tree.basedir, open_no_args.basedir)
+        self.assertEqual('', relpath)
+        open_subdir, relpath = workingtree.WorkingTree.open_containing('subdir')
+        self.assertEqual(tree.basedir, open_subdir.basedir)
+        self.assertEqual('subdir', relpath)
+
 
 class SampleTreeFormat(workingtree.WorkingTreeFormat):
     """A sample format

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2008-09-25 01:11:30 +0000
+++ b/bzrlib/workingtree.py	2008-09-30 20:30:04 +0000
@@ -303,14 +303,14 @@
 
         """
         if path is None:
-            path = os.path.getcwdu()
+            path = osutils.getcwd()
         control = bzrdir.BzrDir.open(path, _unsupported)
         return control.open_workingtree(_unsupported)
-        
+
     @staticmethod
     def open_containing(path=None):
         """Open an existing working tree which has its root about path.
-        
+
         This probes for a working tree at path and searches upwards from there.
 
         Basically we keep looking up until we find the control directory or




More information about the bazaar-commits mailing list