mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
33feafa95a
Summary: We've had a couple of users reporting Rust panics due to an history entry where its node is also its own parent. The most recent report shows that during a rebase the commit context contained a removed file while the file itself isn't present in either parents. Several fix for this were considered but abandoned, leaving us with a simple workaround the issue. Reviewed By: quark-zju Differential Revision: D16681230 fbshipit-source-id: d5305477792b4450475137d304fe7b22dc0977af
44 lines
1.4 KiB
Perl
44 lines
1.4 KiB
Perl
$ . "$TESTDIR/library.sh"
|
|
|
|
$ newserver master
|
|
$ clone master client
|
|
$ cd client
|
|
$ echo a >> a
|
|
$ hg commit -Aqm a
|
|
|
|
Create an empty commit with a misconstructed memctx in the same transaction as a normal commit
|
|
$ cat >> $TESTTMP/repro.py <<EOF
|
|
> from edenscm.mercurial import context, registrar
|
|
> cmdtable = {}
|
|
> command = registrar.command(cmdtable)
|
|
>
|
|
> @command("^repro", [], "")
|
|
> def repro(ui, repo, *pats, **opts):
|
|
> def getfile(repo, memctx, path):
|
|
> if "path" == "a":
|
|
> return "d"
|
|
>
|
|
> return None
|
|
>
|
|
> with repo.wlock(), repo.lock(), repo.transaction('tr'):
|
|
> p1 = context.memctx(
|
|
> repo, # repository
|
|
> (repo['.'].node(), None), # parents
|
|
> "valid commit", # commit message
|
|
> ["a"], # files affected by this change
|
|
> getfile, # fn - see above
|
|
> user="author", # commit author
|
|
> ).commit()
|
|
>
|
|
> context.memctx(
|
|
> repo, # repository
|
|
> (repo[p1].node(), None), # parents
|
|
> "empty commit", # commit message
|
|
> ["fake"], # files affected by this change
|
|
> getfile, # fn - see above
|
|
> user="author", # commit author
|
|
> ).commit()
|
|
> EOF
|
|
$ hg repro --config extensions.repro="$TESTTMP/repro.py" 2>&1 | grep SystemError
|
|
[1]
|