comparison hgext/keyword.py @ 6739:c9fbd6ec3489

context: avoid using None for working parent
author Matt Mackall <mpm@selenic.com>
date Wed, 25 Jun 2008 17:35:20 -0500
parents 336fda65759a
children b148e9099133
comparison
equal deleted inserted replaced
6738:336fda65759a 6739:c9fbd6ec3489
169 Caveat: localrepository._link fails on Windows.''' 169 Caveat: localrepository._link fails on Windows.'''
170 return self.matcher(path) and not islink(path) 170 return self.matcher(path) and not islink(path)
171 171
172 def overwrite(self, node, expand, files): 172 def overwrite(self, node, expand, files):
173 '''Overwrites selected files expanding/shrinking keywords.''' 173 '''Overwrites selected files expanding/shrinking keywords.'''
174 ctx = self.repo.changectx(node)
175 mf = ctx.manifest()
176 if node is not None: # commit 174 if node is not None: # commit
175 ctx = self.repo.changectx(node)
176 mf = ctx.manifest()
177 files = [f for f in ctx.files() if f in mf] 177 files = [f for f in ctx.files() if f in mf]
178 notify = self.ui.debug 178 notify = self.ui.debug
179 else: # kwexpand/kwshrink 179 else: # kwexpand/kwshrink
180 ctx = self.repo.changectx('.')
181 mf = ctx.manifest()
180 notify = self.ui.note 182 notify = self.ui.note
181 candidates = [f for f in files if self.iskwfile(f, mf.linkf)] 183 candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
182 if candidates: 184 if candidates:
183 self.restrict = True # do not expand when reading 185 self.restrict = True # do not expand when reading
184 candidates.sort() 186 candidates.sort()
509 fp=None, changes=None, opts=None): 511 fp=None, changes=None, opts=None):
510 '''Monkeypatch patch.diff to avoid expansion except when 512 '''Monkeypatch patch.diff to avoid expansion except when
511 comparing against working dir.''' 513 comparing against working dir.'''
512 if node2 is not None: 514 if node2 is not None:
513 kwt.matcher = util.never 515 kwt.matcher = util.never
514 elif node1 is not None and node1 != repo.changectx().node(): 516 elif node1 is not None and node1 != repo.changectx('.').node():
515 kwt.restrict = True 517 kwt.restrict = True
516 patch_diff(repo, node1, node2, match, fp, changes, opts) 518 patch_diff(repo, node1, node2, match, fp, changes, opts)
517 519
518 def kwweb_annotate(web, req, tmpl): 520 def kwweb_annotate(web, req, tmpl):
519 '''Wraps webcommands.annotate turning off keyword expansion.''' 521 '''Wraps webcommands.annotate turning off keyword expansion.'''