Commit Graph

34421 Commits

Author SHA1 Message Date
Ryan McElroy
25aff2d866 merge: ensure that we always commit the mergestate
In future patches, we may halt the merge process based on configuration or
user requests by raising exceptions. We need to ensure that the mergestate
is unconditionally committed even when such an exception is raised.

Depends on D930.

Differential Revision: https://phab.mercurial-scm.org/D931
2017-10-06 06:48:43 -07:00
Ryan McElroy
81a06c93fe merge: add tests to show current behavior on failed filemerges
Currently, failed file merges will nevertheless force the user to continue
attempting to merge all additional unresolved files. Future patches will allow
the user to halt the merge process instead. This patch first introduces a test
demonstrating the current bejhavior so the upcoming changes are more obvious.

Differential Revision: https://phab.mercurial-scm.org/D930
2017-10-06 06:48:43 -07:00
Durham Goode
1d4b04170c dirstate: move the _dirfoldmap to dirstatemap
Now that dirstatemap is the source of truth for the list of directories, let's
move _dirfoldmap on to it.

This pattern of moving cached variables onto the dirstate map makes it easier to
invalidate them, as seen by how the cache invalidation functions are slowly
shrinking to just be recreating the dirstatemap instance.

Differential Revision: https://phab.mercurial-scm.org/D983
2017-10-05 11:34:41 -07:00
Durham Goode
e37fd6649b dirstate: remove _dirs property cache
Now that dirs is source of truthed on the dirstatemap, let's get rid of the
_dirs propertycache on the dirstate.

Differential Revision: https://phab.mercurial-scm.org/D982
2017-10-05 11:34:41 -07:00
Durham Goode
1b9b3caa47 dirstate: remove _filefoldmap property cache
Now that the filefoldmap is source of truthed on the dirstatemap, let's get rid
of the property cache on the dirstate.

Differential Revision: https://phab.mercurial-scm.org/D981
2017-10-05 11:34:41 -07:00
Durham Goode
28f48a6846 dirstate: move identity to dirstatemap
Moving the identity function to the dirstatemap class will allow alternative
dirstate implementations to replace the implementation.

Differential Revision: https://phab.mercurial-scm.org/D980
2017-10-05 11:34:41 -07:00
Durham Goode
f97f617524 dirstate: move nonnormal and otherparent sets to dirstatemap
As part of separating dirstate business logic from storage, let's move the
nonnormal and otherparent storage to the dirstatemap class. This will allow
alternative dirstate storage to persist these sets instead of recomputing them.

Differential Revision: https://phab.mercurial-scm.org/D979
2017-10-05 11:34:41 -07:00
Durham Goode
99779c0bbb dirstate: move write into dirstatemap
As part of separating the dirstate business logic from the dirstate storage
logic, let's move the serialization code down into dirstatemap.

Differential Revision: https://phab.mercurial-scm.org/D978
2017-10-05 11:34:41 -07:00
Durham Goode
76bcc9b3be dirstate: move _read into dirstatemap
As part of separating the dirstate business logic from the storage, let's move
the read code into the new dirstatemap class.

Differential Revision: https://phab.mercurial-scm.org/D977
2017-10-05 11:34:41 -07:00
Boris Feld
7fa654bef2 configitems: register the 'templates' section 2017-10-08 21:29:24 +02:00
Boris Feld
1dca7c7296 configitems: register the 'paths' config section 2017-10-11 05:01:55 +02:00
Boris Feld
2ea04ee5d5 configitems: register the 'pager.attend-.*' options 2017-10-11 02:26:09 +02:00
Boris Feld
9296910ea4 configitems: register the 'hooks' config section 2017-10-13 16:39:06 +02:00
Boris Feld
0748d57ee7 configitems: register the 'extensions' section 2017-10-10 10:48:47 +02:00
Boris Feld
90436ba7a8 configitems: register the 'defaults' section 2017-10-08 20:39:51 +02:00
Boris Feld
04cc694185 configitems: register the 'committemplate' section 2017-10-08 21:02:02 +02:00
Boris Feld
abe633ebaf configitems: register the 'color' section 2017-10-10 10:49:28 +02:00
Boris Feld
101b5cf034 configitems: register the 'alias' section 2017-10-08 20:26:25 +02:00
Boris Feld
f9a854f7cf configitems: allow for the registration of "generic" config item
Some section can contains arbitrary keys (eg: color, alias, extensions). We
add a way to register some generic config items for them. This is necessary to
get all the config registered. We use a regular expression because some sub-
attributes (eg: hooks.xxx.priority) can define default value on their own.
2017-10-10 10:49:15 +02:00
Denis Laxalde
9efc7f05e3 transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Upon pull or unbundle, we display a message with the range of new revisions
fetched. This revision range could readily be used after a pull to look out
what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
revisions that might be present in transaction's "changes" but should not be
displayed to the end user.
2017-10-12 09:39:50 +02:00
Yuya Nishihara
1b540c162d i18n: cache translated messages per encoding
This is a simpler workaround alternative to D958, "i18n: clean msgcache when
encoding changes." The cache won't be bloated unless you run tons of commands
with different --encoding options on command server, or serve many repositories
of different web.encoding options on hgweb.

