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

Bernhard Urban lewurm at gmail.com
Tue Nov 4 15:13:59 CST 2014


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.

Granted, we can do something like 'hg clone repoB && hg pull repoA && (test
`hg log -r 'head()' --template '{node}\n' | wc -l` -le 1 || hg merge) &&
make tests', but I think it's somehow unintentional that `hg merge' bails
out on such a "no-op" merge.  I would even go that far and make the
suggested -a option as default, but I can see how this could break existing
software.


What do you think?


Thanks,
Bernhard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20141104/d82c4438/attachment.html>


More information about the Mercurial-devel mailing list