/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-20 14:27:19 UTC
  • mto: This revision was merged to the branch mainline in revision 5837.
  • Revision ID: john@arbash-meinel.com-20110420142719-advs1k5vztqzbrgv
Fix bug #767177. Be more agressive with file.close() calls.

Our test suite gets a number of thread leaks and failures because it happens to get async
SFTPFile.close() calls. (if an SFTPFile closes due to __del__ it is done as an async request,
while if you call SFTPFile.close() it is done as a synchronous request.)
We have a couple other cases, probably. Namely SFTPTransport.get() also does an async
prefetch of the content, so if you don't .read() you'll also leak threads that think they
are doing work that you want.

The biggest change here, though, is using a try/finally in a generator, which is not 
python2.4 compatible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        self.modified = []
62
62
        self.unchanged = []
63
63
        self.unversioned = []
 
64
        self.missing = []
64
65
 
65
66
    def __eq__(self, other):
66
67
        if not isinstance(other, TreeDelta):
137
138
            else:
138
139
                delta.removed.append((path[0], file_id, kind[0]))
139
140
        elif fully_present[0] is False:
140
 
            continue
 
141
            delta.missing.append((path[1], file_id, kind[1]))
141
142
        elif name[0] != name[1] or parent_id[0] != parent_id[1]:
142
143
            # If the name changes, or the parent_id changes, we have a rename
143
144
            # (if we move a parent, that doesn't count as a rename for the
160
161
    delta.removed.sort()
161
162
    delta.added.sort()
162
163
    delta.renamed.sort()
 
164
    delta.missing.sort()
163
165
    # TODO: jam 20060529 These lists shouldn't need to be sorted
164
166
    #       since we added them in alphabetical order.
165
167
    delta.modified.sort()
202
204
                             'unchanged': ' ',
203
205
                             'created': 'N',
204
206
                             'modified': 'M',
205
 
                             'deleted': 'D'}
 
207
                             'deleted': 'D',
 
208
                             'missing': '!',
 
209
                             }
206
210
        self.versioned_map = {'added': '+', # versioned target
207
211
                              'unchanged': ' ', # versioned in both
208
212
                              'removed': '-', # versioned in source
325
329
        else:
326
330
            if content_change:
327
331
                modified = "modified"
 
332
            elif kind[0] is None:
 
333
                modified = "missing"
328
334
            else:
329
335
                modified = "unchanged"
330
336
            if kind[1] == "file":
417
423
 
418
424
    show_list(delta.removed, 'removed', 'D')
419
425
    show_list(delta.added, 'added', 'A')
 
426
    show_list(delta.missing, 'missing', '!')
420
427
    extra_modified = []
421
428
    # Reorder delta.renamed tuples so that all lists share the same
422
429
    # order for their 3 first fields and that they also begin like