Commit Graph

11023 Commits

Author SHA1 Message Date
Jun Wu
3ca85be38e run-tests: unset CHGDEBUG
With CHGDEBUG, chg outputs much more stuff and the test could fail running
with --chg. So unset the environment variable.
2017-01-06 16:19:41 +00:00
Denis Laxalde
5e3ca8d1ab summary: add evolution "troubles" information to summary output
Extend the "parent: " lines in summary with the list of evolution "troubles"
in parentheses, when the parent is troubled.
2017-01-06 14:35:22 +01:00
Denis Laxalde
b2aed04403 templates: display evolution "troubles" in command line style 2017-01-06 13:50:52 +01:00
Denis Laxalde
0c89f1cb3e templatekw: add a "troubles" template keyword
The "troubles" template keyword returns a list of evolution troubles.
It is EXPERIMENTAL, as anything else related to changeset evolution.

Test it in test-obsolete.t which has troubled changesets.
2017-01-06 13:50:16 +01:00
Denis Laxalde
1bc2883779 test: test "trouble: " line in log output with multiple troubles
Follow-up on 38b8a4a2230c.
2017-01-06 15:48:22 +01:00
Gregory Szorc
05ec82c913 hgweb: link to raw-file on annotation page (BC)
Every other template has the "raw" link load "raw-file." However,
fileannotate.tmpl's "raw" link loads "raw-annotate." This feels
inconsistent and wrong.

As far as I can tell, linking to the "raw annotate" view has occurred
since 2006.
2016-12-28 15:48:17 -07:00
Sean Farley
52b92c45af cmdutil: add special string that ignores rest of text
Similar to git, we add a special string:

  HG: ------------------------ >8 ------------------------

that means anything below it is ignored in a commit message.

This is helpful for integrating with third-party tools that display the
2016-12-31 15:36:36 -06:00
Yuya Nishihara
2fa6a1e65e revset: document wdir() as an experimental function
Let's resurrect the docstring since our help module can detect the EXPERIMENTAL
tag and display it only if -v is specified.

This patch updates the test added by bbdfa2d5aaa2 since wdir() is now
documented.
2017-01-05 22:53:42 +09:00
Yuya Nishihara
caee220313 templater: provide loop counter as "index" keyword
This was originally written for JSON templating where we would have to be
careful to not add extra comma, but seems generally useful.

Inner loop started by % operator has its own counter.
2016-04-22 21:46:33 +09:00
Yuya Nishihara
d4c8257977 revsetlang: enable optimization of 'x + y' expression
It's been disabled since fa623f8a8cdd, but it can be enabled now as the
ordering requirement is resolved at analyze().
2016-05-14 20:51:57 +09:00
Gregory Szorc
6758d40c63 zstd: vendor python-zstandard 0.8.0
Commit 81e1f5bbf1fc54808649562d3ed829730765c540 from
https://github.com/indygreg/python-zstandard is imported without
modifications (other than removing unwanted files).

Updates relevant to Mercurial include:

* Support for multi-threaded compression (we can use this for
  bundle and wire protocol compression).
* APIs for batch compression and decompression operations using
  multiple threads and optimal memory allocation mechanism. (Can
  be useful for revlog perf improvements.)
* A ``BufferWithSegments`` type that models a single memory buffer
  containing N discrete items of known lengths. This type can be
  used for very efficient 0-copy data operations.

# no-check-commit
2017-04-01 15:24:03 -07:00
Gregory Szorc
04c3125727 commands: update help for "unbundle"
Similar to the recent change to "bundle," this command no longer
just deals with "changegroup" data.
2017-04-01 13:43:52 -07:00
Gregory Szorc
5c890f5f16 commands: update help for "bundle"
We now have a dedicated help topic to describe bundle specification
strings. Let's update `hg bundle`'s documentation to reflect its
existence.

While I was hear, I also tweaked some wording which I felt was out
of date and needed tweaking. Specifically, `hg bundle` no longer
just deals with "changegroup" data: it can also generate files
that have non-changegroup data.
2017-04-01 13:43:43 -07:00
Gregory Szorc
2f6dff3311 help: document bundle specifications
I softly formalized the concept of a "bundle specification" a while
ago when I was working on clone bundles and stream clone bundles and
wanted a more robust way to define what exactly is in a bundle file.

The concept has existed for a while. Since it is part of the clone
bundles feature and exposed to the user via the "-t" argument to
`hg bundle`, it is something we need to support for the long haul.

After the 4.1 release, I heard a few people comment that they didn't
realize you could generate zstd bundles with `hg bundle`. I'm
partially to blame for not documenting it in bundle's docstring.

Additionally, I added a hacky, experimental feature for controlling
the compression level of bundles in 054e64c4d837. As the commit
message says, I went with a quick and dirty solution out of time
constraints. Furthermore, I wanted to eventually store this
configuration in the "bundlespec" so it could be made more flexible.

Given:

a) bundlespecs are here to stay
b) we don't have great documentation over what they are, despite being
   a user-facing feature
c) the list of available compression engines and their behavior isn't
   exposed
d) we need an extensible place to modify behavior of compression
   engines

I want to move forward with formalizing bundlespecs as a user-facing
feature. This commit does that by introducing a "bundlespec" help
page. Leaning on the just-added compression engine documentation
and API, the topic also conveniently lists available compression
engines and details about them. This makes features like zstd
bundle compression more discoverable. e.g. you can now
`hg help -k zstd` and it lists the "bundlespec" topic.
2017-04-01 13:42:06 -07:00
Gregory Szorc
b4f1111abe tests: store ETag when using --headeronly
Previously, --headeronly would prevent --twice from working
because the ETag wasn't stored when --headeronly was used.
This feels like a bug. That feeling is reaffirmed by the fact
that this change doesn't regress any tests.
2017-04-01 00:21:52 -07:00
Martin von Zweigbergk
6b2860bef0 check-code: fix "covert" typo 2017-04-03 11:30:51 -07:00
Denis Laxalde
b2e35d013c hgweb: rename linerangelog.js as followlines.js
So that the file name matches both the feature name and user facing vocabulary
(e.g. the revset function).
2017-04-03 10:02:55 +02:00
Matt Harbison
916bb7c1c1 test-blackbox: glob away quoting differences on Windows
Windows uses double quotes in these places.
2017-04-02 02:29:51 -04:00
Matt Harbison
6ade8faab6 test-subrepo: update output for Windows 2017-04-02 02:24:09 -04:00
Matt Harbison
46302cc617 test-serve: disable unfixable tests on Windows
These tests would run if hghave.has_serve() were enabled on Windows.  Windows
has no issue allowing an unpriviledged process to open port 13, so it doesn't
abort.  The other tests are related to how MSYS tries to be helpful and converts
Unix constructs to the Windows equivalent.  There isn't any way to disable this
behavior, though it supposedly doesn't happen if the exe is linked against the
MSYS library.
2017-04-02 01:51:07 -04:00
Matt Harbison
95c3232dc3 test-serve: kill daemons before deleting the access and error logs
On Windows, `rm` will fail with 'Permission denied' if another process has it
open.  It looks like the rollback test was missing the kill entirely.
2017-04-02 01:28:05 -04:00
Matt Harbison
23c58339ca test-serve: make the 'listening at *' lines optional
The daemonized serve process doesn't print these lines out (see 0c9eeb8c6b87).
I was able to get it to with the following hack:

 diff --git a/mercurial/win32.py b/mercurial/win32.py
 --- a/mercurial/win32.py
 +++ b/mercurial/win32.py
 @@ -418,6 +418,11 @@
          return str(ppid)

  def spawndetached(args):
 +
 +    import subprocess
 +    return subprocess.Popen(args, cwd=pycompat.getcwd(), env=encoding.environ,
 +                            creationflags=subprocess.CREATE_NEW_PROCESS_GROUP).pid
 +
      # No standard library function really spawns a fully detached
      # process under win32 because they allocate pipes or other objects
      # to handle standard streams communications. Passing these objects

However, MSYS translates --prefixes starting with '/' to 'C:/MinGW/msys/1.0',
which changes the output.  The output isn't so important that I want to spend a
bunch of time on this, and risk breaking some subtle behavior of `hg serve -d`
with the more complicated code.
2017-04-02 00:56:52 -04:00
Matt Harbison
be3883cbff test-http: update output for Windows
The http test simply wasn't updated in d264983c27fa for Windows.  It looks like
the https test meant to glob away the error message in fa7f5826debe, but forgot
the '*', and was subsequently removed in 01af1e5e4062.
2017-04-01 18:30:51 -04:00
Matt Harbison
98d41eff3c tests: quote paths in shell script hooks
Without the quoting, MSYS will remove the '\' directory separators, and the repo
can't be opened.
2017-04-01 15:23:26 -04:00
Matt Harbison
f5d65c9a00 tests: add globs for Windows 2017-04-01 14:48:39 -04:00
Gregory Szorc
62d4252847 show: new extension for displaying various repository data
Currently, Mercurial has a number of commands to show information. And,
there are features coming down the pipe that will introduce more
commands for showing information.

Currently, when introducing a new class of data or a view that we
wish to expose to the user, the strategy is to introduce a new command
or overload an existing command, sometimes both. For example, there is
a desire to formalize the wip/smartlog/underway/mine functionality that
many have devised. There is also a desire to introduce a "topics"
concept. Others would like views of "the current stack." In the
current model, we'd need a new command for wip/smartlog/etc (that
behaves a lot like a pre-defined alias of `hg log`). For topics,
we'd likely overload `hg topic[s]` to both display and manipulate
topics.

Adding new commands for every pre-defined query doesn't scale well
and pollutes `hg help`. Overloading commands to perform read-only and
write operations is arguably an UX anti-pattern: while having all
functionality for a given concept in one command is nice, having a
single command doing multiple discrete operations is not. Furthermore,
a user may be surprised that a command they thought was read-only
actually changes something.

We discussed this at the Mercurial 4.0 Sprint in Paris and decided that
having a single command where we could hang pre-defined views of
various data would be a good idea. Having such a command would:

* Help prevent an explosion of new query-related commands
* Create a clear separation between read and write operations
  (mitigates footguns)
* Avoids overloading the meaning of commands that manipulate data
  (bookmark, tag, branch, etc) (while we can't take away the
  existing behavior for BC reasons, we now won't introduce this
  behavior on new commands)
* Allows users to discover informational views more easily by
  aggregating them in a single location
* Lowers the barrier to creating the new views (since the barrier
  to creating a top-level command is relatively high)

