Commit Graph

27905 Commits

Author SHA1 Message Date
Siddharth Agarwal
66f60475b8 rebase: respect checkunknown and checkignored in more cases
checkunknown and checkignored are currently respected for updates and regular
merges, but not for certain kinds of rebases. To be precise, they aren't
respected for rebases when:

(1) we're rebasing while currently on the destination commit, and
(2) an untracked or ignored file F is currently in the working copy, and
(3) the same file F is in a source commit, and
(4) F has different contents in the source commit.

This happens because rebases set force to True when calling merge.update.
Setting force to True makes a lot of sense in general, but it turns out the
force option is overloaded: there's a deprecated '--force' option in merge that
allows you to merge in outstanding changes, including changes in untracked
files. We use the 'mergeforce' parameter to tell those two cases apart.

I think the behavior during rebases when checkunknown is 'abort' (the default)
is wrong -- we should abort on or overwrite differing untracked files, not try
to merge them in. However that currently breaks rebases by aborting in the
middle -- we need better handling for that case before we can change the
default.
2016-02-03 13:12:06 -08:00
Siddharth Agarwal
afdc50e948 test-merge-force: add tests for merge.checkunknown=warn
In an upcoming patch we're going to change the behavior of some merges with
merge.checkunknown=warn or ignore -- ensure that the behavior of the deprecated
'merge --force' remains the same.
2016-02-03 13:11:34 -08:00
Siddharth Agarwal
803f564a2a merge: tell _checkunknownfiles about whether this was merge --force
In an upcoming patch we'll have different behavior here for when 'merge
--force' is used as opposed to when other kinds of force operations are
performed, like rebases.
2016-02-01 20:28:32 -08:00
Siddharth Agarwal
fceebb99a4 merge: add missing doc for 'labels' parameter 2016-02-01 20:28:32 -08:00
Siddharth Agarwal
3386176013 merge: move abort/warn checks up to the top level of _checkunknownfiles
In upcoming patches, we're also going to do these checks when force is True.
2016-02-01 20:28:32 -08:00
Martin von Zweigbergk
c84bb33a89 match: rename "narrowmatcher" to "subdirmatcher" (API)
I keep mistaking "narrowmatcher" for narrowhg's
narrowmatcher. "subdirmatcher" seems more to the point anyway.
2016-02-05 21:09:32 -08:00
timeless
8e3dbae060 tests: relax test-devel-warnings to reduce false positives
This test is interested in warning output, so
glob away line numbers and hashes as they aren't relevant
to its core.
2016-02-03 18:59:35 +00:00
Matt Mackall
fd4d3ffdae merge with stable 2016-02-07 00:49:31 -06:00
timeless
2c0eb26137 rebase: update working directory when aborting (issue5084) 2016-02-05 01:56:46 +00:00
Yuya Nishihara
6b8c99a6d3 revset: flatten chained 'list' operations (aka function args) (issue5072)
Internal _matchfiles() function can take bunch of arguments, which would
lead to a maximum recursion depth error. This patch avoids the excessive
stack use by flattening 'list' nodes beforehand.

Since getlist() no longer takes a nested 'list' nodes, _parsealiasdecl()
also needs to flatten argument list, "aliasname($1, $2, ...)".
2016-02-02 23:49:49 +09:00
André Sintzoff
7d205ba10a help: fix typo in backgroundclose documentation 2016-02-05 19:40:57 +01:00
Matt Mackall
14c6be5d46 Added signature for changeset 48d3cfe1ba91 2016-02-03 16:00:00 -06:00
Siddharth Agarwal
69360ef583 rebase: don't preserve most extra fields
This backs out changeset 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:31 -08:00
Siddharth Agarwal
d6d688266e rebase: backout changeset 9b23739c41de
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:24:47 -08:00
Siddharth Agarwal
82b2cbc2ee rebase: backout changeset 9fd8e3a61d6a
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:52 -08:00
Siddharth Agarwal
08f24f1f67 graft: don't preserve most extra fields
This backs out changeset 9aa13e9feec8.

