Commit Graph

34951 Commits

Author SHA1 Message Date
Matt Harbison
fa06b74028 lfs: enable the extension locally after sharing a repo with 'lfs' requirement
This is consistent with clone in the previous commit.
2017-11-16 21:01:21 -05:00
Matt Harbison
26786fa7df lfs: enable the extension locally after cloning a repo with 'lfs' requirement
We do the same thing on clone for the largefiles extension, as a convenience.
Similar to largefiles, it's probably safer to only enable this extension on a
per repo basis because it is trivial to add an lfs file.  And that gives the
repository some centralized VCS characteristics.
2017-11-16 20:23:20 -05:00
Yuya Nishihara
2c811cd701 log: translate column labels at once (issue5750)
This makes sure that all columns are aligned. getlogcolumns() is hosted by
templatekw so the namespaces module can see it.

i18n/de.po is updated so test-log.t passes with no error. "obsolete:" and
"instability:" are kept untranslated.
2017-12-02 16:29:49 +09:00
Yuya Nishihara
9d926f0131 log: remove temporary variable 'date' used only once 2017-12-02 16:08:24 +09:00
Augie Fackler
bfcc4b085d merge with stable 2017-12-04 11:28:29 -05:00
Matt Harbison
ffc3cccdf4 convert: restore the ability to use bzr < 2.6.0 (issue5733)
This effectively conditionalizes 7ac081713920.  Some Linux distributions (like
CentOS 7) use really old versions, and the change referenced was causing
exceptions to be thrown.

Even though the deprecation warning says 'since 2.5.0', it wasn't marked as such
in 2.5.1, but is by 2.6.0.  This was tested with 2.4.2 and 2.6.0 with
PYTHONWARNINGS=::DeprecationWarning, and both paths were exercized.
2017-12-01 23:27:08 -05:00
Kevin Bullock
83140eecbb Added signature for changeset f51ae48a3fd9 2017-12-01 13:49:47 -06:00
Boris Feld
6fefecff91 lock: allow to configure when the lock messages are displayed
We add a new 'ui.timeout.warn' config to set a grace period before we display
lock related warning:

    waiting for lock on PATH held by PROCESS

The config is based on 'ui.timeout' and expresses a number of seconds before
the warning is displayed. Negative values disable the warning altogether.

The messages go to the debug output to help people trouble-shooting deadlocks.
2017-11-29 20:39:59 -05:00
Boris Feld
87115045d0 lock: add a trylock method handling the timeout and messaging logic
We are about to make the messages around lock more flexible. We move all the
currently logic into a function in the lock module. We'll update the message
scheme in the next changeset.
2017-11-29 20:36:29 -05:00
Boris Feld
ce5945f52a lock: use configint for 'ui.timeout' config
The ui object can do the conversion itself.
2017-11-29 21:00:02 -05:00
Boris Feld
d4021aee4f scmutil: improve format pattern used in nodesummaries
As spotted by Yuya Nishihara, that value is an integer.
2017-12-04 09:39:37 +01:00
Matt Harbison
c0662d6461 tests: trivial fixes for Windows 2017-12-02 17:52:53 -05:00
Pulkit Goyal
174b204536 py3: use encoding.strtolocal() to convert string to bytes
Differential Revision: https://phab.mercurial-scm.org/D1557
2017-11-29 08:40:25 +05:30
Pulkit Goyal
4aa252d4b0 py3: use pycompat.bytestr() or '%d' in place of str()
Differential Revision: https://phab.mercurial-scm.org/D1556
2017-11-29 08:39:48 +05:30
James May
12adeba8fa archive: pass thru mtime for directory archives, like other archive types do
Without this files in the output archive directory have their mtimes set to
whatever time they were written their.  This is in this inconsistent with
the other archivers, eg. zip, which use exactly the same time for all files.

Works on my machine (Windows), but I don't have a *nix box available to run
anything more thorough, unfortunately.
2017-12-01 17:39:21 +11:00
Anton Shestakov
41e5f7f794 hgweb: remove negative top from .info line in graph
"top: -Xpx" shifts a block up by X pixels, which can be used to visually
compress two lines of text to have less space between them, in this case it's
used for the changesets on /graph page. But not only it's not needed there
(both lines fit fine into their allowed vertical space), but it would also look
better (not as crammed, more vertically centered) without these negative
values.

"position: relative" is needed solely for the "top" property to have effect on
the element, no children of the .info element rely on it, so let's remove it as
well.
2017-12-01 20:33:02 +08:00
Pulkit Goyal
0456ca2613 unamend: drop unused vars, query after taking lock, use ctx.hex() for extras
This is the followup of review on D821.