So, this commit introduces the `hg show` command via the "show"
extension. This command accepts a positional argument of the
"view" to show. New views can be registered with a decorator. To
prove it works, we implement the "bookmarks" view, which shows a
table of bookmarks and their associated nodes.

We introduce a new style to hold everything used by `hg show`.

For our initial bookmarks view, the output varies from `hg bookmarks`:

* Padding is performed in the template itself as opposed to Python
* Revision integers are not shown
* shortest() is used to display a 5 character node by default (as
  opposed to static 12 characters)

I chose to implement the "bookmarks" view first because it is simple
and shouldn't invite too much bikeshedding that detracts from the
evaluation of `hg show` itself. But there is an important point
to consider: we now have 2 ways to show a list of bookmarks. I'm not
a fan of introducing multiple ways to do very similar things. So it
might be worth discussing how we wish to tackle this issue for
bookmarks, tags, branches, MQ series, etc.

I also made the choice of explicitly declaring the default show
template not part of the standard BC guarantees. History has shown
that we make mistakes and poor choices with output formatting but
can't fix these mistakes later because random tools are parsing
output and we don't want to break these tools. Optimizing for human
consumption is one of my goals for `hg show`. So, by not covering
the formatting as part of BC, the barrier to future change is much
lower and humans benefit.

There are some improvements that can be made to formatting. For
example, we don't yet use label() in the templates. We obviously
want this for color. But I'm not sure if we should reuse the existing
log.* labels or invent new ones. I figure we can punt that to a
follow-up.

At the aforementioned Sprint, we discussed and discarded various
alternatives to `hg show`.

We considered making `hg log <view>` perform this behavior. The main
reason we can't do this is because a positional argument to `hg log`
can be a file path and if there is a conflict between a path name and
a view name, behavior is ambiguous. We could have introduced
`hg log --view` or similar, but we felt that required too much typing
(we don't want to require a command flag to show a view) and wasn't
very discoverable. Furthermore, `hg log` is optimized for showing
changelog data and there are things that `hg display` could display
that aren't changelog centric.

There were concerns about using "show" as the command name.

Some users already have a "show" alias that is similar to `hg export`.

There were also concerns that Git users adapted to `git show` would
be confused by `hg show`'s different behavior. The main difference
here is `git show` prints an `hg export` like view of the current
commit by default and `hg show` requires an argument. `git show`
can also display any Git object. `git show` does not support
displaying more complex views: just single objects. If we
implemented `hg show <hash>` or `hg show <identifier>`, `hg show`
would be a superset of `git show`. Although, I'm hesitant to do that
at this time because I view `hg show` as a higher-level querying
command and there are namespace collisions between valid identifiers
and registered views.

There is also a prefix collision with `hg showconfig`, which is an
alias of `hg config`.

We also considered `hg view`, but that is already used by the "hgk"
extension.

`hg display` was also proposed at one point. It has a prefix collision
with `hg diff`. General consensus was "show" or "view" are the best
verbs. And since "view" was taken, "show" was chosen.

There are a number of inline TODOs in this patch. Some of these
represent decisions yet to be made. Others represent features
requiring non-trivial complexity. Rather than bloat the patch or
invite additional bikeshedding, I figured I'd document future
enhancements via TODO so we can get a minimal implmentation landed.
Something is better than nothing.
2017-03-24 19:19:00 -07:00
Jun Wu
0da1479f96 test-revlog-raw: remove duplicated option 2017-04-02 18:13:03 -07:00
Jun Wu
09bd75fdff test-revlog-raw: fix "genbits" implementation
The "genbits" implementation is actually incorrect. This patch fixes it. A
good "genbits" implementation should pass the below assertion:

    n = 3 # or other number
    l = list(genbits(n))
    assert 2**(n*2) == len(set((l[i]<<n)+l[i+1] for i in range(len(l)-1)))

An assertion is added to make sure "genbits" won't work unexpectedly.
2017-04-02 18:12:47 -07:00
Denis Laxalde
c2ed8e445d hgweb: expose a followlines UI in filerevision view
In filerevision view (/file/<rev>/<fname>) we add some event listeners on
mouse clicks of <span> elements in the <pre class="sourcelines"> block.
Those listeners will capture a range of lines selected between two mouse
clicks and a box inviting to follow the history of selected lines will then
show up. Selected lines (i.e. the block of lines) get a CSS class which make
them highlighted. Selection can be cancelled (and restarted) by either
clicking on the cancel ("x") button in the invite box or clicking on any other
source line. Also clicking twice on the same line will abort the selection and
reset event listeners to restart the process.

As a first step, this action is only advertised by the "cursor: cell" CSS rule
on source lines elements as any other mechanisms would make the code
significantly more complicated. This might be improved later.

All JavaScript code lives in a new "linerangelog.js" file, sourced in
filerevision template (only in "paper" style for now).
2017-03-29 22:26:16 +02:00
Jun Wu
ae8c9ce375 revlog: make _addrevision only accept rawtext
All 3 users of _addrevision use raw:

  - addrevision: passing rawtext to _addrevision
  - addgroup: passing rawtext and raw=True to _addrevision
  - clone: passing rawtext to _addrevision

There is no real user using _addrevision(raw=False). On the other hand,
_addrevision is low-level code dealing with raw revlog deltas and rawtexts.
It should not transform rawtext to non-raw text.

This patch removes the "raw" parameter from "_addrevision", and does some
rename and doc change to make it clear that "_addrevision" expects rawtext.

Archeology shows 886a08012bbe added "raw" flag to "_addrevision", follow-ups
fe1e206cb389 and 1cfa6239c923 seem to make the flag unnecessary.

test-revlog-raw.py no longer complains.
2017-03-30 18:38:03 -07:00
Jun Wu
9a6035a980 revlog: use raw revisions in clone
test-revlog-raw.py now shows "clone test passed", but there is more to fix.
2017-03-30 18:24:23 -07:00
Jun Wu
2468c838bd revlog: use raw revisions in revdiff
See the added comment. revdiff is meant to output the raw delta that will be
written to revlog. It should use raw.

test-revlog-raw.py now shows "addgroupcopy test passed", but there is more
to fix.
2017-03-30 18:23:27 -07:00
Jun Wu
558f5cce61 revlog: use raw content when building delta
Using external content provided by flagprocessor when building revlog delta
is wrong, because deltas are applied to raw contents in revlog.

This patch fixes the above issue by adding "raw=True".

test-revlog-raw.py now shows "local test passed", but there is more to fix.
2017-03-30 17:58:03 -07:00
Jun Wu
50b232c61f revlog: fix _cache usage in revision()
As documented at revlog.__init__, revlog._cache stores raw text.

The current read and write usage of "_cache" in revlog.revision lacks of
raw=True check.

This patch fixes that by adding check about raw, and storing rawtext
explicitly in _cache.

Note: it may slow down cache hit code path when raw=False and flags=0. That
performance issue will be fixed in a later patch.

test-revlog-raw now points us to a new problem.
2017-03-30 15:34:08 -07:00
Jun Wu
0409ae86fa revlog: add a stronger test for raw processing
There are some issues about revlog raw processing (flag processor). The test
is relatively strong covering many cases. It will verify fixes.
2017-03-30 20:48:57 -07:00
Pierre-Yves David
e3a8075346 hook: add hook name information to external hook
While we are here, we can also add the hook name information to external hook.
2017-03-31 11:53:56 +02:00
Pierre-Yves David
833b1335ba hook: provide hook type information to external hook
The python hooks have access to the hook type information. There is not reason
for external hook to not be aware of it too.

For the record my use case is to make sure a hook script is configured for the
right type.
2017-03-31 11:08:11 +02:00
Pierre-Yves David
be64e99e37 hook: fix name used in untrusted message
The name used in the message we issue when a hook is untrusted was using "name"
which is actually the hook type and not the name of the hook.
2017-03-31 11:02:05 +02:00
Pierre-Yves David
7a17c488e7 run-tests: auto-replace 'TXNID' output
Hooks related to the transaction are aware of the transaction id. By definition
this txn-id is unique and different for each transaction. As a result it can
never be predicted in test and always needs matching. As a result, touching any
like with this data is annoying. We solve the problem once and for all by
installing an automatic replacement. In test, this will now show as:

  TXNID=TXN:$ID$
2017-03-30 17:29:03 +02:00
Ryan McElroy
a42e2a36a6 rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)
Previously, the pull would succeed, but the subsequent rebase would fail due
to the rebase.requiredest flag. Now abort earlier with a more useful error
message.
2017-03-30 03:50:10 -07:00
Ryan McElroy
d604671a91 rebase: demonstrate behavior with requiredest and pull --rebase 2017-03-30 03:50:10 -07:00
Ryan McElroy
892a9acab3 rebase: allow destination-free continue and abort (issue5513) 2017-03-30 03:50:10 -07:00
Ryan McElroy
46df75b639 rebase: test to show brokenness with requiredest
As shown in issue5513, --continue is broken when destination is required. This
adds a patch that demonstates this silly behavior, which will be fixed in a
future patch.
2017-03-30 03:50:10 -07:00
Ryan McElroy
05ca82fb07 rebase: move destination test to new test file
We'll be adding a lot more tests here, so it makes sense to have this in its
own file now.
2017-03-30 03:50:10 -07:00
Denis Laxalde
495eefece3 hgweb: prefix line id by ctx shortnode in filelog when patches are shown
When "patch" query parameter is present in requests to filelog view, line ids
in patches diff are no longer unique in the page since several patches are
shown on the same page. We now prefix line id by changeset shortnode when
several patches are displayed in the same page to have unique line ids
overall.
2017-03-30 21:40:10 +02:00
Jun Wu
e6e0b871f1 test-check-code: prevent files being added to the root directory
Adding new files in the root directory is probably a mistake, and is usually
discouraged [1]. The test catches it to avoid mistakes like [2].

Modify the test if files need to be added in the root.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-July/086442.html
[2]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095836.html
2017-03-29 12:14:20 -07:00
Jun Wu
6ac1cb4157 unionrepo: avoid unnecessary node -> rev conversion 2017-03-29 16:28:51 -07:00
Jun Wu
9c45c07c8b bundlerepo: avoid unnecessary node -> rev conversion 2017-03-29 16:28:00 -07:00
Jun Wu
7f99b86dbd revlog: avoid unnecessary node -> rev conversion 2017-03-29 16:23:04 -07:00
Jun Wu
5dda7e9e48 check-code: detect r.revision(r.node(rev))
revlog.revision takes either node or rev, but taking a rev is more
efficient, because converting rev to node is just a seek and read.
That's cheaper than converting node to rev, which may require O(n) walk in
revlog index for the first times, and then triggering building the radix
tree index. Even with the radix tree built, rev -> node is still faster than
node -> rev because the radix tree requires more jumps in memory.

