Mercurial > hg
changeset 39685:4024c363cd33
transaction: make names a private attribute
This is used to report the transaction name in __repr__. It is
very obviously an implementation detail and doesn't need to be
exposed as part of the public interface. So mark it as private.
Differential Revision: https://phab.mercurial-scm.org/D4633
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 17 Sep 2018 16:19:55 -0700 |
parents | 1a68c9b1920d |
children | 3d22aef3ecd5 |
files | mercurial/transaction.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/transaction.py Mon Sep 17 16:13:38 2018 -0700 +++ b/mercurial/transaction.py Mon Sep 17 16:19:55 2018 -0700 @@ -149,7 +149,7 @@ if checkambigfiles: self._checkambigfiles.update(checkambigfiles) - self.names = [name] + self._names = [name] # A dict dedicated to precisely tracking the changes introduced in the # transaction. @@ -189,7 +189,7 @@ self._abortcallback = {} def __repr__(self): - name = r'/'.join(self.names) + name = r'/'.join(self._names) return (r'<transaction name=%s, count=%d, usages=%d>' % (name, self._count, self._usages)) @@ -375,14 +375,14 @@ def nest(self, name=r'<unnamed>'): self._count += 1 self._usages += 1 - self.names.append(name) + self._names.append(name) return self def release(self): if self._count > 0: self._usages -= 1 - if self.names: - self.names.pop() + if self._names: + self._names.pop() # if the transaction scopes are left without being closed, fail if self._count > 0 and self._usages == 0: self._abort()