comparison hgext/git/index.py @ 47051:de26b9a7ec29 stable

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
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 27 Apr 2021 18:39:59 -0400
parents 59fa3890d40a
children 7431f5ab0d2a
comparison
equal deleted inserted replaced
47050:ce24a00fe7f0 47051:de26b9a7ec29
4 import os 4 import os
5 import sqlite3 5 import sqlite3
6 6
7 from mercurial.i18n import _ 7 from mercurial.i18n import _
8 from mercurial.node import ( 8 from mercurial.node import (
9 nullhex,
10 nullid, 9 nullid,
11 ) 10 )
12 11
13 from mercurial import ( 12 from mercurial import (
14 encoding, 13 encoding,
279 # This walker is sure to visit all the revisions in history, but 278 # This walker is sure to visit all the revisions in history, but
280 # only once. 279 # only once.
281 for pos, commit in enumerate(walker): 280 for pos, commit in enumerate(walker):
282 if prog is not None: 281 if prog is not None:
283 prog.update(pos) 282 prog.update(pos)
284 p1 = p2 = nullhex 283 p1 = p2 = gitutil.nullgit
285 if len(commit.parents) > 2: 284 if len(commit.parents) > 2:
286 raise error.ProgrammingError( 285 raise error.ProgrammingError(
287 ( 286 (
288 b"git support can't handle octopus merges, " 287 b"git support can't handle octopus merges, "
289 b"found a commit with %d parents :(" 288 b"found a commit with %d parents :("