memctx: make `parents()` return list of one element if it’s not a merge
It is part of the contract of `parents()` that non-merges return a list of one
element. `self._parents` is always a list of two elements in `memctx`.
Differential Revision: https://phab.mercurial-scm.org/D8731
--- a/mercurial/context.py Sat Jul 11 01:14:00 2020 +0200
+++ b/mercurial/context.py Sat Jul 11 02:13:19 2020 +0200
@@ -2891,6 +2891,11 @@
return scmutil.status(modified, added, removed, [], [], [], [])
+ def parents(self):
+ if self._parents[1].node() == nullid:
+ return [self._parents[0]]
+ return self._parents
+
class memfilectx(committablefilectx):
"""memfilectx represents an in-memory file to commit.