[PATCH 2 of 6] revset: fix a crash with 'wdir() and merge()'
Matt Harbison
mharbison72 at gmail.com
Wed Jul 1 02:56:39 UTC 2015
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1435712708 14400
# Tue Jun 30 21:05:08 2015 -0400
# Node ID e96033df31a3e45b1a0eecd793725c6aa9be7c14
# Parent b912314a97b6f067c5bc4ee59c268489bfd0db11
revset: fix a crash with 'wdir() and merge()'
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
@@ -1235,7 +1235,13 @@
# i18n: "merge" is a keyword
getargs(x, 0, 0, _("merge takes no arguments"))
cl = repo.changelog
- return subset.filter(lambda r: cl.parentrevs(r)[1] != -1)
+
+ def filter(r):
+ if r is None:
+ return len(repo[r].parents()) > 1
+ return cl.parentrevs(r)[1] != -1
+
+ return subset.filter(filter)
def branchpoint(repo, subset, x):
"""``branchpoint()``
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
@@ -59,6 +59,13 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
+ $ hg log -r 'wdir() and merge()'
+ changeset: 4:f25cbe84d8b3+
+ parent: 4:f25cbe84d8b3
+ parent: 2:2d95304fed5d
+ user: test
+ date: * (glob)
+
$ hg commit -mm1
Should succeed - 2 heads:
More information about the Mercurial-devel
mailing list