Detecting incoming merge/conflicts before they get pulled

Matt Mackall mpm at selenic.com
Thu Nov 30 15:46:55 CST 2006


On Thu, Nov 30, 2006 at 01:17:27PM -0800, Kelly O'Hair wrote:
> 
> Does anyone know how to find out of a 'hg pull' would result in
> needing to do merges or conflicts? Without actually doing the pull.

In the usual usage scenario (no long-lived named branches), a merge
will be necessary whenever remote adds heads. You can't do this
directly with incoming, but this undocumented trick will work:

 hg incoming --bundle b remote  # grab a bundle of remote changes
 hg heads -R bundle://b         # view heads of local repo + bundle

For compactness, you can use:

 hg heads -q -R bundle://b | wc -l  # get the number of heads
 
> The hg incoming tells me that changesets need to be pulled, but
> not if they would result in conflicts.

File-level conflicts can't be detected without essentially attempting
to do a merge. Which makes it dependent on your choice of 3-way merge
tool.

But that shouldn't be a huge problem. Simply copy your repo, set
HGMERGE to a script that complains about conflicts, and attempt the
merge. If your repo is large, you can copy everything (including the
working dir) with hardlinks.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list