Mercurial - determine if merging from a remote repo is required

We have two repositories: myapp and myapp-1.1 . We combine myapp-1.1 into myapp.

To find out if there are any changes in 1.1 that need to be merged, I do this:

 cd c:\myapp (local clone) hg fetch (fetch from remote myapp repo) hg in ssh://hg/myapp-1.1 (see what needs to be merged in from remote 1.1 repo) 

It works - but is there a better way? Is there a way to do this without requiring local cloning of myapp?

+4
source share
4 answers

Mercurial cannot do much with remote repositories, except for some option to push or pull from them.

Thus, all you want to ask Mercurial to do should be with a local clone.

No, there is no way to check Mercurial whether to merge two remote repositories.

+5
source

What is the problem with the local clone, exactly?

If you want to isolate all operations on the machine, then the repo is located, you can do the following:

 $ ssh $hg_box $ cd myapp; hg in /myapp-1.1 
+1
source

This may seem like the obvious answer, but since Mercurial is a fully distributed source control system and each repo is self-contained, is it possible that you really will go to a field that has myapp and fetch directly from myapp-1.1? I know that most developers have some kind of centralized repository, but this does not preclude the possibility of using Mercurial directly from the window that you have as a “central” repository. These are all still local and remote repositories.

It is assumed that you want to fully combine myapp and myapp1.1. Otherwise, by the definition of what you are doing, you should clone myapp into another complete repository, and then merge it with myapp-1.1.

+1
source

Assuming that neither the remote repo nor the local repo allow multiple heads for each branch, this command should indicate whether the local repo has a remote repo head in this branch:

 hg log -r $( hg in -b branch_name -n -l1 -q --template "{node}\n" ) 

If the local repo does not have this set of changes, but has outgoing changes to "package_name", then usually it should be an indicator necessary for merging.

0
source

Source: https://habr.com/ru/post/1347301/


All Articles