# HG changeset patch
# User Pulkit Goyal <pulkit@yandex-team.ru>
# Date 2018-08-01 13:28:10
# Node ID 2488dcfa71f8671b7ba0d13f5ffad2ffda17a40c
# Parent  730e7d92a023a43ed8f6e205ceb6df03045db21c

context: safegaurd from 'lx' being passed as file flag in manifest

Follows up for d558e53cd6b619d5f671a7580513bfc66a398eac.

Differential Revision: https://phab.mercurial-scm.org/D4259

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1926,8 +1926,13 @@ class overlayworkingctx(committablectx):
                         flags=flags)
 
     def setflags(self, path, l, x):
+        flag = ''
+        if l:
+            flag = 'l'
+        elif x:
+            flag = 'x'
         self._markdirty(path, exists=True, date=dateutil.makedate(),
-                        flags=(l and 'l' or '') + (x and 'x' or ''))
+                        flags=flag)
 
     def remove(self, path):
         self._markdirty(path, exists=False)