Commit Graph

19 Commits

Author SHA1 Message Date
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
FUJIWARA Katsunori
3018e1b77b filemerge: show warning about choice of :prompt only at an actual fallback
Before this patch, internal merge tool :prompt shows "no tool found to
merge FILE" line, even if :prompt is explicitly specified as a tool to
be used.

This patch shows warning message about choice of :prompt only at an
actual fallback, in which case any tool is rejected by capability for
binary or symlink.

It is for backward compatibility to omit warning message in
"changedelete" case.
2017-05-13 03:28:36 +09:00
Kostia Balytskyi
279f8962a7 conflicts: make spacing consistent in conflict markers
The way default marker template was defined before this patch,
the spacing before dash in conflict markes was dependent on
whether changeset is a tip one or not. This is a relevant part
of template:
    '{ifeq(tags, "tip", "", "{tags} "}'
If revision is a tip revision with no other tags, this would
resolve to an empty string, but for revisions which are not tip
and don't have any other tags, this would resolve to a single
space string. In the end this causes weirdnesses like the ones
you can see in the affected tests.

This is a not a big deal, but double spacing may be visually
less pleasant.

Please note that test changes where commit hashes change are
the result of marking files as resolved without removing markers.
2016-11-19 15:41:37 -08:00
Simon Farnsworth
3622717b76 merge: add conflict labels to merge command
Now that we present the conflict labels in prompts, it's useful to have
better names than "local" and "other" for every command.
2016-10-07 08:51:50 -07:00
Simon Farnsworth
1b7185f6d1 merge: always use other, not remote, in user prompts
Now that we store and display merge labels in user prompts (not just
conflict markets), we should rely on labels to clarify the two sides of a
merge operation (hg merge, hg update, hg rebase etc).

"remote" is not a great name here, as it conflates "remote" as in "remote
server" with "remote" as in "the side of the merge that's further away". In
cases where you're merging the "wrong way" around, remote can even be the
"local" commit that you're merging with something pulled from the remote
server.
2016-08-12 05:56:40 -07:00
Simon Farnsworth
906104f96d merge: use labels in prompts to the user
Now that we persist the labels, we can consistently use the labels in
prompts for the user without risk of confusion. This changes a huge amount
of command output:

This means that merge prompts like:
  no tool found to merge a
  keep (l)ocal, take (o)ther, or leave (u)nresolved? u
and
  remote changed a which local deleted
  use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
become:
  no tool found to merge a
  keep (l)ocal [working copy], take (o)ther [destination], or leave (u)nresolved? u
and
  remote [source] changed a which local [dest] deleted
  use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
where "working copy" and "destination" were supplied by the command that
requested the merge as labels for conflict markers, and thus should be
human-friendly.
2016-08-12 06:01:42 -07:00
Simon Farnsworth
74ca86ac73 merge: save merge part labels for later reuse
We permit the caller of merge operations to supply labels for the merge
parts ("local", "other", and optionally "base"). These labels are used in
conflict markers to reduce confusion; however, the labels were not
persistent, so 'hg resolve' would lose the labels.

Store the labels in the mergestate.
2016-03-19 18:37:10 -07: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
Durham Goode
4834302703 merge: add file ancestor linknode to mergestate
During a merge, each file has a current commitnode+filenode, an other
commitnode+filenode, and an ancestor commitnode+filenode. The ancestor
commitnode is not stored though, and we rely on the ability for the filectx() to
look up the commitnode by using the filenode's linkrev. In alternative backends
(like remotefilelog), linkrevs may have restriction that prevent arbitrary
linkrev look up given a filenode.

This patch accounts for that by storing the ancestor commitnode in
the merge state so that it is available later at resolve time.

