bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
2052.3.2
by John Arbash Meinel
 Change Copyright .. by Canonical to Copyright ... Canonical  | 
1  | 
# Copyright (C) 2005, 2006 Canonical Ltd
 | 
| 
1773.4.1
by Martin Pool
 Add pyflakes makefile target; fix many warnings  | 
2  | 
#
 | 
| 
1740.6.1
by Martin Pool
 Remove Scratch objects used by doctests  | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
| 
1773.4.1
by Martin Pool
 Add pyflakes makefile target; fix many warnings  | 
7  | 
#
 | 
| 
1740.6.1
by Martin Pool
 Remove Scratch objects used by doctests  | 
8  | 
# This program is distributed in the hope that it will be useful,
 | 
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
| 
1773.4.1
by Martin Pool
 Add pyflakes makefile target; fix many warnings  | 
12  | 
#
 | 
| 
1740.6.1
by Martin Pool
 Remove Scratch objects used by doctests  | 
13  | 
# You should have received a copy of the GNU General Public License
 | 
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
| 
768
by Martin Pool
 - start some tests for directory renames  | 
17  | 
import os  | 
18  | 
import unittest  | 
|
19  | 
||
| 
1996.3.18
by John Arbash Meinel
 Now that mkdtemp and rmtree are lazy, they should not be directly improted.  | 
20  | 
from bzrlib import (  | 
21  | 
osutils,  | 
|
22  | 
    )
 | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
23  | 
from bzrlib.tests import TestCaseWithTransport, TestCase  | 
| 
1740.6.1
by Martin Pool
 Remove Scratch objects used by doctests  | 
24  | 
from bzrlib.branch import Branch  | 
| 
1185.31.42
by John Arbash Meinel
 Updated whitebox text for new PathNotChild exception  | 
25  | 
from bzrlib.errors import PathNotChild  | 
| 
1185.31.37
by John Arbash Meinel
 Switched os.path.abspath and os.path.realpath to osutils.* (still passes on cygwin)  | 
26  | 
from bzrlib.osutils import relpath, pathjoin, abspath, realpath  | 
| 
778
by Martin Pool
 - simple revert of text files  | 
27  | 
|
28  | 
||
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
29  | 
class MoreTests(TestCaseWithTransport):  | 
| 
771
by Martin Pool
 - more tests of directory renames  | 
30  | 
|
| 
1102
by Martin Pool
 - merge test refactoring from robertc  | 
31  | 
def test_relpath(self):  | 
32  | 
"""test for branch path lookups  | 
|
33  | 
    
 | 
|
| 
1457.1.2
by Robert Collins
 move branch._relpath into osutils as relpath  | 
34  | 
        bzrlib.osutils._relpath do a simple but subtle
 | 
| 
1102
by Martin Pool
 - merge test refactoring from robertc  | 
35  | 
        job: given a path (either relative to cwd or absolute), work out
 | 
36  | 
        if it is inside a branch and return the path relative to the base.
 | 
|
37  | 
        """
 | 
|
| 
1692.7.6
by Martin Pool
 [patch] force deletion of trees containing readonly files (alexander)  | 
38  | 
import tempfile  | 
| 
3638.3.2
by Vincent Ladeuil
 Fix all calls to tempfile.mkdtemp to osutils.mkdtemp.  | 
39  | 
|
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
40  | 
savedir = os.getcwdu()  | 
| 
3638.3.2
by Vincent Ladeuil
 Fix all calls to tempfile.mkdtemp to osutils.mkdtemp.  | 
41  | 
dtmp = osutils.mkdtemp()  | 
| 
907.1.7
by John Arbash Meinel
 Fixed test failure on Mac OSX.  | 
42  | 
        # On Mac OSX, /tmp actually expands to /private/tmp
 | 
| 
1185.31.37
by John Arbash Meinel
 Switched os.path.abspath and os.path.realpath to osutils.* (still passes on cygwin)  | 
43  | 
dtmp = realpath(dtmp)  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
44  | 
|
45  | 
def rp(p):  | 
|
| 
1457.1.2
by Robert Collins
 move branch._relpath into osutils as relpath  | 
46  | 
return relpath(dtmp, p)  | 
| 
3638.3.2
by Vincent Ladeuil
 Fix all calls to tempfile.mkdtemp to osutils.mkdtemp.  | 
47  | 
|
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
48  | 
try:  | 
49  | 
            # check paths inside dtmp while standing outside it
 | 
|
| 
1185.31.33
by John Arbash Meinel
 A couple more path.join statements needed changing.  | 
50  | 
self.assertEqual(rp(pathjoin(dtmp, 'foo')), 'foo')  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
51  | 
|
52  | 
            # root = nothing
 | 
|
53  | 
self.assertEqual(rp(dtmp), '')  | 
|
54  | 
||
| 
1185.31.42
by John Arbash Meinel
 Updated whitebox text for new PathNotChild exception  | 
55  | 
self.assertRaises(PathNotChild,  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
56  | 
rp,  | 
57  | 
'/etc')  | 
|
58  | 
||
59  | 
            # now some near-miss operations -- note that
 | 
|
60  | 
            # os.path.commonprefix gets these wrong!
 | 
|
| 
1185.31.42
by John Arbash Meinel
 Updated whitebox text for new PathNotChild exception  | 
61  | 
self.assertRaises(PathNotChild,  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
62  | 
rp,  | 
63  | 
dtmp.rstrip('\\/') + '2')  | 
|
64  | 
||
| 
1185.31.42
by John Arbash Meinel
 Updated whitebox text for new PathNotChild exception  | 
65  | 
self.assertRaises(PathNotChild,  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
66  | 
rp,  | 
67  | 
dtmp.rstrip('\\/') + '2/foo')  | 
|
68  | 
||
69  | 
            # now operations based on relpath of files in current
 | 
|
70  | 
            # directory, or nearby
 | 
|
71  | 
os.chdir(dtmp)  | 
|
72  | 
||
| 
1185.31.33
by John Arbash Meinel
 A couple more path.join statements needed changing.  | 
73  | 
self.assertEqual(rp('foo/bar/quux'), 'foo/bar/quux')  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
74  | 
|
75  | 
self.assertEqual(rp('foo'), 'foo')  | 
|
76  | 
||
77  | 
self.assertEqual(rp('./foo'), 'foo')  | 
|
78  | 
||
| 
1185.31.37
by John Arbash Meinel
 Switched os.path.abspath and os.path.realpath to osutils.* (still passes on cygwin)  | 
79  | 
self.assertEqual(rp(abspath('foo')), 'foo')  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
80  | 
|
| 
1185.31.42
by John Arbash Meinel
 Updated whitebox text for new PathNotChild exception  | 
81  | 
self.assertRaises(PathNotChild,  | 
| 
601
by Martin Pool
 - whitebox tests for branch path handling  | 
82  | 
rp, '../foo')  | 
83  | 
||
84  | 
finally:  | 
|
85  | 
os.chdir(savedir)  | 
|
| 
1996.3.18
by John Arbash Meinel
 Now that mkdtemp and rmtree are lazy, they should not be directly improted.  | 
86  | 
osutils.rmtree(dtmp)  |