Mercurial > hg
comparison hgext/fastannotate/formatter.py @ 46113:59fa3890d40a
node: import symbols explicitly
There is no point in lazy importing mercurial.node, it is used all over
the place anyway. So consistently import the used symbols directly.
Fix one file using symbols indirectly via mercurial.revlog.
Differential Revision: https://phab.mercurial-scm.org/D9480
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 01 Dec 2020 21:54:46 +0100 |
parents | 687b865b95ad |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
46112:d6afa9c149c3 | 46113:59fa3890d40a |
---|---|
4 # | 4 # |
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 from __future__ import absolute_import | 7 from __future__ import absolute_import |
8 | 8 |
9 from mercurial.node import ( | |
10 hex, | |
11 short, | |
12 ) | |
9 from mercurial import ( | 13 from mercurial import ( |
10 encoding, | 14 encoding, |
11 node, | |
12 pycompat, | 15 pycompat, |
13 templatefilters, | 16 templatefilters, |
14 util, | 17 util, |
15 ) | 18 ) |
16 from mercurial.utils import dateutil | 19 from mercurial.utils import dateutil |
114 self.ui.write(result) | 117 self.ui.write(result) |
115 | 118 |
116 @util.propertycache | 119 @util.propertycache |
117 def _hexfunc(self): | 120 def _hexfunc(self): |
118 if self.ui.debugflag or self.opts.get(b'long_hash'): | 121 if self.ui.debugflag or self.opts.get(b'long_hash'): |
119 return node.hex | 122 return hex |
120 else: | 123 else: |
121 return node.short | 124 return short |
122 | 125 |
123 def end(self): | 126 def end(self): |
124 pass | 127 pass |
125 | 128 |
126 | 129 |
166 self.ui.write(b',') | 169 self.ui.write(b',') |
167 self.needcomma = False | 170 self.needcomma = False |
168 | 171 |
169 @util.propertycache | 172 @util.propertycache |
170 def _hexfunc(self): | 173 def _hexfunc(self): |
171 return node.hex | 174 return hex |
172 | 175 |
173 def end(self): | 176 def end(self): |
174 self.ui.write(b'\n]\n') | 177 self.ui.write(b'\n]\n') |