Sfoglia il codice sorgente

upgrading package: monotone 0.39 -> 0.40

Ralf S. Engelschall 17 anni fa
parent
commit
20148031f3
3 ha cambiato i file con 293 aggiunte e 348 eliminazioni
  1. 0 180
      monotone/monotone.patch
  2. 291 164
      monotone/monotone.patch.rse
  3. 2 4
      monotone/monotone.spec

+ 0 - 180
monotone/monotone.patch

@@ -1,180 +0,0 @@
-Fix "mtn diff" output by handling the special cases of missing trailing
-newline at end of file. This makes the output compatible with GNU
-diffutils' diff(1) and especially allows it to be correctly applied with
-GNU patch(1) again, too.
-
-The source of the problem is that diff_patch:cc:make_diff() called the
-generic function simplestring_xform.cc:split_into_lines() for splitting
-the file data into individual lines, this way removed all(!) newlines at
-all and hence lost the information about the special case of a missing
-trailing newline.
-
-The least invasive fix is to already preserve the information in
-simplestring_xform.cc:split_into_lines() by representing the missing
-newline with the appended text "[\r]\n\\No newline at end of file" on
-the last line (notice that this is the only case were a line can still
-contain a newline after splitting).
-
-Additionally, diff_patch.cc:walk_hunk_consumer() for unknown reasons
-produces added before deleted lines (instead of the expection order of
-deleted before added lines) and hence also had to be fixed in order to
-produce output 100% compatible to GNU diff(1).
-
-Finally, two existing tests related to diff_patch.cc:walk_hunk_consumer() 
-were adjusted and a new test suite was added for checking all four
-special cases related to the missing trailing newline. The complete
-Monotone test suite still succeeed with 0 failures after this change.
-
-Can be removed with Monotone >= 0.40!
-
-Index: diff_patch.cc
---- diff_patch.cc	e359a4c03c6ce548d6414dce11160fbcb6fcb831
-+++ diff_patch.cc	daeb9be7d8c10d33781b54debd541027618dbfce
-@@ -1010,17 +1010,17 @@ void walk_hunk_consumer(vector<long, QA(
-           while (idx(lines2,b) != *i)
-             cons.insert_at(b++);
-         }
--      if (b < lines2.size())
-+      if (a < lines1.size())
-         {
-           cons.advance_to(a);
--          while(b < lines2.size())
--            cons.insert_at(b++);
-+          while(a < lines1.size())
-+            cons.delete_at(a++);
-         }
--      if (a < lines1.size())
-+      if (b < lines2.size())
-         {
-           cons.advance_to(a);
--          while(a < lines1.size())
--            cons.delete_at(a++);
-+          while(b < lines2.size())
-+            cons.insert_at(b++);
-         }
-       cons.flush_hunk(a);
-     }
-@@ -1349,8 +1349,8 @@ make_diff(string const & filename1,
-     }
- 
-   vector<string> lines1, lines2;
--  split_into_lines(data1(), lines1);
--  split_into_lines(data2(), lines2);
-+  split_into_lines(data1(), lines1, true);
-+  split_into_lines(data2(), lines2, true);
- 
-   vector<long, QA(long)> left_interned;
-   vector<long, QA(long)> right_interned;
-Index: simplestring_xform.cc
---- simplestring_xform.cc	5f2e4fcd288a2ec1fd59feb97ebc777b56597608
-+++ simplestring_xform.cc	dcaa75eb0ed67ddc119ef62f06c21bd7d13bf5cb
-@@ -50,9 +50,24 @@ void split_into_lines(string const & in,
- }
- 
- void split_into_lines(string const & in,
-+                      vector<string> & out,
-+                      bool diff_compat)
-+{
-+  return split_into_lines(in, constants::default_encoding, out, diff_compat);
-+}
-+
-+void split_into_lines(string const & in,
-                       string const & encoding,
-                       vector<string> & out)
- {
-+  return split_into_lines(in, encoding, out, false);
-+}
-+
-+void split_into_lines(string const & in,
-+                      string const & encoding,
-+                      vector<string> & out,
-+                      bool diff_compat)
-+{
-   string lc_encoding = lowercase(encoding);
-   out.clear();
- 
-@@ -92,8 +107,16 @@ void split_into_lines(string const & in,
-             break;
-           end = in.find_first_of("\r\n", begin);
-         }
--      if (begin < in.size())
--        out.push_back(in.substr(begin, in.size() - begin));
-+      if (begin < in.size()) {
-+        // special case: last line without trailing newline
-+        string s = in.substr(begin, in.size() - begin);
-+        if (diff_compat) {
-+          // special handling: produce diff(1) compatible output
-+          s += (in.find_first_of("\r") != string::npos ? "\r\n" : "\n");
-+          s += "\\ No newline at end of file"; 
-+        }
-+        out.push_back(s);
-+      }
-     }
-   else
-     {
-Index: simplestring_xform.hh
---- simplestring_xform.hh	0280d49b889bc0b7b2900d5d123cc8ec95a115eb
-+++ simplestring_xform.hh	564a305c99ca931c93956ac3ef903683dcb15db7
-@@ -13,6 +13,15 @@ void split_into_lines(std::string const 
-                       std::string const & encoding,
-                       std::vector<std::string> & out);
- 
-+void split_into_lines(std::string const & in,
-+                      std::vector<std::string> & out,
-+                      bool diff_compat);
-+
-+void split_into_lines(std::string const & in,
-+                      std::string const & encoding,
-+                      std::vector<std::string> & out,
-+                      bool diff_compat);
-+
- void join_lines(std::vector<std::string> const & in,
-                 std::string & out,
-                 std::string const & linesep);
-
------------------------------------------------------------------------------
-
-Fix merging in a special case.
-Can be removed with Monotone >= 0.40!
-
---- roster_merge.cc	d565f9299ca85d77bd1d7f2a29196d7161f0ea08
-+++ roster_merge.cc	d113e5d648bd98bdc15ba7a53958496ea924bd2b
-@@ -525,15 +525,35 @@ roster_merge_result::report_duplicate_na
-       left_roster.get_name(left_nid, left_name);
-       right_roster.get_name(right_nid, right_name);
- 
--      I(left_name == right_name);
--
-       shared_ptr<roster_t const> left_lca_roster, right_lca_roster;
-       revision_id left_lca_rid, right_lca_rid;
- 
-       adaptor.get_ancestral_roster(left_nid, left_lca_rid, left_lca_roster);
-       adaptor.get_ancestral_roster(right_nid, right_lca_rid, right_lca_roster);
- 
--      P(F("conflict: duplicate name '%s'") % left_name);
-+      // In most cases, the left_name equals the right_name. However, maybe
-+      // a parent directory got renamed on one side. In that case, the names
-+      // don't match, but it's still the same directory (by node id), to
-+      // which we want to add the same file (by name).
-+      if (left_name == right_name)
-+        {
-+          file_path dir;
-+          path_component basename;
-+          left_name.dirname_basename(dir, basename);
-+          P(F("conflict: duplicate name '%s' for the directory '%s'") % basename % dir);
-+        }
-+      else
-+        {
-+          file_path left_dir, right_dir;
-+          path_component left_basename, right_basename;
-+          left_name.dirname_basename(left_dir, left_basename);
-+          right_name.dirname_basename(right_dir, right_basename);
-+          I(left_basename == right_basename);
-+          P(F("conflict: duplicate name '%s' for the directory\n"
-+              "          named '%s' on the left and\n"
-+              "          named '%s' on the right.")
-+            % left_basename % left_dir % right_dir);
-+        }
- 
-       node_type left_type  = get_type(left_roster, left_nid);
-       node_type right_type = get_type(right_roster, right_nid);

+ 291 - 164
monotone/monotone.patch.rse

@@ -62,38 +62,11 @@
                                        rse@engelschall.com
                                        www.engelschall.com
 
-Index: app_state.cc
---- app_state.cc	6be9949e433ff6166fd030b34d8eb2d3e18c10b6
-+++ app_state.cc	ce1cdaffff8c14261ab0a22a16571a0737532bbb
-@@ -138,13 +138,24 @@ app_state::create_workspace(system_path 
-   go_to_workspace(new_dir);
-   mark_std_paths_used();
- 
-+#if defined(RSE) /* alt-book-keeping-root */
-+  N(!(directory_exists(bookkeeping_root) || directory_exists(alt_bookkeeping_root)),
-+    F("monotone bookkeeping directory '%s' or '%s' already exists in '%s'")
-+    % bookkeeping_root % alt_bookkeeping_root % new_dir);
-+#else
-   N(!directory_exists(bookkeeping_root),
-     F("monotone bookkeeping directory '%s' already exists in '%s'")
-     % bookkeeping_root % new_dir);
-+#endif
- 
-   L(FL("creating bookkeeping directory '%s' for workspace in '%s'")
-     % bookkeeping_root % new_dir);
- 
-+#if defined(RSE) /* alt-book-keeping-root */
-+  if (getenv("MTN_BKROOT") != NULL)
-+    mkdir_p(bookkeeping_path(getenv("MTN_BKROOT")));
-+  else
-+#endif
-   mkdir_p(bookkeeping_root);
- 
-   make_branch_sticky();
+===================================================================
 Index: cmd_diff_log.cc
---- cmd_diff_log.cc	baea6a3047420da7d1cff17f2669f973e0643e56
-+++ cmd_diff_log.cc	f17665eb2b1be7eaef00380fef3e6c170cd1c152
-@@ -96,6 +96,27 @@ print_indented_set(ostream & os,
+--- cmd_diff_log.cc	fd455eacd212d63aa201035e9417b9cf726f498b
++++ cmd_diff_log.cc	234ce11a43478c6ed8fb9b711f31039e3609bd60
+@@ -100,6 +100,27 @@ print_indented_set(ostream & os,
                     set<file_path> const & s,
                     size_t max_cols)
  {
@@ -121,7 +94,7 @@ Index: cmd_diff_log.cc
    size_t cols = 8;
    os << "       ";
    for (set<file_path>::const_iterator i = s.begin();
-@@ -113,6 +134,7 @@ print_indented_set(ostream & os,
+@@ -117,6 +138,7 @@ print_indented_set(ostream & os,
        cols += str.size() + 1;
      }
    os << '\n';
@@ -129,7 +102,7 @@ Index: cmd_diff_log.cc
  }
  
  void
-@@ -131,7 +153,11 @@ changes_summary::print(ostream & os, siz
+@@ -135,7 +157,11 @@ changes_summary::print(ostream & os, siz
        for (map<file_path, file_path>::const_iterator
             i = cs.nodes_renamed.begin();
             i != cs.nodes_renamed.end(); i++)
@@ -141,8 +114,21 @@ Index: cmd_diff_log.cc
             << " to " << i->second << '\n';
      }
  
-@@ -232,8 +258,13 @@ dump_diffs(cset const & cs,
+@@ -228,7 +254,12 @@ static void
+ }
+ 
+ static void
++#if defined(RSE) /* cosmetics-diff-and-log */
++dump_diffs(app_state & app,
++           lua_hooks & lua,
++#else
+ dump_diffs(lua_hooks & lua,
++#endif
+            database & db,
+            cset const & cs,
             set<file_path> const & paths,
+@@ -238,8 +269,13 @@ dump_diffs(lua_hooks & lua,
+            bool show_encloser,
             bool limit_paths = false)
  {
 +#if defined(RSE) /* cosmetics-diff-and-log */
@@ -155,7 +141,7 @@ Index: cmd_diff_log.cc
  
    for (map<file_path, file_id>::const_iterator
           i = cs.files_added.begin();
-@@ -242,6 +273,9 @@ dump_diffs(cset const & cs,
+@@ -248,6 +284,9 @@ dump_diffs(lua_hooks & lua,
        if (limit_paths && paths.find(i->first) == paths.end())
          continue;
  
@@ -165,7 +151,7 @@ Index: cmd_diff_log.cc
        output << patch_sep << '\n';
        data unpacked;
        vector<string> lines;
-@@ -288,6 +322,9 @@ dump_diffs(cset const & cs,
+@@ -294,6 +333,9 @@ dump_diffs(lua_hooks & lua,
        file_data f_old;
        data data_old, data_new;
  
@@ -174,8 +160,35 @@ Index: cmd_diff_log.cc
 +#endif
        output << patch_sep << '\n';
  
-       app.db.get_file_version(delta_entry_src(i), f_old);
-@@ -503,6 +540,9 @@ CMD(diff, "diff", "di", CMD_REF(informat
+       db.get_file_version(delta_entry_src(i), f_old);
+@@ -331,7 +373,12 @@ static void
+ }
+ 
+ static void
++#if defined(RSE) /* cosmetics-diff-and-log */
++dump_diffs(app_state & app,
++           lua_hooks & lua,
++#else
+ dump_diffs(lua_hooks & lua,
++#endif
+            database & db,
+            cset const & cs,
+            std::ostream & output,
+@@ -340,8 +387,13 @@ dump_diffs(lua_hooks & lua,
+            bool show_encloser)
+ {
+   set<file_path> dummy;
++#if defined(RSE) /* cosmetics-diff-and-log */
++  dump_diffs(app, lua, db, cs, dummy, output,
++             diff_format, new_is_archived, show_encloser);
++#else
+   dump_diffs(lua, db, cs, dummy, output,
+              diff_format, new_is_archived, show_encloser);
++#endif
+ }
+ 
+ // common functionality for diff and automate content_diff to determine
+@@ -506,6 +558,9 @@ CMD(diff, "diff", "di", CMD_REF(informat
    data summary;
    write_cset(included, summary);
  
@@ -185,7 +198,7 @@ Index: cmd_diff_log.cc
    vector<string> lines;
    split_into_lines(summary(), lines);
    cout << "#\n";
-@@ -518,6 +558,9 @@ CMD(diff, "diff", "di", CMD_REF(informat
+@@ -521,6 +576,9 @@ CMD(diff, "diff", "di", CMD_REF(informat
        cout << "# " << _("no changes") << '\n';
      }
    cout << "#\n";
@@ -195,7 +208,37 @@ Index: cmd_diff_log.cc
  
    if (app.opts.diff_format == external_diff)
      {
-@@ -881,7 +924,11 @@ CMD(log, "log", "", CMD_REF(informative)
+@@ -528,9 +586,15 @@ CMD(diff, "diff", "di", CMD_REF(informat
+     }
+   else
+     {
++#if defined(RSE) /* cosmetics-diff-and-log */
++      dump_diffs(app, app.lua, db, included, cout,
++                 app.opts.diff_format, new_is_archived,
++                 !app.opts.no_show_encloser);
++#else
+       dump_diffs(app.lua, db, included, cout,
+                  app.opts.diff_format, new_is_archived,
+                  !app.opts.no_show_encloser);
++#endif
+     }
+ }
+ 
+@@ -558,8 +622,13 @@ CMD_AUTOMATE(content_diff, N_("[FILE [..
+ 
+   prepare_diff(app, db, included, args, new_is_archived, dummy_header);
+ 
++#if defined(RSE) /* cosmetics-diff-and-log */
++  dump_diffs(app, app.lua, db, included, output,
++             app.opts.diff_format, new_is_archived, !app.opts.no_show_encloser);
++#else
+   dump_diffs(app.lua, db, included, output,
+              app.opts.diff_format, new_is_archived, !app.opts.no_show_encloser);
++#endif
+ }
+ 
+ 
+@@ -889,7 +958,11 @@ CMD(log, "log", "", CMD_REF(informative)
            else
              {
                out << string(65, '-') << '\n';
@@ -207,45 +250,61 @@ Index: cmd_diff_log.cc
  
                changes_summary csum;
  
-@@ -896,12 +943,21 @@ CMD(log, "log", "", CMD_REF(informative)
+@@ -904,12 +977,21 @@ CMD(log, "log", "", CMD_REF(informative)
  
                for (set<revision_id>::const_iterator anc = ancestors.begin();
                     anc != ancestors.end(); ++anc)
 +#if defined(RSE) /* cosmetics-diff-and-log */
 +                out << "Ancestor:  " << *anc << '\n';
 +
-+              log_certs(out, app, rid, author_name, "Author:    ", false);
-+              log_certs(out, app, rid, date_name,   "Date:      ", false);
-+              log_certs(out, app, rid, branch_name, "Branch:    ", false);
-+              log_certs(out, app, rid, tag_name,    "Tag:       ", false);
++              log_certs(project, out, rid, author_name, "Author:    ", false);
++              log_certs(project, out, rid, date_name,   "Date:      ", false);
++              log_certs(project, out, rid, branch_name, "Branch:    ", false);
++              log_certs(project, out, rid, tag_name,    "Tag:       ", false);
 +#else
                  out << "Ancestor: " << *anc << '\n';
  
-               log_certs(out, app, rid, author_name, "Author: ", false);
-               log_certs(out, app, rid, date_name,   "Date: ",   false);
-               log_certs(out, app, rid, branch_name, "Branch: ", false);
-               log_certs(out, app, rid, tag_name,    "Tag: ",    false);
+               log_certs(project, out, rid, author_name, "Author: ", false);
+               log_certs(project, out, rid, date_name,   "Date: ",   false);
+               log_certs(project, out, rid, branch_name, "Branch: ", false);
+               log_certs(project, out, rid, tag_name,    "Tag: ",    false);
 +#endif
  
                if (!app.opts.no_files && !csum.cs.empty())
                  {
-@@ -911,7 +967,11 @@ CMD(log, "log", "", CMD_REF(informative)
+@@ -919,16 +1001,26 @@ CMD(log, "log", "", CMD_REF(informative)
                  }
  
-               log_certs(out, app, rid, changelog_name, "ChangeLog: ", true);
+               log_certs(project, out, rid, changelog_name, "ChangeLog: ", true);
 +#if defined(RSE) /* cosmetics-diff-and-log */
-+              log_certs(out, app, rid, comment_name,   "Comments:  ", true);
++              log_certs(project, out, rid, comment_name,   "Comments:  ", true);
 +#else
-               log_certs(out, app, rid, comment_name,   "Comments: ",  true);
+               log_certs(project, out, rid, comment_name,   "Comments: ",  true);
 +#endif
              }
  
            if (app.opts.diffs)
+             {
+               for (edge_map::const_iterator e = rev.edges.begin();
+                    e != rev.edges.end(); ++e)
++#if defined(RSE) /* cosmetics-diff-and-log */
++                dump_diffs(app, app.lua, db, edge_changes(e), diff_paths, out,
++                           app.opts.diff_format, true,
++                           !app.opts.no_show_encloser, !mask.empty());
++#else
+                 dump_diffs(app.lua, db, edge_changes(e), diff_paths, out,
+                            app.opts.diff_format, true,
+                            !app.opts.no_show_encloser, !mask.empty());
++#endif
+             }
+ 
+           if (next > 0)
+===================================================================
 Index: cmd_netsync.cc
---- cmd_netsync.cc	92bc91c7137e339e086b3ab761f1aed5df203143
-+++ cmd_netsync.cc	06dde80e2d7cc9bf8c9413a3df408dbb4cf36110
-@@ -179,7 +179,11 @@ CMD(pull, "pull", "", CMD_REF(network),
-   find_key_if_needed(addr, include_pattern, exclude_pattern, app, false);
+--- cmd_netsync.cc	27ebccae0f902d134ed780bc678b73c954613e43
++++ cmd_netsync.cc	5034034bbb15b278bb355f80f1f3641fe4fe6261
+@@ -253,7 +253,11 @@ CMD(pull, "pull", "", CMD_REF(network),
+                                  args, info, false);
  
    if (app.opts.signing_key() == "")
 +#if defined(RSE) /* cosmetics-netsync */
@@ -254,22 +313,27 @@ Index: cmd_netsync.cc
      P(F("doing anonymous pull; use -kKEYNAME if you need authentication"));
 +#endif
  
-   std::list<utf8> uris;
-   uris.push_back(addr);
-@@ -277,7 +281,11 @@ CMD(clone, "clone", "", CMD_REF(network)
-   app.create_workspace(workspace_dir);
+   run_netsync_protocol(app.opts, app.lua, project, keys,
+                        client_voice, sink_role, info);
+@@ -355,9 +359,16 @@ CMD(clone, "clone", "", CMD_REF(network)
  
+   // paths.cc's idea of the current workspace root is wrong at this point
    if (internal_db)
 +#if defined(RSE) /* alt-book-keeping-root */
-+    app.set_database(system_path((directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / ws_internal_db_file_name));
++    app.opts.dbname = system_path((directory_exists(workspace_dir / alt_bookkeeping_root_component) ?
++                                   (workspace_dir / alt_bookkeeping_root_component) :
++                                   (workspace_dir / bookkeeping_root_component))
++                                  / ws_internal_db_file_name);
 +#else
-     app.set_database(system_path(bookkeeping_root / ws_internal_db_file_name));
+     app.opts.dbname = system_path(workspace_dir
+                                   / bookkeeping_root_component
+                                   / ws_internal_db_file_name);
 +#endif
-   else
-     app.set_database(app.opts.dbname);
  
-@@ -299,7 +307,11 @@ CMD(clone, "clone", "", CMD_REF(network)
-                      app, false);
+   // must do this after setting dbname so that _MTN/options is written
+   // correctly
+@@ -378,7 +389,11 @@ CMD(clone, "clone", "", CMD_REF(network)
+                                info, true, true);
  
    if (app.opts.signing_key() == "")
 +#if defined(RSE) /* cosmetics-netsync */
@@ -278,12 +342,13 @@ Index: cmd_netsync.cc
      P(F("doing anonymous pull; use -kKEYNAME if you need authentication"));
 +#endif
  
-   if (!app.db.var_exists(default_include_pattern_key)
-       || app.opts.set_default)
+   // make sure we're back in the original dir so that file: URIs work
+   change_current_working_dir(start_dir);
+===================================================================
 Index: cmd_ws_commit.cc
---- cmd_ws_commit.cc	e21e2bb8831ce7e62bc428cf32ae10931b5e73e8
-+++ cmd_ws_commit.cc	80856a59e293d7aa2bcc14cfce5896e1276a1921
-@@ -66,7 +66,14 @@ revision_summary(revision_t const & rev,
+--- cmd_ws_commit.cc	77b18e38145f345b0eb65b73cc05619464a8fc59
++++ cmd_ws_commit.cc	da1133ed41a571f4921798526af49743dc48d0a2
+@@ -73,7 +73,14 @@ revision_summary(revision_t const & rev,
  
        for (set<file_path>::const_iterator i = cs.dirs_added.begin();
              i != cs.dirs_added.end(); ++i)
@@ -298,45 +363,56 @@ Index: cmd_ws_commit.cc
  
        for (map<file_path, file_id>::const_iterator i = cs.files_added.begin();
              i != cs.files_added.end(); ++i)
-@@ -1396,7 +1403,11 @@ CMD_NO_WORKSPACE(import, "import", "", C
+@@ -1451,12 +1458,20 @@ CMD_NO_WORKSPACE(import, "import", "", C
    catch (...)
      {
        // clean up before rethrowing
 +#if defined(RSE) /* alt-book-keeping-root */
-+      delete_dir_recursive(directory_exists(alt_bookkeeping_root) ? bookkeeping_root : bookkeeping_root);
++      delete_dir_recursive(directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root);
 +#else
        delete_dir_recursive(bookkeeping_root);
 +#endif
        throw;
      }
  
+   // clean up
++#if defined(RSE) /* alt-book-keeping-root */
++  delete_dir_recursive(directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root);
++#else
+   delete_dir_recursive(bookkeeping_root);
++#endif
+ }
+ 
+ CMD_NO_WORKSPACE(migrate_workspace, "migrate_workspace", "", CMD_REF(tree),
+===================================================================
 Index: diff_patch.cc
---- diff_patch.cc	2d882bd69beabffdef24078ecae588118f8f51cb
-+++ diff_patch.cc	d4d89f2eebbe0d2f7f42e6eb014c3960e5dccdb4
-@@ -1448,6 +1448,9 @@ make_diff(string const & filename1,
+--- diff_patch.cc	06f64d5def0166740f243dedf7fd6776662a0978
++++ diff_patch.cc	d88b56756954ba8b7647cb83194f438cdcf8cbc0
+@@ -1442,6 +1442,9 @@ make_diff(string const & filename1,
      {
        case unified_diff:
        {
 +#if defined(RSE) /* diff-index */
 +        ost << "Index: " << filename2 << '\n';
 +#endif
-         ost << "--- " << filename1 << '\t' << id1 << '\n';
-         ost << "+++ " << filename2 << '\t' << id2 << '\n';
- 
-@@ -1457,6 +1460,9 @@ make_diff(string const & filename1,
+         ost << "--- " << filename1 << '\t'
+             << id1 << '\n';
+         ost << "+++ " << filename2 << '\t'
+@@ -1453,6 +1456,9 @@ make_diff(string const & filename1,
        }
        case context_diff:
        {
 +#if defined(RSE) /* diff-index */
 +        ost << "Index: " << filename2 << '\n';
 +#endif
-         ost << "*** " << filename1 << '\t' << id1 << '\n';
-         ost << "--- " << filename2 << '\t' << id2 << '\n';
- 
+         ost << "*** " << filename1 << '\t'
+             << id1 << '\n';
+         ost << "--- " << filename2 << '\t'
+===================================================================
 Index: file_io.cc
---- file_io.cc	358fb964dc42e7f936a136342b93bb3a4744d1b3
-+++ file_io.cc	6b452acaa58ca24fa5611ea3e6e82e83a7cf7552
-@@ -398,16 +398,36 @@ write_data(file_path const & path, data 
+--- file_io.cc	e18d07679c2d210a40f18b67ed0b4b96f5a2c21a
++++ file_io.cc	291d078c4c156479590b4d553810b6a1dff161a3
+@@ -397,16 +397,36 @@ write_data(file_path const & path, data 
  write_data(file_path const & path, data const & dat)
  {
    // use the bookkeeping root as the temporary directory.
@@ -373,57 +449,27 @@ Index: file_io.cc
  }
  
  void
+===================================================================
 Index: lua_hooks.cc
---- lua_hooks.cc	26dbfb8306a7b7b4871f61877c7fd0f72abadfdd
-+++ lua_hooks.cc	87a5a20651f2010b1e08c38274b29e0e6434e077
-@@ -162,7 +162,11 @@ lua_hooks::workspace_rcfilename(bookkeep
- void
- lua_hooks::workspace_rcfilename(bookkeeping_path & file)
- {
+--- lua_hooks.cc	a747d898e036539c69beba100f6a67e1491b6f96
++++ lua_hooks.cc	8e1fccf93d8658ff25a41f0a3c28e8689af7d86a
+@@ -208,7 +208,11 @@ lua_hooks::load_rcfiles(options & opts)
+         {
+           load_rcfile(opts.conf_dir / "monotonerc", false);
+         }
 +#if defined(RSE) /* alt-book-keeping-root */
-+  file = (directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / "monotonerc";
++      load_rcfile((directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / "monotonerc", false);
 +#else
-   file = bookkeeping_root / "monotonerc";
-+#endif
- }
- 
- 
-Index: monotone.cc
---- monotone.cc	8289cbcfbca10f561afa6e06bf279f6b70e93599
-+++ monotone.cc	2560f9465773c1178c539e51c66efe1a99109881
-@@ -211,12 +211,28 @@ cpp_main(int argc, char ** argv)
-               if (!app.opts.dbname.empty())
-                 app.db.set_filename(app.opts.dbname);
-             }
-+#if defined(RSE) /* environment-variables */
-+          else
-+            {
-+              char *cp;
-+              if ((cp = getenv("MTN_DBFILE")) != NULL)
-+                app.db.set_filename(system_path(cp));
-+            }
-+#endif
- 
-           if (app.opts.key_dir_given || app.opts.conf_dir_given)
-             {
-               if (!app.opts.key_dir.empty())
-                 app.keys.set_key_dir(app.opts.key_dir);
-             }
-+#if defined(RSE) /* environment-variables */
-+          else
-+            {
-+              char *cp;
-+              if ((cp = getenv("MTN_KEYDIR")) != NULL)
-+                app.keys.set_key_dir(system_path(cp));
-+            }
+       load_rcfile(bookkeeping_root / "monotonerc", false);
 +#endif
+     }
  
-           // at this point we allow a workspace (meaning search for it
-           // and if found read _MTN/options, but don't use the data quite
+   // Command-line rcfiles override even that.
+===================================================================
 Index: options_list.hh
---- options_list.hh	1f1eb3ce7a6a72870d0a42ef7f79b58eef621127
-+++ options_list.hh	82cddc1ff530f09a32cf7d2c58d6b9ef01449147
-@@ -178,6 +178,24 @@ OPTION(diff_options, no_show_encloser, f
+--- options_list.hh	78fbe7c5728513ee672b75d6dcefbc2f508ba915
++++ options_list.hh	55158b5e69d2fe75c58e51697a50724597910c47
+@@ -233,6 +233,24 @@ OPTION(diff_options, no_show_encloser, f
    no_show_encloser = true;
  }
  #endif
@@ -448,9 +494,10 @@ Index: options_list.hh
  
  OPT(diffs, "diffs", bool, false, gettext_noop("print diffs along with logs"))
  #ifdef option_bodies
+===================================================================
 Index: paths.cc
 --- paths.cc	d850c3efae62041b8003589817387e5877f63b01
-+++ paths.cc	30e8e5ea486bbbda2344474f7bfa86f0b152c438
++++ paths.cc	7bb66816f0cc3ee8e13527d0ee3b1fc0a1d56411
 @@ -226,7 +226,11 @@ in_bookkeeping_dir(string const & path)
  static inline bool
  in_bookkeeping_dir(string const & path)
@@ -473,6 +520,19 @@ Index: paths.cc
    if (!find_bookdir(root, bookkeeping_root_component, current, removed))
      if (!find_bookdir(root, old_bookkeeping_root_component, current, removed))
        return false;
+@@ -1478,7 +1485,11 @@ static void check_bk_normalizes_to(char 
+ 
+ static void check_bk_normalizes_to(char const * before, char const * after)
+ {
++#if defined(RSE) /* alt-book-keeping-root */
++  bookkeeping_path bp((directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / before);
++#else
+   bookkeeping_path bp(bookkeeping_root / before);
++#endif
+   L(FL("normalizing %s to %s (got %s)") % before % after % bp);
+   UNIT_TEST_CHECK(bp.as_external() == after);
+   UNIT_TEST_CHECK(bookkeeping_path(bp.as_internal()).as_internal() == bp.as_internal());
+===================================================================
 Index: paths.hh
 --- paths.hh	7dd47155b2962d3e4f5fe8764b11c955791803fc
 +++ paths.hh	d29c84938079b1571cc843c7b7c6c61e420421d7
@@ -492,10 +552,11 @@ Index: paths.hh
  // this will always be an absolute path
  class system_path : public any_path
  {
+===================================================================
 Index: roster_merge.cc
---- roster_merge.cc	d565f9299ca85d77bd1d7f2a29196d7161f0ea08
-+++ roster_merge.cc	630d1821e0631e49557bea17008bf88093ec4aa8
-@@ -1273,6 +1273,20 @@ roster_merge(roster_t const & left_paren
+--- roster_merge.cc	b2fca269f9de878a4c50a48f2f437cc385db52a7
++++ roster_merge.cc	71b58f073db3e56731b1a969bdbd95983926806d
+@@ -1296,6 +1296,20 @@ roster_merge(roster_t const & left_paren
            result.roster.detach_node(n->self);
            result.invalid_name_conflicts.push_back(conflict);
          }
@@ -516,10 +577,24 @@ Index: roster_merge.cc
      }
  }
  
+@@ -2228,7 +2242,12 @@ struct simple_invalid_name_conflict : pu
+       I(!result.is_clean());
+       invalid_name_conflict const & c = idx(result.invalid_name_conflicts, 0);
+       I(c.nid == bad_dir_nid);
++#if defined(RSE) /* alt-book-keeping-root */
++      I(   c.parent_name == make_pair(new_root_nid, bookkeeping_root_component)
++        || c.parent_name == make_pair(new_root_nid, alt_bookkeeping_root_component));
++#else
+       I(c.parent_name == make_pair(new_root_nid, bookkeeping_root_component));
++#endif
+       // this tests it was detached, implicitly
+       result.roster.attach_node(bad_dir_nid, file_path_internal("dir_formerly_known_as__MTN"));
+       result.invalid_name_conflicts.pop_back();
+===================================================================
 Index: std_hooks.lua
---- std_hooks.lua	432725fc36dde06af213797306121385491fda0c
-+++ std_hooks.lua	fc4aa2c8e1e8963817dea1a47b21f19ee7292b11
-@@ -284,6 +284,15 @@
+--- std_hooks.lua	9fd3160c435eff59acc8622875047304e3472b9c
++++ std_hooks.lua	2f74359039d3ecc4b13d8b9cc9c561413323fb56
+@@ -284,6 +284,15 @@ function edit_comment(basetext, user_log
     if user_log_message == "" or string.sub(user_log_message, -1) ~= "\n" then
        tmp:write("\n")
     end
@@ -535,13 +610,10 @@ Index: std_hooks.lua
     tmp:write(basetext)
     io.close(tmp)
  
-@@ -1220,4 +1229,165 @@
-    function push_netsync_notifier(notifier)
+@@ -1257,3 +1266,164 @@ end
        return push_hook_functions(notifier)
     end
--end
-\ No newline at end of file
-+end
+ end
 +
 +--  #if defined(RSE) /* extra-command */
 +
@@ -703,10 +775,11 @@ Index: std_hooks.lua
 +
 +--  #endif
 +
+===================================================================
 Index: work.cc
---- work.cc	bcea6fae446e61352e4a12e0259a9094970a9829
-+++ work.cc	1282657792888a3159211df49da6afa167e8cbb4
-@@ -53,28 +53,44 @@ get_revision_path(bookkeeping_path & m_p
+--- work.cc	9c9fd46396607ec971ccf77b6dbdfe54934b9ec5
++++ work.cc	504af8561f70be210430114d21fcee74e87a34df
+@@ -57,35 +57,55 @@ get_revision_path(bookkeeping_path & m_p
  static void
  get_revision_path(bookkeeping_path & m_path)
  {
@@ -751,9 +824,8 @@ Index: work.cc
    L(FL("inodeprints path is %s") % ip_path);
  }
  
-@@ -205,7 +221,11 @@ workspace::get_user_log_path(bookkeeping
- void
- workspace::get_user_log_path(bookkeeping_path & ul_path)
+ static void
+ get_user_log_path(bookkeeping_path & ul_path)
  {
 +#if defined(RSE) /* alt-book-keeping-root */
 +  ul_path = (directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / user_log_file_name;
@@ -763,10 +835,64 @@ Index: work.cc
    L(FL("user log path is %s") % ul_path);
  }
  
-@@ -387,7 +407,11 @@ workspace::get_local_dump_path(bookkeepi
- void
- workspace::get_local_dump_path(bookkeeping_path & d_path)
+@@ -96,7 +116,11 @@ directory_is_workspace(system_path const
+ {
+   // as far as the users of this function are concerned, a version 0
+   // workspace (MT directory instead of _MTN) does not count.
++#if defined(RSE) /* alt-book-keeping-root */
++  return (directory_exists(dir / alt_bookkeeping_root_component) || directory_exists(dir / bookkeeping_root_component));
++#else
+   return directory_exists(dir / bookkeeping_root_component);
++#endif
+ }
+ 
+ bool workspace::found;
+@@ -129,13 +153,24 @@ workspace::create_workspace(options cons
+   go_to_workspace(new_dir);
+   mark_std_paths_used();
+ 
++#if defined(RSE) /* alt-book-keeping-root */
++  N(!(directory_exists(bookkeeping_root) || directory_exists(alt_bookkeeping_root)),
++    F("monotone bookkeeping directory '%s' or '%s' already exists in '%s'")
++    % bookkeeping_root % alt_bookkeeping_root % new_dir);
++#else
+   N(!directory_exists(bookkeeping_root),
+     F("monotone bookkeeping directory '%s' already exists in '%s'")
+     % bookkeeping_root % new_dir);
++#endif
+ 
+   L(FL("creating bookkeeping directory '%s' for workspace in '%s'")
+     % bookkeeping_root % new_dir);
+ 
++#if defined(RSE) /* alt-book-keeping-root */
++  if (getenv("MTN_BKROOT") != NULL)
++    mkdir_p(bookkeeping_path(getenv("MTN_BKROOT")));
++  else
++#endif
+   mkdir_p(bookkeeping_root);
+ 
+   workspace::found = true;
+@@ -483,9 +518,16 @@ workspace::get_database_option(system_pa
+   rsa_keypair_id key_option;
+   system_path keydir_option;
+ 
++#if defined(RSE) /* alt-book-keeping-root */
++  system_path o_path = ((  directory_exists(workspace / alt_bookkeeping_root_component) 
++                         ? (workspace / alt_bookkeeping_root_component)
++                         : (workspace / bookkeeping_root_component))
++                        / options_file_name);
++#else
+   system_path o_path = (workspace
+                         / bookkeeping_root_component
+                         / options_file_name);
++#endif
+   read_options_file(o_path,
+                     database_option, branch_option, key_option, keydir_option);
+ }
+@@ -557,7 +599,11 @@ workspace::get_local_dump_path(bookkeepi
  {
+   N(workspace::found, F("workspace required but not found"));
+ 
 +#if defined(RSE) /* alt-book-keeping-root */
 +  d_path = (directory_exists(alt_bookkeeping_root) ? alt_bookkeeping_root : bookkeeping_root) / local_dump_file_name;
 +#else
@@ -775,7 +901,7 @@ Index: work.cc
    L(FL("local dump path is %s") % d_path);
  }
  
-@@ -747,7 +771,11 @@ path_for_detached_nids()
+@@ -929,7 +975,11 @@ path_for_detached_nids()
  static inline bookkeeping_path
  path_for_detached_nids()
  {
@@ -787,7 +913,7 @@ Index: work.cc
  }
  
  static inline bookkeeping_path
-@@ -1483,9 +1511,15 @@ workspace::perform_pivot_root(file_path 
+@@ -1668,9 +1718,15 @@ workspace::perform_pivot_root(database &
    N(is_dir_t(new_roster.get_node(new_root)),
      F("proposed new root directory '%s' is not a directory") % new_root);
    {
@@ -803,10 +929,11 @@ Index: work.cc
    }
  
    {
+===================================================================
 Index: work_migration.cc
---- work_migration.cc	3d58c3332cd195309eacf5cc52d4e88ad66a6c81
-+++ work_migration.cc	f044e25cc757899f97d413f3fe109a9bafe73553
-@@ -55,9 +55,18 @@ get_ws_format()
+--- work_migration.cc	649da47d7b879f1f2814100fdb831b1de7ecaeca
++++ work_migration.cc	21ada50dddc95ba4c9068f89e8db88409c3e2c68
+@@ -57,9 +57,18 @@ get_ws_format()
  {
    unsigned int format;
    bookkeeping_path f_path = bookkeeping_root / "format";
@@ -825,7 +952,7 @@ Index: work_migration.cc
          format = 1;
        else if (directory_exists(file_path() / old_bookkeeping_root_component))
          format = 0;
-@@ -69,7 +78,11 @@ get_ws_format()
+@@ -71,7 +80,11 @@ get_ws_format()
        data f_dat;
        try
          {
@@ -837,7 +964,7 @@ Index: work_migration.cc
            format = lexical_cast<unsigned int>(remove_ws(f_dat()));
          }
        catch (exception & e)
-@@ -80,7 +93,11 @@ get_ws_format()
+@@ -82,7 +95,11 @@ get_ws_format()
        if (format == 1)
          {
            W(F("_MTN/format should not exist in a format 1 workspace; corrected"));
@@ -849,7 +976,7 @@ Index: work_migration.cc
          }
      }
    return format;
-@@ -90,6 +107,9 @@ workspace::write_ws_format()
+@@ -92,6 +109,9 @@ workspace::write_ws_format()
  workspace::write_ws_format()
  {
    bookkeeping_path f_path = bookkeeping_root / "format";
@@ -859,7 +986,7 @@ Index: work_migration.cc
    // one or other side of this conditional will always be dead code, but
    // both sides should be preserved, to document all historical formats.
    // N.B. this will _not_ do the right thing for format 0.  Which is fine.
-@@ -97,10 +117,19 @@ workspace::write_ws_format()
+@@ -99,10 +119,19 @@ workspace::write_ws_format()
      {
        if (file_exists(f_path))
          delete_file(f_path);
@@ -879,7 +1006,7 @@ Index: work_migration.cc
        write_data(f_path, f_dat);
      }
  }
-@@ -180,7 +209,11 @@ migrate_1_to_2()
+@@ -185,7 +214,11 @@ migrate_1_to_2()
    // information, and _MTN/work does not exist; also, there may be more than
    // one parent revision, but we do not have to worry about that here.
  
@@ -891,7 +1018,7 @@ Index: work_migration.cc
    data base_rev_data; MM(base_rev_data);
    try 
      {
-@@ -196,7 +229,11 @@ migrate_1_to_2()
+@@ -201,7 +234,11 @@ migrate_1_to_2()
  
    cset workcs; 
    MM(workcs);

+ 2 - 4
monotone/monotone.spec

@@ -31,8 +31,8 @@ Distribution: OpenPKG Community
 Class:        EVAL
 Group:        SCM
 License:      GPL
-Version:      0.39
-Release:      20080328
+Version:      0.40
+Release:      20080411
 
 #   package options
 %option       with_rse  yes
@@ -44,7 +44,6 @@ Source3:      monotone-setup.sh
 Source4:      monotone-colorize.pl
 Source5:      monotone-colorize.bashrc
 Source6:      monotone.bashrc
-Patch0:       monotone.patch
 Patch1:       monotone.patch.rse
 
 #   build information
@@ -77,7 +76,6 @@ AutoReqProv:  no
 
 %prep
     %setup -q
-    %patch -p0 -P 0
 %if "%{with_rse}" == "yes"
     %patch -p0 -P 1
 %endif