Note that I have only a fuzzy undertstanding of how darcs works
internally, so my remarks below on internals could be wrong.

Maurí­cio <[EMAIL PROTECTED]> writes:
>>> Is there some kind of 'darcs syncronize' that I could use to
>>> syncronize my repository with other?  Something that would do
>>> something like pulling, pushing and conflict checking?

I assume you mean a two-way sync, such that for two repos R and S, the
end result in that both R and S contain the set union of all patches
from R and S.

In general, Darcs treats bidirectional syncs as two separate syncs.
Some examples are:

    # Pull and push in x.
    darcs pull --repodir x y
    darcs push --repodir x y

    # Pull and send in x.
    darcs pull --repodir x y
    darcs send --repodir x y

    # Pull in x and y.
    darcs pull --repodir x y
    darcs pull --repodir y x

    # Push in x and y.
    darcs push --repodir x y
    darcs push --repodir y x

By default, the last one (push in x and y) will refuse to apply bundles
that introduce conflicts.  Conversely, "pull in x and y" will introduce
conflicts and ask the user to solve them.

>> What should  happen in case of  a conflict?  If there  is nothing that
>> could be done automatically a simple shell script will do your job.

The following is a (very slow!) technique for pushing all patches that
do not introduce conflicts, which I call a "kindly push".

    #!/bin/bash
    x=yd; while while darcs push "$@" <<<$x; do sleep 1; done; do x=n$x; done

Note that it never terminates.  It can't distinguish between "no patche
selected" and "pushed all selected patches successfully".

Also, if you are pushing from a repo that both introduces a conflict in
one patch, then resolves it in another, the "kindly push" will skip
both.  You can sometimes resolve this by fiddling with the step size
(x=yyyyd and x=nnnn$x, for example), but I have not done the hard
thinking on this yet.

> Well, I was  wondering if darcs, knowing in  advance which patches (from
> both repositories) are  going to be applied, could  choose the better or
> more  consistent way  to order  them.

Reordering how patches occur within a repository is a separate
"optimization" step:

    darcs optimize --repodir x --reorder

> For instance, suppose rep.1 has patches 1,2,3 and rep.2 has patches
> a,b,c. Then darcs could choose to apply them like 1,2,a,b,c,3 to avoid
> some problem.  But then I'm not sure if that is a good idea, or if it
> makes sense at all.

I'm not sure; either darcs ALWAYS does this, or it never does.
As you say, I'm not sure if it "makes sense".

> Maybe I  should first ask: is it  possible that I get  a different final
> result if I do "darcs push ;  darcs pull" instead of "darcs pull ; darcs
> push"?

AFAIK, no -- except when there are conflicts.  In that case, I think
darcs will suggest different conflict resolution (i.e. "X or Y?" instead
of "Y or X?") in between the "v v v" and "^ ^ ^" stuff.

_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to