# # # add_dir "tests/automate_get_workspace_root" # # add_file "tests/automate_get_workspace_root/__driver__.lua" # content [437c9b81ebdc37c489d62c3652eef3016d282441] # # patch "NEWS" # from [63d3b12792a507848c7a733534f2278eac5248b7] # to [72bf0457e290fdae5f440ce81c7531fc65a88fc4] # # patch "automate.cc" # from [43388fabb98737e3183612523d7f4a76d0d20427] # to [c8d93c4266411e0dbee70e4144e2ac6c395c7789] # # patch "monotone.texi" # from [abd7160576898d8bc863dbf84d62d2790d760a20] # to [3eadaeee95329e9322058da8708baf999813c30f] # ============================================================ --- tests/automate_get_workspace_root/__driver__.lua 437c9b81ebdc37c489d62c3652eef3016d282441 +++ tests/automate_get_workspace_root/__driver__.lua 437c9b81ebdc37c489d62c3652eef3016d282441 @@ -0,0 +1,10 @@ + +mtn_setup() + +local cwd = chdir(".") + +mkdir("foo") +addfile("foo/bar", "text") + +check(indir("foo",mtn("automate", "get_workspace_root")), 0, true, false) +check(qgrep("^"..cwd.."$", "stdout")) ============================================================ --- NEWS 63d3b12792a507848c7a733534f2278eac5248b7 +++ NEWS 72bf0457e290fdae5f440ce81c7531fc65a88fc4 @@ -38,6 +38,8 @@ - Add 'automate show_conflicts' command + - Add 'automate get_workspce_root' command + Internal Fri Apr 11 22:50:44 UTC 2008 ============================================================ --- automate.cc 43388fabb98737e3183612523d7f4a76d0d20427 +++ automate.cc c8d93c4266411e0dbee70e4144e2ac6c395c7789 @@ -2255,6 +2255,27 @@ CMD_AUTOMATE(drop_db_variables, N_("DOMA } } +// Name: drop_db_variables +// Arguments: +// none +// Changes: +// 8.0 (added) +// Purpose: +// To show the path of the workspace root for the current directory. +// Output format: +// A path +// Error conditions: +// a runtime exception is thrown if the current directory isn't part +// of a workspace. +CMD_AUTOMATE(get_workspace_root, "", + N_("Prints the workspace root for the current directory"), + "", + options::opts::none) +{ + workspace work(app); + output << get_current_working_dir() << '\n'; +} + // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- monotone.texi abd7160576898d8bc863dbf84d62d2790d760a20 +++ monotone.texi 3eadaeee95329e9322058da8708baf999813c30f @@ -8849,6 +8849,38 @@ @section Automation @end table address@hidden mtn automate get_workspace_root + address@hidden @strong address@hidden Arguments: + +None. + address@hidden Added in: + +8.0 + address@hidden Purpose: + +To show the path of the workspace root for the current directory. + address@hidden Sample output: + address@hidden +/home/jim/juice address@hidden verbatim + address@hidden Output format: + +A path. + address@hidden Error conditions: + +If the current directory isn't part of a workspace, prints an error to +stderr and exits with status 1. + address@hidden table + @end ftable @page