So r.revision(r.node(rev)) should be changed to r.revision(rev). This patch
adds a check-code rule to detect that.
2017-03-29 16:46:57 -07:00
Pulkit Goyal
3ccb1b99d0 tests: add check to make sure summary works on Python 2 2017-03-29 14:56:58 +05:30
Denis Laxalde
6af640ec03 hgweb: fix diff hunks filtering by line range in webutil.diffs()
The previous clause for filter out a diff hunk was too restrictive. We need to
consider the following cases (assuming linerange=(lb, ub) and the @s2,l2
hunkrange):

            <-(s2)--------(s2+l2)->
      <-(lb)---(ub)->
               <-(lb)---(ub)->
                           <-(lb)---(ub)->

previously on the first and last situations were considered.

In test-hgweb-filelog.t, add a couple of lines at the beginning of file "b" so
that the line range we will follow does not start at the beginning of file.
This covers the change in aforementioned diff hunk filter clause.
2017-03-29 12:07:07 +02:00
Denis Laxalde
f25fa2b8d5 summary: display obsolete state of parents
Extend the "parent: " lines in summary to display "(obsolete)" when the parent
is obsolete.
2017-03-25 11:30:08 +01:00
Denis Laxalde
aaf9382123 templates: add "changeset.obsolete" label in command line style
Following respective change in cmdutil.changeset_printer.
2017-03-25 10:40:29 +01:00
Denis Laxalde
5f616436cb templatekw: add an "obsolete" keyword
Definition is the same as the one in evolve extension.
2017-03-25 10:34:11 +01:00
David Soria Parra
3e94bf58b6 worker: flush ui buffers before running the worker
a91c6275 introduces flushing ui buffers after a worker finished. If the ui was
not flushed before the worker was started, fork will copy the existing buffers
to the worker. This causes messages issued before the worker started to be
written to the terminal for each worker.

We are now flushing the ui before we start a worker and add an appropriate test
which will fail before this patch.
2017-03-28 10:21:38 -07:00
Jun Wu
28aef1acdc debugconfig: list environment variables in debug output
Since we print "read config from" for config files, printing environment
variables will make it more consistent.
2017-03-26 21:40:22 -07:00
Jun Wu
cc0447168c rcutil: let environ override system configs (BC)
This is BC because system configs won't be able to override $EDITOR, $PAGER.
The new behavior is arguably more rational.
2017-03-26 21:33:37 -07:00
Yuya Nishihara
91f8f53f3a statfs: make getfstype() raise OSError
It's better for getfstype() function to not suppress an error. Callers can
handle it as necessary. Now "hg debugfsinfo" will report OSError.
2017-03-25 17:25:23 +09:00
Yuya Nishihara
aa4a627b31 hghave: use util.getfstype 2017-03-25 18:22:27 +09:00
Jun Wu
35b00f22fa runtests: change local IP glob pattern from "127.0.0.1" to "$LOCALIP"
This is similar to what 9704c8e70d2d does. Since 1363aaf74791 has changed
"127.0.0.1" to "$LOCALIP". The glob pattern needs update accordingly. It is
expected to fix tests running in some BSD jails.
2017-03-26 19:57:17 -07:00
Pierre-Yves David
bbb0efe6b0 drawdag: use 'tagsmod.tag' instead of 'repo.tag'
The former is about to be deprecated.
2017-03-27 18:08:05 +02:00
Denis Laxalde
2702418496 hgweb: filter diff hunks when 'linerange' and 'patch' are specified in filelog 2017-03-13 15:17:20 +01:00
Denis Laxalde
996bd4af95 hgweb: handle a "linerange" request parameter in filelog command
We now handle a "linerange" URL query parameter to filter filelog using
a logic similar to followlines() revset.
The URL syntax is: log/<rev>/<file>?linerange=<fromline>:<toline>
As a result, filelog entries only consists of revision changing specified
line range.

The linerange information is propagated to "more"/"less" navigation links but
not to numeric navigation links as this would apparently require a dedicated
"revnav" class.

Only update the "paper" template in this patch.
2017-01-19 17:41:00 +01:00
Denis Laxalde
6b9779860f hgweb: add a "patch" query parameter to filelog command
Add support for a "patch" query parameter in filelog web command similar to
--patch option of `hg log` to display the diff of each changeset in the table
of revisions. The diff text is displayed in a dedicated row of the table that
follows the existing one for each entry and spans over all columns. Only
update "paper" template in this patch.
2017-03-13 10:41:13 +01:00
Yuya Nishihara
b599e74213 py3: prove second commit works
Finally it works.
2017-03-26 19:11:41 +09:00
Jun Wu
809dfffea4 repair: use ProgrammingError 2017-03-26 16:53:28 -07:00
Pierre-Yves David
7f7216e1a9 histedit: test that an aborted histedit can be rerun (with obsolete)
In the future, this should help catching issue as the one introduced in
33e44341bb82.
2017-03-26 15:55:34 +02:00
Pierre-Yves David
26848e81da histedit: backout changeset 33e44341bb82
Before 33e44341bb82, histedit (like rebase) was only creating markers on final
success from the old-rewritten node to the newly created nodes (as of before
33e44341bb82). In case of abort the aborted attempt were stripped to restore the
repository in its state prior to the attempt.

This use of strip was on purpose. Using markers in this case introduces various
issues. The main one is that keeping the partial result of histedit as obsolete
prevents us to recreates the same nodes in a second attempt. The same operation
will lead to an identical results, using an identical node that already exists
in the repository as obsolete.

To conclude, we cannot and should not switch to obsolescence markers creation on
histedit --abort and we backout 33e44341bb82. A test to catch this class of
issue will be introduced in the next changeset.
2017-03-26 15:46:09 +02:00
Jun Wu
0c169b3296 runtests: unset editor and pager related environment variables
Those environment variables could affect some configuration and future
tests. Drop them to avoid issues.
2017-03-26 20:58:54 -07:00
Pulkit Goyal
1f79d54f45 test-check-py3-commands: cleanup tests related to hg status
We were testing hg status on Python 3 at two places in the test. Cleaned up
one of them.
2017-03-26 21:10:25 +05:30
Gregory Szorc
ee826b7708 gitweb: use monospace font for commit messages
Commit messages often contain vertically aligned text. The default
paper style already uses monospace fonts for rendering commit messages.
And, AFAICT, a number of Git servers also render commit messages
with monospace. It seems like the reasonable thing to do.

