Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 45089:d085fcb11c56
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
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 11 Jul 2020 02:13:19 +0200 |
parents | 3e40abe0a170 |
children | 6a5dcd754842 |
comparison
equal
deleted
inserted
replaced
45088:3e40abe0a170 | 45089:d085fcb11c56 |
---|---|
2889 else: | 2889 else: |
2890 removed.append(f) | 2890 removed.append(f) |
2891 | 2891 |
2892 return scmutil.status(modified, added, removed, [], [], [], []) | 2892 return scmutil.status(modified, added, removed, [], [], [], []) |
2893 | 2893 |
2894 def parents(self): | |
2895 if self._parents[1].node() == nullid: | |
2896 return [self._parents[0]] | |
2897 return self._parents | |
2898 | |
2894 | 2899 |
2895 class memfilectx(committablefilectx): | 2900 class memfilectx(committablefilectx): |
2896 """memfilectx represents an in-memory file to commit. | 2901 """memfilectx represents an in-memory file to commit. |
2897 | 2902 |
2898 See memctx and committablefilectx for more details. | 2903 See memctx and committablefilectx for more details. |