The unified diff between revisions [8846a6b8..] and [ebdccab0..] is displayed below. It can also be downloaded as a raw diff.

This diff has been restricted to the following files: 'commands.cc'

#
#
# patch "commands.cc"
#  from [dbf77e72442ab85b8b4390b8fb1316ca8145d507]
#    to [0fc12a37debd7db7812e2670afcb99d787f869e0]
#
============================================================
--- commands.cc	dbf77e72442ab85b8b4390b8fb1316ca8145d507
+++ commands.cc	0fc12a37debd7db7812e2670afcb99d787f869e0
@@ -300,7 +300,7 @@ struct pid_file
       return;
     require_path_is_nonexistent(path, F("pid file '%s' already exists") % path);
     file.open(path.as_external().c_str());
-    file << get_process_id();
+    file << get_process_id() << endl;
     file.flush();
   }

@@ -461,10 +461,11 @@ describe_revision(app_state & app, revis
   return description;
 }

+
 static void
 complete(app_state & app,
          string const & str,
-         revision_id & completion,
+         set<revision_id> & completion,
          bool must_exist=true)
 {
   // This copies the start of selectors::parse_selector().to avoid
@@ -475,10 +476,10 @@ complete(app_state & app,
   if (str.find_first_not_of(constants::legal_id_bytes) == string::npos
       && str.size() == constants::idlen)
     {
-      completion = revision_id(str);
+      completion.insert(revision_id(str));
       if (must_exist)
-        N(app.db.revision_exists(completion),
-          F("no such revision '%s'") % completion);
+        N(app.db.revision_exists(*completion.begin()),
+          F("no such revision '%s'") % *completion.begin());
       return;
     }

@@ -494,16 +495,36 @@ complete(app_state & app,

   N(completions.size() != 0,
     F("no match for selection '%s'") % str);
+
+  for (set<string>::const_iterator i = completions.begin();
+       i != completions.end(); ++i)
+    {
+      pair<set<revision_id>::const_iterator, bool> p = completion.insert(revision_id(*i));
+      P(F("expanded to '%s'\n") % *(p.first));
+    }
+}
+
+
+static void
+complete(app_state & app,
+         string const & str,
+         revision_id & completion,
+         bool must_exist=true)
+{
+  set<revision_id> completions;
+
+  complete(app, str, completions, must_exist);
+
   if (completions.size() > 1)
     {
       string err = (F("selection '%s' has multiple ambiguous expansions: \n") % str).str();
-      for (set<string>::const_iterator i = completions.begin();
+      for (set<revision_id>::const_iterator i = completions.begin();
            i != completions.end(); ++i)
-        err += (describe_revision(app, revision_id(*i)) + "\n");
+        err += (describe_revision(app, *i) + "\n");
       N(completions.size() == 1, i18n_format(err));
     }
-  completion = revision_id(*(completions.begin()));
-  P(F("expanded to '%s'\n") %  completion);
+
+  completion = *completions.begin();
 }


@@ -1243,6 +1264,23 @@ ALIAS(mv, rename)
 ALIAS(mv, rename)


+CMD(pivot_root, N_("workspace"), N_("NEW_ROOT PUT_OLD"),
+    N_("rename the root directory\n"
+       "after this command, the directory that currently has the name NEW_ROOT\n"
+       "will be the root directory, and the directory that is currently the root\n"
+       "directory will have name PUT_OLD.\n"
+       "Using --execute is strongly recommended."),
+    OPT_EXECUTE)
+{
+  if (args.size() != 2)
+    throw usage(name);
+
+  app.require_workspace();
+  file_path new_root = file_path_external(idx(args, 0));
+  file_path put_old = file_path_external(idx(args, 1));
+  perform_pivot_root(new_root, put_old, app);
+}
+
 // fload and fmerge are simple commands for debugging the line
 // merger.

@@ -1339,7 +1377,7 @@ CMD(status, N_("informative"), N_("[PATH
 }


-CMD(identify, N_("workspace"), N_("[PATH]"),
+CMD(identify, N_("debug"), N_("[PATH]"),
     N_("calculate identity of PATH or stdin"),
     OPT_NONE)
 {
@@ -1740,13 +1778,6 @@ ls_missing (app_state & app, vector<utf8
 }


-struct lt_file_path
-{
-  bool operator()(const file_path &fp1, const file_path &fp2) const
-  {
-    return fp1 < fp2;
-  }
-};
 static void
 ls_changed (app_state & app, vector<utf8> const & args)
 {
@@ -1754,7 +1785,7 @@ ls_changed (app_state & app, vector<utf8
   revision_id rid;
   roster_t old_roster, new_roster;
   data tmp;
-  std::set<file_path, lt_file_path> files;
+  std::set<file_path> files;

   app.require_workspace();
   get_working_revision_and_rosters(app, args, rs, old_roster, new_roster);
@@ -3219,6 +3250,7 @@ CMD(refresh_inodeprints, N_("tree"), "",
 CMD(refresh_inodeprints, N_("tree"), "", N_("refresh the inodeprint cache"),
     OPT_NONE)
 {
+  app.require_workspace();
   enable_inodeprints();
   maybe_update_inodeprints(app);
 }
@@ -3409,7 +3441,11 @@ CMD(revert, N_("workspace"), N_("[PATH].
         }
       else
         {
-          mkdir_p(fp);
+          if (!directory_exists(fp))
+            {
+              P(F("recreating %s/") % fp);
+              mkdir_p(fp);
+            }
         }
     }

@@ -3541,7 +3577,8 @@ CMD(log, N_("informative"), N_("[FILE] .
 CMD(log, N_("informative"), N_("[FILE] ..."),
     N_("print history in reverse order (filtering by 'FILE'). If one or more\n"
     "revisions are given, use them as a starting point."),
-    OPT_LAST % OPT_NEXT % OPT_REVISION % OPT_BRIEF % OPT_DIFFS % OPT_MERGES)
+    OPT_LAST % OPT_NEXT % OPT_REVISION % OPT_BRIEF % OPT_DIFFS % OPT_NO_MERGES %
+    OPT_NO_FILES)
 {
   if (app.revision_selectors.size() == 0)
     app.require_workspace("try passing a --revision to start at");
@@ -3561,11 +3598,11 @@ CMD(log, N_("informative"), N_("[FILE] .
       for (std::vector<utf8>::const_iterator i = app.revision_selectors.begin();
            i != app.revision_selectors.end(); i++)
         {
-          revision_id rid;
-          complete(app, (*i)(), rid);
-          frontier.insert(rid);
+          set<revision_id> rids;
+          complete(app, (*i)(), rids);
+          frontier.insert(rids.begin(), rids.end());
           if (i == app.revision_selectors.begin())
-            first_rid = rid;
+            first_rid = *rids.begin();
         }
     }

@@ -3688,7 +3725,7 @@ CMD(log, N_("informative"), N_("[FILE] .
                    inserter(next_frontier, next_frontier.end()));
             }

-          if (!app.merges && rev.is_merge_node())
+          if (app.no_merges && rev.is_merge_node())
             print_this = false;

           if (print_this)
@@ -3716,7 +3753,7 @@ CMD(log, N_("informative"), N_("[FILE] .
                 log_certs(app, rid, branch_name, "Branch: ", false);
                 log_certs(app, rid, tag_name,    "Tag: ",    false);

-                if (! csum.cs.empty())
+                if (!app.no_files && !csum.cs.empty())
                   {
                     cout << endl;
                     csum.print(cout, 70);