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: 928bc8cc009980


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.colored-diff: 928bc8cc009980fb629a768dbbe01cc6f80c115e
Date: Wed, 17 Aug 2011 11:42:46 +0200 (CEST)

revision:            928bc8cc009980fb629a768dbbe01cc6f80c115e
suspend:             net.venge.monotone.colored-diff
date:                2011-04-14T10:01:55
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.colored-diff
changelog:
explicit merge of '32dadf9c91dc9ee0b572b175c113fd32f119504e'
              and '2367254df165ea4cf9a0ba12229d667e49918d1e'

manifest:
format_version "1"

new_manifest [0193f16235710a13e5262993665ff92d32164893]

old_revision [2367254df165ea4cf9a0ba12229d667e49918d1e]

patch "src/cmd_diff_log.cc"
 from [c9aa40fd997f22a53476a25b6ca5a85593294c7e]
   to [edf24cc63f8190b819b96ae3464010960bdebdf0]

patch "src/cmd_ws_commit.cc"
 from [49428f1e66c32635cba685c13921f5904ed79d89]
   to [d2fb5982862356075d6f8102f6c9b55328f57b0c]

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

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

patch "src/rev_output.cc"
 from [ccf235daf27df22af61326c746170ff3fccb075a]
   to [64f4b7b653880084f21ca8ad4885f026ef87d74b]

patch "src/rev_output.hh"
 from [5879a8268a59545c946583b65f66eda4491b979e]
   to [5d2c0b05bcc9c3324715fc7dfbc9c5cdea9f16a3]

patch "src/std_hooks.lua"
 from [c8cd84c99c2b34b1ed32a0c5b58c9ab415f1be48]
   to [74778bdf4686d30e64c75133c6dfba26e534db5d]

old_revision [32dadf9c91dc9ee0b572b175c113fd32f119504e]

patch "src/asciik.cc"
 from [688ecdcf87cb50fa265a82bac6c90b6e02fc0ed6]
   to [542aa7ee7cd8af6b9b41e7f9450d93f7412513c6]
============================================================
--- 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_diff_log.cc	c9aa40fd997f22a53476a25b6ca5a85593294c7e
+++ src/cmd_diff_log.cc	edf24cc63f8190b819b96ae3464010960bdebdf0
@@ -594,20 +594,11 @@ log_print_rev (app_state    &   app,
     }
   else
     {
-      utf8 header;
-      revision_header(rid, rev, certs, date_fmt, color, header);
+      revision_header(rid, rev, certs, date_fmt, color);
 
-      external header_external;
-      utf8_to_system_best_effort(header, header_external);
-      color.get_ostream() << header_external;
-
       if (!app.opts.no_files)
         {
-          utf8 summary;
-          revision_summary(rev, color, summary);
-          external summary_external;
-          utf8_to_system_best_effort(summary, summary_external);
-          color.get_ostream() << summary_external;
+          revision_summary(rev, color);
         }
     }
 
============================================================
--- src/cmd_ws_commit.cc	49428f1e66c32635cba685c13921f5904ed79d89
+++ src/cmd_ws_commit.cc	d2fb5982862356075d6f8102f6c9b55328f57b0c
@@ -259,8 +259,10 @@ get_log_message_interactively(lua_hooks 
   }
 
   utf8 summary;
-  colorizer color(false, lua, cout);
-  revision_summary(rev, color, summary);
+  ostringstream oss;
+  colorizer color(false, lua, oss);
+  revision_summary(rev, color);
+  summary = utf8(oss.str().c_str());
 
   utf8 full_message(changelog() + cancel() + instructions() + editable() + ignored() +
                     notes() + summary(),
@@ -964,31 +966,37 @@ CMD(status, "status", "", CMD_REF(inform
   utf8 changelog;
   work.read_user_log(changelog);
 
-  utf8 header;
-  utf8 summary;
   colorizer color(app.opts.colorize, app.lua, cout);
 
   revision_header(rid, rev, author, date_t::now(), app.opts.branch, changelog,
-                  date_fmt, color, header);
-  revision_summary(rev, color, summary);
+                  date_fmt, color);
+  revision_summary(rev, color);
 
-  external header_external;
-  external summary_external;
-
-  utf8_to_system_best_effort(header, header_external);
-  utf8_to_system_best_effort(summary, summary_external);
-
-  cout << header_external;
-
   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);
@@ -999,13 +1007,13 @@ 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;
             }
         }
     }
