Commit Graph

23344 Commits

Author SHA1 Message Date
Martin von Zweigbergk
1f5f9eefce merge: branch code into {n1 and n2, n1, n2} top-level cases
There are three high-level cases that are of interest in
manifestmerge(): 1) The file exists on both sides, 2) The file exists
only on the local side, and 3) The file exists only on the remote
side. Let's make this clearer in the code.

The 'if f in copied' case will be broken up into the two applicable
branches in the next patch.
2014-11-23 14:09:10 -08:00
Martin von Zweigbergk
fd7e02842b update: remove redundant and misplaced merge tests
The "nothing to merge" case is covered by test-merge-default.t.

The "uncommitted changes" case is covered by test-merge1.t (and
others).

The "merge -f" case is covered by test-merge-force.t.
2014-12-02 16:39:59 -08:00
Martin von Zweigbergk
a57360798c largefiles: use clearer debug messages in actions
In overridecalculateupdates(), 'g' (get) actions may be converted into
other actions. In most of these cases, it does not make sense to keep
the action's message. For example, 'remote created' does not make
sense for an 'r' (remove) action.
2014-11-21 13:02:45 -08:00
Martin von Zweigbergk
8a629c4b04 largefiles: don't clobber merge action message with user message
The message in the action is used for debugging and should not be the
same as the question presented to the user. Use a different variable
for the user message, so the 'msg' variable already in scope does not
get overwritten.
2014-11-21 11:44:57 -08:00
Ryan McElroy
cf43c21202 bookmarks: factor out repository lookup from writing bookmarks file
This will allow the share extension to extend bookmarks functionality to share
bookmarks between repositories.
2014-12-02 20:31:19 -08:00
Mike Edgar
343ab73738 parsers: ensure revlog index node tree is initialized before insertion
Currently, the revlog index C implementation assumes its node tree will be
initialized before a new element is inserted by revnum. For example, revlog.py
executes 'self.index.insert(-1, e)' in _addrevision(). This is only safe
because the node tree has been initialized by a "node in self.nodemap"
check made in addrevision().

(For context, this was discovered while developing an experimental revlog
mixin which stores "elided nodes" via a separate code path from
_addrevision(); that new code path segfaults without this patch.)
2014-12-04 12:02:02 -05:00
Yuya Nishihara
72198a2056 revset: add 'only' to DoS-safe symbols
There is no reason to disable it in hgweb because the same query can be
written without using 'only()'.
2014-12-03 22:56:42 +09:00
Yuya Nishihara
f62323518b revset: move 'only' so that functions are sorted alphabetically 2014-12-03 22:52:54 +09:00
Matt Harbison
283c311417 tests: drop unnecessary glob that causes a warning on Windows
This was triggered by 7d5fcea60c78.
2014-12-02 22:42:41 -05:00
Martin von Zweigbergk
e1169130c9 merge: add test with conflicting file and remote directory rename
Changset 281e85651e92 (merge: demonstrate that directory renames can
lose local file content, 2014-12-02) should clearly have added the
reverse version of the test: where the remote side renamed a
directory, added a new file in that directory, and the local directory
added a conflicting file in the source directory. Add such a test now,
and also touch up the ones already added slightly (e.g. 'local' was a
stupid value for content that can be on either side of a merge).
2014-12-03 10:01:24 -08:00
Martin von Zweigbergk
35c362a0db graft: use a real conflict for the tests
One of the graft tests grafts a changeset that changes a file's
content from 'a' to 'b' onto a branch that has changed the file's
content from 'a', via 'b', and then back to 'a' again. To prepare for
not considering this a file in need of merging, let's use 'c' as the
file's new content to make sure it has to be considered
conflicting.

