[PATCH 2 of 4] keyword: restore restricted read mode value after overwriting

Christian Ebert blacktrash at gmx.net
Sun Sep 26 12:19:08 CDT 2010

# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1285521521 -7200
# Node ID 99493545697daa9b65471eeb9687159919b0858a
# Parent  f8f14e595f4ae33146efc9daa70ab09a7954841e
keyword: restore restricted read mode value after overwriting

Even though just enforcing expansion after overwriting files in
the working directory caused no problems that we know of, this avoids
a potential source of problems (e.g. in collaboration other extensions)
at no costs.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -198,6 +198,7 @@
             candidates = [f for f in ctx.files() if f in ctx]
         candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
         if candidates:
+            restrict = self.restrict
             self.restrict = True        # do not expand when reading
             mf = ctx.manifest()
             msg = (expand and _('overwriting %s expanding keywords\n')
@@ -223,7 +224,7 @@
                     elif self.record:
-            self.restrict = False
+            self.restrict = restrict
     def shrinktext(self, text):
         '''Unconditionally removes all keyword substitutions from text.'''

More information about the Mercurial-devel mailing list