Ignoring changed files

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Dec 5 16:25:00 UTC 2006


On 2006-12-05 10:02, Steve Borho <steve at ageia.com> wrote:
>On Monday 04 December 2006 23:28, Theodore Tso wrote:
>>On Mon, Dec 04, 2006 at 05:31:54PM -0600, Steve Borho wrote:
>>> It's such a common problem that I wonder if it should be enforced
>>> internally.  Mercurial will prevent you from commiting any local
>>> changes on top of a patch changeset.  Why not prevent the user from
>>> pulling changes on top of a patched changeset?
>>
>> Pulling is perfectly safe.  If there is a mq-patch changeset applied,
>> then an "hg pull" will result in the new changesets creating a new
>> head revision.  It's only if you do an "hg merge" followed by an "hg
>> commit" that you will run into problems, and the "hg commit" will
>> result in an error.  Hg probably shouldn't allow you to do the "hg
>> merge", though.
>>
>> In contrast, an "hg push" to a remote repository is far more
>> dangerous, since the mq changeset is potentially emphemeral and could
>> change after the next "hg qrefresh", the result is a mess --- and it
>> gets even worse if other people pull down the change from the remote
>> repository and then commit on top of it.
>
> Yesterday I went ahead and added the hook work-around to the Wiki.
> What's the consensus on leaving it there?  If people think it's
> unhelpful I'll back it off.
>
> http://www.selenic.com/mercurial/wiki/index.cgi/MqExtension

The times that I had to "hg strip" and re-pull because I had qapplied
some patch and forgot about it, merged and committed are too many.

IMHO, having an early warning during "hg pull" that patches *are*
applied is useful.  Perhaps not by aborting the "pull" operation
altogether, but by something that notifies the user?

Making "merge" a forbidden command when MQ patches are applied is more
useful, but there is no reason why something like the following should
be removed from the Wiki:

    [hooks]
    # Prevent "hg pull" is MQ patches are applied.
    prechangegroup.mq-no-pull = ! hg qtop > /dev/null 2>&1

It's a nice example of both how to write custom hooks in one-liners,
and a useful tip for MQ users :)




More information about the Mercurial mailing list