[PATCH 4 of 6] revset: fix a crash with 'p2(wdir())'
Matt Harbison
mharbison72 at gmail.com
Wed Jul 1 02:56:41 UTC 2015
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1435713945 14400
# Tue Jun 30 21:25:45 2015 -0400
# Node ID 4a504f9bae9718664cc685397ff066e93c163327
# Parent 6e20445b1da8baefbb48bae7af20dfcb2699c9ce
revset: fix a crash with 'p2(wdir())'
The crash was "TypeError: expected string or Unicode object, NoneType found"
down in revlog.parentrevs().
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1476,7 +1476,13 @@
ps = set()
cl = repo.changelog
for r in getset(repo, fullreposet(repo), x):
- ps.add(cl.parentrevs(r)[1])
+ if r is None:
+ parents = repo[r].parents()
+ if len(parents) > 1:
+ ps.update([parents[1].rev()])
+ else:
+ ps.add(cl.parentrevs(r)[1])
+
ps -= set([node.nullrev])
# XXX we should turn this into a baseset instead of a set, smartset may do
# some optimisations from the fact this is a baseset.
diff --git a/tests/test-merge-default.t b/tests/test-merge-default.t
--- a/tests/test-merge-default.t
+++ b/tests/test-merge-default.t
@@ -74,6 +74,12 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: e
+ $ hg log -r 'p2(wdir())'
+ changeset: 2:2d95304fed5d
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: c
+
$ hg commit -mm1
Should succeed - 2 heads:
More information about the Mercurial-devel
mailing list