Exclude "merged" files from merge commit

Matt Mackall mpm at selenic.com
Wed Apr 18 21:43:26 UTC 2012


On Wed, 2012-04-18 at 18:00 +0200, Marc Strapetz wrote:
> For some kind of conflicts, where the file in the merge target has
> diverged too much from the merge source, resolution is to not apply any
> changes from the source at all. Here one will usually do a "hg resolve
> --mark file" and "hg discard -r <working-revision> file".

Not sure what 'hg discard' is, perhaps you mean revert? FYI, you can use
'.' as a synonym for the first parent of the working directory.

>  Still the file
> will show up as modified when invoking "hg status" and it will be
> included for the commit (as "hg debugdata -c" tells me).
> 
> Sometimes this may be appropriate to denote that the file has been
> merged (but without any changes), sometimes it may be more appropriate
> to not have the file included for the merge commit at all. Is there a
> way to achieve this? E.g. by resetting "merged" flag in .hg/dirstate?

This is a incoherent concept in Mercurial, even though it might make
sense elsewhere like CVS.

A changeset is not a delta. A changeset is a complete snapshot of the
current state of all the files in your project. For a merge changeset to
be complete and coherent, we MUST record some state for every file in
the project. Partially committing a merge just isn't well-defined.

Reverting a file to match p1 after a merge is a perfectly valid thing to
do, of course.. but Mercurial will still insist it's 'M'odified. That's
just a quirk of Mercurial's love of symmetry: it's modified -relative to
p2-. But you needn't concern yourself with that: Mercurial always
records the current state of your file at commit.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list