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.issue-120: 45f867b29111e838


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone.issue-120: 45f867b29111e83864a6bd6685d099ea96996289
Date: Thu, 24 Feb 2011 17:30:38 +0100 (CET)

revision:            45f867b29111e83864a6bd6685d099ea96996289
date:                2011-02-24T15:23:51
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.issue-120
changelog:
CMD(changed now outputs the correct format instead of using
friendly_node_summary

Added changed_nodes_summary in an anonymous namespace above CMD(changed as
it should only be called from there at the moment.

boost::bind is used to make an instance of the relevant boost::function
expected by revision_summary - and boost::ref's "output_files" as all of
the file_paths will be accumulated there. We can discard the output of
revision_summary as we only care about the contents of output_files.

manifest:
format_version "1"

new_manifest [51aa8bbd1e06149803939ce781e82024ac69499e]

old_revision [7c57048c60f3f68c977af98fed1454b63d7f4423]

patch "src/cmd_list.cc"
 from [60ec6406130ae4d1f30348c72aff250116450483]
   to [8abe82944d26b67c9506d12e054f8deed0a202e4]
============================================================
--- src/cmd_list.cc	60ec6406130ae4d1f30348c72aff250116450483
+++ src/cmd_list.cc	8abe82944d26b67c9506d12e054f8deed0a202e4
@@ -17,6 +17,7 @@
 #include <iterator>
 
 #include <boost/tuple/tuple.hpp>
+#include <boost/bind.hpp>
 
 #include "basic_io.hh"
 #include "cert.hh"
@@ -851,7 +852,32 @@ CMD(missing, "missing", "", CMD_REF(list
        ostream_iterator<file_path>(cout, "\n"));
 }
 
+namespace
+{
+  namespace
+  {
+    std::string
+    changed_nodes_summary(set<file_path> & output_files,
+                          node_status const status, file_path const & fp_first,
+                          file_path const & fp_second, attr_key const & key,
+                          attr_value const & value);
 
+    std::string
+    changed_nodes_summary(set<file_path> & output_files,
+                          node_status const status, file_path const & fp_first,
+                          file_path const & fp_second, attr_key const & key,
+                          attr_value const & value)
+    {
+      // our output is accumulated in output_files as we only care about the
+      // unique file_path's
+
+      output_files.insert(fp_first);
+
+      return "";
+    }
+  }
+};
+
 CMD(changed, "changed", "", CMD_REF(list), "[PATH...]",
     N_("Lists files that have changed with respect to the current revision"),
     "",
@@ -884,9 +910,13 @@ CMD(changed, "changed", "", CMD_REF(list
   // add the output to a set for ignoring duplicates, but CMD(status can
   // output the info in a friendly format
   utf8 summary;
-  revision_summary(rev, summary, friendly_node_summary);
+  set<file_path> output_files;
+  revision_summary(rev, summary,
+                   bind(changed_nodes_summary, boost::ref(output_files),
+                   _1, _2, _3, _4, _5));
 
-  cout << summary;
+  copy(output_files.begin(), output_files.end(),
+       ostream_iterator<file_path>(cout, "\n"));
 }
 
 namespace

reply via email to

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