Commit Graph

432 Commits

Author SHA1 Message Date
Mads Kiilerich
9fb157e3d1 merge: make debug output slightly more helpful by including message for action
Make recently introduced messages more useful. Instead of:
  f1: g
  f2: m
say:
  f1: remote is newer -> g
  f2: versions differ -> m
2014-04-22 02:09:24 +02:00
Mads Kiilerich
08d77f475a merge: simplify mergestate iter 2012-05-13 17:45:08 +02:00
Gregory Szorc
85e363fea8 resolve: print message when no unresolved files remain (issue4214)
When using resolve, users often have to consult with the output of |hg
resolve -l| to see if any unresolved files remain. This step is tedious
and adds overhead to resolving.

This patch will notify a user if there are no unresolved files remaining
after executing |hg resolve|::

    no unresolved files; you may continue your unfinished operation

The patch stops short of telling the user exactly what command should be
executed to continue the unfinished operation. That is because this
information is not currently captured anywhere. This would make a
compelling follow-up feature.
2014-04-18 22:19:25 -07:00
Gregory Szorc
8e5e922c37 resolve: abort when not applicable (BC)
The resolve command is only relevant when mergestate is present.
This patch will make resolve abort when no mergestate is present.

This change will let people know when they are using resolve when they
shouldn't be. This change will let people know when their use of resolve
doesn't do anything.

Previously, |hg resolve -m| would allow mergestate to be created. This
patch now forbids that. Strictly speaking, this is backwards
incompatible. The author of this patch believes creating mergestate via
resolve doesn't make much sense and this side-effect was unintended.
2014-04-18 19:08:32 -07:00
Gregory Szorc
51ef803e15 mergestate: consistently set variables to None
Some code branches and exceptional circumstances such as empty
mergestate files could result in mergestate._local and
mergestate._other not being defined or reset to None. These variables
are now correctly set to None when they should be.
2014-05-08 16:48:28 -07:00
Matt Mackall
8ba0348c31 ancestor: silence multiple ancestor warning outside of merge (issue4234)
The current situation is a bit of a layering violation as
merge-specific knowledge is pushed down to lower layers and leaks
merge assumptions into other code paths.

Here, we simply silence the warning with a hack. Both the warning and
the hack will probably go away in the near future when bid merge is
made the default.
2014-04-30 14:19:01 -05:00
Mads Kiilerich
134cd15f9a merge: improve notes for listing the bids for ambiguous merges 2014-04-21 20:24:54 +02:00
Mads Kiilerich
a37cc358ef merge: tell the user when we are using bid merge
Bid merge is a new rarely used feature that the user explicitly enabled - we
should tell/warn when the user actually is using it, just like we tell when we
not are using it.

Give a message like
  note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
2014-04-18 13:33:20 +02:00
Mads Kiilerich
019c70c1d0 merge: fix stray character in bid merge message 2014-04-21 20:22:14 +02:00
Mads Kiilerich
6112ed888f merge: fix wrong number of arguments for bid merge message 2014-04-21 19:53:19 +02:00
Matt Mackall
4c8937e91e merge: fix test failures with new merge code on OS X
The case collision checker was missing a op entry for 'k'eep.
2014-04-21 15:08:39 -05:00
Mads Kiilerich
5a1f9b25aa merge: with merge.preferancestor=*, run an auction with bids from ancestors
The basic idea is to do the merge planning with all the available ancestors,
consider the resulting actions as "bids", make an "auction" and
automatically pick the most favourable action for each file.

This implements the basic functionality and will only consider "keep" and
"get" actions. The heuristics for picking the best action can be tweaked later
on.

By default it will only pass ctx.ancestor as the single ancestor to
calculateupdates. The code path for merging with a single ancestor is not
changed.
2014-02-28 02:52:32 +01:00
Mads Kiilerich
276e18adae merge: let manifestmerge emit 'keep' actions when keeping wd version
Such a 'keep' action will later be the preferred (non)action when there
is multiple ancestors. It is thus very convenient to have it explicitly.

The extra actions will only be emitted in the case where the local file has
changed since the ancestor but the other hasn't. That is the symmetrical
operation to a 'get' action.

