monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] roster restrictions and implicitly included parent dire


From: Derek Scherger
Subject: [Monotone-devel] roster restrictions and implicitly included parent directories
Date: Sun, 26 Feb 2006 23:20:26 -0700
User-agent: Mozilla Thunderbird 1.0.7 (X11/20060205)

So the conversion to rosters added proper support for directories and all was good right? It's clearly a great addition, but it does complicate things a bit. In particular it broke a few tests that use restrictions to include only partial trees.

For example:

        $ monotone add foo foo/bar foo/baz

creates a new directory foo (assuming it wasn't already tracked), and if this was the first command of a new project it also creates a new root directory for the project.

        $ monotone status --brief
        
        added
        added   foo
        added   foo/bar
        added   foo/baz

The first line there is the root directory addition. Now

        $ ~/monotone/mainline/monotone st --brief foo
        monotone: fatal: std::logic_error: roster.cc:497: invariant
        'I(has_root())' violated

This problem would come up because restricting the tree to foo excludes the root directory addition. The original solution to this problem was to have a restriction implicitly include the parent directories of anything it includes. This is what the current mainline rosters code does and the reason we haven't seen such problems.

I have a patch (that was an experiment as much as anything) that removes this "solution" from the mainline code. This patch makes some small changes to the tests that break to make sure that containing directories exist before restricting to things below them. For example:

        $ monotone add foo
        $ monotone commit
        $ monotone add foo/bar
        $ monotone add foo/baz
        $ monotone commit foo/bar

This works because the commit of foo creates it and the root directory so later restricting to things under foo does not require any excluded additions.

One test that currently fails on mainline (XFAIL) because of this problem is t_revert_new_project.at. In summary this test starts a new project and does:

        $ monotone add foo
        $ monotone add bar
        $ monotone revert foo

The problem here is that revert foo implicitly includes the newly added root directory and faithfully reverts this addition. This leaves bar hanging in a non-existent root directory and the working copy is hosed.

I'm holding off committing the patch I have only because it makes a somewhat subtle semantic change and would like to make sure everyone agrees this is the right way to go.

Cheers,
Derek









reply via email to

[Prev in Thread] Current Thread [Next in Thread]