This commit converts all instances of the full commit message
in the gitweb style to render with monospace.
2017-03-24 19:52:43 -07:00
Martin von Zweigbergk
6a886bd950 rebase: don't require destination if commands.rebase.requiredest=False 2017-03-24 16:20:10 -07:00
Martin von Zweigbergk
1781d7139a tests: add tests with commands.{update,rebase}.requiredest=False
This shows how rebase is currently broken with
commands.rebase.requiredest=False.
2017-03-24 16:20:04 -07:00
Augie Fackler
2d61fb35c8 osx: use more paranoid quoting in test 2017-03-20 17:49:47 -04:00
Augie Fackler
9e6dae6142 osx: install completion scripts using install(1) to avoid umask badness
This actually fixes some tests that were showing us umask badness that
had been overlooked.
2017-03-20 17:50:05 -04:00
Augie Fackler
e788062ad2 py3: prove `hg {add,addremove,commit} all work
We can't do a second commit in a repo yet, because pure-Python bdiff
is broken on Python 3. That is probably a good next step.
2017-03-19 01:47:56 -04:00
David Soria Parra
92f2b90f4d convert: fix the handling of empty changlist descriptions in P4
Empty changelist descriptions are valid in Perforce. If we encounter one of
them we are currently running into an IndexError. In case of empty commit
messages set the commit message to **empty changelist description**, which
follows Perforce terminology.
2017-03-22 14:12:58 -05:00
Martin von Zweigbergk
68e5878038 status: support commands.status.relative config
When the config is set to true, status output becomes relative to the
working directory. This has bugged me since I started using hg and it
turns it is sillily simple to support it (unless I missed something,
of course).

We could also add a --relative flag, but I would personally always
want that on, and I haven't heard any use for having it sometimes on,
so this patch only lets you enable it via config.
2017-03-21 17:50:44 -07:00
Martin von Zweigbergk
dc4c37c445 plain: ignore [commands] config
We only have commands.{update,rebase}.requiredest so far. We should
clearly ignore those two if HGPLAIN is in effect, and it seems like we
should ignore any future config that will be added in [commands] since
that is about changing the behavior of commands.

Thanks to Yuya for suggesting to centralize the code in ui.py.

While at it, remove the unnecessary False values passed to
ui.configbool() for the aforementioned config options.
2017-03-21 21:26:52 -07:00
Kostia Balytskyi
ffc66837df tests: make test-simplekeyvaluefile.py py2.6-compatible
Python 2.6 unittest.TestCase does not have assertRaisesRegexp.
2017-03-22 11:26:23 -07:00
Yuya Nishihara
8c9b9d4020 similar: take the first match instead of the last
It seems more natural. This makes the next patch slightly cleaner.
2017-03-23 20:52:41 +09:00
Yuya Nishihara
14fa3ba925 revset: make children() not look at p2 if null (issue5439)
Unlike p1 = null, p2 = null denotes the revision has only one parent, which
shouldn't be considered a child of the null revision. This was spotted while
fixing the issue4682 and rediscovered as issue5439.
2015-05-23 11:04:11 +09:00
Augie Fackler
067ebafd12 merge with stable 2017-01-04 14:52:59 -05:00
Yuya Nishihara
3379250232 demandimport: do not raise ImportError for unknown item in fromlist
This is the behavior of the default __import__() function, which doesn't
validate the existence of the fromlist items. Later on, the missing attribute
is detected while processing the import statement.

https://hg.python.org/cpython/file/v2.7.13/Python/import.c#l2575

The comtypes library relies on this (maybe) undocumented behavior, and we
got a bug report to TortoiseHg, sigh.

https://bitbucket.org/tortoisehg/thg/issues/4647/

The test added at 0be19b069edf verifies the behavior of the import statement,
so this patch only adds the test of __import__() function and works around
CPython/PyPy difference.
2016-12-19 22:46:00 +09:00
Anton Shestakov
dc9f869036 hgweb: add missing slash to file log url in rss style 2016-12-08 23:59:36 +08:00
Mads Kiilerich
9c5f48e630 shelve: add missing space in help text
The change is trivial and unlikely to have been translated so we update
translation files too.
2016-11-14 22:43:25 +01:00
Nathan Goldbaum
cd41ee4190 tag: clarify warning about making a tag on a branch head
Currently the warning is ambiguous about whether the new tag (possibly specified
via --rev) is being added on a branch head or whether the working directory is
based on a branch head. Clarify the error message to eliminate this ambiguity.
2016-10-31 17:12:32 -05:00
Yuya Nishihara
26d053eede hghave: fix 'rmcwd' to ensure temporary directory is removed
On platforms where cwd can't be removed, it should try rmdir() after chdir
to the original cwd.
2016-11-01 21:14:33 +09:00
FUJIWARA Katsunori
f6a54b0fb3 tests: test preserving execbit changes at amending only on execbit platform 2016-10-30 06:15:09 +09:00
FUJIWARA Katsunori
2e91a346cc tests: put temporary file outside the working directory for test portability
test-largefiles-update.t creates temporary file exec-bit.patch inside
the working directory for no-execbit platform specific test, but
subsequent tests aren't aware of it.

On execbit platform, subsequent tests can run successfully, because
exec-bit.patch isn't created.

But on no-execbit platform, this temporary file makes subsequent tests
show "? exec-bit.patch" at each "hg status".
2016-10-30 06:15:09 +09:00
FUJIWARA Katsunori
395fcead6f tests: avoid quoting of commit messages for test portability
journal extension uses util.shellquote() to record command line, but
result of it depends on runtime platform: double quotation is used on
Windows and OpenVMS, but single quotation is used otherwise.

test-journal-share.t sometimes specifies commit messages including
white space on command line. It makes journal output depend on runtime
platform, but commit message itself isn't important in this test case.
2016-10-30 06:15:09 +09:00
FUJIWARA Katsunori
8b10b9dd7e tests: use basic format code "%Y" instead of "%s" for test portability
On Windows, strftime() doesn't support format code "%s", and it causes
"invalid format string" error.

    https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx

test-command-template.t examines not seconds value in UTC, but
arithmetic calculation. Therefore, using format code "%Y" instead of
"%s" should be reasonable.

FYI:

- Python standard library reference doesn't list "%s" up in format
  code list required for "C standard (1989 version)", even though it
  also mentions that additional format codes are required for "C
  standard (1999 version)"

  https://docs.python.org/2.7/library/datetime.html#strftime-and-strptime-behavior

- The Open Group Base Specifications Issue 7 (IEEE Std 1003.1-2008,
  2016 Edition) doesn't require strftime to support format code "%s"

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html

- "man strftime" of (Open/Oracle) Solaris and Mac OS X (= UNIX
  certified OSs) describes about format code "%s"
2016-10-30 06:15:07 +09:00
FUJIWARA Katsunori
feea36218b tests: add test-commit-interactive-curses.t "require tic" for test portability
Standard library of Python on Windows doesn't have curses module.
2016-10-29 03:08:08 +09:00
FUJIWARA Katsunori
85658908df tests: use "?" to glob both ":" and ";" in output for test portability
If environment variable looks like PATH or so (e.g. any of components
joined by ":" contains "/"), ":" in it is replaced with ";" by MinGW
at spawning Windows native process, to follow path concatenation style
of Windows.

Therefore, "bundle:../full.hg" is converted into "bundle;..\full.hg"
on MinGW.

Difference between "/" and "\" is automatically ignored by "(glob)",
but difference between ":" and ";" should be globed explicitly.
2016-10-29 03:04:54 +09:00
FUJIWARA Katsunori
2568974470 tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:

  - unless binding between *.py suffix and python runtime, application
    selector dialog is displayed, and running test is blocked at each
    printenv.py invocations

  - it isn't safe to assume binding between *.py suffix and python
    runtime, because application binding is easily broken

    For example, installing IDE (VisualStudio with Python Tools, or
    so) often requires binding between source files and IDE itself.

This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.

This changes were confirmed in cases below:

  - without any application binding for *.py suffix
  - with binding between *.py suffix and VisualStudio

This patch also replaces "echo + redirection" style with "heredoc"
style, because:

  - hook command line is parsed by cmd.exe as shell at first, and
  - single quotation can't quote arguments on cmd.exe, therefore,
  - "printenv.py foobar" should be quoted by double quotation, but
  - nested quoting (or tricky escaping) isn't readable
2016-10-29 02:44:45 +09:00
Yuya Nishihara
01ff276025 templater: use unfiltered changelog to calculate shortest() at constant time
cl._partialmatch() can be pretty slow if hidden revisions are involved. This
patch cancels the slowdown introduced by the previous patch by using an
unfiltered changelog, which means shortest(node) isn't always the shortest.

The result isn't perfect, but seems okay as long as shortest(node) is short
enough to type and can be used as an identifier.

  (with hidden revisions)
  % hg log -R hg-committed -r0:20000 -T '{node|shortest}\n' --time > /dev/null
  (.^^) time: real 1.530 secs (user 1.480+0.000 sys 0.040+0.000)
  (.^)  time: real 43.080 secs (user 43.060+0.000 sys 0.030+0.000)
  (.)   time: real 1.680 secs (user 1.650+0.000 sys 0.020+0.000)
2016-10-25 21:49:30 +09:00
Yuya Nishihara
35fcce9afc templater: do not use index.partialmatch() directly to calculate shortest()
cl.index.partialmatch() isn't a drop-in replacement for cl._partialmatch().
It has no knowledge about hidden revisions, and it raises ValueError if a node
shorter than 4 chars is given. Instead, use index.partialmatch() through
cl._partialmatch(), which has no such problems and gives the identical result
with/without --pure.

The test output was sampled with --pure without this patch, which shows the
most correct result. However, we'll need to switch to using an unfiltered
changelog because _partialmatch() of a filtered changelog can be an order of
magnitude slower.

  (with hidden revisions)
  % hg log -R hg-committed -r0:20000 -T '{node|shortest}\n' --time > /dev/null
  (.^)  time: real 1.530 secs (user 1.480+0.000 sys 0.040+0.000)
  (.)   time: real 43.080 secs (user 43.060+0.000 sys 0.030+0.000)
2016-10-23 14:05:23 +09:00
Yuya Nishihara
85c5af29fa tests: run "cwd was removed" test only if cwd can actually be removed
On some platforms, cwd can't be removed. In which case, util.unlinkpath()
continues with no error since the failure of directory removal isn't critical.
So it doesn't make sense to run the test added by 6395630fdfdc on those
platforms. OTOH, we need to run the test in test-rebase-scenario-global.t
since the repository is referenced after that.
2016-10-26 22:50:06 +09:00
Gábor Stefanik
5533b05a12 merge: avoid superfluous filemerges when grafting through renames (issue5407)
This is a fix for a regression introduced by the patches for issue4028.

The test changes are due to us doing fewer _checkcopies searches now, which
makes some test outputs revert to the pre-issue4028 behavior. That issue itself
remains fixed, we only skip copy tracing for files where it isn't relevant.
As a nice side effect, this makes copy detection much faster when tracing
backwards through lots of renames.
2016-10-25 21:01:53 +02:00
Simon Farnsworth
06082f0f98 tests: fix test-casefolding.t
The message had changed, but the test was not updated. This test does not
run on Linux, but failed on my Mac.
2016-10-21 16:31:16 +01:00
Gregory Szorc
3f32afbd84 commands: print security protocol support in debuginstall
Over the past week I've had to instruct multiple people to run
Python code to query the ssl module to see what TLS protocol support
is present. I think it would be useful for `hg debuginstall` to print
this info to make it easier to access and debug why Mercurial is
complaining about using an insecure TLS 1.0 protocol.

Ideally we'd also print the path to the CA cert bundle. But the APIs
for querying that in sslutil can emit warnings, making it slightly
more difficult to integrate into `hg debuginstall`. That work will
have to wait for another day.
2016-10-19 15:07:11 -07:00
Kevin Bullock
734a4f1625 merge default into stable for 4.0 code freeze 2016-10-18 14:15:15 -05:00
Mads Kiilerich
8f6d6ccc08 largefiles: fix 'deleted' files sometimes persistently appearing with R status
A code snippet that has been around since largefiles was introduced was wrong:
Standins no longer found in lfdirstate has *not* been removed -
they have probably just been deleted ... or not created.

This wrong reporting did that 'up -C' didn't undo the change and didn't sync
the two dirstates.

Instead of reporting such files as removed, propagate the deletion to the
standin file and report the file as deleted.
2016-10-17 17:12:24 +02:00
Mads Kiilerich
231fdaf8a2 largefiles: more safe handling of interruptions while updating modifications
Largefiles are fragile with the design where dirstate and lfdirstate must be
kept in sync.

To be less fragile, mark all clean largefiles as unsure ("normallookup") before
updating standins. After standins have been updated and we know exactly which
largefile standins actually was changed, mark the unchanged largefiles back to
clean ("normal").

This will make the failure mode more safe. If interrupted, the next command
will continue to perform extra hashing of all largefiles. That will do that all
largefiles that are out of sync with their standin will be marked dirty and
they will show up in status and can be cleaned with update --clean.
2016-10-16 02:29:45 +02:00
Mads Kiilerich
3482fa8368 largefiles: test coverage of fatal interruption of update
Test using existing changesets in a clean working directory, revealing problems
with files that don't show up as modified or do show up as removed when they
just not have been written yet.
2016-10-16 02:26:38 +02:00
Pierre-Yves David
667d10975b changegroup: skip delta when the underlying revlog do not use them
Revlog can now be configured to store full snapshot only. This is used on the
changelog. However, the changegroup packing was still recomputing deltas to be
sent over the wire.

We now just reuse the full snapshot directly in this case, skipping delta
computation. This provides use with a large speed up(-30%):

# perfchangegroupchangelog on mercurial
! wall 2.010326 comb 2.020000 user 2.000000 sys 0.020000 (best of 5)
! wall 1.382039 comb 1.380000 user 1.370000 sys 0.010000 (best of 8)

# perfchangegroupchangelog on pypy
! wall 5.792589 comb 5.780000 user 5.780000 sys 0.000000 (best of 3)
! wall 3.911158 comb 3.920000 user 3.900000 sys 0.020000 (best of 3)

# perfchangegroupchangelog on mozilla central
! wall 20.683727 comb 20.680000 user 20.630000 sys 0.050000 (best of 3)
! wall 14.190204 comb 14.190000 user 14.150000 sys 0.040000 (best of 3)

Many tests have to be updated because of the change in bundle content. All
theses update have been verified.  Because diffing changelog was not very
valuable, the resulting bundle have similar size (often a bit smaller):

# full bundle of mozilla central
with delta:    1142740533B
without delta: 1142173300B

So this is a win all over the board.
2016-10-14 01:31:11 +02:00
Gábor Stefanik
2f48be6841 copies: make _checkcopies handle copy sequences spanning the TCA (issue4028)
When working in a rotated DAG (for a graftlike merge), there can be files
that are renamed both between the base and the topological CA, and between
the TCA and the endpoint farther from the base. Such renames span the TCA
(and thus need both passes of _checkcopies to be fully detected), but may
not necessarily be divergent.

Make _checkcopies return "incomplete copies" and "incomplete divergences"
in this case, and let mergecopies recombine them once data from both passes
of _checkcopies is available.

With this patch, all known cases involving renames and grafts pass.

(Developed together with Pierre-Yves David)
2016-10-11 04:39:47 +02:00
Denis Laxalde
37fb9b1045 cmdutil: add support for evolution "troubles" display in changeset_printer
Add a "trouble" line in changeset header along with a couple of labels on
"log.changeset" line to indicate whether a changeset is troubled or not and
which kind trouble occurs.
2016-10-10 12:06:58 +02:00
Gábor Stefanik
242c4897e8 checkcopies: handle divergences contained entirely in tca::ctx
During a graftlike merge, _checkcopies runs from ctx to tca, possibly
passing over the merge base. If there is a rename both before and after
the base, then we're actually dealing with divergent renames.
If there is no rename on the other side of tca, then the divergence is
contained entirely in the range of one _checkcopies invocation, and
should be detected "in the loop" without having to rely on the other
_checkcopies pass.
2016-10-12 11:54:03 +02:00
Augie Fackler
1fc82bbf21 py3: update test expectation on stable 2016-09-23 14:37:15 -04:00
Kevin Bullock
9eb7f2dc02 grep: rewrite help to better document current (confusing) behavior 2016-09-23 12:45:10 -05:00
timeless
aa2c0ad5a3 crecord: properly handle files with No newline at eof (issue5268)
Yes, this bug was a single character with the wrong case...
2016-09-02 20:15:37 +00:00
Jun Wu
a5ec43fe40 annotate: pre-calculate the "needed" dictionary (issue5360)
The "needed" dict is used as a reference counter to free items in the giant
"hist" dict. However, currently it is not very accurate and can lead to
dropping "hist" items unnecessarily, for example, with the following DAG,

       -3-
      /   \
  0--1--2--4--

The current algorithm will visit and calculate rev 1 twice, undesired. And
it tries to be smart by clearing rev 1's parents: "pcache[1] = []" at the
time hist[1] being accessed (note: hist[1] needs to be used twice, by rev 2
and rev 3). It can result in incorrect results if p1 of rev 4 deletes chunks
belonging to rev 0.

However, simply removing "needed" is not okay, because it will consume 10x
memory:

  # without any change
  % HGRCPATH= lrun ./hg annotate mercurial/commands.py -r d130a38 3>&2 [1]
  MEMORY   49074176
  CPUTIME  9.213
  REALTIME 9.270

  # with "needed" removed
  MEMORY   637673472
  CPUTIME  8.164
  REALTIME 8.249

This patch moves "needed" (and "pcache") calculation to a separate DFS to
address the issue. It improves perf and fixes issue5360 by correctly reusing
hist, while maintaining low memory usage. Some additional attempt has been
made to further reduce memory usage, like changing "pcache[f] = []" to "del
pcache[f]". Therefore the result can be both faster and lower memory usage:

  # with this patch applied
  MEMORY   47575040
  CPUTIME  7.870
  REALTIME 7.926

[1]: lrun is a lightweight sandbox built on Linux cgroup and namespace. It's
     used to measure CPU and memory usage here. Source code is available at
     github.com/quark-zju/lrun.
2016-09-02 15:20:59 +01:00
Gábor Stefanik
a47c5119e6 update: enable copy tracing for backwards and non-linear updates
As a followup to the issue4028 series, this fixes a variant of the issue
that can occur when updating with uncommited local changes.

The duplicated .hgsub warning is coming from wc.dirty(). We would previously
skip this call because it's only relevant when we're going to perform copy
tracing, which we didn't do before.

The change to the update summary line is because we now treat the rename as a
proper rename (which counts as a change), rather than an add+delete pair
(which counts as a change and a delete).
2016-08-25 22:02:26 +02:00
Mads Kiilerich
2373d2e7bb tests: add more test coverage of phase changes when pushing
Prepare for test coverage of phase updates with future push --readonly option,
both with and without actually pushing changesets.
2016-08-21 01:12:00 +02:00
Gábor Stefanik
d967d939d6 mergecopies: invoke _computenonoverlap for both base and tca during merges
The algorithm of _checkcopies can only walk backwards in the DAG, never
forward. Because of this, the two _checkcopies patches need to run from
their respective endpoints to the TCA to cover the entire subgraph where
the merge is being performed. However, detection of files new in both
endpoints, as well as directory rename detection, need to run with respect
to the merge base, so we need lists of new files both from the TCA's and
the merge base's viewpoint to correctly detect renames in a graft-like
merge scenario.

(Series reworked by Pierre-Yves David)
2016-10-13 02:19:43 +02:00
Gábor Stefanik
52ad8526f6 tests: introduce tests for grafting through renames
These cover all currently known cases of renames being grafted,
or changes being grafted through renames.

Right now, most of these cases are broken. Later patches in this series
will make them behave correctly.

The testcases heavily rely on each other, which would make it very difficult
to separate them and add them one-by-one for each case fixed by a patch.
Separating them should perhaps be a 4.1 task, if it doesn't slow down
the tests too much.

(Developed together with Pierre-Yves David)
2016-10-12 12:41:28 +02:00
Gábor Stefanik
4adc2f1a6a checkcopies: add a sanity check against false-positive copies
When grafting a copy backwards through a rename, a copy is wrongly detected,
which causes the graft to be applied inappropriately, in a destructive way.
Make sure that the old file name really exists in the common ancestor,
and bail out if it doesn't.

This fixes the aggravated case of bug 5343, although the basic issue
(failure to duplicate the copy information) still occurs.
2016-10-12 21:33:45 +02:00
Gregory Szorc
26f6f03d4c exchange: refactor APIs to obtain bundle data (API)
Currently, exchange.getbundle() returns either a cg1unpacker or a
util.chunkbuffer (in the case of bundle2). This is kinda OK, as
both expose a .read() to consumers. However, localpeer.getbundle()
has code inferring what the response type is based on arguments and
converts the util.chunkbuffer returned in the bundle2 case to a
bundle2.unbundle20 instance. This is a sign that the API for
exchange.getbundle() is not ideal because it doesn't consistently
return an "unbundler" instance.

In addition, unbundlers mask the fact that there is an underlying
generator of changegroup data. In both cg1 and bundle2, this generator
is being fed into a util.chunkbuffer so it can be re-exposed as a
file object.

util.chunkbuffer is a nice abstraction. However, it should only be
used "at the edges." This is because keeping data as a generator is
more efficient than converting it to a chunkbuffer, especially if we
convert that chunkbuffer back to a generator (as is the case in some
code paths currently).

This patch refactors exchange.getbundle() into
exchange.getbundlechunks(). The new API returns an iterator of chunks
instead of a file-like object.

Callers of exchange.getbundle() have been updated to use the new API.

There is a minor change of behavior in test-getbundle.t. This is
because `hg debuggetbundle` isn't defining bundlecaps. As a result,
a cg1 data stream and unpacker is being produced. This is getting fed
into a new bundle20 instance via bundle2.writebundle(), which uses
a backchannel mechanism between changegroup generation to add the
"nbchanges" part parameter. I never liked this backchannel mechanism
and I plan to remove it someday. `hg bundle` still produces the
"nbchanges" part parameter, so there should be no user-visible
change of behavior. I consider this "regression" a bug in
`hg debuggetbundle`. And that bug is captured by an existing
"TODO" in the code to use bundle2 capabilities.
2016-10-16 10:38:52 -07:00
Mads Kiilerich
39f2a13215 util: increase filechunkiter size to 128k
util.filechunkiter has been using a chunk size of 64k for more than 10 years,
also in years where Moore's law still was a law. It is probably ok to bump it
now and perhaps get a slight win in some cases.

Also, largefiles have been using 128k for a long time. Specifying that size
multiple times (or forgetting to do it) seems a bit stupid. Decreasing it to
64k also seems unfortunate.

Thus, we will set the default chunksize to 128k and use the default everywhere.
2016-10-14 01:53:15 +02:00
Yuya Nishihara
7e790cf836 revset: for x^2, do not take null as a valid p2 revision
Since we don't count null p2 revision as a parent, x^2 should never return
null even if null is explicitly populated.
2016-10-14 23:33:00 +09:00
Danek Duvall
fb575a9782 color: allow for user-configurable terminfo codes for effects
If the entry in the terminfo database for your terminal is missing some
attributes, it should be possible to create them on the fly without
resorting to just making them a color.  This change allows you to have

    [color]
    terminfo.<effect> = <code>

where <effect> might be something like "dim" or "bold", and <code> is the
escape sequence that would otherwise have come from a call to tigetstr().
If an escape character is needed, use "\E".  Any such settings will
override attributes that are present in the terminfo database.
2016-10-13 11:48:17 -07:00
Stanislau Hlebik
b83f0c0687 update: warn if cwd was deleted
During update directories are deleted as soon as they have no entries.
But if current working directory is deleted then it cause problems
in complex commands like 'hg split'. This commit adds a warning
that will help users figure the problem faster.
2016-10-04 04:06:48 -07:00
Mads Kiilerich
ecb497971e merge: clarify warning for (not) merging flags without ancestor
Give hints why it can't merge and what it will do instead.
2016-10-12 12:22:18 +02:00
Mads Kiilerich
dc79a99eb6 merge: only show "cannot merge flags for %s" warning if flags are different 2016-10-12 12:22:18 +02:00
Mads Kiilerich
bb41b9551b tests: add test coverage of merging x flag without ancestor
It is more noisy than necessary - we will fix that later.
2016-10-12 12:22:18 +02:00
Philippe Pepiot
fd197b867c record: return code from underlying commit 2016-10-12 12:22:54 +02:00
Philippe Pepiot
82dc121fd0 commit: return 1 for interactive commit with no changes (issue5397)
For consistency with non interactive commit
2016-10-14 09:52:38 +02:00
Gregory Szorc
0ee2ea3be0 changelog: disable delta chains
This patch disables delta chains on changelogs. After this patch, new
entries on changelogs - including existing changelogs - will be stored
as the fulltext of that data (likely compressed). No delta computation
will be performed.

An overview of delta chains and data justifying this change follows.

Revlogs try to store entries as a delta against a previous entry (either
a parent revision in the case of generaldelta or the previous physical
revision when not using generaldelta). Most of the time this is the
correct thing to do: it frequently results in less CPU usage and smaller
storage.

Delta chains are most effective when the base revision being deltad
against is similar to the current data. This tends to occur naturally
for manifests and file data, since only small parts of each tend to
change with each revision. Changelogs, however, are a different story.

Changelog entries represent changesets/commits. And unless commits in a
repository are homogonous (same author, changing same files, similar
commit messages, etc), a delta from one entry to the next tends to be
relatively large compared to the size of the entry. This means that
delta chains tend to be short. How short? Here is the full vs delta
revision breakdown on some real world repos:

Repo             % Full    % Delta   Max Length
hg                45.8       54.2        6
mozilla-central   42.4       57.6        8
mozilla-unified   42.5       57.5       17
pypy              46.1       53.9        6
python-zstandard  46.1       53.9        3

(I threw in python-zstandard as an example of a repo that is homogonous.
It contains a small Python project with changes all from the same
author.)

Contrast this with the manifest revlog for these repos, where 99+% of
revisions are deltas and delta chains run into the thousands.

So delta chains aren't as useful on changelogs. But even a short delta
chain may provide benefits. Let's measure that.

Delta chains may require less CPU to read revisions if the CPU time
spent reading smaller deltas is less than the CPU time used to
decompress larger individual entries. We can measure this via
`hg perfrevlog -c -d 1` to iterate a revlog to resolve each revision's
fulltext. Here are the results of that command on a repo using delta
chains in its changelog and on a repo without delta chains:

hg (forward)
! wall 0.407008 comb 0.410000 user 0.410000 sys 0.000000 (best of 25)
! wall 0.390061 comb 0.390000 user 0.390000 sys 0.000000 (best of 26)

hg (reverse)
! wall 0.515221 comb 0.520000 user 0.520000 sys 0.000000 (best of 19)
! wall 0.400018 comb 0.400000 user 0.390000 sys 0.010000 (best of 25)

mozilla-central (forward)
! wall 4.508296 comb 4.490000 user 4.490000 sys 0.000000 (best of 3)
! wall 4.370222 comb 4.370000 user 4.350000 sys 0.020000 (best of 3)

mozilla-central (reverse)
! wall 5.758995 comb 5.760000 user 5.720000 sys 0.040000 (best of 3)
! wall 4.346503 comb 4.340000 user 4.320000 sys 0.020000 (best of 3)

mozilla-unified (forward)
! wall 4.957088 comb 4.950000 user 4.940000 sys 0.010000 (best of 3)
! wall 4.660528 comb 4.650000 user 4.630000 sys 0.020000 (best of 3)

mozilla-unified (reverse)
! wall 6.119827 comb 6.110000 user 6.090000 sys 0.020000 (best of 3)
! wall 4.675136 comb 4.670000 user 4.670000 sys 0.000000 (best of 3)

pypy (forward)
! wall 1.231122 comb 1.240000 user 1.230000 sys 0.010000 (best of 8)
! wall 1.164896 comb 1.160000 user 1.160000 sys 0.000000 (best of 9)

pypy (reverse)
! wall 1.467049 comb 1.460000 user 1.460000 sys 0.000000 (best of 7)
! wall 1.160200 comb 1.170000 user 1.160000 sys 0.010000 (best of 9)

The data clearly shows that it takes less wall and CPU time to resolve
revisions when there are no delta chains in the changelogs, regardless
of the direction of traversal. Furthermore, not using a delta chain
means that fulltext resolution in reverse is as fast as iterating
forward. So not using delta chains on the changelog is a clear CPU win
for reading operations.

An example of a user-visible operation showing this speed-up is revset
evaluation. Here are results for
`hg perfrevset 'author(gps) or author(mpm)'`:

hg
! wall 1.655506 comb 1.660000 user 1.650000 sys 0.010000 (best of 6)
! wall 1.612723 comb 1.610000 user 1.600000 sys 0.010000 (best of 7)

mozilla-central
! wall 17.629826 comb 17.640000 user 17.600000 sys 0.040000 (best of 3)
! wall 17.311033 comb 17.300000 user 17.260000 sys 0.040000 (best of 3)

What about 00changelog.i size?

Repo                Delta Chains     No Delta Chains
hg                    7,033,250         6,976,771
mozilla-central      82,978,748        81,574,623
mozilla-unified      88,112,349        86,702,162
pypy                 20,740,699        20,659,741

The data shows that removing delta chains from the changelog makes the
changelog smaller.

Delta chains are also used during changegroup generation. This
operation essentially converts a series of revisions to one large
delta chain. And changegroup generation is smart: if the delta in
the revlog matches what the changegroup is emitting, it will reuse
the delta instead of recalculating it. We can measure the impact
removing changelog delta chains has on changegroup generation via
`hg perfchangegroupchangelog`:

hg
! wall 1.589245 comb 1.590000 user 1.590000 sys 0.000000 (best of 7)
! wall 1.788060 comb 1.790000 user 1.790000 sys 0.000000 (best of 6)

mozilla-central
! wall 17.382585 comb 17.380000 user 17.340000 sys 0.040000 (best of 3)
! wall 20.161357 comb 20.160000 user 20.120000 sys 0.040000 (best of 3)

mozilla-unified
! wall 18.722839 comb 18.720000 user 18.680000 sys 0.040000 (best of 3)
! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3)

pypy
! wall 4.828317 comb 4.830000 user 4.820000 sys 0.010000 (best of 3)
! wall 5.415455 comb 5.420000 user 5.410000 sys 0.010000 (best of 3)

The data shows eliminating delta chains makes the changelog part of
changegroup generation slower. This is expected since we now have to
compute deltas for revisions where we could recycle the delta before.

It is worth putting this regression into context of overall changegroup
times. Here is the rough total CPU time spent in changegroup generation
for various repos while using delta chains on the changelog:

Repo              CPU Time (s)    CPU Time w/ compression
hg                  4.50              7.05
mozilla-central   111.1             222.0
pypy               28.68             75.5

Before compression, removing delta chains from the changegroup adds
~4.4% overhead to hg changegroup generation, 1.3% to mozilla-central,
and 2.0% to pypy. When you factor in zlib compression, these percentages
are roughly divided by 2.

While the increased CPU usage for changegroup generation is unfortunate,
I think it is acceptable because the percentage is small, server
operators (those likely impacted most by this) have other mechanisms
to mitigate CPU consumption (namely reducing zlib compression level and
pre-generated clone bundles), and because there is room to optimize this
in the future. For example, we could use the nullid as the base revision,
effectively encoding the full revision for each entry in the changegroup.
When doing this, `hg perfchangegroupchangelog` nearly halves:

mozilla-unified
! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3)
! wall 11.196461 comb 11.200000 user 11.190000 sys 0.010000 (best of 3)

This looks very promising as a future optimization opportunity.

It's worth that the changes in test-acl.t to the changegroup part size.
This is because revision 6 in the changegroup had a delta chain of
length 2 before and after this patch the base revision is nullrev.
When the base revision is nullrev, cg2packer.deltaparent() hardcodes
the *previous* revision from the changegroup as the delta parent.
This caused the delta in the changegroup to switch base revisions,
the delta to change, and the size to change accordingly. While the
size increased in this case, I think sizes will remain the same
on average, as the delta base for changelog revisions doesn't matter
too much (as this patch shows). So, I don't consider this a regression.
2016-10-13 12:50:27 +02:00
Pierre-Yves David
d482e52866 help: backout 6f89f03ad369 (mark boolean flags with [no-] in help) for now
The ability to negate any boolean flags itself is great, but I think we are not
ready to expose the help side of it yet.

First, while there exist a handful of such flags whose default value can be
changed (eg: git diff, patchwork confirmation), there is only a few of them. The
users who benefit the most from this change are alias users and large
installation that can deploy extension to change behavior (eg: facebook
tweakdefault).  So the majority of user who will be affected by a large change
to command help that is not yet relevant to them. (I expect this to become
relevant when ui.progressive start to exists).

Below is an example of the impact of the new help on 'hg help diff':

  -r --rev REV [+]              revision
  -c --change REV               change made by revision
  -a --[no-]text                treat all files as text
  -g --[no-]git                 use git extended diff format
     --[no-]nodates             omit dates from diff headers
     --[no-]noprefix            omit a/ and b/ prefixes from filenames
  -p --[no-]show-function       show which function each change is in
     --[no-]reverse             produce a diff that undoes the changes
  -w --[no-]ignore-all-space    ignore white space when comparing lines
  -b --[no-]ignore-space-change ignore changes in the amount of white space
  -B --[no-]ignore-blank-lines  ignore changes whose lines are all blank
  -U --unified NUM              number of lines of context to show
     --[no-]stat                output diffstat-style summary of changes
     --root DIR                 produce diffs relative to subdirectory
  -I --include PATTERN [+]      include names matching the given patterns
  -X --exclude PATTERN [+]      exclude names matching the given patterns
  -S --[no-]subrepos            recurse into subrepositories

Another issue with the current state of help, the default value for the
flag is not conveyed to the user. For example in the 'backout' help, there is
no real distinction between "--[no-]backup" (default to True) and "--[no-]keep"
(default) to False:

  --[no-]backup        no backups
  --[no-]keep          do not modify working directory during strip

In addition, I've discussed with Augie Fackler and the last batch of the work on
this have burned him out quite some. Therefore he is not intending to perform
any more work on this topic. Quoting him, he would rather see the help part
backed out than spending more time on it.

I do not think we are ready to expose this to users in 4.0 (freeze in a week),
especially because we cannot expect quick improvement on these aspect as this
topic no longer have an owner. We should be able to reintroduce that change in
the future when someone get back on it and the main issues are solves:

* Introduction of  ui.progressive makes it relevant for a majority of user,
* Current default value are efficiently conveyed to the user.

(In addition, the excerpt from diff help show that we still have some issue with
some negative option like '--nodates' so further improvement are probably
welcome there.)
2016-10-09 03:11:18 +02:00
Augie Fackler
530be6f190 copy: distinguish "file exists" cases and add a hint (BC)
Users that want to add a copy record to an existing commit with 'hg
commit --amend' should be guided towards this workflow, rather than
reaching for some sort of uncommit-recommit flow. As part of this,
distinguish in the top-line error message whether the file merely
already exists (untracked) on disk or the file already exists in
history.

The full list of copy and rename cases and how they interact with
flags are listed below:

target exists  --after  --force  |  action
      n            n      *    |  copy
      n            y      *    |  (1)
  untracked        n      n    |  (4) NEWHINT
  untracked        n      y    |  (3)
  untracked        y      *    |  (2)
      y            n      n    |  (4) NEWHINT
      y            n      y    |  (3)
      y            y      n    |  (2)
      y            y      y    |  (3)
   deleted         n      n    |  copy
   deleted         n      y    |  (3)
   deleted         y      n    |  (1)
   deleted         y      y    |  (1)

* = don't care
(1) <src>: not recording move - <target> does not exist
(2) preserve target contents
(3) replace target contents
(4) <target>: not overwriting - file {exists,already committed}

Credit to Kevin for wholly rewriting my table to cover more cases we
discovered at the sprint.

I think this change gets the hints correct in all cases, but I'd
appreciate close inspection of the test cases to make sure I haven't
gotten turned around in here.
2016-09-19 17:15:39 -04:00
FUJIWARA Katsunori
37e273ea35 perf: replace ui.configint() by getint() for Mercurial earlier than 1.9
Before this patch, using ui.configint() prevents perf.py from
measuring performance with Mercurial earlier than 1.9 (or
12e7e9fbf243), because ui.configint() isn't available in such
Mercurial, even though there are some code paths for Mercurial earlier
than 1.9 in perf.py.

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

This patch replaces ui.configint() invocations by newly introduced
getint().

This patch also adds check-perf-code.py an extra check entry to detect
direct usage of ui.configint() in perf.py.

BTW, this patch doesn't choose adding configint() method at runtime by
replacing ui.__class__ like below, even though this is the recommended
way to modern Mercurial extensions.

    def uisetup(ui):
        if not util.safehasattr(ui, 'configint'):
            class uiwrap(ui.__class__):
                def configint(self, section, name, ....):
                    ....
            ui.__class__ = uiwrap

Because changes to ui.__class__ by uisetup() of loaded extension have
been propagated since 1.6.1 (or 07a6e7bd0cc1), the recommended way
above doesn't work as expected with Mercurial earlier than it.
2016-10-09 01:03:19 +09:00
FUJIWARA Katsunori
dd96bd471b perf: add functions to get vfs-like object for Mercurial earlier than 2.3
Before this patch, using svfs prevents perf.py from measuring
performance of Mercurial earlier than 2.3 (or 12df7401e8cd), because
svfs isn't available in such Mercurial, even though there are some
code paths for Mercurial earlier than 2.3 in perf.py.

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

To get appropriate vfs-like object to access files under .hg/store,
this patch adds getsvfs() (and also getvfs(), for future use).

To avoid examining existence of attribute at each repetition while
measuring performance, getsvfs() is invoked outside the function to be
called repeatedly.

This patch also adds check-perf-code.py an extra check entry to detect
direct usage of repo.(vfs|svfs|opener|sopener) in perf.py.
2016-10-09 01:03:18 +09:00
FUJIWARA Katsunori
9d79ac8dbc perf: get subsettable from appropriate module for Mercurial earlier than 2.9
Before this patch, using branchmap.subsettable prevents perfbranchmap
from measuring performance of Mercurial earlier than 2.9 (or
aad678a92970), because aad678a92970 moved subsettable from repoview.py
to branchmap.py, even though there are some code paths for Mercurial
earlier than 2.9 in perf.py.

For example, setting "_prereadsize" attribute in perfindex() and
perfnodelookup() is effective only with hg earlier than 1.8 (or
1299f0c14572).

To get subsettable from appropriate module, this patch examines
existence of subsettable in branchmap and repoview.

This patch also adds check-perf-code.py an extra check entry to detect
direct usage of subsettable attribute in perf.py.
2016-10-09 01:03:17 +09:00
Mateusz Kwapich
f97c61b781 py3: use raw strings in line continuation (convert ext)
Our py2 to py3 string translations marks those as bytestrings.
2016-10-10 05:31:31 -07:00
Mateusz Kwapich
41dd071f2f py3: namedtuple takes unicode (journal ext)
namedtuple usage consistent with changelog.py:141
2016-10-10 05:30:14 -07:00
Pulkit Goyal
65a2376373 py3: test to check which commands run
This test helps us to keep track on the commands which runs to Python 3.
The full traceback is hidden. Thanks to Augie and Martijn to wrap it up
in four lines.
2016-10-09 13:59:20 +02:00
Augie Fackler
5b9434e546 test-clone: discard lock-related messages
We can't predict where those will show up and they're not
super-important for the contents of this particular test, so just drop
them. Further reduces the flakiness of the test to zero.
2016-10-09 04:37:02 -04:00
Augie Fackler
8d7ad91965 test-clone: fix some instability in pooled clone race condition test
Healthy output (one log file mentioning "existing pooled" and one
mentioning "new pooled") will now print in a stable order, but
unhealthy output will print some sort of error.

This reduces the flakiness of the test from 55% to 38%. My next patch
makes it completely stable.
2016-10-09 04:25:22 -04:00
Simon Farnsworth
d5bf3ea399 templater: provide arithmetic operations on integers
The termwidth template keyword is of limited use without some way to ensure
that margins are respected.

Provide a full set of arithmetic operators (four basic operations plus the
mod function, defined to match Python's // for division), so that you can
create termwidth based layouts that match the user's terminal size
2016-10-09 05:51:04 -07:00
Yuya Nishihara
6ed34c797c py3: make check-py3-compat.py load modules in standard manner
Otherwise no code transformation would be applied to the modules which are
imported only by imp.load_module().

This change means modules are imported from PYTHONPATH, not from the paths
given by command arguments. This isn't always correct, but seems acceptable.
2016-10-08 17:22:07 +02:00
Yuya Nishihara
635359be9c py3: include module filename in check-py3-compat.py output
This change is intended to reduce noises in the next patch.
2016-10-09 08:31:39 +02:00
Gábor Stefanik
9fbfde0b09 mail: take --encoding and HGENCODING into account
Fall back to our encoding strategy for sending MIME text
that's neither ASCII nor UTF-8.
2016-10-05 13:45:22 +02:00
Simon Farnsworth
c7fbc87ac7 template: provide a termwidth keyword (issue5395)
We want to provide terminal-sized output. As a starting point, expose the
terminal width to the templater for use in things like fill.
2016-10-08 02:26:48 -07:00
Augie Fackler
10de2c7e4f util: ensure forwarded attrs are set in globals() as sysstr
Custom module importer strikes again.
2016-10-08 08:36:39 -04:00
Augie Fackler
968375bf81 i18n: make the locale directory name the same string type as the datapath 2016-10-08 05:26:18 -04:00
Yuya Nishihara
5196f3da90 templater: add relpath() to convert repo path to relative path (issue5394)
File paths in template are repository-absolute paths. This function can be
used to convert them to filesystem paths relative to cwd. This also converts
'/' to '\\' on Windows.
2016-10-08 15:24:26 +02:00
Ryan McElroy
eabf9d1003 import: abort instead of crashing when copy source does not exist (issue5375)
Previously, when a patch contained a move or copy from a source that did not
exist, `hg import` would crash. This patch changes import to raise a PatchError
with an explanantion of what is wrong with the patch to avoid the stack trace
and bad user experience.
2016-10-08 05:26:58 -07:00
Mateusz Kwapich
c9434eddcf py3: make encodefun in store.py compatible with py3k
This ensures that the filename encoding functions always map bytestrings
to bytestrings regardless of python version.
2016-10-08 08:54:05 -07:00
Tooru Fujisawa
2c9ec77e6d hgweb: avoid line wrap between revision and annotate-info (issue5398)
Add white-space: nowrap to td.annotate to avoid wrapping div.annotate-info
into next line if there is revision number in the same cell, as it is hard to
mouse over div.annotate-info if it's wrapped into next line.
2016-10-08 19:32:54 +09:00
Pulkit Goyal
5df46f7e20 mail: handle renamed email.Header
We are still using email.Header which was renamed to email.header back in
Python 2.5. References: https://hg.python.org/cpython/file/2.4/Lib/email
and https://hg.python.org/cpython/file/2.5/Lib/email
2016-10-07 17:30:11 +02:00
Augie Fackler
efaaf08415 revset: build _syminitletters from a saner source: the string module
For now, these sets will be unicode characters in Python 3, which is
probably wrong, but it un-blocks importing the module so we can get
further along. In the future we'll have to come up with a reasonable
encoding strategy for revsets in Python 3.

This patch was originally pair-programmed with Martijn.
2016-10-07 08:32:40 -04:00
Pierre-Yves David
8b00f799de pull: grab wlock during pull
because pull might move bookmarks and bookmark are protected by wlock, we have
to grab wlock for pull :-(

This required a small upgrade of the 'lockdelay' extension used by
'test-clone.t' because the delay must apply to a single lock only.
2016-08-23 23:47:59 +02:00
Simon Farnsworth
3622717b76 merge: add conflict labels to merge command
Now that we present the conflict labels in prompts, it's useful to have
better names than "local" and "other" for every command.
2016-10-07 08:51:50 -07:00
Simon Farnsworth
dfbb92b63b merge: use labels in subrepo merge
This is the last place that doesn't respect conflict labels in merge output.
Teach subrepos to use subrepo merge output too.
2016-10-08 01:25:28 -07:00
Augie Fackler
8facc4e910 hgmanpage: stop using raw-unicode strings
These don't exist in Python 3, and this ends up looking a little more
explicit to Martijn and me anyway.
2016-10-07 07:43:04 -04:00
Augie Fackler
2b99f3fc25 util: use string.hexdigits instead of defining it ourselves
This resolves some Python 3 weirdness.
2016-10-07 08:58:23 -04:00
Augie Fackler
ef318ea690 util: correct check of sys.version_info
sys.version is a string, and shouldn't be compared against a tuple for
version comparisons. This was always true, so we were never disabling
gc on 2.6.

>>> (2, 7) >= '2.7'
True
>>> (2, 6) >= '2.7'
True
2016-10-07 08:01:16 -04:00
Pulkit Goyal
757d64b218 py3: handle multiple arguments in .encode() and .decode()
There is a case and more can be present where these functions have
multiple arguments. Our transformer used to handle the first argument, so
added a loop to handle more arguments if present.
2016-10-07 14:04:49 +02:00
Pulkit Goyal
3a0ce3bcba py3: convert to unicode to pass into encode()
encoding.encoding is bytes, we need to pass it to encode() which accepts
unicodes in py3, so used pycomapt.sysstr() Also this can't be done using
transformer as that only transforms the string values not variables.
2016-10-07 12:13:28 +02:00
Yuya Nishihara
7078b29941 revset: do not rewrite ':y' to '0:y' (issue5385)
That's no longer valid since the revision 0 may be hidden. Bypass validating
the existence of '0' and filter it by spanset.
2016-10-01 20:20:11 +09:00
Gregory Szorc
f91c7e8491 hg: set default path correctly when doing a clone+share (issue5378)
Before, if performing a clone+share from a repo that was itself
using shared storage, the share code would copy paths.default from
the underlying repo being shared, not from the source given by
the user.

This patch teaches hg.clonewithshare to resolve paths.default
and pass it to share so it can be written to the hgrc accordingly.
2016-10-02 22:34:40 -07:00
Pulkit Goyal
8ae574b546 py3: use unicode in is_frozen()
imp.is_frozen() doesnot accepts bytes on Python 3.
It does accept both bytes and strings on Python 2.
2016-10-02 05:29:17 +05:30
Pulkit Goyal
93ca2d7cd6 py3: use unicodes in __slots__
__slots__ doesnot accepts bytes on Python 3.
2016-10-02 03:38:14 +05:30
Augie Fackler
8bed0bf30f merge with stable 2016-10-01 15:10:38 -04:00
Yuya Nishihara
f3a42c7e9f url: fix crash by empty path with #fragments
Before, "#foo" paths made hg crash. We've moved the #fragment parsing at
246862840084, but we shouldn't set path to None too early. This patch just
removes the "if not path:" block since that's checked a few lines later.
2016-09-30 21:38:47 +09:00
Yuya Nishihara
19a513c19c py3: make i18n use encoding.environ 2016-09-28 20:07:32 +09:00
Yuya Nishihara
52ffc6a5bd py3: provide encoding.environ which is a dict of bytes
This can't be moved to pycompat.py since we need encoding.tolocal() to
build bytes dict from unicode os.environ.
2016-09-28 20:05:34 +09:00
Pierre-Yves David
9680f282d3 extensions: fix a debug message when searching for extensions
The "next" value was wrong. When 'hgext.NAME' is not found we now search for
'hgext3rd.NAME'.
2016-09-30 00:25:15 +02:00
Mateusz Kwapich
016e1e5ef8 dirstate: rebuild should update dirstate properly
Updating dirstate by simply adding and dropping files from self._map doesn't
keep the other maps updated (think: _dirs, _copymap, _foldmap, _nonormalset)
thus introducing cache inconsistency.

This is also affecting the debugstate tests since now we don't even try to set
correct mode and mtime for the files because they are marked dirty anyway and
will be checked during next status call.
2016-08-30 15:16:28 -07:00
Augie Fackler
8843ab4c98 help: mark boolean flags with [no-] to explain that they can be negated
That is, help gets tweaked thus:

  global options ([+] can be repeated):
   -v --[no-]verbose      enable additional output


Other proposals have included:

  global options ([+] can be repeated, options marked [?] are boolean flags):
   -v --verbose[?]        enable additional output

and

  global options ([+] can be repeated, options marked [^] are boolean flags):
   -v --verbose[^]        enable additional output

which avoid the unfortunate visual noise in this patch. In this
version's favor, it's consistent with what I'm used to seeing in man
pages and similar documentation venues.
2016-09-13 22:58:12 -04:00
Yuya Nishihara
09cf7ebffd demandimport: error out early on missing attribute of non package (issue5373)
If the parent module isn't a package, all valid attributes must be obtained
from it. We can raise ImportError early if any attributes not found.
2016-09-26 23:28:57 +09:00
Anton Shestakov
9edbb61202 hgweb: make anchor name actually match its href on help index page 2016-09-26 16:12:40 +08:00
Gregory Szorc
55983533a4 perf: add perfchangegroupchangelog command
This command can be used for testing the performance of producing the
changelog portion of a changegroup.

We could use additional perf* commands for testing other parts of
changegroup. Those can be written another time, when they are needed.
(And those may want to refactor the changegroup generation API so code
can be reused.) Speaking of code reuse, yes, this command does reinvent
a small wheel. I didn't want to scope bloat to change the changegroup
API because that will invite bikeshedding.
2016-09-24 12:22:30 -07:00
Yuya Nishihara
16b1b93d3f log: copy the way of ancestor traversal to --follow matcher (issue5376)
We can't use fctx.linkrev() because follow() revset tries hard to simulate
the traversal of changelog DAG, not filelog DAG. This patch fixes
_makefollowlogfilematcher() to walk file ancestors in the same way as
revset._follow().

I'll factor out a common function in future patches.
2016-09-24 19:58:23 +09:00
Gregory Szorc
f892a67fb1 tests: actually test non-generaldelta variant for stream clones
88ce883ffb46 accidentally made both tests test generaldelta repos.
Restore the test for a non-gd repo.
2016-09-25 13:20:55 -07:00
Hannes Oldenburg
d853961750 templates: add built-in files() function
We already support multiple primitive for listing files, which were
affected by the current changeset.
This patch adds files() which returns files of the current changeset
matching a given pattern or fileset query via the "set:" prefix.
2016-09-23 08:15:05 +00:00
Xidorn Quan
a5b2da437e rebase: rebase changesets in topo order (issue5370) (BC)
There are two reasons that rebase should be done this way:
1. This would make rebasing faster because it would minimize the total
   number of files to be checked out in the process, as it don't need
   to switch back and forth between branches.
2. It makes resolving conflicts easier as user has a better context.

This commit changes the behavior in "Test multiple root handling" of
test-rebase-obsolete.t. It is an expected change which reflects the new
behavior that commits in a branch are grouped together when rebased.
2016-09-17 17:02:56 +10:00
Yuya Nishihara
03a45f600c graphlog: preserve topo sort even if additional filter options specified
Use ordered=revset.followorder instead. This change is logically the same
as 0a4ba6171d17.
2016-09-22 20:53:53 +09:00
FUJIWARA Katsunori
8a6898b88d scmutil: add file object wrapper class to check ambiguity at closing
In Mercurial source tree, opening a file in "a"/"a+" mode like below
doesn't specify atomictemp=True for vfs, and this avoids file stat
ambiguity check by atomictempfile.

  - writing changes out in revlog layer uses "a+" mode
  - truncation in repair.strip() uses "a" mode
  - truncation in transaction._playback() uses "a" mode

If steps below occurs at "the same time in sec", all of mtime, ctime
and size are same between (1) and (3).

  1. append data to revlog-style file (and close transaction)
  2. discard appended data by truncation (strip or rollback)
  3. append same size but different data to revlog-style file again

Therefore, cache validation doesn't work after (3) as expected.

This patch adds file object wrapper class checkambigatclosing to check
(and get rid of) ambiguity at closing. It is used by vfs in subsequent
patch.

This is a part of ExactCacheValidationPlan.

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan

BTW, checkambigatclosing is tested in test-filecache.py, even though
it doesn't use filecache itself, because filecache assumes that file
stat ambiguity never occurs (and there is no another test-*.py related
to filecache).
2016-09-22 21:51:57 +09:00
Anton Shestakov
b13a9ea1f9 gitweb: tweak branch table's last row's cell colspan on summary page
This table only has 3 columns, so max sensible colspan is 3.
2016-09-21 19:52:48 +08:00
timeless
837067a341 tests: clarify demandimport disabled state 2016-09-21 03:39:37 +00:00
timeless
129b8093c7 tests: favor single quotes for wrapping hg help ... 2016-09-20 23:49:20 +00:00
timeless
94b5113786 samplehgrcs: use single quotes in use warning 2016-09-20 23:49:00 +00:00
timeless
d938849e7f util: use single quotes in use warning 2016-09-20 23:48:30 +00:00
timeless
38fbbc49b0 localrepo: use single quotes in use warning 2016-09-20 23:48:08 +00:00
timeless
5fd9e9e1b5 help: use single quotes in use warning 2016-09-20 23:47:46 +00:00
timeless
a57e86590a discovery: use single quotes in use warning 2016-09-20 23:47:30 +00:00
timeless
dd077e79ae bundle: use single quotes in use warning 2016-09-20 23:46:15 +00:00
timeless
04798f0fb8 histedit: use single quotes in use warning 2016-09-20 23:45:25 +00:00
timeless
80ebd8528d mq: use single quotes in use warning 2016-09-20 23:44:59 +00:00
timeless
1be7bec44c rebase: use single quotes in use warning 2016-09-20 23:44:28 +00:00
timeless
872aae0d97 push: update help hint to point to config.paths section 2016-09-20 20:12:38 +00:00
timeless
263e302697 update: use single quotes in use warning 2016-09-02 21:49:33 +00:00
timeless
9b9d2357c6 remove: specify hg in added warning 2016-09-02 21:46:00 +00:00
Augie Fackler
cd4972dca8 copy: document current behavior of 'hg cp --after'
I'm about to propose an output change here, but the existing behavior
was untested!
2016-09-19 17:14:43 -04:00
Yuya Nishihara
320973b5ef revset: fix keyword arguments to go through optimization process
Before, a keyvalue node was processed by the last catch-all condition of
_optimize(). Therefore, topo.firstbranch=expr would bypass tree rewriting
and would crash if an expr wasn't trivial.
2016-08-07 14:58:49 +09:00
Augie Fackler
97b8f423b9 exchange: correctly specify url to unbundle (issue5145)
This parameter is slightly confusingly named in wireproto, so it got
mis-specified from the start as 'push' instead of the URL to which we
are pushing. Sigh. I've got a patch for that which I'll mail
separately since it's not really appropriate for stable.

Fixes a regression in bundle2 from bundle1.
2016-08-05 16:25:15 -04:00
Matt Mackall
8b736f8354 date: accept broader range of ISO 8601 time specs
The "normal" ISO date/time includes a T between date and time. It also
allows dropping the colons and seconds from the timespec. Add new
patterns for these forms as well as tests.
2016-07-27 15:22:36 -05:00