~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_matchers.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-29 21:53:33 UTC
  • mto: This revision was merged to the branch mainline in revision 6119.
  • Revision ID: jelmer@samba.org-20110829215333-t7b6up4hgzf2jfws
In HasLayout, take into consideration Tree.has_versioned_directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        t = self.make_branch_and_tree('.')
117
117
        self.build_tree(['a', 'b/', 'b/c'])
118
118
        t.add(['a', 'b', 'b/c'], ['a-id', 'b-id', 'c-id'])
119
 
        self.assertThat(t, HasLayout(['', 'a', 'b', 'b/c']))
 
119
        self.assertThat(t, HasLayout(['', 'a', 'b/', 'b/c']))
120
120
        self.assertThat(t, HasLayout(
121
121
            [('', t.get_root_id()),
122
122
             ('a', 'a-id'),
123
 
             ('b', 'b-id'),
 
123
             ('b/', 'b-id'),
124
124
             ('b/c', 'c-id')]))
125
125
 
126
126
    def test_mismatch(self):
130
130
        mismatch = HasLayout(['a']).match(t)
131
131
        self.assertIsNot(None, mismatch)
132
132
        self.assertEquals(
133
 
            "[u'', u'a', u'b', u'b/c'] != ['a']",
 
133
            "[u'', u'a', u'b/', u'b/c'] != ['a']",
 
134
            mismatch.describe())
 
135
 
 
136
    def test_no_dirs(self):
 
137
        # Some tree/repository formats do not support versioned directories
 
138
        t = self.make_branch_and_tree('.')
 
139
        t.has_versioned_directories = lambda: False
 
140
        self.build_tree(['a', 'b/', 'b/c'])
 
141
        t.add(['a', 'b', 'b/c'], ['a-id', 'b-id', 'c-id'])
 
142
        self.assertIs(None, HasLayout(['', 'a', 'b/', 'b/c']).match(t))
 
143
        self.assertIs(None, HasLayout(['', 'a', 'b/', 'b/c', 'd/']).match(t))
 
144
        mismatch = HasLayout([u'', u'a', u'd/']).match(t)
 
145
        self.assertIsNot(None, mismatch)
 
146
        self.assertEquals(
 
147
            "[u'', u'a', u'b/', u'b/c'] != [u'', u'a']",
134
148
            mismatch.describe())