Commit Graph

14 Commits

Author SHA1 Message Date
Yuya Nishihara
23dd71f9c6 identify: change p1/p2 to a list of parents
It makes sense because the nested data structure is a list of items.
2017-06-26 09:18:55 +09:00
Matt Harbison
e73eeef097 identify: rename 'changed' keyword -> 'dirty'
I meant to do this before sending the initial templater support, but forgot.

I'm quite surprised that 'dirty' doesn't occur in more user facing contexts, but
there are a few, like the help for blackbox.  It also more obviously mirrors the
'(clean)' state printed by the summary command.  I also didn't like that it was
just one letter off from {changes} in the {latesttags} sub-keywords, which has a
totally different meaning.
2017-06-25 17:46:35 -04:00
Matt Harbison
cf51dfbba8 identify: add template support
This is based on a patch proposed last year by Mathias De Maré[1], with a few
changes.

  - Tags and bookmarks are now formatted lists, for more flexible queries.
  - The templater is populated whether or not [-nibtB] is specified.  (Plain
    output is unchanged.)  This seems more consistent with other templated
    commands.
  - The 'id' property is a string, instead of a list.
  - The parents of 'wdir()' have their own list of attributes.

I left 'id' as a string because it seems very useful for generating version
info.  It's also a bit strange because the value and meaning changes depending
on whether or not --debug is passed (short vs full hash), whether the revision
is a merge or not (one hash or two, separated by a '+'), the working directory
or not (node vs p1node), and local or not (remote defaults to tip, and never has
'+').  The equivalent string built with {rev} seems much less useful, and I
couldn't think of a reasonable name, so I left it out.

The discussion seemed to be pointing towards having a list of nodes, with more
than one entry for a merge.  It seems simpler to give the nodes a name, and use
{node} for the actual commit probed, especially now that there is a virtual node
for 'wdir()'.

Yuya mentioned using fm.nested() in that thread, so I did for the parent nodes.
I'm not sure if the plan is to fill in all of the context attributes in these
items, or if these nested items should simply be made {p1node} and {p1rev}.

I used ':' as the tag separator for consistency with {tags} in the log
templater.  Likewise, bookmarks are separated by a space for consistency with
the corresponding log template.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-August/087039.html
2017-06-24 23:09:21 -04:00
Pulkit Goyal
f8b6f67b7a update: show the commit to which we updated in case of multiple heads (BC)
Currently when we have multiple heads on the same branch, update tells us that
there some more heads for the current branch but does not tells us the head to
which the repository has been updated to. It makes more sense showing the
head we updated to and then telling there are some more heads.
2017-06-06 22:17:39 +05:30
Pierre-Yves David
38693c451d destutil: allow to specify an explicit source for the merge
We can now specify from where the merge is performed. The experimental revset
is updated to take revisions as argument, allowing to test the feature.

This will become very useful for pick the 'rebase' default destination. For this
reason, we also exclude all descendants from the rebased set from the candidate
destinations. This descendants exclusion was not necessary for merge as default
destination would not be picked from anything else than a head.

I'm not super excited with the current error messages, but I would prefer to
delay an overall messages rework once 'hg rebase' is done getting a default
destination aligned with 'hg merge'.
2016-02-08 19:32:29 +01:00
Pierre-Yves David
5f9bab17c1 merge: give priority to "not at head" failures for bare 'hg merge'
We refuse to pick a destination for a bare 'hg merge' if the working copy is not
at head. This is meant to prevent strange merge from user who forget to update.
(Moreover, such merge does not reduce actually the number of heads)

However, we were doing that as the last possible failure type. So user were
recommended to merge with an explicit head (from this bad location) if the
branch had too many heads.

We now make "not on branch heads" class of failure the first things to check
and fail on. The one test that change was actually trying to check for these
failure (and did not). The new test output is correct.
2016-02-08 14:55:58 +01: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
4664d62d42 revset: rename and test '_destmerge'
We make the name consistent with the one used by '_destupdate' and we ensure the
code is run by testing it (abort is expected and merge would).
2015-10-15 01:47:28 +01:00
Mads Kiilerich
fae32dd0a3 comments: describe ancestor consistently - avoid 'least common ancestor'
"best" is as defined by mercurial.ancestor.ancestors: furthest from a root (as
measured by longest path).
2014-08-19 01:13:10 +02:00
Matt Mackall
a968007692 merge with stable 2011-12-08 16:01:44 -06:00
Matt Mackall
a69962e18c branch: warn on branching 2011-12-08 14:32:44 -06:00
Kevin Bullock
4b1f198355 merge: make 'nothing to merge' aborts consistent
Makes the 'nothing to merge' abort messages in commands.py consistent with
those in merge.py. Also makes commands.merge() and merge.update() use hints.
The tests show the changes.
2011-12-07 11:23:01 -06:00
Matt Mackall
08439e0f2d tests: add exit codes to unified tests 2010-09-16 17:51:32 -05:00
Adrian Buehlmann
278c3f123f tests: unify test-merge-default 2010-09-11 11:44:53 +02:00