Differential Revision: https://phab.mercurial-scm.org/D1579
2017-12-03 00:29:51 +05:30
Matt Harbison
a3597c86d6 test-lfs: drop a hack for ignoring convert devel-warnings
This was fixed on stable in 90e6d6ae632d.
2017-12-01 22:40:55 -05:00
Pulkit Goyal
6d1ddd1aef py3: use bytes in place of basestring
All strings in mercurial must be bytes so we can easily replace basestring with
bytes.

Differential Revision: https://phab.mercurial-scm.org/D1555
2017-12-01 16:53:55 +05:30
Martin von Zweigbergk
9ca0e39e98 amend: make a copy of "extra" to avoid mutating an input
I don't know of any problems this has caused, it just seems less
surprising.

Differential Revision: https://phab.mercurial-scm.org/D1575
2017-12-01 14:13:55 -08:00
Pulkit Goyal
262d41547f tests: removes bashism from test-unamend.t
FreeBSD builders fail because of bashism.

Differential Revision: https://phab.mercurial-scm.org/D1578
2017-12-02 06:32:41 +05:30
Martin von Zweigbergk
96e10ab37b run-tests: avoid calculating _testdir again
Differential Revision: https://phab.mercurial-scm.org/D1574
2017-12-01 12:28:05 -08:00
Martin von Zweigbergk
ca0a21ad2a run-tests: simplify by using dict.pop() with default
Differential Revision: https://phab.mercurial-scm.org/D1573
2017-12-01 12:27:28 -08:00
Mark Thomas
107956c510 merge: check created file dirs for path conflicts only once (issue5716)
In large repositories, updates involving the creation of many files check the
same directories repeatedly in the wctx manifest.  Move these checks out to a
separate loop to avoid repeated checks hitting the manifest.

Differential Revision: https://phab.mercurial-scm.org/D1226
2017-11-24 12:53:58 -08:00
Mark Thomas
2f4962c2a4 merge: cache unknown dir checks (issue5716)
As mentioned in D1222, the recent pathconflicts change regresses update
performance in large repositories when many files are being updated.

To mitigate this, we introduce two caches of directories that have
already found to be either:

  - unknown directories, but which are not aliased by files and
    so don't need to be checked if they are files again; and

  - missing directores, which cannot cause path conflicts, and
    cannot contain a file that causes a path conflict.

When checking the paths of a file, testing against this caches means we can
skip tests that involve touching the filesystem.

Differential Revision: https://phab.mercurial-scm.org/D1224
2017-11-24 12:53:58 -08:00
Yuya Nishihara
5ff5d9b38c dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
If this feature is enabled, early options are parsed using the global options
table. As the parser stops processing options when non/unknown option is
encountered, it won't mistakenly take an option value as a new early option.
Still "--" can be injected to terminate the parsing (e.g. "hg -R -- log"), I
think it's unlikely to lead to an RCE.

To minimize a risk of this change, new fancyopts.earlygetopt() path is enabled
only when +strictflags is set. Also the strict parser doesn't support '--repo',
a short for '--repository' yet. This limitation will be removed later.

As this feature is backward incompatible, I decided to add a new opt-in
mechanism to HGPLAIN. I'm not pretty sure if this is the right choice, but
I'm thinking of adding +feature/-feature syntax to HGPLAIN. Alternatively,
we could add a new environment variable. Any bikeshedding is welcome.

Note that HGPLAIN=+strictflags doesn't work correctly in chg session since
command arguments are pre-processed in C. This wouldn't be easily fixed.
2017-11-23 22:17:03 +09:00
Yuya Nishihara
b0d1fec38b fancyopts: add early-options parser compatible with getopt()
The next patch will add a flag for strict parsing of early options, where
we'll have to parse all early options at once instead of processing them
one-by-one by dispatch._earlygetopt(). That's why I decided to hook
fancyopts().

All dispatch._early*opt() functions is planned to be replaced with this
function. But in this stable series, only the strict mode will be handled
by fancyopts.earlygetopt().
2017-11-23 22:04:53 +09:00
Gregory Szorc
58c39c1c8d py3: use byteskwargs in sparse.py
This removes several dozen failures in Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1482
2017-11-20 23:23:10 -08:00
Gregory Szorc
32815ee95d py3: define __next__ in patch.py
This needed to appease Python 3's iterator protocol.

This is crasher #5 in Python 3.

