Commit Graph

32112 Commits

Author SHA1 Message Date
Augie Fackler
817b42dcf8 largefiles: use repo[None].walk instead of repo.walk 2017-05-18 18:00:38 -04:00
Jun Wu
b9b53e155e parsers: add version to help detect breaking binary changes 2017-04-25 17:43:30 -07:00
Jun Wu
a834f8300e osutil: add version to help detect breaking binary changes
See the previous patch for why.
2017-04-25 17:36:59 -07:00
Jun Wu
ccdd272d29 mpatch: add version to help detect breaking binary changes 2017-04-25 17:38:36 -07:00
Jun Wu
757c1e41e0 diffhelpers: add version to help detect breaking binary changes 2017-04-25 17:40:13 -07:00
Jun Wu
9c351a5051 base85: add version to help detect breaking binary changes 2017-04-25 17:45:48 -07:00
Jun Wu
43069dd542 bdiff: add version to help detect breaking binary changes
Previously, we have no way to detect if a compiled .so file could be used or
not, and blindly load it if it exists. Usually we carefully maintain
compatibility of .so and fallback to pure code gracefully. But if we stick
to the rules, certain nice changes will be impossible to make in a clean
way.

This patch adds a "version" constant to the module so we can detect
inconsistency and take appropriate actions (warn, abort, fallback to pure,
run make automatically) in module loader.
2017-04-25 17:34:41 -07:00
Pierre-Yves David
1d69629fff obsmarker: add an experimental flag controlling "operation" recording
It seems better to introduce the experiment behind a flag for now as there are
multiple concerns around the feature:

 * Storing operation increase the size of obsolescence markers significantly
   (+10-20%).

 * It performs poorly when exchanging markers (cannot combine command names,
   command name might be unknown remotely, etc)
2017-05-20 03:10:23 +02:00
Gregory Szorc
87d24f1e62 run-tests: remove references to Python 2.6
These are the obvious ones. There is tons of code in this file
implementing features from unittest that weren't present in
Python 2.6. But that's for other patches.
2017-05-19 19:46:45 -07:00
Augie Fackler
8197ec1496 dirstate: mark {begin,end}parentchange as deprecated (API) 2017-05-18 17:13:32 -04:00
Augie Fackler
d3c24043bb merge: migrate to context manager for changing dirstate parents 2017-05-18 17:11:24 -04:00
Augie Fackler
c46d888391 localrepo: migrate to context manager for changing dirstate parents 2017-05-18 17:11:14 -04:00
Augie Fackler
f75f070546 context: migrate to context manager for changing dirstate parents 2017-05-18 17:11:07 -04:00
Augie Fackler
dd53cf64c4 rebase: migrate to context manager for changing dirstate parents 2017-05-18 17:11:01 -04:00
Augie Fackler
73cf882ca2 mq: migrate to context manager for changing dirstate parents 2017-05-18 17:10:53 -04:00
Augie Fackler
dae08b1747 dirstate: introduce new context manager for marking dirstate parent changes 2017-05-18 17:10:30 -04:00
Kostia Balytskyi
81aac539f9 contrib: make editmergeps able to work with notepad++
Notepad++ has a different FIRSTLINE argument, so needs special handling.
2017-05-19 17:01:34 -07:00
Kostia Balytskyi
962089afce contrib: make editmergeps able to work with Windows GUI editors
Using Start-Process -Wait makes it wait until the process finishes,
which is necesssary for Windows GUI applications. My short testing
also demonstrated that it does not hurt with command line vim.
2017-05-19 17:00:55 -07:00
Yuya Nishihara
7b77796abc extensions: show deprecation warning for the use of cmdutil.command
Since this is a fundamental API for extensions, we set 1-year period until
actually removing it.
2016-01-09 23:24:52 +09:00
Yuya Nishihara
029af11327 extensions: prohibit registration of command without using @command (API)
Detect the problem earlier for better error indication. I'm tired of teaching
users that the mq extension is not guilty but the third-party extension is.

https://bitbucket.org/tortoisehg/thg/issues?q=%27norepo%27
2017-05-13 15:41:50 +09:00
Yuya Nishihara
748641feec extensions: optionally print hint on import failure
Test will be added by the next patch.
2017-05-14 15:46:45 +09:00
Yuya Nishihara
1e7ba75af3 error: add hint to ProgrammingError
As the hint isn't shown by the default exception handler, we need to print
it manually. I've copied the "** " style from _exceptionwarning().
2017-05-14 15:41:27 +09:00
Yuya Nishihara
018a4881b3 registrar: unindent superfluous "if True" block 2017-05-08 22:14:56 +09:00
Yuya Nishihara
12a6145361 registrar: switch @command decorator to class
It overrides _funcregistrarbase._doregister() since the structure of the
command table is quite different.
2017-05-08 22:08:40 +09:00
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Yuya Nishihara
cf5160a016 gendoc: make sure locale path is set before loading any modules
Otherwise some messages wouldn't be translated depending on when the util
was loaded.
2017-05-13 17:53:55 +09:00
Wez Furlong
bd80cca69d fsmonitor: don't attempt state-leave if we didn't state-enter
The state-enter command may not have been successful; for example, the watchman
client session may have timed out if the user was busy/idle for a long period
during a merge conflict resolution earlier in processing a rebase for a stack
of diffs.

