[PATCH 0 of 8 RFC] Add guard option to update, which aborts if the update is unsafe

Laurens Holst laurens.nospam at grauw.nl
Wed Dec 21 13:45:50 CST 2011


Hi,

If you update while you are working on some changes, when there are conflicts
you are bothered with conflict markers or merge tools and prompts and resolve
commands and all that. Your code that was in a working state will no longer work
until you have resolved the conflicts. Worse, it scatters your focus. In such
case you may rather want to postpone the update until you are done, or commit
your changes first and do a proper merge.

This set of changes adds a --guard/-g flag that aborts the update if it touches
any files that are modified locally and could potentially cause conflicts. The
update could still break your code, however going back to a working version will
now simply be a matter of updating back to the original revision. Later in the
series it also performs tentative merges to see if there are conflicts, and
only aborts when there is an actual conflict.

A guarded update has the following properties:

1. It does not prompt the user for input
2. It does not alter the user’s changes in the working copy
3. It is reversible, the user can move back his original state just by updating

If any of these can not be satisfied, the update aborts.

To answer the question why you would update while working on a change in the
first place, here are some use cases:

1. To test your local changes on a different version
2. To look something up for a colleague who asks you a question
3. To make the history more linear
4. Out of habit by Subversion refugees

~Laurens


More information about the Mercurial-devel mailing list