##// END OF EJS Templates
keyword: simplify record switch in kwtemplater.overwrite...
Christian Ebert -
r11087:dc2f3786 default
parent child Browse files
Show More
@@ -160,12 +160,9 b' class kwtemplater(object):'
160 Caveat: localrepository._link fails on Windows.'''
160 Caveat: localrepository._link fails on Windows.'''
161 return self.match(path) and not 'l' in flagfunc(path)
161 return self.match(path) and not 'l' in flagfunc(path)
162
162
163 def overwrite(self, node, expand, candidates, recctx=None):
163 def overwrite(self, node, expand, candidates):
164 '''Overwrites selected files expanding/shrinking keywords.'''
164 '''Overwrites selected files expanding/shrinking keywords.'''
165 if recctx is None:
165 ctx = self.repo[node]
166 ctx = self.repo[node]
167 else:
168 ctx = recctx
169 mf = ctx.manifest()
166 mf = ctx.manifest()
170 if node is not None: # commit, record
167 if node is not None: # commit, record
171 candidates = [f for f in ctx.files() if f in mf]
168 candidates = [f for f in ctx.files() if f in mf]
@@ -175,7 +172,7 b' class kwtemplater(object):'
175 msg = (expand and _('overwriting %s expanding keywords\n')
172 msg = (expand and _('overwriting %s expanding keywords\n')
176 or _('overwriting %s shrinking keywords\n'))
173 or _('overwriting %s shrinking keywords\n'))
177 for f in candidates:
174 for f in candidates:
178 if recctx is None:
175 if not self.record:
179 data = self.repo.file(f).read(mf[f])
176 data = self.repo.file(f).read(mf[f])
180 else:
177 else:
181 data = self.repo.wread(f)
178 data = self.repo.wread(f)
@@ -507,7 +504,7 b' def reposetup(ui, repo):'
507 ret = orig(ui, repo, commitfunc, *pats, **opts)
504 ret = orig(ui, repo, commitfunc, *pats, **opts)
508 recctx = repo['.']
505 recctx = repo['.']
509 if ctx != recctx:
506 if ctx != recctx:
510 kwt.overwrite('.', True, None, recctx)
507 kwt.overwrite('.', True, None)
511 return ret
508 return ret
512 finally:
509 finally:
513 wlock.release()
510 wlock.release()
General Comments 0
You need to be logged in to leave comments. Login now