Mercurial > hg
comparison hgext/git/gitlog.py @ 47052:f8fa7ec53517 stable
git: initialize `extra` to have at least the branch name for nullid
Otherwise, this crashes trying to convert to local encoding:
...
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 333, in _show
branch = ctx.branch()
File "/mnt/c/Users/Matt/hg/mercurial/context.py", line 675, in branch
return encoding.tolocal(self._changeset.extra.get(b"branch"))
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 181, in tolocal
if isasciistr(s):
TypeError: a bytes-like object is required, not 'NoneType'
This was originally reported to the thg bug tracker.
https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/5629
Differential Revision: https://phab.mercurial-scm.org/D10528
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 27 Apr 2021 19:38:19 -0400 |
parents | ce24a00fe7f0 |
children | 7431f5ab0d2a |
comparison
equal
deleted
inserted
replaced
47051:de26b9a7ec29 | 47052:f8fa7ec53517 |
---|---|
219 # Ensure we have a node id | 219 # Ensure we have a node id |
220 if isinstance(nodeorrev, int): | 220 if isinstance(nodeorrev, int): |
221 n = self.node(nodeorrev) | 221 n = self.node(nodeorrev) |
222 else: | 222 else: |
223 n = nodeorrev | 223 n = nodeorrev |
224 extra = {b'branch': b'default'} | |
224 # handle looking up nullid | 225 # handle looking up nullid |
225 if n == nullid: | 226 if n == nullid: |
226 return hgchangelog._changelogrevision(extra={}, manifest=nullid) | 227 return hgchangelog._changelogrevision(extra=extra, manifest=nullid) |
227 hn = gitutil.togitnode(n) | 228 hn = gitutil.togitnode(n) |
228 # We've got a real commit! | 229 # We've got a real commit! |
229 files = [ | 230 files = [ |
230 r[0] | 231 r[0] |
231 for r in self._db.execute( | 232 for r in self._db.execute( |
251 files=files, | 252 files=files, |
252 # TODO filesadded in the index | 253 # TODO filesadded in the index |
253 filesremoved=filesremoved, | 254 filesremoved=filesremoved, |
254 description=c.message.encode('utf8'), | 255 description=c.message.encode('utf8'), |
255 # TODO do we want to handle extra? how? | 256 # TODO do we want to handle extra? how? |
256 extra={b'branch': b'default'}, | 257 extra=extra, |
257 ) | 258 ) |
258 | 259 |
259 def ancestors(self, revs, stoprev=0, inclusive=False): | 260 def ancestors(self, revs, stoprev=0, inclusive=False): |
260 revs = list(revs) | 261 revs = list(revs) |
261 tip = self.rev(self.tip()) | 262 tip = self.rev(self.tip()) |