Differential Revision: https://phab.mercurial-scm.org/D1480
2017-11-20 23:13:09 -08:00
Gregory Szorc
99a062e473 run-tests: mechanism to report exceptions during test execution
Sometimes when running tests you introduce a ton of exceptions.
The most extreme example of this is running Mercurial with Python 3,
which currently spews thousands of exceptions when running the test
harness.

This commit adds an opt-in feature to run-tests.py to aggregate
exceptions encountered by `hg` when running tests.

When --exceptions is used, the test harness enables the
"logexceptions" extension in the test environment. This extension
wraps the Mercurial function to handle exceptions and writes
information about the exception to a random filename in a directory
defined by the test harness via an environment variable. At the
end of the test harness, these files are parsed, aggregated, and
a list of all unique Mercurial frames triggering exceptions is
printed in order of frequency.

This feature is intended to aid Python 3 development. I've only
really tested it on Python 3. There is no shortage of improvements
that could be made. e.g. we could write a separate file containing
the exception report - maybe even an HTML report. We also don't
capture which tests demonstrate the exceptions, so there's no turnkey
way to test whether a code change made an exception disappear.
Perfect is the enemy of good. I think the current patch is useful
enough to land. Whoever uses it can send patches to imprve its
usefulness.

Differential Revision: https://phab.mercurial-scm.org/D1477
2017-11-20 23:02:32 -08:00
Gregory Szorc
913e1deefc run-tests: make --extra-config-opt work with Python 3
And add test coverage to ensure it works.

Differential Revision: https://phab.mercurial-scm.org/D1476
2017-11-20 21:26:11 -08:00
Gregory Szorc
c1ab166a69 run-tests: organize options into argument groups
And sort arguments so help output is more legible.

There are probably a ton of ways to group things. I tried to
picture the test harness as a pipeline and attempted to draw boundaries
around stages in that pipeline to create the groupings.

Differential Revision: https://phab.mercurial-scm.org/D1475
2017-11-20 21:08:18 -08:00
Gregory Szorc
cead888098 run-tests: convert to argparse
optparse has been deprecated since Python 3.2. Best to get on the new
boat before the old one sinks.

It looks like argparse formats its usage string differently than
optparse. Meh.

Differential Revision: https://phab.mercurial-scm.org/D1474
2017-11-20 20:41:43 -08:00
Kevin Bullock
c86342f882 merge with stable 2017-12-01 15:21:05 -06:00
Boris Feld
13f89f2060 server: introduce a 'experimental.single-head-per-branch' option
When the option is set, the repository will reject any transaction adding
multiple heads to the same named branch.

For now we reject all scenario with multiple heads. One could imagine handling
closed branches differently. We prefer to keep things simple for now. The
feature might get extended later. Branch closing is not the best experience
Mercurial has to offer anyway.
2017-11-16 03:52:42 +01:00
Boris Feld
b51190da4b scmutil: extra utility to display a reasonable amount of nodes
Push have some logic to display a reasonable amount nodes. We extract it to an
utility function to make it reusable.
2017-11-16 03:52:38 +01:00
Matt Harbison
c1ef7c5a7a largefiles: pay attention to dropped standin files when updating largefiles
Previously, the largefile for a dropped standin would be deleted here, and then
restored from the cache.  This had the effect of clobbering uncommitted changes
if a revert caused the file to be forgotten, which is not what happens with a
normal file.  Now the removal and update is skipped for dropped largefiles, and
the corresponding standin is deleted from disk.

This was noticed when working on issue5738 because the forgotten standin files
were left behind, and that changes the behavior of the next rename to that
directory.  My first attempt was to cleanup the standins before calling this.
That failed, because this function deletes the largefile if the corresponding
standin is missing.

This function is called by the revert command, merge (and therefore update), and
patch, via the scmutil.marktouched() override.  So it should be pretty narrow in
scope.

I didn't mark issue5738 as fixed because the move related issues can still
happen if the main tree and the .hglf subtree get out of sync somehow.  I don't
see an easy fix for that, but that should be an edge case.  If whoever queues
this thinks it is good enough to close out the bug and can cram it into the
summary, go for it.
2017-11-12 23:45:14 -05:00
Matt Harbison
9d58e7d4a4 test-largefiles: demonstrate problems with renaming and reverting a directory
These things were uncovered looking at issue5738.

First, if the destination directory exists under .hglf, the source is moved
under the destination instead of renaming the last component for `hg mv srcdir
dstdir`.  This is extra confusing, because it occurs even if the user visible
destination (i.e. the path _not_ under .hglf) does not exist.

