equal
deleted
inserted
replaced
191 |
191 |
192 def overwrite(self, node, expand, candidates): |
192 def overwrite(self, node, expand, candidates): |
193 '''Overwrites selected files expanding/shrinking keywords.''' |
193 '''Overwrites selected files expanding/shrinking keywords.''' |
194 ctx = self.repo[node] |
194 ctx = self.repo[node] |
195 mf = ctx.manifest() |
195 mf = ctx.manifest() |
196 if node is not None: # commit, record |
196 if self.record: |
197 candidates = [f for f in ctx.files() if f in mf] |
197 candidates = [f for f in ctx.files() if f in mf] |
198 candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] |
198 candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] |
199 if candidates: |
199 if candidates: |
200 self.restrict = True # do not expand when reading |
200 self.restrict = True # do not expand when reading |
201 msg = (expand and _('overwriting %s expanding keywords\n') |
201 msg = (expand and _('overwriting %s expanding keywords\n') |
206 else: |
206 else: |
207 data = self.repo.wread(f) |
207 data = self.repo.wread(f) |
208 if util.binary(data): |
208 if util.binary(data): |
209 continue |
209 continue |
210 if expand: |
210 if expand: |
211 if node is None: |
211 if node is None: # kwexpand/kwshrink |
212 ctx = self.repo.filectx(f, fileid=mf[f]).changectx() |
212 ctx = self.repo.filectx(f, fileid=mf[f]).changectx() |
213 data, found = self.substitute(data, f, ctx, |
213 data, found = self.substitute(data, f, ctx, |
214 self.re_kw.subn) |
214 self.re_kw.subn) |
215 else: |
215 else: |
216 found = self.re_kw.search(data) |
216 found = self.re_kw.search(data) |
494 |
494 |
495 def kwcommitctx(self, ctx, error=False): |
495 def kwcommitctx(self, ctx, error=False): |
496 n = super(kwrepo, self).commitctx(ctx, error) |
496 n = super(kwrepo, self).commitctx(ctx, error) |
497 # no lock needed, only called from repo.commit() which already locks |
497 # no lock needed, only called from repo.commit() which already locks |
498 if not kwt.record: |
498 if not kwt.record: |
499 kwt.overwrite(n, True, None) |
499 kwt.overwrite(n, True, sorted(ctx.added() + ctx.modified())) |
500 return n |
500 return n |
501 |
501 |
502 # monkeypatches |
502 # monkeypatches |
503 def kwpatchfile_init(orig, self, ui, fname, opener, |
503 def kwpatchfile_init(orig, self, ui, fname, opener, |
504 missing=False, eolmode=None): |
504 missing=False, eolmode=None): |