Issue 112: mtn au checkout cwdir issue

Reported by Tony Cooper, Nov 27, 2010

Just been testing the Monotone:AutomateStdio Perl library against 

   As a part of the testing I tried using the new the au checkout 
command. During the entire test (which exercises all of the au stdio 
interface) the mtn subprocess is not terminated (so the same 
instance is used to test all commands) and the same dedicated test 
workspace is used (which is reset after each test run).

   The checkout test was basically run inside this test workspace 
and the equivalent of `au checkout --branch net.venge.monotone 
../MTN-TESTER-WS' is done (i.e. it is checked out at the same level 
as the current test workspace and not inside it). When that test has 
finished the ../MTN-TESTER-WS directory is removed. From then on in 
every command fails with a `I need a workspace' error. If however, I 
restart the mtn subprocess directly after this test then everything 
works as expected.

   The au checkout command seems to change the mtn subprocess's 
notion of what workspace it is using for the rest of the session, in 
effect doing a chdir().

   I can understand why it needs to temporarily switch workspaces, 
but shouldn't it switch back again afterwards?

   MTIA Tony.

Output of `mtn version --full`:
monotone 0.99.1 (base revision: 
Running on          : Linux 2.6.9-34.EL #1 Sun Mar 19 13:34:16 CST 
2006 i686
C++ compiler        : GNU C++ version 4.3.2
C++ standard library: GNU libstdc++ version 20080905
Boost version       : 1_40
SQLite version      : 3.5.9 (compiled against 3.5.9)
Lua version         : Lua 5.1
PCRE version        : 7.6 2008-01-28 (compiled against 7.6)
Botan version       : 1.8.9 (compiled against 1.8.9)
Changes since base revision:
format_version "1"

new_manifest [c1270158b7fa91abf8235ad129b0476943bde1ed]

old_revision [8973482283db7c36780dce2b54721ccc0f5b7388]

  Generated from data cached in the distribution;
  further changes may have been made.

Comment 1 by Tony Cooper, Nov 27, 2010

Feedback from Stephen Leake:

I think the best approach is to document what automate commands 
change the process working directory (checkout is apparently the 
only one so far), and add an explicit 'au change_workspace' command 
(see, )).

Then we either need to make 'au change_workspace' process 
_MTN/options, or add another command to do that.

For my current use of 'LUAEXT change_workspace', processing 
_MTN/options would be appropriate (not doing that hasn't been a 
problem yet, but it could be).
Another approach would be to require au commands to restore the 
process working directory. But I think explicit workspace control 
will be more useful in the long run; it gives au the same power 
shell scripts that
invoke mtn have.

All of this is post 1.0.

Comment 2 by Thomas Keller, Nov 27, 2010

I'd even go a bit further and make no behind-the-scenes workspace 
changes at all - especially not through some dubious new 
change_workspace automate command. The reason why I think this is 
bad is because it adds another thing we need to track the state of 
during a long running process and this usually comes with lots of 
problems (concurrent access, hacky implementation, complex logic).

What I'd rather vote for is a completly explicit --workspace-path 
option in monotone. Then whatever the inner implicit logic found to 
be the current workspace would be overridden by the given workspace 
path and the options for this would be processed afterwards.

Created: 8 years 5 months ago by Tony Cooper

Updated: 8 years 5 months ago

Status: New

Followed by: 1 person

Type:Incorrect Behavior
Component:Automation Interface

Quick Links:    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status