There's a second similar case further down where an ancestor is
grafted. Make sure that is also considered a conflict.
2014-12-03 15:03:29 -08:00
John Coomes
310ded0ea2 add: use lexists so that broken symbolic links are added
This restores the add behavior prior to 83750c0d774f and matches the
behavior of addremove.
2014-12-03 14:33:29 -08:00
Mads Kiilerich
32ab3ad47a rebase: avoid redundant repo[rev].rev() - just keep working in rev space 2014-12-02 05:12:59 +01:00
Mads Kiilerich
1b7641d285 rebase: always store rev in state, also when collapsing 2014-12-02 05:12:59 +01:00
Mads Kiilerich
e768b7844a rebase: clarify naming of variables holding node hashes - don't call them rev 2014-12-02 05:12:53 +01:00
Ryan McElroy
468da3b11a bookmarks: factor out bookmark file opening for easier extensibility 2014-11-27 00:24:25 -08:00
Matt Mackall
30e416b9be merge with stable 2014-12-02 17:19:20 -06:00
Pierre-Yves David
8c62cbc185 rebase: ignore negative state when updating back to original wc parent
The state mapping also contains some magic negative values (detached
parent, ignored revision). Blindly reading the state thus lead to
unfortunate usage of the negative value as an update destination. We
now filter them out.

We do a minor alteration of the test to catch this.
2014-12-02 11:06:38 -08:00
Matt Mackall
f37609509f merge with i18n 2014-12-01 18:51:10 -06:00
Matt Mackall
57db67f921 Added signature for changeset 99b29d2bd5ed 2014-12-01 18:39:19 -06:00
Wagner Bruna
3b892bfd69 i18n-pt_BR: synchronized with a05dbabaa7d7 2014-12-01 11:21:30 -02:00
Mads Kiilerich
4c4b1f5ddd merge: before cd/dc prompt, check that changed side really changed
Before, merging would in some cases ask "wrong" questions about
"changed/deleted" conflicts ... and even do it before the resolve phase where
they can be postponed, re"resolved" or answered in bulk operations.

Instead, check that the content of the changed file really did change.

Reading and comparing file content is expensive and should be avoided before
the resolve phase. Prompting the user is however even more expensive. Checking
the content here is thus better.

The 'f in ancestors[0]' should not be necessary but is included to be extra
safe.
2014-12-01 02:30:21 +01:00
Mads Kiilerich
0619283698 largefiles: don't show largefile/normal prompts if one side is unchanged 2014-12-01 02:11:29 +01:00
Mads Kiilerich
99f8557b66 tests: add test-issue3084.t cases for 'changed but same' as for 'unchanged'
Use suffix -same for cases where file changed but content is the same - that is
the case where manifestmerge doesn't detect that a file is unchanged.

(The suffix -id is already used for cases where the file didn't change - that
is the trivial case where manifestmerge detects that the file is unchanged.)

These new tests are good but the results are bad. There shouldn't be any merge
conflicts or prompts when one side didn't change.
2014-12-01 02:11:17 +01:00
Mads Kiilerich
ad85c54a44 tests: clean-up of largefiles tests in test-issue3084.t
Prepare for adding more test cases to the systematic testing, moving the test
from dcd04c26c0f8 to another section.
2014-12-01 02:10:57 +01:00
Pierre-Yves David
1e785e1322 pushkey: gracefully handle prepushkey hook failure (issue4455)
This allow to gracefully report the failure of the bookmark push and carry on.
Before this change set. Local push would plain quit and wireprotocol would
failed in various ungraceful way.
2014-11-29 19:17:47 -08:00
Pierre-Yves David
6cf24b99de hook: raise a more specialized HookAbort exception when a hook fails
We need to gracefully handle some aborts for pushkey, especially
because it leads to a user-facing crash over the wireprotocols. So we
need a more specialized exception to catch.
2014-11-29 19:13:35 -08:00
Matt Mackall
c8d5dc5d96 help: fix typo in files help 2014-12-01 15:04:34 -06:00
Pierre-Yves David
56b039c98c revset: fix first and last for generatorset (issue4465)
The code was just plain wrong.
2014-12-01 05:18:12 -08:00
FUJIWARA Katsunori
43f343827a i18n-ja: synchronized with 4b491ac93c5c 2014-11-29 14:32:12 +09:00
Mads Kiilerich
a5440bd8ed mq: fix update of headers that occur in the "wrong" order
Mq tried to insert headers in the right order. Sometimes it would stop
searching before checking all headers and it could thus duplicate a header
instead of replacing it.
2014-11-28 02:57:33 +01:00
Gregory Szorc
9ccf5570f8 hgweb: send proper HTTP response after uncaught exception
This patch fixes a bug where hgweb would send an incomplete HTTP
response.

