monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] restriction fixes


From: Derek Scherger
Subject: [Monotone-devel] restriction fixes
Date: Mon, 27 Aug 2007 12:16:29 -0600
User-agent: Thunderbird 2.0.0.6 (X11/20070805)

I've just pushed net.venge.monotone.experiment.restricted_rosters that
changes the way we do restrictions somewhat.

The old code uses make_restricted_csets which, given two rosters and a
restriction, creates included and excluded csets like this:

OLD  <included>  RESTRICTED  <excluded>  NEW

Applying the included cset to the OLD roster would give the RESTRICTED
roster and applying the excluded cset to the RESTRICTED roster would
give the NEW roster.

This approach doesn't work correctly in cases where a directory is
renamed and a child of that directory is changed (renamed, content
changes, attribute changes) because the cset contains pathnames which
always come from the NEW roster for changes or additions. (in roster.cc
delta_in_both uses to_p, the new path, for renames, content and
attribute changes). If the directory rename is excluded the generated
csets still refer to content changes of things in that directory by the
new name.

for example:

mtn setup .
mtn add foo
mtn add foo/bar
mtn commit
mtn mv foo/bar foo/baz
mtn mv foo abc

the full cset at this point is something like

rename foo
    to abc

rename abc/bar
    to abc/baz

and if we restrict this to just the rename of bar the restricted cset is
something like

rename abc/bar
    to abc/baz

only the OLD roster doesn't have anything called abc. See
tests/restricted_diff_bug and
tests/fetching_nonexistent_entry_from_children_bug for more details.

This new branch has replaced make_restricted_csets with
make_restricted_roster which builds the RESTRICTED roster from the OLD
and NEW rosters based on the given restriction. Then, it calculates the
included/excluded csets using the normal make_cset with either the OLD
and RESTRICTED rosters or the RESTRICTED and NEW rosters. This gets the
names correct in the above case and allows the rename of bar to be
committed independently of the parent directory rename.

It's still not perfect! It does fix the
fetching_nonexistent_entry_from_children_bug case and it changes the
restricted_diff_bug so that it fails with a missing file. What happens
now is that diff dir2/test.txt fails because that file is called
dir1/test.txt in the roster and this disagrees with the filesystem.

This new code allows for non-content changes to children of renamed
directories to be committed independently of their parent dir renames
and will fail on missing files rather than invariants for content changes.
This does _not_ fix Koen's problem of attempting to commit a child
without its required parent directories.

I haven't propagated this to mainline yet because it seems like some of
it might be a mildly controversial and I'd like to get some feedback
first. It would be good if people could look it over and make sure
they're happy with it. In particular the attaching of nodes to the
restricted roster needs to be done carefully so that parents are
attached before children. I've also removed all of the old cset checking
code that tried to make sure restricted csets would apply cleanly to the
OLD and NEW rosters. The changes to revert were interesting.

I'm sure there's still room for improvement.

Cheers,
Derek





reply via email to

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