changeset 38761:d558e53cd6b6 stable

context: safegaurd against 'lx' being passed as file flag in manifest Subversion can have a file as executable link. When using hgsubversion, we will have both islink and isexec True. This will lead to _flags being set to `lx`. However, manifest expects flag to be one-byte so it will crash if 'lx' is passed. Also it's impossible to have an executable link. This patch will safegaurd us from having 'lx' being a possible value. This was authored by Ivan Lezhankin from Yandex. Differential Revision: https://phab.mercurial-scm.org/D3985
author Pulkit Goyal <pulkit@yandex-team.ru>
date Wed, 25 Jul 2018 21:19:06 +0300
parents 17da52bbadb0
children fe3ca1e6f786
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Jul 31 13:53:06 2018 -0700
+++ b/mercurial/context.py	Wed Jul 25 21:19:06 2018 +0300
@@ -2327,7 +2327,12 @@
         revision being committed, or None."""
         super(memfilectx, self).__init__(repo, path, None, changectx)
         self._data = data
-        self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
+        if islink:
+            self._flags = 'l'
+        elif isexec:
+            self._flags = 'x'
+        else:
+            self._flags = ''
         self._copied = None
         if copied:
             self._copied = (copied, nullid)