hgkw/keyword.py
changeset 981 0b32ba113ad2
parent 979 6cabb1c47f21
child 984 a4ea5c2d3ff3
child 991 68475648cd7e
--- a/hgkw/keyword.py	Tue Aug 09 12:54:11 2011 +0200
+++ b/hgkw/keyword.py	Wed Sep 14 15:30:21 2011 +0100
@@ -257,7 +257,6 @@
             msg = _('overwriting %s expanding keywords\n')
         else:
             msg = _('overwriting %s shrinking keywords\n')
-        lctx = ctx
         for f in candidates:
             if self.restrict:
                 data = self.repo.file(f).read(mf[f])
@@ -267,15 +266,17 @@
                 continue
             if expand:
                 if lookup:
-                    lctx = self.linkctx(f, mf[f])
-                data, found = self.substitute(data, f, lctx, re_kw.subn)
+                    ctx = self.linkctx(f, mf[f])
+                data, found = self.substitute(data, f, ctx, re_kw.subn)
             elif self.restrict:
                 found = re_kw.search(data)
             else:
                 data, found = _shrinktext(data, re_kw.subn)
             if found:
                 self.ui.note(msg % f)
-                self.repo.wwrite(f, data, ctx.flags(f))
+                fp = self.repo.wopener(f, "wb", atomictemp=True)
+                fp.write(data)
+                fp.close()
                 if kwcmd:
                     self.repo.dirstate.normal(f)
                 elif self.record: