~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

(John Arbash Meinel) Fix bug #104257 to handle unknown files in previously empty versioned directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
2121
2121
                        # this has two possibilities:
2122
2122
                        # A) it is versioned but empty, so there is no block for it
2123
2123
                        # B) it is not versioned.
2124
 
                        # in either case it was processed by the containing directories walk:
2125
 
                        # if it is root/foo, when we walked root we emitted it,
2126
 
                        # or if we ere given root/foo to walk specifically, we
2127
 
                        # emitted it when checking the walk-root entries
2128
 
                        # advance the iterator and loop - we dont need to emit it.
 
2124
 
 
2125
                        # if (A) then we need to recurse into it to check for
 
2126
                        # new unknown files or directories.
 
2127
                        # if (B) then we should ignore it, because we don't
 
2128
                        # recurse into unknown directories.
 
2129
                        if want_unversioned:
 
2130
                            path_index = 0
 
2131
                            while path_index < len(current_dir_info[1]):
 
2132
                                    current_path_info = current_dir_info[1][path_index]
 
2133
                                    if current_path_info[2] == 'directory':
 
2134
                                        if self.target._directory_is_tree_reference(
 
2135
                                            current_path_info[0].decode('utf8')):
 
2136
                                            current_path_info = current_path_info[:2] + \
 
2137
                                                ('tree-reference',) + current_path_info[3:]
 
2138
                                    new_executable = bool(
 
2139
                                        stat.S_ISREG(current_path_info[3].st_mode)
 
2140
                                        and stat.S_IEXEC & current_path_info[3].st_mode)
 
2141
                                    yield (None,
 
2142
                                        (None, utf8_decode_or_none(current_path_info[0])),
 
2143
                                        True,
 
2144
                                        (False, False),
 
2145
                                        (None, None),
 
2146
                                        (None, utf8_decode_or_none(current_path_info[1])),
 
2147
                                        (None, current_path_info[2]),
 
2148
                                        (None, new_executable))
 
2149
                                    # dont descend into this unversioned path if it is
 
2150
                                    # a dir
 
2151
                                    if current_path_info[2] in ('directory',
 
2152
                                                                'tree-reference'):
 
2153
                                        del current_dir_info[1][path_index]
 
2154
                                        path_index -= 1
 
2155
                                    path_index += 1
 
2156
 
 
2157
                        # This dir info has been handled, go to the next
2129
2158
                        try:
2130
2159
                            current_dir_info = dir_iterator.next()
2131
2160
                        except StopIteration:
2294
2323
                                new_executable = bool(
2295
2324
                                    stat.S_ISREG(current_path_info[3].st_mode)
2296
2325
                                    and stat.S_IEXEC & current_path_info[3].st_mode)
2297
 
                                if want_unversioned:
2298
 
                                    yield (None,
2299
 
                                        (None, utf8_decode_or_none(current_path_info[0])),
2300
 
                                        True,
2301
 
                                        (False, False),
2302
 
                                        (None, None),
2303
 
                                        (None, utf8_decode_or_none(current_path_info[1])),
2304
 
                                        (None, current_path_info[2]),
2305
 
                                        (None, new_executable))
 
2326
                                yield (None,
 
2327
                                    (None, utf8_decode_or_none(current_path_info[0])),
 
2328
                                    True,
 
2329
                                    (False, False),
 
2330
                                    (None, None),
 
2331
                                    (None, utf8_decode_or_none(current_path_info[1])),
 
2332
                                    (None, current_path_info[2]),
 
2333
                                    (None, new_executable))
2306
2334
                            # dont descend into this unversioned path if it is
2307
2335
                            # a dir
2308
2336
                            if current_path_info[2] in ('directory'):