See the previous patch for why we're doing this.
2016-02-03 09:06:52 -08:00
Siddharth Agarwal
c8ebb66630 amend: don't preserve most extra fields
This backs out changeset fd794e885a9e9.

There are some extra fields that absolutely should not be preserved, like the
convert_revision field introduced by the convert and hgsubversion extensions.
The problem with extensions blacklisting certain extra fields is that they
might not be enabled at the time the amend is performed.

In the long run we probably want separately marked transferable and
non-transferable extra fields, but for now restore the old Mercurial 3.6
behavior.
2016-02-03 08:59:46 -08:00
Wagner Bruna
de70b03c22 histedit: fix typo in documentation 2016-02-03 11:01:11 -02:00
Yuya Nishihara
9d11e83caf osutil: do not abort loading pure module just because libc has no recvmsg()
On Solaris, recvmsg() is provided by libsocket.so. We could try hard to look
for the library which provides 'recvmsg' symbol, but it would make little sense
now since recvfds() won't work anyway on Solaris. So this patch just disables
_recvmsg() on such platforms.

Thanks to FUJIWARA Katsunori for spotting this problem.
2016-02-03 22:47:27 +09:00
Yuya Nishihara
ce2c3d9c16 osutil: disable compilation of recvfds() on unsupported platforms
It appears that Solaris doesn't provide CMSG_LEN(), msg_control, etc. As
recvfds() is only necessary for chg, this patch just drops it if CMSG_LEN
isn't defined, which is the same workaround as Python 3.x.

https://hg.python.org/cpython/rev/c64216addd7f#l7.33
2016-02-02 20:56:48 +09:00
Wagner Bruna
520e980e14 i18n-pt_BR: synchronized with f565b894e807 2016-02-03 10:57:27 -02:00
Matt Mackall
00e8416bcd Added signature for changeset b68cb92d45ee 2016-02-01 17:58:13 -06:00
Matt Mackall
441b93c1f5 merge with i18n 2016-02-01 16:14:51 -06:00
FUJIWARA Katsunori
7b42659ca1 i18n-ja: synchronized with 8722bd8b0726 2016-02-01 23:17:40 +09:00
Wagner Bruna
f0a0975a77 i18n-pt_BR: synchronized with 2fdffa2ec2c4 2016-02-01 12:12:06 -02:00
Martin von Zweigbergk
80df9c6505 verify: recover lost freeing of memory
In 0413f674179e (verify: move file cross checking to its own function,
2016-01-05), "mflinkrevs = None" was moved into function, so the
reference was cleared there, but the calling function now held on to
the variable. The point of clearing it was presumably to free up
memory, so let's move the clearing to the calling function where it
makes a difference. Also change "mflinkrevs = None" to "del
mflinkrevs", since the comment about scope now surely is obsolete.
2016-01-31 00:31:55 -08:00
Martijn Pieters
9c233476de rebase: better way to detect non-detaching revisions (issue5044)
Rather than look for the lowest revision, see if the rebase state is tracking
the parents of this revision. Otherwise we can't handle multiple revisions in
one rebase that includes a merge revision.

Fixes issue5044.
2016-02-01 15:41:43 +00:00
FUJIWARA Katsunori
127b880d6a doc: itemize text blocks to increase readability in HTML format
Before this patch, text blocks changed in this patch are shown as just
continuous text blocks like below in HTML format.

    Global configuration like the username setting is typically put into:

    %USERPROFILE%\mercurial.ini
    $HOME/.hgrc

This patch itemizes these text blocks to increase readability in HTML
format.

    Global configuration like the username setting is typically put into:

    - %USERPROFILE%\mercurial.ini (on Windows)
    - $HOME/.hgrc (on Unix, Plan9)

