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: 8789e5dd037ae17298210df81b


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 8789e5dd037ae17298210df81bf542a37aec8ec1
Date: Mon, 17 Jan 2011 11:49:33 GMT

revision:            8789e5dd037ae17298210df81bf542a37aec8ec1
date:                2011-01-17T11:49:22
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
Refactor the code for 'mtn ls unknown|ignored' so the help text gets
a little bit more helpful, and so the user isn't fooled into thinking
the two commands mean the same thing.

manifest:
format_version "1"

new_manifest [86056793e06eb7bd4b12098cbf3cc0eef8e85a42]

old_revision [f97dc9da5f3cd72ff01c40105bdf4d10c9873cd9]

patch "cmd_list.cc"
 from [f706db0c8374b743160e1ac88cbd863f67f0b2b3]
   to [1761568b06cf3afa752a2e6d1611b450cbfae6c4]
============================================================
--- cmd_list.cc	f706db0c8374b743160e1ac88cbd863f67f0b2b3
+++ cmd_list.cc	1761568b06cf3afa752a2e6d1611b450cbfae6c4
@@ -782,10 +782,10 @@ CMD(known, "known", "", CMD_REF(list), "
        ostream_iterator<file_path>(cout, "\n"));
 }
 
-CMD(unknown, "unknown", "ignored", CMD_REF(list), "[PATH]",
-    N_("Lists workspace files that do not belong to the current branch"),
-    "",
-    options::opts::depth | options::opts::exclude)
+static void get_unknown_ignored(app_state & app,
+                                args_vector const & args,
+                                set<file_path> & unknown,
+                                set<file_path> & ignored)
 {
   database db(app);
   workspace work(app);
@@ -793,26 +793,38 @@ CMD(unknown, "unknown", "ignored", CMD_R
   vector<file_path> roots = args_to_paths(args);
   path_restriction mask(roots, args_to_paths(app.opts.exclude),
                         app.opts.depth, ignored_file(work));
-  set<file_path> unknown, ignored;
 
   // if no starting paths have been specified use the workspace root
   if (roots.empty())
     roots.push_back(file_path());
 
   work.find_unknown_and_ignored(db, mask, roots, unknown, ignored);
+}
 
-  utf8 const & realname = execid[execid.size() - 1];
-  if (realname() == "ignored")
-    copy(ignored.begin(), ignored.end(),
-         ostream_iterator<file_path>(cout, "\n"));
-  else
-    {
-      I(realname() == "unknown");
-      copy(unknown.begin(), unknown.end(),
-           ostream_iterator<file_path>(cout, "\n"));
-    }
+CMD(unknown, "unknown", "", CMD_REF(list), "[PATH]",
+    N_("Lists workspace files that are unknown in the current branch"),
+    "",
+    options::opts::depth | options::opts::exclude)
+{
+  set<file_path> unknown, _;
+  get_unknown_ignored(app, args, unknown, _);
+
+  copy(unknown.begin(), unknown.end(),
+       ostream_iterator<file_path>(cout, "\n"));
 }
 
+CMD(ignored, "ignored", "", CMD_REF(list), "[PATH]",
+    N_("Lists workspace files that are ignored in the current branch"),
+    "",
+    options::opts::depth | options::opts::exclude)
+{
+  set<file_path> _, ignored;
+  get_unknown_ignored(app, args, _, ignored);
+
+  copy(ignored.begin(), ignored.end(),
+       ostream_iterator<file_path>(cout, "\n"));
+}
+
 CMD(missing, "missing", "", CMD_REF(list), "",
     N_("Lists files that belong to the branch but are not in the workspace"),
     "",

reply via email to

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