This will create more action tuples that not really serve a purpose. The number
of actions will however have the number of changed files as upper bound and it
should thus not increase the memory/cpu use significantly.
2014-04-07 02:12:28 +02:00
Mads Kiilerich
5a86bd87e5 merge: pass merge ancestor to calculateupdates as a list
The list will so far always have one element.
2014-04-06 13:39:51 +02:00
Mads Kiilerich
41480e1b79 merge: move ancestor selection tweaking from manifestmerge to update function
- passing it through calculateupdates.

This will make sure manifestmerge actually use the ancestor it is given.
2014-04-06 13:39:51 +02:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Mads Kiilerich
a0f70f6a56 merge: keep destination filename as key in filemerge actions
Gives more readable debug output and makes it possible to compare/merge actions
later.
2014-03-02 18:52:16 +01:00
Mads Kiilerich
897b2ac8d9 merge: keep destination filename as key in actions for merge with dir rename
Avoids
   None: local renamed directory to b/c -> d
  updating:None 1/1 files (100.00%)
and makes it possible to compare/merge actions later.
2014-03-02 18:49:36 +01:00
Mads Kiilerich
71486dc145 merge: include ancestor node in merge actions 2014-02-28 02:38:33 +01:00
Mads Kiilerich
26a58ad0b7 merge: use ancestor filename from planning phase instead of filectx ancestor
test-merge-types.t changes a bit in flag merging. It relied on the
implementation detail that 100% identical revlog entries are reused. The revlog
reuse did that fctx.ancestor() saw an ancestor where there really not was one.
2014-02-25 20:30:08 +01:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
e0d81db88f merge: fix lack of "%s" in format string causing TypeError at runtime 2014-04-01 02:46:03 +09:00
Mads Kiilerich
6c40916e6d merge: audit the right destination file when merging with dir rename 2014-03-01 18:09:39 +01:00
Pierre-Yves David
3eab08d896 resolve: use "other" changeset from merge state (issue4163)
We can use the "other" data from the recorded merge state instead of inferring
what the other could be from working copy parent. This will allow resolve to
fulfil its duty even when the second parent have been dropped.

Most direct benefit is fixing a regression in backout.
2014-02-25 18:45:01 -08:00
Pierre-Yves David
f2a2751552 merge: add "other" file node in the merge state file
This data is mostly redundant with the "other" changeset node (+ other changeset
file path). However, more data never hurt.

The old format do not store it so this require some dancing to add and remove it
on demand.
2014-02-25 18:54:47 -08:00
Pierre-Yves David
49ce770140 merge: infer the "other" changeset when falling back to v1 format
When we have to fallback to the old version of the file, we infer the
"other" from current working directory parent. The same way it is currently done
in the resolve command. This is know to have shortcoming… but we cannot do
better from the data contained in the old file format. This is actually the
motivation to add this new file format.
2014-02-27 14:14:57 -08:00
Pierre-Yves David
15afb2ca0c merge: record the "other" node in merge state
We need to record the merge we were merging with. This solve multiple
bug with resolve when dropping the second parent after a merge. This
happen a lot when doing special merge (overriding the ancestor).
Backout, shelve, rebase, etc. can takes advantage of it.

This changeset just add the information in the merge state. We'll use it in the
resolve process in a later changeset.
2014-02-25 18:42:11 -08:00
Pierre-Yves David
b5e943e8cb merge: introduce new format for the state file
This new format will allow us to address common bugs while doing special merge
(graft, backout, rebase…) and record user choice during conflict resolution.

The format is open so we can add more record for future usage.

This file still store hexified version of node to help human willing to debug
it by hand. The overhead or oversize are not expected be an issue.

