[PATCH] update: when failing to merge, mention how to abandon the update (issue1431)

Matt Mackall mpm at selenic.com
Mon Feb 21 17:55:54 UTC 2011


On Sun, 2011-02-20 at 00:48 -0800, Brodie Rao wrote:
> On Sun, Feb 20, 2011 at 12:34 AM, Gilles Moris <gilles.moris at free.fr> wrote:
> > On Sunday 20 February 2011 06:59:26 am Brodie Rao wrote:
> >> # HG changeset patch
> >> # User Brodie Rao <brodie at bitheap.org>
> >> # Date 1298181399 28800
> >> # Node ID a8fc9b1309a82eaea2a0454809678c8d53df9d48
> >> # Parent  643b8212813e631b5525049fc4321a34a4def105
> >> update: when failing to merge, mention how to abandon the update
> >> (issue1431)
> >>
> >> Prior to the resolve command being added in 92ccccb55ba3, hg update
> >> printed a similar message explaining how to retry the update.
> >>
> >> diff --git a/mercurial/hg.py b/mercurial/hg.py
> >> --- a/mercurial/hg.py
> >> +++ b/mercurial/hg.py
> >> @@ -378,10 +378,12 @@ def _showstats(repo, stats):
> >>
> >>  def update(repo, node):
> >>      """update the working directory to node, merging linear changes"""
> >> +    pl = repo.parents()
> >>      stats = mergemod.update(repo, node, False, False, None)
> >>      _showstats(repo, stats)
> >>      if stats[3]:
> >> -        repo.ui.status(_("use 'hg resolve' to retry unresolved file
> >> merges\n")) +        repo.ui.status(_("use 'hg resolve' to retry unresolved
> >> file merges " +                         "or 'hg update %s' to abandon\n") %
> >> pl[0].rev())
> >
> > You mean: "hg update --clean ."
> 
> No, I don't. This message is for hg update, not hg merge. Doing "hg
> update --clean ." would not put you back to a state prior to running
> hg update; it would keep you at the revision you just updated to and
> delete all of your modifications, including the ones that caused the
> merge conflicts in the first place.

A reverse update probably won't "fix" an update merge that's gone sour.
In fact, it'll probably get you further from a "good" state.

Consider:

- Bob is in the middle of some uncommitted work
- Bob pulls from Alice
- Bob updates so he's not creating a new branch
- Bob bungles the merge: conflicts, deleted wrong files, etc.
- Now Bob tries to update backwards

At this point, his current state:
a) is still missing files
b) contains conflicts (from the future!)
c) no longer has any relevant resolve state
d) is not at the development head

In short, his working state is much more of a mess than before the
reverse update.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial-devel mailing list