tell update to run only if there are no conflicts
Lasse Kliemann
lasse at lassekliemann.de
Sat Apr 11 10:23:17 UTC 2015
Suppose I have changed some files in my working copy, then run
hg pull
hg update
and the incoming changesets do not concern the files that I have changed,
those are simply updated in the working copy, and my new parent will be the
last changeset that I pulled in (not considering multiple branches now,
which might make it more complicated, I haven't thought about that yet).
This workflow, in my opinion, gives a much cleaner, more linear history than
first commiting, then pulling and merging. It also works when the pulled in
changes concern the files that I was editing, provided that the changes can
be merged.
However, if there are conflicts, the process is stuck until those conflicts
are resolved. In this case, I think that first commiting and then merging
and resolving the conflict is the cleaner version.
Is there a way to tell the update command to only do something if that does
not cause any conflicts?
Part of the background of my question is that I'm looking for a command
sequence that unexperienced users (who might never have heard of a "merge"
or something like that) can always use and which will never get their
working copy stuck in some way. Currently, a working sequence is:
hg commit
hg push -f
hg pull
hg update
This will always complete and make the user's changes known to the central
repository (where the push is to), probably be creating a new head, so that
I or anyone else on the team who is more experienced can see what the user
did and also do merges, resolve conflicts, etc.
(For my applications, this is one of *the* reasons why we prefer Mercurial
before anything else, because Mercurial is the only system I know of where
such a sequence exists. Git, for example, cannot do it, at least not without
certain add-ons, which still have to be written. I recently discussed that
on the Git mailing list.)
A drawback is still that we get that highly non-linear history. So I would
prefer:
hg pull
hg update --only-if-no-conflicts
hg commit
hg push -f
Is that possible or would it be possible to implement?
Thanks a lot!
More information about the Mercurial
mailing list