Is it possible to run hg merge in a test status

466 views
Skip to first unread message

Josh Malinski

unread,
Jul 9, 2010, 10:18:33 AM7/9/10
to merc...@selenic.com

Basically I have a situation where management wants to see the status of the merging of development lines to see what files will require human contact. This will allow us to “manage” our time so that we can “plan accordingly”.

 

So at this point what I am looking for is a list of files that mercurial won’t be able to automatically merge where a developer is going to have to step in. I know about using –n  / --dry-run but this performs the merge and force human interaction if it can’t be automatically resolved. This won’t give me my output ahead of time.

 

I don’t know if this is possible so I figured to pose the question so I can take it back.

 

--Josh

 

Tony Mechelynck

unread,
Jul 9, 2010, 10:43:36 AM7/9/10
to Josh Malinski, merc...@selenic.com
> *--Josh*
>
>
>
> _______________________________________________
> Mercurial mailing list
> Merc...@selenic.com
> http://selenic.com/mailman/listinfo/mercurial

from "hg help merge":

-P --preview review revisions to merge (no merge is performed)


Best regards,
Tony.
--
November, n.:
The eleventh twelfth of a weariness.
-- Ambrose Bierce, "The Devil's Dictionary"
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Martin Geisler

unread,
Jul 9, 2010, 10:45:36 AM7/9/10
to Josh Malinski, merc...@selenic.com
"Josh Malinski" <JMal...@anasazisoftware.com> writes:

> Basically I have a situation where management wants to see the status
> of the merging of development lines to see what files will require
> human contact. This will allow us to "manage" our time so that we can
> "plan accordingly".
>
>
>
> So at this point what I am looking for is a list of files that
> mercurial won't be able to automatically merge where a developer is

> going to have to step in. I know about using -n / --dry-run but this


> performs the merge and force human interaction if it can't be
> automatically resolved. This won't give me my output ahead of time.
>
>
>
> I don't know if this is possible so I figured to pose the question so I
> can take it back.

What about using

hg merge --config ui.merge=false merge
hg resolve --list
hg update --clean .

This does the following:

- The --config option overrides your merge tool configuration for this
one call to 'hg merge'.

- We ask Mercurial to always use the program called 'false'. This is a
regular program (on Unix) that simply terminates with an exit code of
1 to indicate an error.

- Because 'false' always returns 1, Mercurial will think that all merges
failed.

- However, Mercurial will only call the false program for files where
the builtin premerge step fails -- that is, files where there are
overlapping changes.

- The resolve command tracks the failed merges.

- The update command restores the state to how it looked before the
merge.


Note that there is also an internal merge program called
'internal:fail'. Using that will give different results since it also
disables the premerge step. It is very important that the premerge step
is run since you only want to know about conflicts.

This wiki page documents the merge tool configuration:

http://mercurial.selenic.com/wiki/MergeToolConfiguration

--
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/

Matt Mackall

unread,
Jul 9, 2010, 10:50:18 AM7/9/10
to Tony Mechelynck, Josh Malinski, merc...@selenic.com
On Fri, 2010-07-09 at 16:43 +0200, Tony Mechelynck wrote:
> On 09/07/10 16:18, Josh Malinski wrote:
> > Basically I have a situation where management wants to see the status of
> > the merging of development lines to see what files will require human
> > contact. This will allow us to “manage” our time so that we can “plan
> > accordingly”.
> >
> > So at this point what I am looking for is a list of files that mercurial
> > won’t be able to automatically merge where a developer is going to have
> > to step in. I know about using –n / --dry-run but this performs the
> > merge and force human interaction if it can’t be automatically resolved.
> > This won’t give me my output ahead of time.
> >
> > I don’t know if this is possible so I figured to pose the question so I
> > can take it back.
> >
> > *--Josh*
> >
> >
> >
> > _______________________________________________
> > Mercurial mailing list
> > Merc...@selenic.com
> > http://selenic.com/mailman/listinfo/mercurial
>
> from "hg help merge":
>
> -P --preview review revisions to merge (no merge is performed)

That won't help.

The two tricks to doing an unattended merge are:

- specify a non-interactive merge with -y
- specify that all manual file merges fail with HGMERGE=internal:fail

HGMERGE=internal:fail hg merge -y otherbranch

You'll get a summary like:

6 files updated, 0 files merged, 0 files removed, 0 files unresolved

The merged count is the number of files merged without conflict by the
internal merge tool, the unresolved count is how many had conflicts.

The list of failing file merges can be found with:

hg resolve -l

--
Mathematics is the supreme nostalgia of our time.

Tony Mechelynck

unread,
Jul 9, 2010, 11:21:13 AM7/9/10
to Matt Mackall, Josh Malinski, merc...@selenic.com

According to
http://mercurial.selenic.com/wiki/MergeProgram#How_Mercurial_decides_which_merge_program_to_use
if the merge program is "internal:fail", Mercurial will skip its
internal "simple merge algorithm", since the user has specified that no
merging take place. IOW, in that case all file merges will be treated as
"unresolved".

Martin Geisler's method of using --config ui.merge=false (followed by hg
resolve -- list then by some undo operation) might work, not very
elegantly, but on Windows you would IIUC have to supply a "false.bat"
file consisting of only the line "exit 1" (without quotes).


Best regards,
Tony.
--
ARTHUR: Charge!
[They all charge with swords drawn towards the RABBIT. A tremendous
twenty
second fight with Peckinpahish shots and borrowing heavily also on the
Kung Fu and karate-type films ensues, in which some four KNIGHTS are
comprehensively killed.]
ARTHUR: Run away! Run away!
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

Martin Geisler

unread,
Jul 9, 2010, 4:48:17 PM7/9/10
to Tony Mechelynck, Josh Malinski, merc...@selenic.com
Tony Mechelynck <antoine.m...@gmail.com> writes:

> Martin Geisler's method of using --config ui.merge=false (followed by
> hg resolve -- list then by some undo operation) might work, not very
> elegantly, but on Windows you would IIUC have to supply a "false.bat"
> file consisting of only the line "exit 1" (without quotes).

Yes, you will have to do something like that on Windows.

You could perhaps also use the internal:dump merge tool -- it will dump
out Subversion-like files when there is a merge conflict.

Perhaps this is actually quite nice for your usecase since you can then
inspect the conflicts directly and decide how much manual work is needed
in each case.

--
Martin Geisler

Mercurial links: http://mercurial.ch/

Reply all
Reply to author
Forward
0 new messages