It's cleaner (from the perspective of the watchman logs) to avoid issuing the
state-leave command in these cases.

Test Plan:
ran

`hg rebase --tool :merge -r '(draft() & date(-14)) - master::' -d master`

and didn't observe any errors in the watchman logs or in the output from

`watchman -p -j <<<'["subscribe", "/data/users/wez/fbsource", "wez", {"expression": ["name", ".hg/updatestate"]}]'`
2017-05-18 12:49:10 -07:00
Wez Furlong
5d4aba54fc fsmonitor: acquire localrepo.wlock prior to emitting hg.update state
we see some weird things in the watchman logs where the mercurial
process is seemingly confused about which hg.update state it is publishing
through watchman.

On closer examination, we're seeing conflicting pids for the clients involved
and this implies a race.

To resolve this, we extend the wlock around the state-enter/state-leave
events that are emitted to watchman.

Test Plan:
Some manual testing:

In one window, run this, and then checkout a different rev:

```
$ watchman -p -j <<<'["subscribe", "/data/users/wez/fbsource", "wez", {"expression": ["name", ".hg/updatestate"]}]'
{
    "version": "4.9.0",
    "subscribe": "wez",
    "clock": "c:1495034090:814028:1:312576"
}
{
    "state-enter": "hg.update",
    "version": "4.9.0",
    "clock": "c:1495034090:814028:1:312596",
    "unilateral": true,
    "subscription": "wez",
    "metadata": {
        "status": "ok",
        "distance": 125,
        "rev": "a1275d79ffa6c58b53116c8ec401c275ca6c1e2a",
        "partial": false
    },
    "root": "/data/users/wez/fbsource"
}
{
    "root": "/data/users/wez/fbsource",
    "metadata": {
        "status": "ok",
        "distance": 125,
        "rev": "a1275d79ffa6c58b53116c8ec401c275ca6c1e2a",
        "partial": false
    },
    "subscription": "wez",
    "unilateral": true,
    "version": "4.9.0",
    "clock": "c:1495034090:814028:1:312627",
    "state-leave": "hg.update"
}
```

Tailed the watchman log file and looked for invalid state assertion errors,
then ran my `rebase-all` script to update/rebase all of my heads.

Didn't trigger the error condition (but couldn't reliably trigger it previously
anyway), and the output captured above shows that the states are being emitted
correctly.
2017-05-18 12:48:07 -07:00
Pierre-Yves David
457dd23894 obsolete: move the 'isenabled' function at the top of the file
That is a simple and important function so having it at the top next to the
related constant seems better.
2017-05-19 13:12:42 +02:00
Pierre-Yves David
705173411e cache: make the cache updated callback easily accessible to extension
This will help extension to benefit from this new logic. As a side effect this
clarify the 'transaction' method a little bit.
2017-05-19 13:09:23 +02:00
Pierre-Yves David
60bb5d96f7 obscheckhead: skip context creation to test phase
On repository with many many heads, this is called often enough to show an
overhead to appears in some profile. So we skip the 'changectx' creation to test
the node phases.
2017-05-19 12:35:14 +02:00
Pierre-Yves David
9387092910 tests: add missing 'test-push-checkheads-partial-C1.t'
For some reason, this one test case did not made it with the others as they got
upstreamed during the 4.2 cycle.
2017-05-19 02:44:30 +02:00
Kostia Balytskyi
7d52c13c89 contrib: add editmerge version for powershell
This just adds a translation of existing contrib/editmerge to powershell.
It allows users on Windows to iteratively resolve conflicts in their
editor of choice.

# no-check-commit
2017-05-18 14:36:46 -07:00
Kostia Balytskyi
3d3055016f run-tests: allow hg executable to be hg.exe
When running tests on Windows (via msys), user sometimes does not want to run
them against source hg, but against compiled hg.exe. For that purpose,
--with-hg option can be used, but currently run-tests.py prints a warning if
the value of this argument is not a file with basename 'hg'. This patch allows
such file to be 'hg.exe'.
2017-05-17 12:51:40 -07:00
Durham Goode
77dcefda06 obsolete: add operation metadata to rebase/amend/histedit obsmarkers
By recording what operation created the obsmarker, we can show very intuitive
messages to the user in various UIs. For instance, log output could have
messages like "Amended as XXX" to show why a commit is old and has an 'x' on it.

     @  ac28e3  durham
    /   First commit
   |
   | o  d4afe7 durham
   | |  Second commit
   | |
   | x  8e9a5d (Amended as ac28e3)  durham
   |/   First commit
   |