Like as other platform sensitive container-ed text blocks, this patch
also adds explicit "on PLATFORM" information to each items for
readability in HTML format, even though output of "hg help config" on
command line seems a little redundant. For example, on Unix:

    Global configuration like the username setting is typically put into:

    - "$HOME/.hgrc" (on Unix, Plan9)
2016-02-01 22:14:06 +09:00
FUJIWARA Katsunori
4c1f8febc6 doc: use correct indentation for enumeration
This creates hg.1.html as expected.
2016-02-01 22:14:06 +09:00
FUJIWARA Katsunori
c6d9f4c401 doc: use correct cross reference in help documentation
This patch fixes problems below:

  - ":hg:" role should be followed by not '"' but '`'
  - there is a help topic not "default-push" but "config.default-push"
2016-02-01 22:13:57 +09:00
FUJIWARA Katsunori
6a03d4f576 doc: prevent literal text block from being treated as non-literal one
This creates hg.1.html as expected.
2016-02-01 22:06:35 +09:00
FUJIWARA Katsunori
901d78d859 doc: prevent non-literal text block from being treated as literal one
This creates hg.1.html as expected.
2016-02-01 22:06:35 +09:00
FUJIWARA Katsunori
a189f9751b histedit: show correct hash ID at verification error
node.short() on 'ha' in verifyactions() causes broken hash ID, because
it is initialized with node.hex()-ed node value.
2016-02-01 20:29:20 +09:00
Yuya Nishihara
c24eb61d0c backout: disable --merge with --no-commit (issue4874)
Because "backout --merge" have to make a commit before merging, it doesn't
work with --no-commit. We could change "backout --merge" to make a merge
commit automatically, and --no-commit to bypass a merge commit, but that
change would be undesirable because:

 a) it's hard to fix bad merges in general
 b) two commits would be created with the same --message

So, this patch simply disables "--merge --no-commit".
2016-01-30 18:00:11 +09:00
Martin von Zweigbergk
86ca76bafe changegroup: fix pulling to treemanifest repo from flat repo (issue5066)
In b89de5ee5b31 (changegroup: don't support versions 01 and 02 with
treemanifests, 2016-01-19), I stopped supporting use of cg1 and cg2
with treemanifest repos. What I had not considered was that it's
perfectly safe to pull *to* a treemanifest repo using any changegroup
version. As reported in issue5066, I therefore broke pull from old
repos into a treemanifest repo. It was not covered by the test case,
because that pulled from a local repo while enabling treemanifests,
which enabled treemanifests on the source repo as well. After
switching to pulling via HTTP, it breaks.

Fix by splitting up changegroup.supportedversions() into
supportedincomingversions() and supportedoutgoingversions().
2016-01-27 09:07:28 -08:00
Martin von Zweigbergk
19285a7ebc tests: minor cleanup to treemanifest test 2016-01-28 13:49:05 -08:00
Siddharth Agarwal
bfbbb007c7 merge: don't try to merge subrepos twice (issue4988)
In my patch series ending with rev c3f2eede6938 I switched most change/delete
conflicts to be handled at the resolve layer. .hgsubstate was the one file that
we weren't able to handle, so we kept the old code path around for it.

The old code path added .hgsubstate to one of the other lists as the user
specifies, including possibly the 'g' list.

Now since we did this check after converting the actions from being keyed by
file to being keyed by action type, there was nothing that actually removed
.hgsubstate from the 'cd' or 'dc' lists. This meant that the file would
eventually make its way into the 'mergeactions' list, now freshly augmented
with 'cd' and 'dc' actions.

We call subrepo.submerge for both 'g' actions and merge actions.

This means that if the resolution to an .hgsubstate change/delete conflict was
to add it to the 'g' list, subrepo.submerge would be called twice. It turns out
that this doesn't cause any adverse effects on Linux due to caching, but
apparently breaks on other operating systems including Windows.

The fix here moves this to before we convert the actions over. This ensures
that it .hgsubstate doesn't make its way into multiple lists.

