equal
deleted
inserted
replaced
147 |
147 |
148 self._checkambigfiles = set() |
148 self._checkambigfiles = set() |
149 if checkambigfiles: |
149 if checkambigfiles: |
150 self._checkambigfiles.update(checkambigfiles) |
150 self._checkambigfiles.update(checkambigfiles) |
151 |
151 |
152 self.names = [name] |
152 self._names = [name] |
153 |
153 |
154 # A dict dedicated to precisely tracking the changes introduced in the |
154 # A dict dedicated to precisely tracking the changes introduced in the |
155 # transaction. |
155 # transaction. |
156 self.changes = {} |
156 self.changes = {} |
157 |
157 |
187 self._postclosecallback = {} |
187 self._postclosecallback = {} |
188 # holds callbacks to call during abort |
188 # holds callbacks to call during abort |
189 self._abortcallback = {} |
189 self._abortcallback = {} |
190 |
190 |
191 def __repr__(self): |
191 def __repr__(self): |
192 name = r'/'.join(self.names) |
192 name = r'/'.join(self._names) |
193 return (r'<transaction name=%s, count=%d, usages=%d>' % |
193 return (r'<transaction name=%s, count=%d, usages=%d>' % |
194 (name, self._count, self._usages)) |
194 (name, self._count, self._usages)) |
195 |
195 |
196 def __del__(self): |
196 def __del__(self): |
197 if self._journal: |
197 if self._journal: |
373 |
373 |
374 @active |
374 @active |
375 def nest(self, name=r'<unnamed>'): |
375 def nest(self, name=r'<unnamed>'): |
376 self._count += 1 |
376 self._count += 1 |
377 self._usages += 1 |
377 self._usages += 1 |
378 self.names.append(name) |
378 self._names.append(name) |
379 return self |
379 return self |
380 |
380 |
381 def release(self): |
381 def release(self): |
382 if self._count > 0: |
382 if self._count > 0: |
383 self._usages -= 1 |
383 self._usages -= 1 |
384 if self.names: |
384 if self._names: |
385 self.names.pop() |
385 self._names.pop() |
386 # if the transaction scopes are left without being closed, fail |
386 # if the transaction scopes are left without being closed, fail |
387 if self._count > 0 and self._usages == 0: |
387 if self._count > 0 and self._usages == 0: |
388 self._abort() |
388 self._abort() |
389 |
389 |
390 def running(self): |
390 def running(self): |