hgkw/keyword.py
branch0.9.2compat
changeset 984 a4ea5c2d3ff3
parent 704 772628d1ccb5
parent 981 0b32ba113ad2
--- a/hgkw/keyword.py	Tue Mar 30 11:12:09 2010 +0100
+++ b/hgkw/keyword.py	Wed Sep 14 16:19:33 2011 +0100
@@ -338,8 +338,10 @@
         candidates = [f for f in candidates if self.iskwfile(f, islink)]
         if candidates:
             self.restrict = True # do not expand when reading
-            msg = (expand and _('overwriting %s expanding keywords\n')
-                   or _('overwriting %s shrinking keywords\n'))
+            if expand:
+                msg = _('overwriting %s expanding keywords\n')
+            else:
+                msg = _('overwriting %s shrinking keywords\n')
             overwritten = []
             for f in candidates:
                 fp = self.repo.file(f)
@@ -354,7 +356,10 @@
                     found = self.re_kw.search(data)
                 if found:
                     self.ui.note(msg % f)
+                    fpath = self.repo.wjoin(f)
+                    mode = os.lstat(fpath).st_mode
                     self.repo.wwrite(f, data, mf.flags(f))
+                    os.chmod(fpath, mode)
                     overwritten.append(f)
             _normal(self.repo, overwritten)
             self.restrict = False
@@ -566,7 +571,7 @@
     cwd = pats and repo.getcwd() or ''
     modified, added, removed, deleted, unknown, ignored, clean = status
     files = []
-    if not opts.get('unknown') or ops.get('all'):
+    if not opts.get('unknown') or opts.get('all'):
         try:
             # f67d1468ac50
             files = util.sort(modified + added + clean)