If an uncaught exception is raised when hgweb is processing a request,
hgweb attempts to send a generic error response and log that exception.

The server defaults to chunked transfer coding. If an uncaught exception
occurred, it was sending the error response string / chunk properly.
However, RFC 7230 Section 4.1 mandates a 0 size last chunk be sent to
indicate end of the entity body. hgweb was failing to send this last
chunk. As a result, properly written HTTP clients would assume more data
was coming and they would likely time out waiting for another chunk to
arrive.

Mercurial's own test harness was paving over the improper HTTP behavior
by not attempting to read the response body if the status code was 500.
This incorrect workaround was added in faced8f5c2af and has been removed
with this patch.
2014-11-28 10:59:02 -08:00
Pierre-Yves David
2d599c1c7d revert: look for copy information for all local modifications
Renaming a file over an existing one marks the file as modified. So we
track rename source in modified file too.
2014-11-25 19:40:54 -08:00
Pierre-Yves David
8db67ed78a rename: properly report removed and added file as modified (issue4458)
The result of 'hg rm' + 'hg rename' disagreed with the one from
'hg rename --force'. We align them on 'hg move --force' because it agrees with
what 'hg status' says after the commit.

Stopping reporting a modified file as added puts an end to the hg revert confusion in this
situation (issue4458).

However, reporting the file as modified also prevents revert from restoring the copy
source. We fix this in a later changeset.

Git diff also stop reporting the add in the middle of the chain as add. Not
sure how important (and even wrong) it is.
2014-11-24 18:42:56 -08:00
Pierre-Yves David
bb7457d4d7 manifest: fix a bug where working copy file 'add' mark was buggy
Because the same dictionary was used to (1) get node from parent and (2) store
annotated version, we could end up with buggy values. For example with a chain
of renames:

  $ hg mv b c
  $ hg mv a b

The value from 'b' would be updated as "<old-a>a", then the value of c would be
updated as "<old-b>a'. With the current dictionary sharing this ends up with:

    '<new-c>' == '<old-a>aa'

This value is double-wrong as we should use '<old-b>' and a single 'a'.

We now use a read-only value for lookup. The 'test-rename.t' test is impacted
because such a chained added file is suddenly detected as such.
2014-11-26 14:54:16 -08:00
anatoly techtonik
6abd5e7bc0 merge: be precise about what merged into what in short desc 2014-11-26 17:22:09 +03:00
FUJIWARA Katsunori
4359f5ec2d largefiles: avoid exec-bit examination on the platform being unaware of it
Changeset 5b64e22ecd8e introduced the examination of exec bit of
largefiles in "hg status --rev REV" case, but it doesn't avoid it on
the platform being unaware of exec-bit (e.g. on NTFS of Windows).
2014-11-25 18:37:28 +09:00
Durham Goode
0a7a4a1f33 changegroup: fix file linkrevs during reorders (issue4462)
Previously, if reorder was true during the creation of a changegroup bundle,
it was possible that the manifest and filelogs would be reordered such that the
resulting bundle filelog had a linkrev that pointed to a commit that was not
the earliest instance of the filelog revision. For example:

With commits:

0<-1<---3<-4
  \       /
   --2<---

if 2 and 3 added the same version of a file, if the manifests of 2 and 3 have
their order reversed, but the changelog did not, it could produce a filelog with
linkrevs 0<-3 instead of 0<-2, which meant if commit 3 was stripped, it would
delete that file data from the repository and commit 2 would be corrupt (as
would any future pulls that tried to build upon that version of the file).

