changeset 2888:3848488244fc

Move ui.diffopts to patch.diffopts where it belongs
author Matt Mackall <mpm@selenic.com>
date Tue, 15 Aug 2006 11:34:08 -0500
parents 05257fd28591
children 20b95aef3fe0
files hgext/mq.py mercurial/commands.py mercurial/hgweb/hgweb_mod.py mercurial/patch.py mercurial/ui.py
diffstat 5 files changed, 18 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Aug 14 15:07:00 2006 -0500
+++ b/hgext/mq.py	Tue Aug 15 11:34:08 2006 -0500
@@ -77,7 +77,7 @@
 
     def diffopts(self):
         if self._diffopts is None:
-            self._diffopts = self.ui.diffopts()
+            self._diffopts = patch.diffopts(self.ui)
         return self._diffopts
 
     def join(self, *p):
--- a/mercurial/commands.py	Mon Aug 14 15:07:00 2006 -0500
+++ b/mercurial/commands.py	Tue Aug 15 11:34:08 2006 -0500
@@ -1337,7 +1337,7 @@
     fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
 
     patch.diff(repo, node1, node2, fns, match=matchfn,
-               opts=ui.diffopts(opts))
+               opts=patch.diffopts(ui, opts))
 
 def export(ui, repo, *changesets, **opts):
     """dump the header and diffs for one or more changesets
@@ -1374,7 +1374,8 @@
     else:
         ui.note(_('exporting patch:\n'))
     patch.export(repo, map(repo.lookup, revs), template=opts['output'],
-                 switch_parent=opts['switch_parent'], opts=ui.diffopts(opts))
+                 switch_parent=opts['switch_parent'],
+                 opts=patch.diffopts(ui, opts))
 
 def forget(ui, repo, *pats, **opts):
     """don't add the specified files on the next commit (DEPRECATED)
--- a/mercurial/hgweb/hgweb_mod.py	Mon Aug 14 15:07:00 2006 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Aug 15 11:34:08 2006 -0500
@@ -11,7 +11,7 @@
 import mimetypes
 from mercurial.demandload import demandload
 demandload(globals(), "re zlib ConfigParser mimetools cStringIO sys tempfile")
-demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone")
+demandload(globals(), "mercurial:mdiff,ui,hg,util,archival,streamclone,patch")
 demandload(globals(), "mercurial:templater")
 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile")
 from mercurial.node import *
@@ -134,7 +134,7 @@
             modified, added, removed = map(lambda x: filterfiles(files, x),
                                            (modified, added, removed))
 
-        diffopts = ui.diffopts()
+        diffopts = patch.diffopts(ui)
         for f in modified:
             to = r.file(f).read(mmap1[f])
             tn = r.file(f).read(mmap2[f])
--- a/mercurial/patch.py	Mon Aug 14 15:07:00 2006 -0500
+++ b/mercurial/patch.py	Tue Aug 15 11:34:08 2006 -0500
@@ -251,6 +251,18 @@
 
     return files
 
+def diffopts(ui, opts={}):
+    return mdiff.diffopts(
+        text=opts.get('text'),
+        showfunc=(opts.get('show_function') or
+                  ui.configbool('diff', 'showfunc', None)),
+        ignorews=(opts.get('ignore_all_space') or
+                  ui.configbool('diff', 'ignorews', None)),
+        ignorewsamount=(opts.get('ignore_space_change') or
+                        ui.configbool('diff', 'ignorewsamount', None)),
+        ignoreblanklines=(opts.get('ignore_blank_lines') or
+                          ui.configbool('diff', 'ignoreblanklines', None)))
+
 def diff(repo, node1=None, node2=None, files=None, match=util.always,
          fp=None, changes=None, opts=None):
     '''print diff of changes to files between two nodes, or node and
--- a/mercurial/ui.py	Mon Aug 14 15:07:00 2006 -0500
+++ b/mercurial/ui.py	Tue Aug 15 11:34:08 2006 -0500
@@ -169,18 +169,6 @@
             result[key.lower()] = value
         return result
 
-    def diffopts(self, opts={}):
-        return mdiff.diffopts(
-            text=opts.get('text'),
-            showfunc=(opts.get('show_function') or
-                      self.configbool('diff', 'showfunc', None)),
-            ignorews=(opts.get('ignore_all_space') or
-                      self.configbool('diff', 'ignorews', None)),
-            ignorewsamount=(opts.get('ignore_space_change') or
-                            self.configbool('diff', 'ignorewsamount', None)),
-            ignoreblanklines=(opts.get('ignore_blank_lines') or
-                              self.configbool('diff', 'ignoreblanklines', None)))
-
     def username(self):
         """Return default username to be used in commits.