The real fix here is going to be:
(1) move .hgsubstate conflict resolution into the resolve layer, and
(2) use a real data structure for the actions rather than shuffling data around
    between lists and dictionaries: we need a hash (or prefix-based) index by
    file and a list index by action type.

There's a very tiny behavior change here: collision detection on
case-insensitive systems will happen after this is resolved, not before. I think
this is the right change -- .hgsubstate could theoretically collide with other
files -- but in any case it makes no practical difference.

Thanks to Yuya Nishihara for investigating this.
2016-01-29 14:19:29 -08:00
Nathan Goldbaum
2d19c5b8f4 bookmarks: improve documentation for --rev option 2016-01-27 16:16:38 -06:00
Siddharth Agarwal
baf8fd47c7 merge: undocument checkunknown and checkignored configs for 3.7
We've discovered an issue with this flag during certain kinds of rebases. When:

(1) we're rebasing while currently on the destination commit, and
(2) an untracked or ignored file F is currently in the working copy, and
(3) the same file F is in a source commit, and
(4) F has different contents in the source commit,

then we'll try to merge the file rather than overwrite it.

An earlier patch I sent honored the options for these situations as well.
Unfortunately, rebases go through the same flow as the old, deprecated 'hg
merge --force'. We'd rather not make any changes to 'hg merge --force'
behavior, and there's no way from this point in the code to figure out whether
we're in 'hg rebase' or 'hg merge --force'.

Pierre-Yves David and I came up with the idea to split the 'force' flag up into
'force' for rebases, and 'forcemerge' for merge. Since this is a very
disruptive change and we're in freeze mode, simply undocument the options for
this release so that our hands aren't tied by BC concerns. We'll redocument
them in the next release.
2016-01-27 12:33:07 -08:00
FUJIWARA Katsunori
07d633b500 commands: advance current active bookmark at pull --update correctly
Before this patch, "hg pull --update" doesn't advance current active
bookmark correctly, if pulling itself doesn't advance it, even though
"hg pull" + "hg update" does so.

Existing test for "pull --update works the same as pull && update" in
test-bookmarks.t doesn't examine this case, because pulling itself
advance current active bookmark before actual updating the working
directory in that test case.

To advance current active bookmark at "hg pull --update" correctly,
this patch examines 'movemarkfrom' instead of 'not checkout'.

Even if 'not checkout' at the invocation of postincoming(), 'checkout'
is overwritten by "the revision to update to" value returned by
destutil.destupdate() in such case. Therefore, 'not checkout'
condition means "update destination is revision #0", and isn't
suitable for examining whether active bookmark should be advanced.

Even though examination around "movemarkfrom == repo['.'].node()" may
seem a little redundant just for this issue, this makes it easier to
compare (and unify in the future, maybe) with the same logic to update
bookmark at "hg update" below.

        if not ret and movemarkfrom:
            if movemarkfrom == repo['.'].node():
                pass # no-op update
            elif bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
                ui.status(_("updating bookmark %s\n") % repo._activebookmark)
            else:
                # this can happen with a non-linear update
                ui.status(_("(leaving bookmark %s)\n") %
                          repo._activebookmark)
                bookmarks.deactivate(repo)
2016-01-28 20:10:06 +09:00
Matt Harbison
6d46368119 largefiles: prevent committing a missing largefile
Previously, if the largefile was deleted at the time of a commit, the standin
was silently not updated and its current state (possibly garbage) was recorded.
The test makes it look like this is somewhat of an edge case, but the same thing
happens when an `hg revert` followed by `rm` changes the standin.

