two-way sync, without branches

Dustin Sallings dustin at spy.net
Mon Jul 16 18:47:39 CDT 2007


On Jul 16, 2007, at 16:17 , Yakov Lerner wrote:

> I need to use hg for two-way sync between two or more hosts
> using the intermediate "bare" repo. Without branches.
> I tried this sequence:
>
>         hg commit -A -m changes
>         hg pull; hg update; hg push;
>
> The branch got created, which I want to avoid.
> I do not understand why the branch got created.
> I am probably missing some "master branch" label in push or in pull ?

	That would create a branch if changes were made upstream.  You'll  
have to merge if you don't want it.

	A branch is anywhere where there was a divergence from a single point.

	For example, if machines A and B both have change f788a434e64b and  
you modify the state of both trees, and commit both changes, each  
change is individually considered a valid point in time and may be  
developed independently forever.

	At the point where a given tree sees that there were two children of  
f788a434e64b, you have to merge the trees, effectively telling  
mercurial that these changes should both be included into a new  
linear development tree.

	This generally doesn't occur in centralized systems as there can't  
be two independent commits against the same version.


	If this isn't what happened, then I'm not sure how you ended up with  
two heads.  ``hg heads'' will show them to you.  I do the same kind  
of thing all the time (except I use ``hg pull -u'' instead of ``hg  
pull ; hg update'').

-- 
Dustin Sallings


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial/attachments/20070716/e2128620/attachment.htm 


More information about the Mercurial mailing list