Rev 3831: Fix #296620 by letting bzrttols provides color diff support in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Nov 12 01:25:17 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3831
revision-id: pqm at pqm.ubuntu.com-20081112012514-6y8u99lf11pk0rdm
parent: pqm at pqm.ubuntu.com-20081111045205-junyogmq9uajfg6z
parent: v.ladeuil+lp at free.fr-20081112004841-45lwpb0tc2x05ooo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-11-12 01:25:14 +0000
message:
  Fix #296620 by letting bzrttols provides color diff support
modified:
  bzrlib/shelf_ui.py             shelver.py-20081005210102-33worgzwrtdw0yrm-1
    ------------------------------------------------------------
    revno: 3830.1.1
    revision-id: v.ladeuil+lp at free.fr-20081112004841-45lwpb0tc2x05ooo
    parent: pqm at pqm.ubuntu.com-20081111045205-junyogmq9uajfg6z
    parent: vila at scythe-20081111055023-8s7iqcawrv83igqx
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: bzr.integration
    timestamp: Wed 2008-11-12 01:48:41 +0100
    message:
      Fix #296620 by letting bzrttols provides color diff support
    modified:
      bzrlib/shelf_ui.py             shelver.py-20081005210102-33worgzwrtdw0yrm-1
    ------------------------------------------------------------
    revno: 3828.1.1
    revision-id: vila at scythe-20081111055023-8s7iqcawrv83igqx
    parent: pqm at pqm.ubuntu.com-20081111023942-ir0du8iel76giykh
    committer: Vincent Ladeuil <vila at scythe>
    branch nick: 296620-shelf-ui-no-colordiff
    timestamp: Tue 2008-11-11 15:50:23 +1000
    message:
      Fix #296620 by allowing plugins instead of requiring them.
      
      * shelf_ui.py: 
      (diff_writer_factory): Give plugins something to override.
      (Shelver.__init__): Use the factory if no None.
    modified:
      bzrlib/shelf_ui.py             shelver.py-20081005210102-33worgzwrtdw0yrm-1
=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py	2008-11-03 21:52:46 +0000
+++ b/bzrlib/shelf_ui.py	2008-11-11 05:50:23 +0000
@@ -33,10 +33,10 @@
     ui,
     workingtree,
 )
-try:
-    from bzrlib.plugins.bzrtools import colordiff
-except ImportError:
-    colordiff = None
+
+
+# Plugins may want to override the following
+diff_writer_factory = None
 
 
 class Shelver(object):
@@ -56,8 +56,9 @@
         """
         self.work_tree = work_tree
         self.target_tree = target_tree
-        if colordiff is not None:
-            self.diff_writer = colordiff.DiffWriter(sys.stdout, False)
+        if diff_writer_factory is not None:
+            self.diff_writer = diff_writer_factory(target=sys.stdout,
+                                                   check_style=False)
         else:
             self.diff_writer = sys.stdout
         self.manager = work_tree.get_shelf_manager()




More information about the bazaar-commits mailing list