Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 37171:d7f3fdab94c4
context: remove unwanted assignments in basectx.__new__() (API)
The two subclasses in core apparently didn't trust __new__() to do the
job anyway (they both reassigned all the properties after).
Differential Revision: https://phab.mercurial-scm.org/D2966
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 29 Mar 2018 21:15:40 -0700 |
parents | 05c13e5aa9ec |
children | 05ff1a155a21 |
comparison
equal
deleted
inserted
replaced
37170:b837655c1509 | 37171:d7f3fdab94c4 |
---|---|
64 be committed.""" | 64 be committed.""" |
65 def __new__(cls, repo, changeid='', *args, **kwargs): | 65 def __new__(cls, repo, changeid='', *args, **kwargs): |
66 if isinstance(changeid, basectx): | 66 if isinstance(changeid, basectx): |
67 return changeid | 67 return changeid |
68 | 68 |
69 o = super(basectx, cls).__new__(cls) | 69 return super(basectx, cls).__new__(cls) |
70 | |
71 o._repo = repo | |
72 o._rev = nullrev | |
73 o._node = nullid | |
74 | |
75 return o | |
76 | 70 |
77 def __bytes__(self): | 71 def __bytes__(self): |
78 return short(self.node()) | 72 return short(self.node()) |
79 | 73 |
80 __str__ = encoding.strmethod(__bytes__) | 74 __str__ = encoding.strmethod(__bytes__) |