comparison hgext/keyword.py @ 7378:8dde275680d8

keyword: move common code out of commit condition
author Christian Ebert <blacktrash@gmx.net>
date Fri, 14 Nov 2008 22:29:03 +0100
parents 9f1370130a45
children 27d304c8cc03
comparison
equal deleted inserted replaced
7377:374a6b3ac623 7378:8dde275680d8
163 Caveat: localrepository._link fails on Windows.''' 163 Caveat: localrepository._link fails on Windows.'''
164 return self.matcher(path) and not 'l' in flagfunc(path) 164 return self.matcher(path) and not 'l' in flagfunc(path)
165 165
166 def overwrite(self, node, expand, files): 166 def overwrite(self, node, expand, files):
167 '''Overwrites selected files expanding/shrinking keywords.''' 167 '''Overwrites selected files expanding/shrinking keywords.'''
168 ctx = self.repo[node]
169 mf = ctx.manifest()
168 if node is not None: # commit 170 if node is not None: # commit
169 ctx = self.repo[node]
170 mf = ctx.manifest()
171 files = [f for f in ctx.files() if f in mf] 171 files = [f for f in ctx.files() if f in mf]
172 notify = self.ui.debug 172 notify = self.ui.debug
173 else: # kwexpand/kwshrink 173 else: # kwexpand/kwshrink
174 ctx = self.repo[None]
175 mf = ctx.manifest()
176 notify = self.ui.note 174 notify = self.ui.note
177 candidates = [f for f in files if self.iskwfile(f, ctx.flags)] 175 candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
178 if candidates: 176 if candidates:
179 self.restrict = True # do not expand when reading 177 self.restrict = True # do not expand when reading
180 action = expand and 'expanding' or 'shrinking' 178 action = expand and 'expanding' or 'shrinking'