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

Christian Ebert blacktrash at gmx.net
Sat Sep 25 03:17:47 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1285401862 -7200
# Node ID b4fbaabfd89e93b93c8ede1d9978af751be6c7c5
# Parent  1f6abbd387832628f7955280e8dca4f959b1904b
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 @@
                         self.repo.dirstate.normal(f)
                     elif self.record:
                         self.repo.dirstate.normallookup(f)
-            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