This results in some test changes because the ancestor commitnode we're using at
resolve time changes slightly. Before, we used the linkrev commit, which is the
earliest commit that introduced that particular filenode (which may not be the
latest common ancestor of the commits being merged). Now we use the latest
common ancestor of the merged commits as the commitnode. This is fine though,
because that commit contains the same filenode as the linkrev'd commit.
2016-02-05 10:22:14 -08:00
Siddharth Agarwal
1c3dcd1546 filemerge: default change/delete conflicts to 'leave unresolved' (BC)
It makes far more sense to leave these conflicts unresolved and kick back to
the user than to just assume that the local version be chosen. There are almost
certainly buggy scripts and applications using Mercurial in the wild that do
merges or rebases non-interactively, and then assume that if the operation
succeeded there's nothing the user needs to pay attention to.

(This wasn't possible earlier because there was no way to re-resolve
change/delete conflicts -- but now it is.)
2015-12-23 12:51:45 -08:00
Danek Duvall
7653e06efa tests: Solaris diff -U also emits "No differences encountered"
This came up before, but the tests in check-code.py don't find -U (only -u)
and they don't work when the diff is inside a shell function.  This fixes
the offending tests and beefs up check-code.py.
2015-12-27 15:24:48 -08:00
Siddharth Agarwal
106adbe75b filemerge: default regular prompts to 'leave unresolved' (BC)
It makes far more sense to leave these conflicts unresolved and kick back to
the user than to just assume that the local version be chosen. There are almost
certainly buggy scripts and applications using Mercurial in the wild that do
merges or rebases non-interactively, and then assume that if the operation
succeeded there's nothing the user needs to pay attention to.
2015-12-01 09:48:38 -08:00
Siddharth Agarwal
7382fa0a4e filemerge: add a 'leave unresolved' option to change/delete prompts
We're going to make this option the default in an upcoming patch.
2015-11-30 13:43:55 -08:00
Siddharth Agarwal
7be324f9ab filemerge: add a 'leave unresolved' option to regular prompts
'Regular' here means anything that isn't a change/delete prompt. We'll add this
option to change/delete prompts in a subsequent patch.
2015-11-30 11:17:18 -08:00
Siddharth Agarwal
106338a190 merge: move almost all change/delete conflicts to resolve phase (BC) (API)
We have finally laid all the groundwork to make this happen.

The only change/delete conflicts that haven't been moved are .hgsubstate
conflicts. Those are trickier to deal with and well outside the scope of this
series.

We add comprehensive testing not just for the initial selections but also for
re-resolves and all possible dirstate transitions caused by merge tools. That
testing managed to shake out several bugs in the way we were handling dirstate
transitions.

The other test changes are because we now treat change/delete conflicts as
proper merges, and increment the 'merged' counter rather than the 'updated'
counter. I believe this is the right approach here.

For third-party extensions, if they're interacting with filemerge code they
might have to deal with an absentfilectx rather than a regular filectx.

Still to come:
- add a 'leave unresolved' option to merges
- change the default for non-interactive change/delete conflicts to be 'leave
  unresolved'
- add debug output to go alongside debug outputs for binary and symlink file
  merges
2015-11-25 14:25:33 -08:00
Siddharth Agarwal
1a8c549e79 test-merge-changedelete.t: print out debugmergestate
We're going to use this to verify the merge state in upcoming patches.
2015-11-25 14:26:46 -08:00
Siddharth Agarwal
61b438932e test-merge-changedelete.t: add resolve --list output
We're going to move change/delete conflicts to the resolve phase, and the
resolve --list output is one of the things that will be important to test.
2015-11-23 13:45:56 -08:00
Siddharth Agarwal
ed293bb9ab test-merge-changedelete.t: add a file with regular merge conflicts
In upcoming patches we're going to move change/delete conflicts to the resolve
phase -- it will be important to see how regular conflicts interact with
change/delete ones.
2015-11-23 13:43:14 -08:00
Siddharth Agarwal
afb6e4152e test-merge-prompt.t: rename to test-merge-changedelete.t
Because:
(a) the only prompts we test in this file are change/delete prompts, and
(b) we're going to be expanding the scope of this test to cover future
    improvements to change/delete conflicts, including avoiding prompts
    altogether.
2015-11-11 17:32:41 -08:00