##// END OF EJS Templates
transaction: make names a private attribute...
Gregory Szorc -
r39721:4024c363 default
parent child Browse files
Show More
@@ -149,7 +149,7 b' class transaction(util.transactional):'
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.
@@ -189,7 +189,7 b' class transaction(util.transactional):'
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
@@ -375,14 +375,14 b' class transaction(util.transactional):'
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()
General Comments 0
You need to be logged in to leave comments. Login now