comparison hgext/extdiff.py @ 2959:7f5fc4b347de

extdiff: make new diff commands pick up their options correctly
author TK Soh <teekaysoh@yahoo.com>
date Thu, 17 Aug 2006 15:30:45 -0500
parents 05f357b70cb0
children be98c5ce4022
comparison
equal deleted inserted replaced
2958:ff3ea21a981a 2959:7f5fc4b347de
151 if not cmd.startswith('cmd.'): continue 151 if not cmd.startswith('cmd.'): continue
152 cmd = cmd[4:] 152 cmd = cmd[4:]
153 if not path: path = cmd 153 if not path: path = cmd
154 diffopts = ui.config('extdiff', 'opts.' + cmd, '') 154 diffopts = ui.config('extdiff', 'opts.' + cmd, '')
155 diffopts = diffopts and [diffopts] or [] 155 diffopts = diffopts and [diffopts] or []
156 def save(cmd, path): 156 def save(cmd, path, diffopts):
157 '''use closure to save diff command to use''' 157 '''use closure to save diff command to use'''
158 def mydiff(ui, repo, *pats, **opts): 158 def mydiff(ui, repo, *pats, **opts):
159 return dodiff(ui, repo, path, diffopts, pats, opts) 159 return dodiff(ui, repo, path, diffopts, pats, opts)
160 mydiff.__doc__ = '''use %(path)r to diff repository (or selected files) 160 mydiff.__doc__ = '''use %(path)r to diff repository (or selected files)
161 161
168 directory, and, when no revisions are specified, the 168 directory, and, when no revisions are specified, the
169 working directory files are compared to its parent.''' % { 169 working directory files are compared to its parent.''' % {
170 'path': path, 170 'path': path,
171 } 171 }
172 return mydiff 172 return mydiff
173 cmdtable[cmd] = (save(cmd, path), 173 cmdtable[cmd] = (save(cmd, path, diffopts),
174 cmdtable['extdiff'][1][1:], 174 cmdtable['extdiff'][1][1:],
175 _('hg %s [OPT]... [FILE]...') % cmd) 175 _('hg %s [OPT]... [FILE]...') % cmd)