The old format is still used. It will be written to disk along side the newer
format. And at parse time we detect if the data from old version of the
mergestate are different from the one in the new version file. If its the same,
both have most likely be written at the same time and you can trust the extra
data from the new file. If it differs, the old file have been written by an
older version of mercurial that did not knew about the new file. In that case we
use the content of the old file.
2014-02-25 18:37:06 -08:00
Pierre-Yves David
01a482bed9 merge: change the merge state serialisation to use a record based logic
The format of the file is unchanged. But we are preparing a new file with a new
format that would be record based. So we change all the read/write logic to
handle a list of record until a very low level. This will allow simple plugging
of the new format in the current code.
2014-02-27 12:59:41 -08:00
Pierre-Yves David
2438827558 merge: move merge state file path into a constant
We are about to change the format. Having the file path in a single place make
it easier to update the filename for the new version.
2014-02-25 17:14:49 -08:00
Mads Kiilerich
5157505e94 merge: mark mergestate as dirty when resolve changes _state
Correctness - no visible difference so far.
2014-02-28 02:26:03 +01:00
Mads Kiilerich
4aef593d5a merge: don't overwrite file untracked after remove, abort with 'untracked files'
Merge could overwrite untracked files and cause data loss.

Instead we now handle the 'local side removed file and has untracked file
instead' case as the 'other side added file that local has untracked' case:

  FILE: untracked file exists
  abort: untracked files in working directory differ from files in requested revision

It could perhaps make sense to create .orig files when overwriting, either
instead of aborting or when overwriting anyway because of force ... but for now
we stay consistent with similar cases.
2014-02-10 00:43:54 +01:00
Pierre-Yves David
c559733782 merge: adds documentation to the mergestate class
Document most the new function involved in the new serialisation process (and a
few others).
2014-03-05 10:49:43 -08:00
Pierre-Yves David
2cdc06eb49 merge: add blank line between mergestate's method
This class is now too big to be a single big block of continuous text.
2014-03-05 10:22:43 -08:00
Mads Kiilerich
f6187cda8d merge: use the right ancestor when both sides copied the same file
The tests shows no real changes because of this ... but there must be some
weird corner cases where using the right ancestor for the merge planning is
better than using the wrong one.
2014-02-25 20:29:46 +01:00
Mads Kiilerich
24ed93fbb6 merge: handle create+delete prompts in calculateupdates
I would like to move it all the way to the interactive resolve state like
merges are ... but this is a first intermediate step.
2014-03-02 18:36:02 +01:00
Mads Kiilerich
23f515d5c2 merge: handle acceptremove of create+delete early in manifest merge 2014-02-28 02:26:03 +01:00
Augie Fackler
5b6342a4d8 merge with stable 2014-03-01 21:08:28 -05:00
Olle Lundberg
bee0a3e630 merge: fix spelling of length 2014-02-28 02:28:12 +01: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
Sean Farley
17f6cfcd6f merge: refactor initialization of variables in update
There is no code change here but this helps prepare for future commits that
will fix a bare update with obsolete markers.
2013-11-06 17:02:07 -06:00
Sean Farley
26332808a6 merge: update comment for future devs 2013-11-06 10:26:25 -06:00
Siddharth Agarwal
5fa78a0d83 merge: move forgets to the beginning of the action list
Forgets need to be in the beginning of the action list, same as removes. This
lets us avoid clashes in the dirstate where a directory is forgotten and a
file with the same name is added, or vice versa.
2013-11-06 10:20:18 -08:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Siddharth Agarwal
69eb5c00b0 merge: exit early during a no-op update (BC)
hg update . (or equivalents) are effectively no-ops in just about all
circumstances.  These sorts of updates can be especially common in a
bookmark-oriented workflow. This saves us a status check and a manifest
decompression, which means that on a repo with over 210,000 files, this brings
hg update . down from 2.5 seconds to 0.15.

There is one change in behavior: a file that was added, not committed, and then
deleted but not removed used to be removed from the dirstate. With this patch
it isn't. This is what causes the change in test-mq-qpush-exact.t. This seems
like it's enough of an edge case to not be worth handling.

The output of test-empty.t changes because those files are not yet created.
2013-10-01 17:43:54 -07:00
Siddharth Agarwal
c84868311c merge: standardize error message for dirty subrepo 2013-09-23 20:53:14 -07:00
Siddharth Agarwal
88c86521eb merge: standardize error message for dirty working dir 2013-09-23 20:50:51 -07: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