Commit Graph

22 Commits

Author SHA1 Message Date
Pierre-Yves David
2dcf98d614 update: change default destination to tipmost descendant (issue4673) (BC)
Bare 'hg update' now brings you to the tipmost descendant (on the same branch).
Leaving the user on the same topological branch. The previous behavior, updating
to the tipmost changeset on the same branch could lead to jump from a
topological branch to another. This was confusing and impractical. As the only
conceivable reason for the old behavior have been address by the recently
introduce message about other heads, we can "safely" change this behavior

All test changes have been reviewed and seen a valid consequences.
2016-02-02 15:24:11 +00:00
Pierre-Yves David
2e0675043e update: warn about other topological heads on bare update
A concern around the user experience of Mercurial is user getting stuck on there
own topological branch forever. For example, someone pulling another topological
branch, missing that message in pull asking them to merge and getting stuck on
there own local branch.

The current way to "address" this concern was for bare 'hg update' to target the
tipmost (also latest pulled) changesets and complain when the update was not
linear. That way, failure to merge newly pulled changesets would result in some
kind of failure.

Yet the failure was quite obscure, not working in all cases (eg: commit right
after pull) and the behavior was very impractical in the common case
(eg: issue4673).

To be able to change that behavior, we need to provide other ways to alert a
user stucks on one of many topological head. We do so with an extra message after
bare update:

  1 other heads for branch "default"

Bookmark get its own special version:

  1 other divergent bookmarks for "foobar"

There is significant room to improve the message itself, and we should augment
it with hint about how to see theses other heads or handle the situation (see
in-line comment). But having "a" message is already a significant improvement
compared to the existing situation. Once we have it we can iterate on a better
version of it. As having such message is an important step toward changing the
default destination for update and other nicety, I would like to move forward
quickly on getting such message.

This was discussed during London - October 2015 Sprint.
2016-02-02 14:49:02 +00:00
Pierre-Yves David
fb61444d77 revset: reintroduce and experimental revset for update destination
The revset is not ready for prime time yet. However it is useful to have some
version of it exposed to help candidate users to play with it and provide
feedback on what we should aim at.

We add a small test to make sure the code runs.
2015-10-15 01:35:44 +01:00
FUJIWARA Katsunori
3706cf02be update: replace workingctx.dirty and raising Abort by cmdutil.bailifchanged
This patch makes wrapping "commands.update()" by largefiles extension
useless, because "cmdutil.bailifchanged()" can detect changes of
largefiles in the working directory.

This patch also changes test-update-branches.t, because
"cmdutil.bailifchanged()" shows more detailed information about
dirty-ness of the working directory than "workingctx.dirty()".
2015-03-25 13:55:35 +09:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Sean Farley
8973f827ab update: consider successor changesets when moving active bookmark
Previously, when an obsolete changeset was bookmarked, successor changesets were not considered
when moving the bookmark forward. Now that a bare update will move to the tip most of the
successor changesets, we also update the bookmark logic to allow the bookmark to move with this
update.

Tests have been updated and keep issue4015 covered as well.
2014-01-15 17:48:48 -06:00
Sean Farley
eb5399916a merge: consider successor changesets for a bare update
Previously, a bare update would ignore any successor changesets thus
potentially leaving you on an obsolete head. This happens commonly when there
is an old bookmark that hasn't been moved forward which is the motivating
reason for this patch series.

Now, we will check for successor changesets if two conditions hold: 1) we are
doing a bare update 2) *and* we are currently on an obsolete head.

If we are in this situation, then we calculate the branchtip of the successor
set and update to that changeset.

Tests coverage has been added.
2014-01-15 16:41:18 -06:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Sean Farley
a66d57e510 bookmarks: consider successor changesets when moving bookmark (issue4015)
Previously, this required -f because we didn't consider obsolete changesets
(and their children ... or successors of those children, etc.). We now use
obsolete.foreground to calculate acceptable changesets when advancing the
bookmark.

Test coverage has been added.
2013-11-06 19:01:14 -06:00
Siddharth Agarwal
663145e3f0 update: standardize error message for dirty update --check
This and following patches will standardize the error message for dirty working
directories to "uncommitted changes".
2013-09-23 20:33:02 -07:00
Siddharth Agarwal
7213ad0e07 update: improve error message for dirty non-linear update with rev 2013-09-23 20:08:52 -07:00
Siddharth Agarwal
ecd3be8cef update: add error message for dirty non-linear update with no rev
Previously, the error message for a dirty non-linear update was the same (and
relatively unhelpful) whether or not a rev was specified. This patch and an
upcoming one will introduce separate, more helpful hints.
2013-09-23 20:07:30 -07:00
Siddharth Agarwal
55e7463f51 update: improve error message for clean non-linear update 2013-09-23 17:43:33 -07:00
Pierre-Yves David
11445bce46 update: allow dirty update to foreground (successors)
Update to "foreground" are no longer seen as cross branch update. "Foreground"
are descendants or successors (or successors of descendants (or descendant of
successors (etc))). This allows to update with uncommited changes that get
automatically merged.

This changeset is a small step forward. We want to allow dirty update to
"background" (precursors) and takes obsolescence in account when finding the
default update destination. But those requires deeper changes and will comes in
later changesets.
2013-04-16 15:33:18 +02:00
Siddharth Agarwal
a5e71891bd commands: don't infer repo for commands like update (issue2748)
Maintain a whitelist of commands to infer the repo for instead. The whitelist
contains those commands that take file(s) in the working dir as arguments.
2012-10-16 11:43:15 -07:00
Mads Kiilerich
59664fd950 check-code: fix check for trailing whitespace on continued lines too
The tests in test-annotate.t and test-import-git.t that relied on trailing
space in a file created by a here string is now masked by a literal 'EOL'
string that is removed.
2012-08-08 18:10:37 +02:00
Patrick Mezard
036643538d update: make --check abort with dirty subrepos
Aka "we could use dirty() but... yeah let's use it"
2012-04-23 12:12:04 +02:00
Brendan Cully
ea84333a75 Make pull -u behave like pull && update
Previously, pull would not update if new branch heads were received,
whereas pull && update would move to the tipmost branch head.

Also change the "crosses branches" abort in merge.update from
"crosses branches (merge branches or use --check to force update)"
to
"crosses branches (merge branches or update --check to force update)"

since it can no longer assume the user is running hg update.
2011-05-31 11:52:22 -07:00
Brodie Rao
2187fcb2bb update: use higher level wording for "crosses branches" error
When using "hg update" to update to a revision on another branch, if
the user has uncommitted changes in the working directory, hg aborts
with the following message:

  abort: crosses branches (use 'hg merge' to merge or use 'hg update
  -C' to discard changes)

If the user isn't trying to update to tip and they follow the command
examples verbatim, they would end up updating to the wrong revision.

This patch removes the command examples in favor of just telling the
user to either merge or use --clean:

  abort: crosses branches (merge branches or use --clean to discard
  changes)

hg also aborts if the user tries to use "hg update" to get to tip
(without specifying a revision) and tip is on another branch:

  abort: crosses branches (use 'hg merge' or use 'hg update -c')

This message is changed in the same fashion:

  abort: crosses branches (merge branches or use --check to force
  update)
2010-10-09 17:02:28 -05:00
Matt Mackall
200e89394d tests: fix a bunch of pointless #s in unified tests 2010-09-17 17:03:08 -05:00
Sune Foldager
843894f4b3 tests: remove exec bit from .t files 2010-09-14 16:03:10 +02:00
Adrian Buehlmann
79059e20c1 combine tests 2010-09-14 12:20:51 +02:00