Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 19:38:19 -0400] rev 47052
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
Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 18:39:59 -0400] rev 47051
git: consistently use str for parents when rebuilding the index database
The tests show no changes, but when these values are overwritten shortly after
when a git commit object is available, that uses str. It seems better to use
that for consistency.
It does materially affect the database though, because the old value stored was
`X'3030..3030'` and is now '00..00' when the changelog table is dumped in
sqlite3. There is one query that specifies the parents, but it passes the non
null hashes as str, so it worked as expected. That likely explains the lack of
test changes.
Differential Revision: https://phab.mercurial-scm.org/D10527
Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 17:54:08 -0400] rev 47050
git: pass the correct type to the sqlite3 query for baselog.hasnode()
It looks like this function is mostly used in exchange (which isn't supported
now) and histedit (which crashes). But I did verify in a REPL that passing
bytes to `db.execute()` fails to find the row, whereas passing str works.
Differential Revision: https://phab.mercurial-scm.org/D10526
Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 17:11:55 -0400] rev 47049
git: use the correct type for stopping changelog.revs()
The `tip` function returns a binary node, but the database is expecting an int.
Differential Revision: https://phab.mercurial-scm.org/D10525
Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 16:58:59 -0400] rev 47048
git: use the proper filenode for deleted files in changelog.changelogrevision
Inline printing shows it still doesn't find the removed file in the test, but it
is at least a str instead of bytes like the immediate query before it that does
find files. Looking at the database, it doesn't look like the remove was
recorded. Additionally, `hg log -r 'removes("re:.*")'` stacktraces.
Differential Revision: https://phab.mercurial-scm.org/D10524
Matt Harbison <matt_harbison@yahoo.com> [Tue, 27 Apr 2021 12:59:17 -0400] rev 47047
tests: add coverage for git.changelog.headrevs(...)
Differential Revision: https://phab.mercurial-scm.org/D10523