2017-05-09 16:29:31 -07:00
Martin von Zweigbergk
64acd1e09e match: use match.prefix() in subdirmatcher
It seems like the subdirmatcher should be checking if the matcher it's
based on is matching prefixes. It was effectively doing that already
because "prefix() == not always() and not anypats() and not
isexact()", subdirmatcher was checking the first two parts of that
condition and I don't think it will ever be given an "exact" matcher
with it's directory name (because exact matchers are for matching
files, not directories). Still, let's switch to using prefix() for
clarity (and because I'm trying to remove code that reaches for
matchers internals).
2017-05-17 22:33:15 -07:00
Martin von Zweigbergk
096fa56147 match: avoid accessing match._pathrestricted from subdirmatcher
Accessing only the public API wherever possible helps us refactor
matchers later.
2017-05-12 16:31:21 -07:00
Martin von Zweigbergk
ddbf56e07e match: override visitdir() the usual way in subdirmatcher
Just override the function instead of replacing it on each instance.
2017-05-18 10:17:57 -07:00
Martin von Zweigbergk
767cd2bb63 match: make _fileroots a @propertycache and rename it to _fileset
The files in the set are not necesserily roots of anything. Making it
a @propertycache will help towards extracting a base class for
matchers.
2017-05-18 09:04:37 -07:00
Martin von Zweigbergk
430b02b3ab fsmonitor: use modern match API
It seems like fsmonitor/__init__.py was based on a pretty old version
of dirstate.py. Let's copy over the changes from the following two
commits:

1161b515cc4d (match: add isexact() method to hide internals, 2014-10-29)
b1d8372ab1d0 (dirstate: avoid match.files() in walk(), 2015-05-19)
2017-05-17 23:54:43 -07:00
Andrew Zwicky
faec617779 diffstat: properly count lines starting in '--' or '++' (issue5479)
Lines that start in '--' or '++' were previously not counted
as deletions or additions in diffstat, resulting in incorrect
addition/deletion counts.  The bug was present if the start
of the line, combined with the diff character resulted
in '---' or '+++'.

diffstatdata will now track, for each file, if it has moved
pas the header section by looking for a line beginning with
'@@'.  Once that has happened, lines beginning with '-'
or '+' will be counted for deletions and additions.  Once a
line beginning with 'diff' is found, the process starts over.
2017-05-17 20:51:17 -05:00
Pierre-Yves David
0278e10741 test-http-bad-server: match different in output
Same as for previous update, the longer port number can affect this ouput.
2017-05-19 12:38:34 +02:00
Martin von Zweigbergk
e4f5b2c691 config: make config.items() return a copy
config.items() was iterating over a copy of the data for the the
specified section on Python 2 by using .items(). However, on Python 3,
items() does not make a copy, so let's switch to explicitly making a
copy to make it safe on both Python 2 and Python 3.
2017-05-18 13:38:37 -07:00
Stanislau Hlebik
32f126a2e0 filemerge: store error messages in module variables
Copytracing may be disabled because it's too slow (see
experimental.disablecopytrace config option). In that case user may get errors
like 'local changed FILE which other deleted'. It would be nice to give user a
hint to rerun command with `--config experimental.disablecopytrace=False`. To
make it possible let's extract error message to variables so that extension may
overwrite them.
2017-05-19 03:47:43 -07:00
Jun Wu
70f3088190 run-tests: support multiple cases in .t test
Sometimes we want to run similar tests with slightly different
configurations. Previously we duplicate the test files. This patch
introduces special "#testcases" syntax that allows a single .t file to
contain multiple test cases.

Defined cases could be tested using "#if".

For example, if a test should behave the same with or without an
experimental flag, we can add the following to the .t header:

    #testcases default experimental-a
    #if experimental-a
      $ cat >> $HGRCPATH << EOF
      > [experimental]
      > feature=a
      > EOF
    #endif

The "experimental-a" block won't be executed when running the "default" test
case.
2017-05-16 23:10:31 -07:00
Gregory Szorc
8af088ee65 revlog: rename constants (API)
Feature flag constants don't need "NG" in the name because they will
presumably apply to non-"NG" version revlogs.

All feature flag constants should also share a similar naming
convention to identify them as such.

And, "RevlogNG" isn't a great internal name since it isn't obvious it
maps to version 1 revlogs. Plus, "NG" (next generation) is only a good
name as long as it is the latest version. Since we're talking about
version 2, now is as good a time as any to move on from that naming.
2017-05-17 19:52:18 -07:00
Gregory Szorc
0d15165c74 localrepo: reformat set literals
Putting multiple elements on the same line makes diffs harder
to read. Switch to one line per element so future changes are
easier on the eyes.
2017-05-17 20:01:29 -07:00
Jeremy Fitzhardinge
429da32f1a rebase: make sure merge state is cleaned up for no-op rebases (issue5494)
If a rebase ends up doing a no-op commit, make sure the merge state is still cleaned up.
2017-05-18 13:18:05 -07:00
Martin von Zweigbergk
3bc2187d25 match: remove ispartial()
The function was added in c2498bb6d298 (match: add match.ispartial(),
2015-05-15) for use by narrowhg, but narrowhg never ended up needing
it.
2017-05-17 09:43:50 -07:00
Jun Wu
519380fba4 run-tests: rename test description dict to testdesc
Previously the word "test" was used for both a Test instance and a path or
test dict. This patch renames them so it's clear that "testdesc" is the
dict, and "test" is the instance.
2017-05-16 21:17:40 -07:00