[PATCH] merge: add option to return successful exit code on a 'no-op merge'

Matt Mackall mpm at selenic.com
Tue Nov 4 16:09:19 CST 2014


On Tue, 2014-11-04 at 22:13 +0100, Bernhard Urban wrote:
> On Tue, Nov 4, 2014 at 7:16 PM, Pierre-Yves David <
> pierre-yves.david at ens-lyon.org> wrote:
> 
> >
> >
> > On 11/04/2014 04:08 PM, Bernhard Urban wrote:
> >
> >> # HG changeset patch
> >> # User Bernhard Urban <lewurm at gmail.com>
> >> # Date 1415116918 -3600
> >> #      Tue Nov 04 17:01:58 2014 +0100
> >> # Node ID 5c6b2329f67f18a6f2bf9fff2ef86f04337b25ff
> >> # Parent  30e0dcd7c5ffd99fb9c2474e9d73ca01a7d292fa
> >> merge: add option to return successful exit code on a 'no-op merge'
> >>
> >
> > Can you tell us more about your usecase here ?
> >
> >
> Our concrete situation is that we've a downstream repo (repoB) that we want
> to automatically merge on pushes to its upstream repo (repoA) and run some
> tests.
> 
> So we do something like `hg clone repoB && hg pull repoA && hg merge &&
> make tests'.  The intended behaviour is that if the merge fails, the whole
> build should be marked as failed (and thus, needs human interaction).
> However, it can happen that for some reasons repoB is already merged with
> repoA and then `hg merge' breaks the chain because it returns something !=0
> since there's nothing to merge.

We're pretty reluctant to add new flags with very narrow uses. The fact
that we've gotten nearly 10 years without this being proposed suggests
it might be a pretty obscure need.

I think for your case, it might be better to have:

a) a compact query to find the merge target
b) a command that has no output but returns true for a non-empty revset

This is sort of what you want:

hg id -qr 'head() and not .' # not silent

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list