Is it possible to synchronize local/remote repositories without any interaction (i.e. by script)?

Adrian Klaver adrian.klaver at aklaver.com
Sun Aug 12 21:32:07 UTC 2018


On 08/12/2018 01:55 PM, Chris Green wrote:
> On Sun, Aug 12, 2018 at 01:46:39PM -0400, Augie Fackler wrote:
>>     On Aug 12, 2018, at 10:00 AM, Chris Green <[1]cl at isbd.net> wrote:
>>>
>>>     These need to be as far as possible silent scripts, as noted above I'm
>>>     happy to have them talk to me if there's a conflict of some sort but
>>>     otherwise I want quietness.  I can probably manage to make the ssh
>>>     access password/key-less but how easy is it to automate the mercurial
>>>     bits?
>>>
>> Should be pretty easy - `hg push && hg pull` is probably all you need,
>> and if either of those exit nonzero you need to do some kind of merge.
> 
> So if I make a change on a 'remote' machine and commit it to the local
> repository then all I need do is 'push <central repository>' and the
> change will be there too?  I thought doing that would create a branch
> and that someone/somewhere then had to do a merge on the 'central'
> repository.

hg help push

" Push changesets from the local repository to the specified destination.

     This operation is symmetrical to pull: it is identical to a pull in 
the destination repository from the current one.

  By default, push will not allow creation of new heads at the 
destination, since multiple heads would make it unclear which head to 
use. In this situation, it is recommended to pull and merge before pushing.


...


  Use --new-branch if you want to allow push to create a new named branch
     that is not present at the destination. This allows you to only 
create a new branch without forcing other changes.
"

So merges and branches are not automatically part of push/pull.




-- 
Adrian Klaver
adrian.klaver at aklaver.com



More information about the Mercurial mailing list