comparison hgext/keyword.py @ 8098:6a6ce1df98d2

keyword: set overwrite message only once, not for each file
author Christian Ebert <blacktrash@gmx.net>
date Tue, 21 Apr 2009 09:56:07 +0100
parents 67efe5e3b0fb
children 6ee71f78497c
comparison
equal deleted inserted replaced
8097:eea3c1a8fba8 8098:6a6ce1df98d2
175 else: # kwexpand/kwshrink 175 else: # kwexpand/kwshrink
176 notify = self.ui.note 176 notify = self.ui.note
177 candidates = [f for f in files if self.iskwfile(f, ctx.flags)] 177 candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
178 if candidates: 178 if candidates:
179 self.restrict = True # do not expand when reading 179 self.restrict = True # do not expand when reading
180 msg = (expand and _('overwriting %s expanding keywords\n')
181 or _('overwriting %s shrinking keywords\n'))
180 for f in candidates: 182 for f in candidates:
181 fp = self.repo.file(f) 183 fp = self.repo.file(f)
182 data = fp.read(mf[f]) 184 data = fp.read(mf[f])
183 if util.binary(data): 185 if util.binary(data):
184 continue 186 continue
188 data, found = self.substitute(data, f, ctx, 190 data, found = self.substitute(data, f, ctx,
189 self.re_kw.subn) 191 self.re_kw.subn)
190 else: 192 else:
191 found = self.re_kw.search(data) 193 found = self.re_kw.search(data)
192 if found: 194 if found:
193 if expand:
194 msg = _('overwriting %s expanding keywords\n')
195 else:
196 msg = _('overwriting %s shrinking keywords\n')
197 notify(msg % f) 195 notify(msg % f)
198 self.repo.wwrite(f, data, mf.flags(f)) 196 self.repo.wwrite(f, data, mf.flags(f))
199 self.repo.dirstate.normal(f) 197 self.repo.dirstate.normal(f)
200 self.restrict = False 198 self.restrict = False
201 199