monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone.colored-diff: 32dadf9c91dc9e


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.colored-diff: 32dadf9c91dc9ee0b572b175c113fd32f119504e
Date: Wed, 13 Apr 2011 00:02:26 +0200 (CEST)

revision:            32dadf9c91dc9ee0b572b175c113fd32f119504e
date:                2011-04-12T22:03:06
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.colored-diff
changelog:
New purpose "important" for the colorizer - used by "mtn status"

This is used to display the "*** description *** messages shown to the user
when doing "mtn status". It's called "important" because it is to highlight
to the user they should check what they are doing. It's not called warning as
it's valid to create a new branch, and divergence.

manifest:
format_version "1"

new_manifest [002643657fc5873b9ad34eaf13f43cf715ad68d9]

old_revision [6e3fa1d7e3ac9e535ae4343b56950afa1139275b]

patch "src/cmd_ws_commit.cc"
 from [97997cf92634c8b79fc7cd357f3b44895643a066]
   to [d2fb5982862356075d6f8102f6c9b55328f57b0c]

patch "src/colorizer.cc"
 from [c4a84f8e4ae26c763df6d57ac3f6c11f48ad6fbf]
   to [06e2ce758cd7cbd2eb16927f3a58beb3642b6238]

patch "src/colorizer.hh"
 from [22dc6d5552c8ab0c59a918ca54f1e2273fb813cb]
   to [36da84d0887c3cfce25da6fde2d878186b95aaa2]

patch "src/std_hooks.lua"
 from [c8cd84c99c2b34b1ed32a0c5b58c9ab415f1be48]
   to [74778bdf4686d30e64c75133c6dfba26e534db5d]
============================================================
--- src/std_hooks.lua	c8cd84c99c2b34b1ed32a0c5b58c9ab415f1be48
+++ src/std_hooks.lua	74778bdf4686d30e64c75133c6dfba26e534db5d
@@ -1561,6 +1561,7 @@ function get_output_color(purpose)
                 change = { fg = "blue", bg = "", style = "" },
                 comment = { fg = "yellow", bg = "", style = "" },
                 encloser = { fg = "magenta", bg = "", style = "" },
+                important = { fg = "white", bg = "red", style = "" },
                 log_revision = { fg = "", bg = "", style = "bold" },
                 remove = { fg = "red", bg = "", style = "" },
                 rename = { fg = "yellow", bg = "", style = "" },
============================================================
--- src/cmd_ws_commit.cc	97997cf92634c8b79fc7cd357f3b44895643a066
+++ src/cmd_ws_commit.cc	d2fb5982862356075d6f8102f6c9b55328f57b0c
@@ -975,12 +975,28 @@ CMD(status, "status", "", CMD_REF(inform
   if (!old_branches.empty() &&
       old_branches.find(app.opts.branch) == old_branches.end())
     {
-      cout << string(70, '-') << '\n'
-           << _("*** THIS REVISION WILL CREATE A NEW BRANCH ***") << "\n\n";
+      color.get_ostream() << string(70, '-') << '\n';
+      color.colorize(_("*** THIS REVISION WILL CREATE A NEW BRANCH ***"),
+                     colorizer::important);
+      color.get_ostream() << "\n\n";
+
       for (set<branch_name>::const_iterator i = old_branches.begin();
            i != old_branches.end(); ++i)
-        cout << _("Old Branch: ") << *i << '\n';
-      cout << _("New Branch: ") << app.opts.branch << "\n\n";
+        {
+          std::ostringstream old_name;
+          old_name << *i;
+
+          color.colorize(_("Old Branch: "), colorizer::remove);
+          color.colorize(old_name.str(), colorizer::remove);
+          color.get_ostream() << '\n';
+        }
+
+      std::ostringstream new_name;
+      new_name << app.opts.branch;
+
+      color.colorize(_("New Branch: "), colorizer::add);
+      color.colorize(new_name.str(), colorizer::add);
+      color.get_ostream() << "\n\n";
     }
   set<revision_id> heads;
   project.get_branch_heads(app.opts.branch, heads, false);
@@ -991,7 +1007,9 @@ CMD(status, "status", "", CMD_REF(inform
         {
           if (heads.find(edge_old_revision(e)) == heads.end())
             {
-              cout << _("*** THIS REVISION WILL CREATE DIVERGENCE ***") << "\n\n";
+              color.get_ostream() << color.colorize(_("*** THIS REVISION WILL CREATE DIVERGENCE ***"),
+                                                    colorizer::important)
+                                  << "\n\n";
               break;
             }
         }
============================================================
--- src/colorizer.cc	c4a84f8e4ae26c763df6d57ac3f6c11f48ad6fbf
+++ src/colorizer.cc	06e2ce758cd7cbd2eb16927f3a58beb3642b6238
@@ -33,6 +33,8 @@ string colorizer::purpose_to_name(colori
       return "comment";
     case encloser:
       return "encloser";
+    case important:
+      return "important";
     case log_revision:
       return "log_revision";
     case remove:
@@ -221,6 +223,7 @@ colorizer::init_colormap()
   colormap.insert(map_output_color<T>(change));
   colormap.insert(map_output_color<T>(comment));
   colormap.insert(map_output_color<T>(encloser));
+  colormap.insert(map_output_color<T>(important));
   colormap.insert(map_output_color<T>(log_revision));
   colormap.insert(map_output_color<T>(remove));
   colormap.insert(map_output_color<T>(rename));
============================================================
--- src/colorizer.hh	22dc6d5552c8ab0c59a918ca54f1e2273fb813cb
+++ src/colorizer.hh	36da84d0887c3cfce25da6fde2d878186b95aaa2
@@ -29,6 +29,7 @@ struct colorizer
                  change,
                  comment,
                  encloser,
+                 important,
                  log_revision,
                  remove,
                  rename,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]