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: a3dc8f1526dcdf8c


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

revision:            a3dc8f1526dcdf8c37412441e6ccc8b4a6d136d7
date:                2011-02-23T20:28:52
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone.issue-120
changelog:
Replaced edge_map iteration with a call to revision_summary

The iteration originally came from revision_summary anyway, and I'm
planning to extend it by adding a boost::function callback parameter so each
caller can decide what to do with each node.

The 3 existing callers can output the friendly format as they do now, but
the CMD(changed call can just output the ordered filenames with duplicates
removed.

NOTE: This is not a functional replacement and actually breaks "mtn ls
changed" for the meantime, by making it return the same as "mtn status".

manifest:
format_version "1"

new_manifest [eb9982abebfcce0edce85e975b630a8506df206b]

old_revision [38220f6ec36f96e77eea6f8eb31d729fb4c35b97]

patch "src/cmd_list.cc"
 from [52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf]
   to [e3241a4bac5495f95ba880464d7de98a2ba4135c]
============================================================
--- src/cmd_list.cc	52eb368ccb13dc0ec9dd6095ff92993a5d3f28cf
+++ src/cmd_list.cc	e3241a4bac5495f95ba880464d7de98a2ba4135c
@@ -29,6 +29,7 @@
 #include "key_store.hh"
 #include "restrictions.hh"
 #include "revision.hh"
+#include "rev_output.hh"
 #include "simplestring_xform.hh"
 #include "transforms.hh"
 #include "ui.hh"
@@ -879,75 +880,13 @@ CMD(changed, "changed", "", CMD_REF(list
   revision_id rid;
   calculate_ident(rev, rid);
 
-  set<file_path> output_files;
+  // TODO: revision_summary needs changing to take in a function, so we can
+  // 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);
 
-  // TODO: Refactor this method and promote these locals to parameters
-  // We can then use the method to provide us with "mtn ls added" for
-  // example
-  bool output_dropped = true;
-  bool output_renamed = true;
-  bool output_added = true;
-  bool output_patched = true;
-  bool output_attrs = true;
-
-  for (edge_map::const_iterator i = rev.edges.begin(); i != rev.edges.end(); ++i)
-    {
-      revision_id parent = edge_old_revision(*i);
-      cset const & cs = edge_changes(*i);
-
-      if (output_dropped)
-        {
-          for (set<file_path>::const_iterator i = cs.nodes_deleted.begin();
-            i != cs.nodes_deleted.end(); ++i)
-            output_files.insert(*i);
-        }
-
-      if (output_renamed)
-        {
-          for (map<file_path, file_path>::const_iterator
-            i = cs.nodes_renamed.begin();
-            i != cs.nodes_renamed.end(); ++i)
-            output_files.insert(i->second);
-        }
-
-      if (output_added)
-        {
-          for (set<file_path>::const_iterator i = cs.dirs_added.begin();
-            i != cs.dirs_added.end(); ++i)
-            output_files.insert(*i);
-
-          for (map<file_path, file_id>::const_iterator i = cs.files_added.begin();
-            i != cs.files_added.end(); ++i)
-            output_files.insert(i->first);
-        }
-
-      if (output_patched)
-        {
-          for (map<file_path, pair<file_id, file_id> >::const_iterator
-            i = cs.deltas_applied.begin(); i != cs.deltas_applied.end(); ++i)
-            output_files.insert(i->first);
-        }
-
-      if (output_attrs)
-        {
-          for (map<pair<file_path, attr_key>, attr_value >::const_iterator
-            i = cs.attrs_set.begin(); i != cs.attrs_set.end(); ++i)
-            output_files.insert(i->first.first);
-
-            // FIXME: naming here could not be more inconsistent
-            // the cset calls it attrs_cleared
-            // the command is attr drop
-            // here it is called unset
-            // the revision text uses attr clear 
-
-          for (set<pair<file_path, attr_key> >::const_iterator
-            i = cs.attrs_cleared.begin(); i != cs.attrs_cleared.end(); ++i)
-            output_files.insert(i->first);
-        }
-    }
-
-  copy(output_files.begin(), output_files.end(),
-       ostream_iterator<file_path>(cout, "\n"));
+  cout << summary;
 }
 
 namespace

reply via email to

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