##// END OF EJS Templates
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall -
r2888:38484882 default
parent child Browse files
Show More
@@ -77,7 +77,7 b' class queue:'
77
77
78 def diffopts(self):
78 def diffopts(self):
79 if self._diffopts is None:
79 if self._diffopts is None:
80 self._diffopts = self.ui.diffopts()
80 self._diffopts = patch.diffopts(self.ui)
81 return self._diffopts
81 return self._diffopts
82
82
83 def join(self, *p):
83 def join(self, *p):
@@ -1337,7 +1337,7 b' def diff(ui, repo, *pats, **opts):'
1337 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
1337 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
1338
1338
1339 patch.diff(repo, node1, node2, fns, match=matchfn,
1339 patch.diff(repo, node1, node2, fns, match=matchfn,
1340 opts=ui.diffopts(opts))
1340 opts=patch.diffopts(ui, opts))
1341
1341
1342 def export(ui, repo, *changesets, **opts):
1342 def export(ui, repo, *changesets, **opts):
1343 """dump the header and diffs for one or more changesets
1343 """dump the header and diffs for one or more changesets
@@ -1374,7 +1374,8 b' def export(ui, repo, *changesets, **opts'
1374 else:
1374 else:
1375 ui.note(_('exporting patch:\n'))
1375 ui.note(_('exporting patch:\n'))
1376 patch.export(repo, map(repo.lookup, revs), template=opts['output'],
1376 patch.export(repo, map(repo.lookup, revs), template=opts['output'],
1377 switch_parent=opts['switch_parent'], opts=ui.diffopts(opts))
1377 switch_parent=opts['switch_parent'],
1378 opts=patch.diffopts(ui, opts))
1378
1379
1379 def forget(ui, repo, *pats, **opts):
1380 def forget(ui, repo, *pats, **opts):
1380 """don't add the specified files on the next commit (DEPRECATED)
1381 """don't add the specified files on the next commit (DEPRECATED)
@@ -11,7 +11,7 b' import os.path'
11 import mimetypes
11 import mimetypes
12 from mercurial.demandload import demandload
12 from mercurial.demandload import demandload
13 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile")
13 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile")
14 demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone")
14 demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch")
15 demandload(globals(), "mercurial:templater")
15 demandload(globals(), "mercurial:templater")
16 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile")
16 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile")
17 from mercurial.node import *
17 from mercurial.node import *
@@ -134,7 +134,7 b' class hgweb(object):'
134 modified, added, removed = map(lambda x: filterfiles(files, x),
134 modified, added, removed = map(lambda x: filterfiles(files, x),
135 (modified, added, removed))
135 (modified, added, removed))
136
136
137 diffopts = ui.diffopts()
137 diffopts = patch.diffopts(ui)
138 for f in modified:
138 for f in modified:
139 to = r.file(f).read(mmap1[f])
139 to = r.file(f).read(mmap1[f])
140 tn = r.file(f).read(mmap2[f])
140 tn = r.file(f).read(mmap2[f])
@@ -251,6 +251,18 b' def patch(strip, patchname, ui, cwd=None'
251
251
252 return files
252 return files
253
253
254 def diffopts(ui, opts={}):
255 return mdiff.diffopts(
256 text=opts.get('text'),
257 showfunc=(opts.get('show_function') or
258 ui.configbool('diff', 'showfunc', None)),
259 ignorews=(opts.get('ignore_all_space') or
260 ui.configbool('diff', 'ignorews', None)),
261 ignorewsamount=(opts.get('ignore_space_change') or
262 ui.configbool('diff', 'ignorewsamount', None)),
263 ignoreblanklines=(opts.get('ignore_blank_lines') or
264 ui.configbool('diff', 'ignoreblanklines', None)))
265
254 def diff(repo, node1=None, node2=None, files=None, match=util.always,
266 def diff(repo, node1=None, node2=None, files=None, match=util.always,
255 fp=None, changes=None, opts=None):
267 fp=None, changes=None, opts=None):
256 '''print diff of changes to files between two nodes, or node and
268 '''print diff of changes to files between two nodes, or node and
@@ -169,18 +169,6 b' class ui(object):'
169 result[key.lower()] = value
169 result[key.lower()] = value
170 return result
170 return result
171
171
172 def diffopts(self, opts={}):
173 return mdiff.diffopts(
174 text=opts.get('text'),
175 showfunc=(opts.get('show_function') or
176 self.configbool('diff', 'showfunc', None)),
177 ignorews=(opts.get('ignore_all_space') or
178 self.configbool('diff', 'ignorews', None)),
179 ignorewsamount=(opts.get('ignore_space_change') or
180 self.configbool('diff', 'ignorewsamount', None)),
181 ignoreblanklines=(opts.get('ignore_blank_lines') or
182 self.configbool('diff', 'ignoreblanklines', None)))
183
184 def username(self):
172 def username(self):
185 """Return default username to be used in commits.
173 """Return default username to be used in commits.
186
174
General Comments 0
You need to be logged in to leave comments. Login now