The fix is to make the linkrev fixup smarter. Previously it considered the first
manifest that added a file to be the first commit that added that file, which is
not true. Now, for every file revision we add to the bundle we make sure we
attach it to the earliest applicable linkrev.
2014-11-20 16:30:57 -08:00
Anton Shestakov
89f6661e0b templates: fix broken "less" & "more" links in paper style (issue4460)
"/search", which is an invalid command in hgweb, was mistakenly used for
"[show] more [revsets]" and "[show] less [revsets]" links on search page in
templates "paper" (and those which inherit paper, such as coal) before and
worked fine until 73c8d0c02c22, which made hgweb more strict about invalid
commands.
2014-11-21 13:58:49 +08:00
Siddharth Agarwal
c24b872cf4 diff: explicitly honor all diffopts
'hg diff' should naturally honor all diffopts.
2014-11-18 22:18:05 -08:00
Siddharth Agarwal
21ee5b69d0 annotate: explicitly only honor whitespace diffopts
The whitespace ones are the only ones the annotate logic cares about anyway, so
there's no visible impact.
2014-11-18 22:16:46 -08:00
Siddharth Agarwal
134022a8b9 notify: explicitly honor all diffopts
The notify output doesn't seem to be parseable anyway, what with the maxdiff
config option. Plus it is designed mainly for servers where hopefully the
admins are doing sensible things.
2014-11-18 21:47:47 -08:00
Siddharth Agarwal
bf23516938 jsonchangeset: don't honor whitespace and format-changing diffopts
JSON is meant to be parsed by computers, and format changes can break them.
2014-11-18 22:13:05 -08:00
Siddharth Agarwal
b06bac1ae7 transplant: don't honor whitespace and format-changing diffopts
transplant uses diff purely internally.
2014-11-18 21:49:05 -08:00
Siddharth Agarwal
3773fbe93c hgk: don't honor whitespace and format-changing diffopts
The diff-tree command is a plumbing command in Git, which means it is expected
to have a stable output format. Ensure that our output is stable too.
2014-11-18 21:38:19 -08:00
Siddharth Agarwal
1c8311a9c0 patchbomb: don't honor whitespace and format-changing diffopts (BC)
The whitespace diffopts break lossless transmission, and the format-changing
ones make import harder. We expect parsers to be able to read git-style diffs,
though.
2014-11-18 17:36:24 -08:00
Martin von Zweigbergk
c830d8dc9d merge: add more thorough tests for --force
With generate-working-copy-states.py generalized to support
arbitrarily many changesets, we can use it for generating test cases
for merge: use one changeset each for base, remote and local. With the
various working copy states, this is a total of 104 cases.

The first candidate for additional testing is 'hg merge --force'. Even
though the force option is deprecated, it is convenient for testing
because it can be tested without first needing to revert any
changes. Except for the lack of checking for uncommitted changes, it
differs in only a few cases from unforced merge.

The new tests cover all the cases in the existing test-merge-force.t,
except for the unforced merge case, which is covered in several other
files anyway, so nothing remains of the file after this patch.
2014-11-26 11:45:21 -08:00
Martin von Zweigbergk
81df1b38d5 merge: display modify/delete conflict prompts in sorted order
The order is determined by manifest.diff(), which currently is not
sorted. There are currently no tests for this, but we will soon add
some that would be flaky without this patch.
2014-11-26 10:25:27 -08:00
Pierre-Yves David
e6c651e56b push: stop independent usage of bundle2 in syncphase (issue4454)
The phase-syncing code was using bundle2 if the remote supported it. It was
doing so without regard to bundle2 activation on the client. Moreover, the
phase push is now properly included in the unified bundle2 push, so having extra
code in syncphase should be useless. If the remote is bundle2-enabled, the
phases should already be synced.

The buggy verification code was leading to a crash when a 3.2 client was pushing
to a 3.1 server. The real bundle2 path detected that their versions were
incompatible, but the syncphase code failed to, sending an incompatible bundle2
to the server.

We drop the useless and buggy code as a result. The "else" clause is
de-indented in the process.
2014-11-19 01:36:17 +00:00
Martin von Zweigbergk
7a9312d969 update: don't overwrite untracked ignored files on update
When looking for untracked files that would conflict with a tracked
file in the target revision (or the remote side of a merge), we
explcitly exclude ignored files. The code was added in f1db75422e70
(merge: refactor unknown file conflict checking, 2012-02-09), but it
seems like only unknown, not ignored, files were considered since the
beginning of time.

Although ignored files are mostly build outputs and backup files, we
should still not overwrite them. Fix by simply removing the explicit
check.
2014-11-16 23:41:44 -08:00