[Pkg-bazaar-commits] ./bzr/unstable r100: - add test case for ignore files
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:51:08 UTC 2009
------------------------------------------------------------
revno: 100
committer: mbp at sourcefrog.net
timestamp: Sun 2005-03-27 00:41:53 +1100
message:
- add test case for ignore files
modified:
bzrlib/branch.py
bzrlib/tests.py
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2005-03-25 08:26:36 +0000
+++ b/bzrlib/branch.py 2005-03-26 13:41:53 +0000
@@ -767,7 +767,7 @@
>>> isdir(bd)
False
"""
- def __init__(self, files = []):
+ def __init__(self, files=[], dirs=[]):
"""Make a test branch.
This creates a temporary directory and runs init-tree in it.
@@ -775,6 +775,9 @@
If any files are listed, they are created in the working copy.
"""
Branch.__init__(self, tempfile.mkdtemp(), init=True)
+ for d in dirs:
+ os.mkdir(self.abspath(d))
+
for f in files:
file(os.path.join(self.base, f), 'w').write('content of %s' % f)
=== modified file 'bzrlib/tests.py'
--- a/bzrlib/tests.py 2005-03-22 07:28:45 +0000
+++ b/bzrlib/tests.py 2005-03-26 13:41:53 +0000
@@ -28,6 +28,7 @@
These are run by ``bzr.doctest``.
>>> import bzrlib, os
+>>> from bzrlib import ScratchBranch
>>> bzrlib.commands.cmd_rocks()
it sure does!
@@ -173,4 +174,22 @@
>>> list(b.working_tree().unknowns())
['d2/d3', 'd2/f2', 'd2/f3']
+Tests for ignored files and patterns:
+
+ >>> b = ScratchBranch(dirs=['src', 'doc'],
+ ... files=['configure.in', 'configure',
+ ... 'doc/configure', 'foo.c',
+ ... 'foo'])
+ >>> list(b.unknowns())
+ ['configure', 'configure.in', 'doc', 'foo', 'foo.c', 'src']
+ >>> b.add(['doc', 'foo.c', 'src', 'configure.in'])
+ >>> list(b.unknowns())
+ ['configure', 'doc/configure', 'foo']
+ >>> f = file(b.abspath('.bzrignore'), 'w')
+ >>> f.write('./configure\n'
+ ... './foo\n')
+ >>> f.close()
+ >>> b.add('.bzrignore')
+ >>> list(b.unknowns())
+ ['configure', 'doc/configure', 'foo']
"""
More information about the Pkg-bazaar-commits
mailing list