The test was originally written by Jun Wu.

Differential Revision: https://phab.mercurial-scm.org/D1053
2017-10-13 21:36:10 +09:00
Yuya Nishihara
239bc0e96c templater: fix ifcontains() to handle type mismatch gracefully
This was unintentionally changed in b8023e389b64. Since ifcontains() takes
needle of any types, it shouldn't abort depending on the given container type.
2017-10-12 22:09:11 +09:00
Yuya Nishihara
11659330ed help: use single quotes in `template example`
It was hard to read because ``""`` was rendered as """".
2017-10-12 21:56:13 +09:00
Yuya Nishihara
b3bcc5233c help: hide template keywords of obsolescence as they are still experimental 2017-10-12 21:48:02 +09:00
Yuya Nishihara
c9014c6361 help: fix formatting of template keywords
Our minirst formatter can't render multi-paragraph definition lists well.
Also added periods where appropriate.
2017-10-12 21:42:42 +09:00
Yuya Nishihara
9618d42102 chg: remove outdated rule to start test server
This rule is no longer useful because chg daemon may be killed and respawned
per config/environment hash. We can't reliably run a daemon in foreground.
2017-10-12 22:21:14 +09:00
Yuya Nishihara
a312ee40fa configitems: drop redundant default of web.allow<archtype>
Otherwise develwarn would be sent to stderr. I've added blackbox logging
to capture warnings.
2017-10-13 00:22:54 +09:00
Yuya Nishihara
607219189c configitems: correct default values of web.allow<archtype> and web.hidden
The default of ui.configbool() is False unless explicitly specified.
2017-10-13 00:14:28 +09:00
Yuya Nishihara
1f85a4e152 bdiff: include compat.h in header to define ssize_t
Before cb121eb76276, compat.h was included first so it happened to work.
But we shouldn't rely on the include order.
2017-10-13 22:38:24 +09:00
Boris Feld
97857d3a8e test: add an extra case for obsolescence distributed case
This changeset introduces a new documented test case for a distributed
obsolescence scenario. The scenario involves a simple case where some
obsolescence markers are retrieved before the changeset they affect. See the
test case documentation for details.

We also test variants where the changesets are added from a bundle.
2017-09-30 22:37:20 +01:00
Boris Feld
49725ddf88 test: add a test file dedicated to an important distributed case
This test file introduces documented test case for obsolescence markers usage
that are important to distributed workflow cases.

In the distributed case, new changesets, markers, and phases can be added in
orders that would not happen during the local only usage. Documenting these
scenarios and test them is important as we make progress with various
obsolescence aspects.
2017-09-29 19:59:15 +01:00
Pulkit Goyal
9492c3a9ec repoview: remove incorrect documentation of the function
In repoview.py, computeunserved() and computemutable() functions had the same
documentation. The documentation of computemutable() is wrong. I was unable to
write documentation for the function but it's better to not having the
documentation than having it wrong.

Differential Revision: https://phab.mercurial-scm.org/D1016
2017-10-10 23:19:35 +05:30
Jun Wu
b882ee58de check-code: suggest pycompat.is(posix|windows|darwin)
Differential Revision: https://phab.mercurial-scm.org/D1037
2017-10-12 09:34:58 -07:00
Jun Wu
79d026fdfe codemod: use pycompat.isdarwin
This is done by:

  sed -i "s/pycompat\.sysplatform == 'darwin'/pycompat.isdarwin/" **/*.py

Plus a manual change to `sslutil.py` which involves indentation change that
cannot be done by `sed`.

Differential Revision: https://phab.mercurial-scm.org/D1035
2017-10-12 23:34:34 -07:00
Jun Wu
72d17900ca codemod: use pycompat.isposix
This is done by:

  sed -i "s/pycompat\.osname == 'posix'/pycompat.isposix/" **/*.py

Differential Revision: https://phab.mercurial-scm.org/D1036
2017-10-12 09:04:22 -07:00
Jun Wu
2ae56b14de codemod: use pycompat.iswindows
This is done by:

  sed -i "s/pycompat\.osname == 'nt'/pycompat.iswindows/" **/*.py
  sed -i "s/pycompat\.osname != 'nt'/not pycompat.iswindows/" **/*.py
  sed -i 's/pycompat.osname == "nt"/pycompat.iswindows/' **/*.py

Differential Revision: https://phab.mercurial-scm.org/D1034
2017-10-12 23:30:46 -07:00
Jun Wu
7b62930cd9 pycompat: define operating system constants
As suggested by Ryan in D1019, it's cleaner if we use defined constants
instead of `osname == 'nt'` everywhere.

Differential Revision: https://phab.mercurial-scm.org/D1033
2017-10-12 19:20:04 -07:00
Jun Wu
d91707e2a4 hgweb: do not import uuid immediately to avoid its side effect
With hgdemandimport disabled (chg's case), `import uuid` has an immediate
side effect calling `ctypes.util.find_library` trying to locate the
`libuuid` library.  This happens at `import` time before `dispatch.run()`.
The call trace is like:

  File "hg/hg", line 54, in <module>
    from mercurial import (
  File "hg/mercurial/dispatch.py", line 24, in <module>
    from . import (
  File "hg/mercurial/commands.py", line 23, in <module>
    from . import (
  File "hg/mercurial/help.py", line 33, in <module>
    from .hgweb import (
  File "hg/mercurial/hgweb/__init__.py", line 20, in <module>
    from . import (
  File "hg/mercurial/hgweb/hgweb_mod.py", line 14, in <module>
    from .common import (
  File "hg/mercurial/hgweb/common.py", line 15, in <module>
    import uuid
  File "/usr/lib64/python2.7/uuid.py", line 404, in <module>
    lib = ctypes.CDLL(ctypes.util.find_library(libname))

The problem is, `ctypes.util.find_library` will execute
`sh -c '/sbin/ldconfig -p 2>/dev/null'` on Python <= 2.7.12. The output of
`sh` may pollute the terminal:

  shell-init: error retrieving current directory: getcwd: cannot access
  parent directories: No such file or directory

This patch moves `import uuid` so its side-effect can only happen after the
cwd check in `dispatch._getlocal`. Therefore the terminal won't be
polluted by importing `uuid`.

Differential Revision: https://phab.mercurial-scm.org/D1024
2017-10-11 21:24:32 -07:00
Jun Wu
6c6917ead6 check-code: forbid platform.system()
See the previous patches for the reason.

Differential Revision: https://phab.mercurial-scm.org/D1021
2017-10-11 17:42:57 -07:00
Jun Wu
fdee39a8b7 largefiles: do not use platform.system()
See the previous patch for the reason.

Differential Revision: https://phab.mercurial-scm.org/D1020
2017-10-11 17:42:35 -07:00
Jun Wu
ac8158995b logtoprocess: do not use platform.system()
See the previous patch for the reason.

Differential Revision: https://phab.mercurial-scm.org/D1019
2017-10-11 17:38:20 -07:00
Jun Wu
7f6381a6d9 selectors2: do not use platform.system()
`platform.system()` may have a side effect spawning a shell executing
`uname -p`, which may print a warning when the current directory is removed:

  shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

This patch changes selectors2 to test the `sys.platform` string, which is a
much safer way to detect Jython.

Jython's `sys.platform` looks like this:

  Jython 2.7.1 (default:0df7adb1b397, Jun 30 2017, 19:02:43)
  [OpenJDK 64-Bit Server VM (Oracle Corporation)] on java1.8.0_144
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> sys.platform
  'java1.8.0_144 ( ==linux2 for targets )'

Differential Revision: https://phab.mercurial-scm.org/D1018
2017-10-11 17:27:21 -07:00
Jun Wu
c0f8669061 dispatch: when --pager=no is passed, also disable pager on req.repo.ui
With a future chg change, `req.repo` could be set and currently it is
unaffected by `--pager=on`. This patch makes it so.

This could make one of the test cases in `test-pager.t` pass with future chg
changes.

Differential Revision: https://phab.mercurial-scm.org/D990
2017-10-09 12:42:28 -07:00
Durham Goode
c48caf9e03 bundle2: immediate exit for ctrl+c (issue5692)
21c2df59a regressed bundle2 by catching all exceptions and trying to handle
them. The old behavior was to allow KeyboardInterrupts to throw and not have
graceful cleanup, which allowed it to exit immediately. Let's go back to that
behavior.

Differential Revision: https://phab.mercurial-scm.org/D960
2017-10-11 10:36:59 -07:00
Augie Fackler
fb50ec8285 exewrapper: format with clang-format
A few *s move around, some spaces around parens, a couple of
braces. Nothing remarkable.

Differential Revision: https://phab.mercurial-scm.org/D1032
2017-10-04 11:04:18 -04:00
Augie Fackler
bad97ff7fe util: add clang-format control comment around struct and format macro
clang-format is not a fan of PyObject_HEAD.

Differential Revision: https://phab.mercurial-scm.org/D1031
2017-10-04 11:02:44 -04:00
Augie Fackler
f4d56c2a16 mpatch: reflow two oddly formatted else blocks with clang-format
Differential Revision: https://phab.mercurial-scm.org/D1029
2017-10-04 10:57:23 -04:00
Augie Fackler
0455ba8dfd mpatch: re-wrap wide line with clang-format
Differential Revision: https://phab.mercurial-scm.org/D1027
2017-10-04 10:55:51 -04:00
Augie Fackler
186610a84b bdiff: remove trailing newlines
Differential Revision: https://phab.mercurial-scm.org/D1009
2017-10-04 10:51:39 -04:00
Augie Fackler
22f768930e bdiff: rewrap function prototypes per clang-format
Differential Revision: https://phab.mercurial-scm.org/D1008
2017-10-04 10:51:25 -04:00