Additionally, when a largefile is forgotten via revert, any modifications end up
getting clobbered.  For normal files, the forgotten file is left unchanged, as
shown by test-import.t.  The forget command on a largefile will correctly leave
the file unmodified.
2017-11-12 00:24:38 -05:00
Matt Harbison
d913b0c5b9 tests: add globs for Windows 2017-11-11 12:37:05 -05:00
Yuya Nishihara
d46d87090c cat: record the current behavior of wildcard matches in subrepos
Mercurial subrepos support any match patterns.
2017-11-25 15:29:34 +09:00
Augie Fackler
285d5a2a3b merge with i18n 2017-11-29 17:49:08 -05:00
Matt Harbison
40cf71ae24 convert: avoid wrong lfconvert defaults by moving configitems to core
The `hg lfconvert --to-normal` command uses the convert extension internally to
work its magic, but that produced devel-warn messages if the convert extension
wasn't loaded by the user.  The test in 658e7a6d93e0 (modified here) wasn't
showing the warnings because the convert extension was loaded via $HGRCPATH.
Most of the config options default to None/False, but 'hg.usebranchnames' and
'hg.tagsbranch' are supposed to default to True and 'default' respectively.

The first iteration of this was to ui.setconfig() inside lfconvert, to force the
convert extension to load.  But there really is no precedent for doing this, and
check-config complained that 'extensions.convert' isn't documented.  Yuya
suggested this alternative.

This partially backs out 448e09d8859d.
2017-11-28 23:20:08 -05:00
Boris Feld
cf402c02f7 tr-summary: keep a weakref to the unfiltered repository
Repoview can have a different life cycle, causing issue in some corner
cases. The particular instance that revealed this comes from localpeer. The
localpeer hold a reference to the unfiltered repository, but calling 'local()'
will create an on-demand 'visible' repoview. That repoview can be garbaged
collected any time. Here is a simplified step by step reproduction::

    1) tr = peer.local().transaction('foo')
    2) tr.close()

After (1), the repoview object is garbage collected, so weakref used in (2)
point to nothing.


Thanks to Sean Farley for helping raising and debugging this issue.
2017-11-24 21:51:41 -05:00
Wagner Bruna
9766674d68 i18n-pt_BR: synchronized with f1d5a55d6a57 2017-11-21 13:50:25 -02:00
Yuya Nishihara
52b06fe73d dispatch: verify result of early command parsing
Before, early options were stripped from args, and because of this, some
kind of parsing errors weren't reported. For example,

  $ hg ci -m -Ra file

would execute "hg ci -m file" in repository "a".

This patch fixes the issue by parsing early options again by real getopt-based
parser, and verifying the results. If the early parsing appears wrong, hg just
aborts. The current error message seems not nice, and should be improved, maybe
in V2 or follow-up.

Note that this isn't a security feature because we can still do anything by
using shell aliases.
2017-11-11 12:40:13 +09:00
Yuya Nishihara
fccba4aa77 dispatch: convert non-list option parsed by _earlygetopt() to string
So we can easily compare it with the corresponding getopt() result.

There's a minor behavior change. Before, "hg --cwd ''" failed with ENOENT.
But with this patch, an empty cwd is silently ignored. "hg -R ''" has always
worked as such, so -R has no BC.
2017-11-11 17:55:15 +09:00
Yuya Nishihara
f9dd555dd4 dispatch: add option to not strip command args parsed by _earlygetopt()
This allows us to parse the original args later by full-blown getopt() in
order to verify the result of the faulty early parsing. Still we need the
'strip=True' behavior for shell aliases.

Note that this series is RFC because it seems to change too much to be
included in stable release.
2017-11-11 16:46:41 +09:00
Yuya Nishihara
333fc1d401 dispatch: fix early parsing of short option with value like -R=foo
Before, -R=foo was parsed as '-R' 'foo', which disagrees with the standard
getopt behavior.
2017-11-14 00:25:59 +09:00
Yuya Nishihara
82ae4401fe dispatch: abort if early boolean options can't be parsed
Perhaps we'll need to restrict the parsing rules of --debugger and --profile,
where this patch will help us know why the --debugger option doesn't work.

I have another series to extend this feature to --config/--cwd/-R, but even
with that, shell aliases can be used to get around the restriction.
2017-11-11 14:02:41 +09:00
Yuya Nishihara
8f01395e02 dispatch: stop parsing of early boolean option at "--" 2017-11-10 22:27:26 +09:00