Aside from the second invocation of this in lfutil.updatestandinsbymatch()
(which is what triggers this test case), the three other uses are guarded by
dirstate checks for added or modified, or an existence check in the filesystem.
So aborting in lfutil.updatestandins() should be safe, and will avoid silent
skips in the future if this is used elsewhere.
2016-01-24 00:10:19 -05:00
Augie Fackler
db82034373 changegroup: fix treemanifest exchange code (issue5061)
There were two mistakes: one was accidental reuse of the fclnode
variable from the loop gathering file nodes, and the other (masked by
that bug) was not correctly handling deleted directories. Both cases
are now fixed and the test passes.
2016-01-27 10:24:25 -05:00
Matt Mackall
e2cfbb7c54 log: speed up single file log with hidden revs (issue4747)
On repos with lots of heads, the filelog() code could spend several
minutes decompressing manifests. This change instead tries to
efficiently scan the changelog for candidates and decompress as few
manifests as possible. This is a regression introduced in 3.3 by the
linkrev adjustment code. Prior to that, filelog was nearly instant.

For the repo in the bug report, this improves time of a simple log
command from ~3 minutes to ~.5 seconds, a 360x speedup.

For the main Mercurial repo, a log of commands.py slows down from
1.14s to 1.45s, a 27% slowdown. This is still faster than the file()
revset, which takes 2.1 seconds.
2016-01-22 12:08:20 -06:00
Matt Harbison
49d08bc58e largefiles: report the missing file count after a commit that does nothing
This is the same warning that is printed for normal files.
2016-01-23 23:32:49 -05:00
Matt Harbison
87e191502b commit: factor the post commit status check into a cmdutil method
The largefiles extension needs to set lfstatus for this status call.  Otherwise,
if a missing largefile is explicitly named, a confusing message is issued that
says the largefile wasn't found, followed by another that says nothing changed.
2016-01-23 23:24:30 -05:00
Matt Harbison
9906cb44b6 largefiles: fix an explicit largefile commit after a remove (issue4969)
The change in 6fce9a02f069 to handle a normal -> largefile switch was too
aggressive in preserving the original matcher names.  If a largefile is
explicitly provided by the user, but only the standin exists in dirstate, then
only the standin can be committed.

There's still maybe an issue when the largefile is deleted outside of Mercurial:

  $ rm large
  $ hg ci -m "oops" large
  large: The system cannot find the file specified
  nothing changed
  [1]
2016-01-23 20:51:17 -05:00
Martin von Zweigbergk
c04f1844f0 context: back out sneaky code change in documentation change
In a4119550f1e1 (context: clarify why we don't compare file contents
when nodeid differs, 2016-01-12), I also changed "node2 != _newnode"
into "self.rev() is not None". I don't remember why. They are similar,
but the former also catches the case where the file is clean in the
dirstate (so node2 is not _newnode), but different from the "other"
context. This resulted in unnecessary file content comparison a few
lines further down in the code. Let's just back out the code change.

Thanks to Durham Goode for spotting this.
2016-01-25 15:48:35 -08:00
Jun Wu
2c5ea7f03b chgserver: create new process group after fork (issue5051)
This is to make SIGTSTP work. Before the patch, the server process group is
considered "orphaned" and will ignore SIGTSTP, SIGTTIN, SIGTTOU, according to
POSIX. See the comment above `will_become_orphaned_pgrp` in `kernel/exit.c`
from Linux 4.3 for details.

SIGTSTP is important if chgserver runs some ncurses commend like `commit -i`.
Ncurses has its own SIGTSTP handler which will do the following:

  1. Clean the screen
  2. Stop itself by resending SIGTSTP to itself
  3. Restore the screen

If SIGTSTP is ignored, step 2 will be a noop, which means the process cannot
be suspended properly.

In order to make things work, chg client needs to forward SIGTSTP and SIGCONT
to server as well.
2016-01-19 18:20:13 +00:00
Matt Mackall
9b78d1a779 check-commit: check for double-addition of blank lines
Previously, we were only checking for a blank line being added next to
an existing one. Now we also check for two being added at the same time.
2016-02-05 16:54:01 -06:00
Matt Mackall
925e4d9b93 check-commit: scan for multiple instances of error patterns 2016-02-05 16:52:02 -06:00