You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2008/10/28 13:29:04 UTC

Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

On Mon, 2008-10-27 at 20:36 +0100, Stephen Butler wrote:
> Quoting Julian Foad <ju...@btopenworld.com>:
> > Now, stages of detection...

BTW, I was talking only about update/switch, not merge.

> I hadn't thought about sub-items 1c or 1d above.  Good catch.
> 
> So IIUC we'll print one line of output upon detecting an existing conflict
> (1b, 1c, 1d above), or creating fresh tree conflict (#3 below).
> 
> I think we should be completely silent for the rest of a conflicted
> tree (1a), to avoid burying the user in lots of "Skipped" messages.

I agree: one notification per conflicted sub-tree. Revised text:

[[[
 * 1. if  # Incoming change inside an item already in conflict:
 *     a.
 *      tree/text/prop change to node beneath tree-conflicted dir
 *    then  # Skip all changes in this conflicted subtree [2]:
 *      do not update the Base nor the Working
 *      notify "skipped because already in conflict" just once
 *        for the whole conflicted subtree
 *
 *    if  # Incoming change affects an item already in conflict:
 *     b.
 *      tree/text/prop change to tree-conflicted dir/file, or
 *     e.
 *      tree change to a dir tree containing any conflicts, or
 *     c.
 *      tree change to a text/prop-conflicted file/dir, or
 *     d.
 *      text/prop change to a text/prop-conflicted file/dir[1],
 *    then  # Skip this change [2]:
 *      do not update the Base nor the Working
 *      notify "skipped because already in conflict"
 *
]]]

I've also added a condition "e." which was missing.


> Too much output would distract the user from the initial message,
> which describes where the tree conflict is.  After resolving the tree
> conflict, the user can check status or resume update/switch, and find
> any other conflicts in the tree.

Yes.


> >  *
> >  * 2. if  # Incoming change affects an item that's "obstructed":
> >  *      on-disk node kind doesn't match recorded Working node kind,
> >  *      including an absence/presence mis-match
> >  *    then  # Skip this change [2]:
> >  *      do not update the Base nor the Working
> >  *      notify "skipped because obstructed"
> >  *
> >  * 3. if  # Incoming change raises a tree conflict:
> >  *      tree/text/prop change to node beneath tree-scheduled[3] dir

Like in (1.), here we insert:

    *    then  # Skip all changes in conflicted subtree
    *      do not update the Base nor the Working
    *      notify "skipped because already in conflict" just once
    *        for the whole conflicted subtree
    *
    *    if

> >  *      tree/text/prop change to tree-scheduled[3] dir/file, or
> >  *      text/prop change to tree-scheduled dir/file,
> >  *    then  # Skip this change:
> >  *      do not update the Base nor the Working [4]
> >  *      notify "tree conflict"
> >  *
> >  * 4. Apply the change:


[...]
> Here's my basic implementation plan:
> 
> The following update callbacks need to check for existing conflicts:
> 
>    open_directory
>    open_file
>    add_directory
>    add_file
>    delete_entry
>    absent_file
>    absent_directory
> 
> In each callback, we'll make the following checks/calls.
> 

1.a.
>    (eb->inside_a_tree_conflict)
> 
>      True if we're walking a tree-conflicted tree.  Works even if the
>      target and its parent dir do not exist (e.g., we've skipped adding
>      the parent dir due to the tree conflict).  Skip target silently if
>      true.
> 
1.b/c/d
>    svn_wc_conflicted_p2()
> 
>      Check for existing conflicts.   Requires a versioned parent dir for
>      a tree conflict.  Requires a versioned parent dir and versioned
>      target for text or prop conflicts.  Skip target with notification
>      if conflicts are found.

1.e. may need a new check.

2. - obstructions - has a fair amount of existing code but should be
rationalized.

3.
>    check_tree_conflict(&tree_conflict, eb, ...)
> 
>      Returns a fresh tree conflict if the target is a victim.  Requires
>      a versioned parent dir.  If a conflict is found, record it
>      persistently.
> 
>    notify_tree_conflict(tree_conflict, eb, ...)
> 
>      If there's a tree conflict and an eb->notify_func, notify the user.

This should differ:

  for a newly raised tree conflict, notify "tree conflict"

  for a pre-existing conflict, notify "skipped (because of a conflict)"

But any notification is better than none, to start with.

Thanks.
- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

Posted by Julian Foad <ju...@btopenworld.com>.
On Sat, 2008-11-01 at 02:04 +0100, Neels J. Hofmeyr wrote:
> 
> Julian Foad wrote:
> > How's the attached doc-string to go at the top of update_editor.c?
> > 
> > - Julian
> > 
> > 
> > 
> +/*
> + * This code handles "checkout" and "update" and "switch".
> + * A checkout is similar to an update that is only adding new items.
> 
> ### maybe also say
> + * An "update" and a "switch" are essentially the same operation.
> 
> + *
> + * The intended behaviour of "update" and "switch", focusing on the checks
> + * to be made before applying a change, is:
> + *
> + *   For each incoming change:
> + *     if target is already in conflict or obstructed:
> + *       skip this change
> + *     else
> + *     if this action will cause a tree conflict:
> + *       record the tree conflict
> + *       skip this change
> + *     else:
> + *       make this change
> 
> :) nice
> 
> + *
> + * In more detail:
> + *
> + *   For each incoming change:
> + *
> + *   1.   if  # Incoming change is inside an item already in conflict:
> + *    a.    tree/text/prop change to node beneath tree-conflicted dir
> + *        then  # Skip all changes in this conflicted subtree [*1]:
> + *          do not update the Base nor the Working
> + *          notify "skipped because already in conflict" just once
> + *            for the whole conflicted subtree
> + *
> + *        if  # Incoming change affects an item already in conflict:
> + *    b.    tree/text/prop change to tree-conflicted dir/file, or
> + *    c.    tree change to a text/prop-conflicted file/dir, or
> + *    d.    text/prop change to a text/prop-conflicted file/dir [*2], or
> + *    e.    tree change to a dir tree containing any conflicts,
> + *        then  # Skip this change [*1]:
> + *          do not update the Base nor the Working
> + *          notify "skipped because already in conflict"
> + *
> + *   2.   if  # Incoming change affects an item that's "obstructed":
> + *    a.    on-disk node kind doesn't match recorded Working node kind
> + *            (including an absence/presence mis-match),
> + *        then  # Skip this change [*1]:
> + *          do not update the Base nor the Working
> + *          notify "skipped because obstructed"
> + *
> + *   3.   if  # Incoming change raises a tree conflict:
> + *    a.    tree/text/prop change to node beneath sched-delete dir, or
> + *    b.    tree/text/prop change to sched-delete dir/file, or
> + *    c.    text/prop change to tree-scheduled dir/file,
> + *        then  # Skip this change:
> + *          do not update the Base nor the Working [*3]
> + *          notify "tree conflict"
> + *
> + *   4.   Apply the change:
> + *          update the Base
> + *          update the Working, possibly raising text/prop conflicts
> + *          notify
> + *
> + * Notes:
> + *
> + *      "Tree change" here refers to an add or delete of the target node,
> + *      including the add or delete part of a copy or move or rename.
> + *
> + * [*1] We should skip changes to an entire node, as the base revision number
> + *      applies to the entire node. Not sure how this affects attempts to
> + *      handle text and prop changes separately.
> + *
> + * [*2] Details of which combinations of property and text changes conflict
> + *      are not specified here.
> 
> ### Maybe say where they are specified. Are they?

I don't know if these details are written down anywhere, so I have no
reference to insert.

I committed the doc-string as it was.

- Julian

> 
> + *
> + * [*3] For now, we skip the update, and require the user to:
> + *        - Modify the WC to be compatible with the incoming change;
> + *        - Mark the conflict as resolved;
> + *        - Repeat the update.
> + *      Ideally, it would be possible to resolve any conflict without
> + *      repeating the update. To achieve this, we would have to store the
> + *      necessary data at conflict detection time, and delay the update of
> + *      the Base until the time of resolving.
> + */
> 
> 
> Looks good!
> ~Neels
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

Posted by "Neels J. Hofmeyr" <ne...@elego.de>.

Julian Foad wrote:
> How's the attached doc-string to go at the top of update_editor.c?
> 
> - Julian
> 
> 
> 
+/*
+ * This code handles "checkout" and "update" and "switch".
+ * A checkout is similar to an update that is only adding new items.

### maybe also say
+ * An "update" and a "switch" are essentially the same operation.

+ *
+ * The intended behaviour of "update" and "switch", focusing on the checks
+ * to be made before applying a change, is:
+ *
+ *   For each incoming change:
+ *     if target is already in conflict or obstructed:
+ *       skip this change
+ *     else
+ *     if this action will cause a tree conflict:
+ *       record the tree conflict
+ *       skip this change
+ *     else:
+ *       make this change

:) nice

+ *
+ * In more detail:
+ *
+ *   For each incoming change:
+ *
+ *   1.   if  # Incoming change is inside an item already in conflict:
+ *    a.    tree/text/prop change to node beneath tree-conflicted dir
+ *        then  # Skip all changes in this conflicted subtree [*1]:
+ *          do not update the Base nor the Working
+ *          notify "skipped because already in conflict" just once
+ *            for the whole conflicted subtree
+ *
+ *        if  # Incoming change affects an item already in conflict:
+ *    b.    tree/text/prop change to tree-conflicted dir/file, or
+ *    c.    tree change to a text/prop-conflicted file/dir, or
+ *    d.    text/prop change to a text/prop-conflicted file/dir [*2], or
+ *    e.    tree change to a dir tree containing any conflicts,
+ *        then  # Skip this change [*1]:
+ *          do not update the Base nor the Working
+ *          notify "skipped because already in conflict"
+ *
+ *   2.   if  # Incoming change affects an item that's "obstructed":
+ *    a.    on-disk node kind doesn't match recorded Working node kind
+ *            (including an absence/presence mis-match),
+ *        then  # Skip this change [*1]:
+ *          do not update the Base nor the Working
+ *          notify "skipped because obstructed"
+ *
+ *   3.   if  # Incoming change raises a tree conflict:
+ *    a.    tree/text/prop change to node beneath sched-delete dir, or
+ *    b.    tree/text/prop change to sched-delete dir/file, or
+ *    c.    text/prop change to tree-scheduled dir/file,
+ *        then  # Skip this change:
+ *          do not update the Base nor the Working [*3]
+ *          notify "tree conflict"
+ *
+ *   4.   Apply the change:
+ *          update the Base
+ *          update the Working, possibly raising text/prop conflicts
+ *          notify
+ *
+ * Notes:
+ *
+ *      "Tree change" here refers to an add or delete of the target node,
+ *      including the add or delete part of a copy or move or rename.
+ *
+ * [*1] We should skip changes to an entire node, as the base revision number
+ *      applies to the entire node. Not sure how this affects attempts to
+ *      handle text and prop changes separately.
+ *
+ * [*2] Details of which combinations of property and text changes conflict
+ *      are not specified here.

### Maybe say where they are specified. Are they?

+ *
+ * [*3] For now, we skip the update, and require the user to:
+ *        - Modify the WC to be compatible with the incoming change;
+ *        - Mark the conflict as resolved;
+ *        - Repeat the update.
+ *      Ideally, it would be possible to resolve any conflict without
+ *      repeating the update. To achieve this, we would have to store the
+ *      necessary data at conflict detection time, and delay the update of
+ *      the Base until the time of resolving.
+ */


Looks good!
~Neels


Re: Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

Posted by Julian Foad <ju...@btopenworld.com>.
How's the attached doc-string to go at the top of update_editor.c?

- Julian



Re: Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

Posted by Julian Foad <ju...@btopenworld.com>.
On Tue, 2008-10-28 at 17:59 +0100, Stephen Butler wrote:
> Quoting Julian Foad <ju...@btopenworld.com>:
> 
> >
> > I agree: one notification per conflicted sub-tree. Revised text:
> >
> > [[[
> >  * 1. if  # Incoming change inside an item already in conflict:
> >  *     a.
> >  *      tree/text/prop change to node beneath tree-conflicted dir
> >  *    then  # Skip all changes in this conflicted subtree [2]:
> >  *      do not update the Base nor the Working
> >  *      notify "skipped because already in conflict" just once
> >  *        for the whole conflicted subtree
> >  *
> >  *    if  # Incoming change affects an item already in conflict:
> >  *     b.
> >  *      tree/text/prop change to tree-conflicted dir/file, or
> >  *     e.
> >  *      tree change to a dir tree containing any conflicts, or
> >  *     c.
> >  *      tree change to a text/prop-conflicted file/dir, or
> >  *     d.
> >  *      text/prop change to a text/prop-conflicted file/dir[1],
> >  *    then  # Skip this change [2]:
> >  *      do not update the Base nor the Working
> >  *      notify "skipped because already in conflict"
> >  *
> > ]]]
> >
> > I've also added a condition "e." which was missing.
> 
> I'm afraid I don't understand condition "e".  It sounds rather expensive,
> applying svn_wc_conflicted_p2() to everything in a dir tree.  Or did you
> have something else in mind?

I do mean we would have to look for any conflicts on the whole tree that
is to be deleted. (Deletion is the only tree change that this condition
could apply to.) I don't see it as any more expensive than other things
we're doing such as (in a merge) comparing the contents of the subtree
for equality before deleting it.

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Stages of tree conflict detection in "update" [was: branch tree-conflicts-notify: merge to trunk?]

Posted by Stephen Butler <sb...@elego.de>.
Quoting Julian Foad <ju...@btopenworld.com>:

>
> I agree: one notification per conflicted sub-tree. Revised text:
>
> [[[
>  * 1. if  # Incoming change inside an item already in conflict:
>  *     a.
>  *      tree/text/prop change to node beneath tree-conflicted dir
>  *    then  # Skip all changes in this conflicted subtree [2]:
>  *      do not update the Base nor the Working
>  *      notify "skipped because already in conflict" just once
>  *        for the whole conflicted subtree
>  *
>  *    if  # Incoming change affects an item already in conflict:
>  *     b.
>  *      tree/text/prop change to tree-conflicted dir/file, or
>  *     e.
>  *      tree change to a dir tree containing any conflicts, or
>  *     c.
>  *      tree change to a text/prop-conflicted file/dir, or
>  *     d.
>  *      text/prop change to a text/prop-conflicted file/dir[1],
>  *    then  # Skip this change [2]:
>  *      do not update the Base nor the Working
>  *      notify "skipped because already in conflict"
>  *
> ]]]
>
> I've also added a condition "e." which was missing.

I'm afraid I don't understand condition "e".  It sounds rather expensive,
applying svn_wc_conflicted_p2() to everything in a dir tree.  Or did you
have something else in mind?

Steve


-- 
Stephen Butler | Software Developer
elego Software Solutions GmbH
Gustav-Meyer-Allee 25 | 13355 Berlin | Germany
fon: +49 30 2345 8696 | mobile: +49 163 25 45 015
fax: +49 30 2345 8695 | http://www.elegosoft.com
Geschäftsführer: Olaf Wagner | Sitz der Gesellschaft: Berlin
Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org