Commit Graph

27769 Commits

Author SHA1 Message Date
Yuya Nishihara
ec5b4c4575 help: update template examples to use reST literal syntax
This should prevent processing backslashes as reST syntax elements. Before
this patch, '\' was lost in HTML and man pages.
2016-02-05 23:17:07 +09:00
Yuya Nishihara
02e214117d ui: fix crash by non-interactive prompt echo for user name
Since we've dropped a str cast at write() by 7dbd3db608c5, ui.prompt() should
convert default to '' if it is None. Otherwise, write() would fail with
"TypeError: object of type 'NoneType' has no len()".

This patch includes the tests for both interactive and non-interactive cases
because "ui.askusername" was never tested.
2016-02-06 20:43:20 +09:00
Yuya Nishihara
61b45241f5 zeroconf: forward all arguments passed to ui.configitems() wrapper
cf6cc5344afa added 'ignoresub' argument to ui.configitems(), but zeroconf
wrapper wasn't updated. It caused the following crash:

  Traceback (most recent call last):
    File "bin/hg", line 43, in <module>
      mercurial.dispatch.run()
    File "lib/python/mercurial/dispatch.py", line 54, in run
      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
    File "lib/python/mercurial/dispatch.py", line 120, in dispatch
      ret = _runcatch(req)
    File "lib/python/mercurial/dispatch.py", line 191, in _runcatch
      return _dispatch(req)
    File "lib/python/mercurial/dispatch.py", line 924, in _dispatch
      cmdpats, cmdoptions)
    File "lib/python/mercurial/dispatch.py", line 681, in runcommand
      ret = _runcommand(ui, options, cmd, d)
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
    File "lib/python/hgext/zeroconf/__init__.py", line 180, in cleanupafterdispatch
      return orig(ui, options, cmd, cmdfunc)
    File "lib/python/mercurial/dispatch.py", line 1055, in _runcommand
      return checkargs()
    File "lib/python/mercurial/dispatch.py", line 1015, in checkargs
      return cmdfunc()
    File "lib/python/mercurial/dispatch.py", line 921, in <lambda>
      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
    File "lib/python/mercurial/util.py", line 991, in check
      return func(*args, **kwargs)
    File "lib/python/mercurial/commands.py", line 5405, in paths
      pathitems = sorted(ui.paths.iteritems())
    File "lib/python/mercurial/util.py", line 723, in __get__
      result = self.func(obj)
    File "lib/python/mercurial/ui.py", line 619, in paths
      return paths(self)
    File "lib/python/mercurial/ui.py", line 1099, in __init__
      for name, loc in ui.configitems('paths', ignoresub=True):
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
  TypeError: configitems() got an unexpected keyword argument 'ignoresub'

We have no test coverage for zeroconf, so I've added a minimal test that
could reproduce this problem.
2016-02-10 22:53:17 +09: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
Yuya Nishihara
1f60c51fa5 templater: abort if infinite recursion detected while compiling
In this case, a template is parsed recursively with no thunk for lazy
evaluation. This patch prevents recursion by putting a dummy of the same name
into a cache that will be referenced while parsing if there's a recursion.

  changeset = {files % changeset}\n
                       ~~~~~~~~~
                        = [(_runrecursivesymbol, 'changeset')]
2015-07-23 23:41:29 +09:00
Yuya Nishihara
554208ae8f templater: abort if infinite recursion detected while evaluation (issue4758)
It would be nice if we could detect recursion at the parsing phase, but we
can't because a template can refer to a keyword of the same name. For example,
"rev = {rev}" is valid if rev is a keyword, and we don't know if rev is a
keyword or a template while parsing.
2015-07-22 23:29:41 +09:00
Martin von Zweigbergk
d1531da666 exchange: set 'treemanifest' param on pushed changegroups too
In 7a1ccfe03f74 (treemanifests: set bundle2 part parameter indicating
treemanifest, 2016-01-08), I didn't realize I had to set the parameter
separately for getbundle and unbundle. Having the parameter there on
push allows us to push to an empty repo and have the requirements
updated correctly.
2016-01-22 16:31:50 -08:00
Laurent Charignon
f5b5bd3884 crecord: fix help bar display issue (issue5063)
Before this patch, the help bar in crecord wouldn't be printed correctly when
the terminal window didn't have enough column to display it. This patch adds
logic to make sure that the help bar message is always displayed. We use an
ellipsis when it is not possible to display the complete message.
2016-01-25 11:37:02 -08:00
Laurent Charignon
f009465327 crecord: fix typo in the help text
In the crecord help dialog, the toggle all option was wrongfully documented.
Instead of using 'a', one must use 'A' to toggle all the hunks. The crecord
header that is always displayed on the screen contains the right shortcut and
does not need to be changed.
2016-01-25 10:13:03 -08:00
Mason Malone
081f032818 subrepo: better error messages in _ensuregit
This patch improves the error messages raised when an OSError occurs, since
simply re-raising the exception can be both confusing and misleading. For
example, if "hg identify" is run inside a repository that contains a Git
subrepository and the git binary could not be found, it'll exit with the message
"abort: No such file or directory". That implies "identify" has a problem
reading the repository itself. There's no way for the user to know what the
real problem is unless they dive into the Mercurial source, which is what I
ended up doing after spending hours debugging errors while provisioning a VM
with Ansible (turns out I forgot to install Git on it).

Descriptive errors are especially important on Windows, since it's common for
Windows users to forget to set the "Path" system variable after installing Git.
2016-01-17 22:53:57 -05:00
Anton Shestakov
f6e436f317 hgweb: update canvas.width before dynamically redrawing graph (issue2683)
After 313b8d61b548 graph canvas width is decided once on the initial rendering.
However, after graph page gets scrolled down to load more, it might need more
horizontal space to draw, so it needs to resize the canvas dynamically.

The exact problem that this patch solves can be seen using:

    hg init testfork
    cd testfork
    echo 0 > foo
    hg ci -Am0
    echo 1 > foo
    hg ci -m1
    hg up 0
    echo 2 > foo
    hg ci -m2
    hg gl -T '{rev}\n'

    @  2
    |
    | o  1
    |/
    o  0

    hg serve

And then by navigating to http://127.0.0.1:8000/graph/tip?revcount=1

"revcount=1" makes sure the initial graph contains only revision 2. And because
the initial canvas width takes only that one revision into count, after the
(immediate) AJAX update revision 1 will be cut off from the graph.

We can safely set canvas width to the new value we get from the AJAX request
because every time graph is updated, it is completely redrawn using all the
requested nodes (in the case above it will use /graph/2?revcount=61), so the
value is guaranteed not to decrease.

P.S.: Sorry for parsing HTML with regexes, but I didn't start it.
2016-01-23 17:31:31 +08:00
Bryan O'Sullivan
95a960a422 run-tests: "fix" race condition in race condition fix
Laurent's commit 56cdfddbd2ed still suffers from a race: by the
time the "job" function tries to assign to channels[channel], that
list has been truncated to empty.  The result is that every job
thread raises an IndexError.

Earlier, I tried an approach of correctly locking channels, but
that caused run-tests to hang on KeyboardInterrupt sometimes.

This approach is strictly hackier, but seems to actually work
reliably.
2016-01-22 11:00:13 -08:00