-
-  cout << summary_external;
 }
 
 static void
============================================================
--- src/rev_output.cc	ccf235daf27df22af61326c746170ff3fccb075a
+++ src/rev_output.cc	64f4b7b653880084f21ca8ad4885f026ef87d74b
@@ -31,7 +31,7 @@ revision_header(revision_id const rid, r
 revision_header(revision_id const rid, revision_t const & rev,
                 string const & author, date_t const date,
                 branch_name const & branch, utf8 const & changelog,
-                string const & date_fmt, colorizer const & color, utf8 & header)
+                string const & date_fmt, colorizer const & color)
 {
   vector<cert> certs;
   key_id empty_key;
@@ -47,13 +47,13 @@ revision_header(revision_id const rid, r
     certs.push_back(cert(rid, changelog_cert_name,
                          cert_value(changelog(), origin::user), empty_key));
 
-  revision_header(rid, rev, certs, date_fmt, color, header);
+  revision_header(rid, rev, certs, date_fmt, color);
 }
 
 void
 revision_header(revision_id const rid, revision_t const & rev,
                 vector<cert> const & certs, string const & date_fmt,
-                colorizer const & color, utf8 & header)
+                colorizer const & color)
 {
   color.get_ostream() << color.colorize(string(70, '-'),
                                         colorizer::log_revision) << '\n';
@@ -124,7 +124,7 @@ void
 }
 
 void
-revision_summary(revision_t const & rev, colorizer const & color, utf8 & summary)
+revision_summary(revision_t const & rev, colorizer const & color)
 {
   // We intentionally do not collapse the final \n into the format
   // strings here, for consistency with newline conventions used by most
============================================================
--- src/rev_output.hh	5879a8268a59545c946583b65f66eda4491b979e
+++ src/rev_output.hh	5d2c0b05bcc9c3324715fc7dfbc9c5cdea9f16a3
@@ -21,16 +21,15 @@ revision_header(revision_id const rid, r
 revision_header(revision_id const rid, revision_t const & rev,
                 std::string const & author, date_t const date,
                 branch_name const & branch, utf8 const & changelog,
-                std::string const & date_fmt, colorizer const & color,
-                utf8 & header);
+                std::string const & date_fmt, colorizer const & color);
 
 void
 revision_header(revision_id const rid, revision_t const & rev,
                 std::vector<cert> const & certs, std::string const & date_fmt,
-                colorizer const & color, utf8 & header);
+                colorizer const & color);
 
 void
-revision_summary(revision_t const & rev, colorizer const & color, utf8 & summary);
+revision_summary(revision_t const & rev, colorizer const & color);
 
 #endif  // header guard
 
============================================================
--- 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,
============================================================
--- src/asciik.cc	688ecdcf87cb50fa265a82bac6c90b6e02fc0ed6
+++ src/asciik.cc	542aa7ee7cd8af6b9b41e7f9450d93f7412513c6
@@ -376,7 +376,7 @@ CMD(asciik, "asciik", "", CMD_REF(debug)
 CMD(asciik, "asciik", "", CMD_REF(debug), N_("SELECTOR"),
     N_("Prints an ASCII representation of the revisions' graph"),
     "",
-    options::opts::colorize)
+    options::opts::none)
 {
   E(args.size() == 1, origin::user,
     F("wrong argument count"));

reply via email to

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