Merge lp:~jelmer/brz/shelving-directory-with-ignored into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 6836
Proposed branch: lp:~jelmer/brz/shelving-directory-with-ignored
Merge into: lp:brz
Diff against target: 52 lines (+28/-0)
1 file modified
breezy/tests/test_shelf.py (+28/-0)
To merge this branch: bzr merge lp:~jelmer/brz/shelving-directory-with-ignored
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+334650@code.launchpad.net

Description of the change

Add a test to demonstrate that shelving a directory with ignored file fails. #611739

Based on https://code.launchpad.net/~n142857/+junk/shelving-directory-with-ignored

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Technically this should use one of the testtools helper methods, and also report unexpected success if the exception is not raised?

Revision history for this message
Martin Packman (gz) wrote :

Lets land and fixup later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/test_shelf.py'
2--- breezy/tests/test_shelf.py 2017-11-17 03:06:50 +0000
3+++ breezy/tests/test_shelf.py 2017-12-04 00:18:24 +0000
4@@ -18,6 +18,7 @@
5
6 from .. import (
7 errors,
8+ ignores,
9 osutils,
10 shelf,
11 tests,
12@@ -29,6 +30,10 @@
13 )
14 from . import (
15 features,
16+ KnownFailure,
17+ )
18+from .errors import (
19+ MalformedTransform,
20 )
21
22
23@@ -226,6 +231,29 @@
24 creator.transform()
25 self.check_shelve_creation(creator, tree)
26
27+ def test_shelve_directory_with_ignored(self):
28+ tree = self.make_branch_and_tree('.')
29+ tree.lock_write()
30+ self.addCleanup(tree.unlock)
31+ tree.commit('Empty tree')
32+ self.build_tree_contents([('foo', 'a\n'), ('bar/',), ('bar/ignored','ign\n')])
33+ tree.add(['foo', 'bar'], ['foo-id', 'bar-id'])
34+ creator = shelf.ShelfCreator(tree, tree.basis_tree())
35+ self.addCleanup(creator.finalize)
36+ self.assertEqual([('add file', 'bar-id', 'directory', 'bar'),
37+ ('add file', 'foo-id', 'file', 'foo')],
38+ sorted(list(creator.iter_shelvable())))
39+ ignores._set_user_ignores([])
40+ in_patterns = ['ignored',]
41+ ignores.add_unique_user_ignores(in_patterns)
42+
43+ creator.shelve_change(('add file', 'bar-id', 'directory', 'bar'))
44+ try:
45+ creator.transform()
46+ self.check_shelve_creation(creator, tree)
47+ except MalformedTransform:
48+ raise KnownFailure('shelving directory with ignored file: see bug #611739')
49+
50 def _test_shelve_symlink_creation(self, link_name, link_target,
51 shelve_change=False):
52 self.requireFeature(features.SymlinkFeature)

Subscribers

People subscribed via source and target branches