OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: r...@openpkg.org Module: openpkg-src Date: 10-Apr-2009 14:52:34 Branch: HEAD Handle: 2009041013523400 Modified files: openpkg-src/monotone monotone.patch.rse Log: support relative path in 'mtn base diff' command Summary: Revision Changes Path 1.14 +70 -4 openpkg-src/monotone/monotone.patch.rse ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/monotone/monotone.patch.rse ============================================================================ $ cvs diff -u -r1.13 -r1.14 monotone.patch.rse --- openpkg-src/monotone/monotone.patch.rse 10 Apr 2009 09:13:50 -0000 1.13 +++ openpkg-src/monotone/monotone.patch.rse 10 Apr 2009 12:52:34 -0000 1.14 @@ -57,6 +57,12 @@ o dot-mtn-message: Support a ".mtn-message" file in the root-directory as a template for the commit messages. + + o lua-rel-path: + Support for additional Lua function workspace_relpath() for + receiving the "initial relative path" within the workspace (which + is important to know because in a Lua hook the current working + directory was changed to the workspace root). Ralf S. Engelschall r...@engelschall.com @@ -446,6 +452,36 @@ // Command-line rcfiles override even that. =================================================================== +Index: luaext_platform.cc +--- luaext_platform.cc b22b5f7fa127055e909280379694c1635f4923ff ++++ luaext_platform.cc 24765cd8252f31a829d450ef92e002e615c98f9d +@@ -14,6 +14,9 @@ + #include <cstdlib> + + #include "platform.hh" ++#if defined(RSE) /* lua-rel-path */ ++#include "paths.hh" ++#endif + + using std::malloc; + using std::free; +@@ -185,6 +188,15 @@ LUAEXT(get_pid, ) + return 1; + } + ++#if defined(RSE) /* lua-rel-path */ ++LUAEXT(workspace_relpath, ) ++{ ++ std::string str = workspace_initial_relative_path(); ++ lua_pushlstring(LS, str.c_str(), str.size()); ++ return 1; ++} ++#endif ++ + // Local Variables: + // mode: C++ + // fill-column: 76 +=================================================================== Index: merge_roster.cc --- merge_roster.cc 0350ccbd3b9b7d79f93c7d8852b890ee4020e14c +++ merge_roster.cc c31f695342bef084cbd8222c0f0e0cd897ef1c64 @@ -604,7 +640,7 @@ =================================================================== Index: paths.cc --- paths.cc 30a2058671b87385d855d97cd20705f91870b777 -+++ paths.cc 9025fc41ef775a708ccdd7197699e0dcac9bef33 ++++ paths.cc 3c3e7441a14aed59f2917855cf780374d06f934d @@ -231,7 +231,11 @@ in_bookkeeping_dir(string const & path) static inline bool in_bookkeeping_dir(string const & path) @@ -627,10 +663,24 @@ if (!find_bookdir(root, bookkeeping_root_component, current, removed)) if (!find_bookdir(root, old_bookkeeping_root_component, current, removed)) return false; +@@ -1021,6 +1028,13 @@ mark_std_paths_used(void) + initial_rel_path.get(); + } + ++#if defined(RSE) /* lua-rel-path */ ++string workspace_initial_relative_path(void) ++{ ++ return initial_rel_path.get(); ++} ++#endif ++ + /////////////////////////////////////////////////////////////////////////// + // utility used by migrate_ancestry + /////////////////////////////////////////////////////////////////////////// =================================================================== Index: paths.hh --- paths.hh cbd3ac7810f4fd8c528bcb5f87549d9d0e358d0a -+++ paths.hh 80c2adbe3fd95636778fc4446c1221ae7e7082cc ++++ paths.hh a2ab108311e8f0365c71ba6dacbc1dbd6f49452d @@ -349,6 +349,15 @@ private: // for migration #define old_bookkeeping_root_component (path_component("MT")) @@ -647,10 +697,23 @@ // this will always be an absolute path class system_path : public any_path { +@@ -448,8 +457,12 @@ find_new_path_for(std::map<file_path, fi + find_new_path_for(std::map<file_path, file_path> const & renames, + file_path const & old_path); + ++#if defined(RSE) /* lua-rel-path */ ++std::string workspace_initial_relative_path(void); + #endif + ++#endif ++ + // Local Variables: + // mode: C++ + // fill-column: 76 =================================================================== Index: std_hooks.lua --- std_hooks.lua d8c06cff3368b388f6b6268227e1432a94a3ed6f -+++ std_hooks.lua f7b4cd79ab47c716505b1a79b586940964a78329 ++++ std_hooks.lua 9cb4968109871df229d5cd5a1ef4fdbf0e04e1a9 @@ -304,6 +304,15 @@ function edit_comment(basetext, user_log if user_log_message == "" or string.sub(user_log_message, -1) ~= "\n" then tmp:write("\n") @@ -667,7 +730,7 @@ tmp:write(basetext) io.close(tmp) -@@ -1373,3 +1382,210 @@ end +@@ -1373,3 +1382,213 @@ end return push_hook_functions(notifier) end end @@ -827,6 +890,9 @@ + -- upgrade current branch by merging in revisions of base branch + local rc + if filename ~= nil then ++ if not string.sub(filename, 1, 1) ~= "/" then ++ filename = workspace_relpath() .. "/" .. filename ++ end + rc = execute("mtn", "diff", "-r", "h:" .. branch_base, "-r", "h:" .. branch_this, filename) + else + rc = execute("mtn", "diff", "-r", "h:" .. branch_base, "-r", "h:" .. branch_this) @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org