Commit Graph

14661 Commits

Author SHA1 Message Date
Anton Shestakov
4de10bfe5d coal: reuse style-paper.css and use a separate css file for visual tweaks
To remove another big chunk of duplication from coal hgweb style, we can move
all visual tweaks to style-extra-coal.css and include it together with
style-paper.css.
2015-09-18 14:03:32 +08:00
Anton Shestakov
e8f1879f80 coal: reuse all templates from paper/map by %including the file
Before, coal/map simply had all the templates copied and pasted from paper/map
file. It was easy to make a change to paper that would get into coal only
partially and just sit there until something like 216a95e6094f happened.

Let's remove this duplication from coal/map by using %include to reuse
templates from paper/map directly.
2015-09-18 01:06:27 +08:00
timeless@mozdev.org
ed7f1d1663 help/config: reword committemplate external editor text 2015-09-04 05:40:52 -04:00
timeless@mozdev.org
59c061a8d6 help/config: reword committemplate multibyte character text 2015-09-04 05:40:37 -04:00
timeless@mozdev.org
11a62cdebb help/config: use :hg:help config.... notation 2015-08-28 15:43:14 -04:00
timeless@mozdev.org
a92c1c739a help/config: omit True or False 2015-08-28 15:24:58 -04:00
timeless@mozdev.org
37e4b0effc help/config: capitalize items 2015-08-28 15:13:28 -04:00
Anton Shestakov
a80c2de885 gitweb: add author to filelogentry
The line is copied from shortlogentry template.
2015-09-18 14:24:53 +08:00
Anton Shestakov
66ab769443 monoblue: add author to filelogentry
The line is copied from shortlogentry template.
2015-09-18 14:24:38 +08:00
Anton Shestakov
b1908a7d13 monoblue: split a long line in filelogentry template
The whole td has a nowrap class, which disallows breaking the line, so it's not
required to use non-breakable spaces.
2015-09-18 14:23:44 +08:00
Yuya Nishihara
b2d79071df readbundle: fix typo of None compression
The test simulates pre-53c48b25631a hgweb that sends "unbundle" capability
with no argument.
2015-09-18 21:32:43 +09:00
Pierre-Yves David
0b4b905886 readbundle: map 'HG10UN' to None compression
In line with the other previous changes
2015-09-11 17:06:56 -07:00
Pierre-Yves David
70cc7f5586 getsubset: use None to request uncompressed changegroup 2015-09-11 17:06:02 -07:00
Pierre-Yves David
a9d2d02aff bundle: use None when unpacking uncompressed changegroup
Let's be more modern!
2015-09-11 17:05:46 -07:00
Pierre-Yves David
6a841b0f13 writebundle: use 'None' instead of 'UN' for the bundle2 case
Let's be modern!
2015-09-15 17:43:54 -07:00
Pierre-Yves David
47af8d73d3 compression: use 'None' for no-compression
This seems more idiomatic and clearer. We still support both None and 'UN' for
now because no user are migrated.
2015-09-15 17:53:28 -07:00
Pierre-Yves David
f052875fa0 changegroup: move all compressions utilities in util
We'll reuse the compression for other things (next target bundle2), so let's
make it more accessible and organised.
2015-09-15 17:35:32 -07:00
Pierre-Yves David
c27b91f154 obsolete: clarify that 'successorssets' returns the latest successors
We do not return the first successors we found, we returns the latest (non
obsolete  (mostly)) one following the obsolete link transitively. We update the
documentation to make this clean.
2015-09-15 13:12:03 -07:00
Pierre-Yves David
f317af09f6 obsolete: drop an empty line at the end of a docstring
This empty line is useless, let's drop it.
2015-09-15 13:10:25 -07:00
Pierre-Yves David
4595c06fb1 traceback: allow providing a local support contact point
The extensions blaming code is fine for casual users but pretty terrible for
corporate environments that can deploy a large amount of extensions to
unsuspecting users. Reports will likely blame a random "innocent" extension (in
our case crecord) and the hint in the message will triggers endless debug
attempts from the user.

We introduce a "ui.supportcontact" option that allow such big company to redirect
their users to their own support desk. This disables all extensions blaming and
just point people to the local support in all cases.
2015-09-11 12:45:19 -07:00
Pierre-Yves David
50db85e952 dispatch: pre-indent the extensions blaming logic
We are about to put some real conditional here, but pre-indenting in it's own
changesets makes next patch much cleaner.
2015-09-17 11:50:55 -07:00
Yuya Nishihara
a3529f51c1 localrepo: refresh filecache stats only if transaction finished successfully
If commit is aborted by pretxncommit hook, in-memory changelog and manifest
have entries that would be added. So they must be discarded on invalidate().

But the mechanism introduced by 071f71da2fe2 doesn't handle this case well.
It tries to mitigate the penalty of invalidate() by marking in-memory cache
as "clean" on unlock assuming that they are identical to the stored data.
But this assumption is wrong if stored data are rolled back by tr.abort().

This patch moves the hook to post-close action so that it will never be
triggered on abort.

This bug was originally reported to thg, which is only reproducible in
command-server process on unix, evolve disabled.

https://bitbucket.org/tortoisehg/thg/issues/4285/
2015-09-15 00:32:39 +09:00
Yuya Nishihara
b265ea8243 localrepo: move closure of lock release to class
It only captures "self", so it isn't necessary to be created dynamically.
2015-09-15 21:00:28 +09:00
timeless@mozdev.org
180d1578ac posix: shellquote do not require quoting for "+" (issue4818) 2015-09-04 11:15:02 -04:00
Gregory Szorc
4e3c6d9b7a hgweb: consume generator inside context manager (issue4756)
If code inside a context manager returns a generator, the context
manager exits before the generator is iterated.

hgweb was using a context manager to control thread safe access to a
localrepository instance. But it was returning a generator, so there was
a race condition between a previous request streaming a response to the
client and a new request obtaining the released but in use repository.
By iterating the generator inside the context manager, we ensure we
don't release the repo instance until after the response has finished.

With this change, hgweb finally appears to have full localrepository
isolation between threads. I can no longer reproduce the 2 exceptions
reported in issue4756.

test-hgweb-non-interactive.t has been modified to consume the output
of calling into a WSGI application. Without this, execution of the WSGI
application stalls because of the added yield statement.
2015-09-12 12:16:39 -07:00
Anton Shestakov
d1c17dc442 hgweb: replace .sourcelast with .bottomline that does the same
In paper and Coal, basically, div.sourcelast was only used to make a 1px border
on the bottom of file source view (and only there). It's better to use
bottomline class, that also exists for the same purpose (visually), but is used
more widely and works without needing an empty <div>.
2015-09-14 18:41:09 +08:00
Anton Shestakov
166a086d20 coal: copy newer things from paper
Basically, coal style in hgweb is intended to be functionally equivalent (just
different in style) to paper, and does this by reusing almost all templates
from paper (except header.tmpl, where it specifies a different css file). Looks
like everybody forgot this and so many improvements to paper templates, that
should've also made it into coal, were often only half-done there (usually
thanks to template reuse). Let's fix this by bulk-copying missing things from
paper/map and style-paper.css to coal/map and style-coal.css.

There were many improvements to paper that didn't touch coal, and that makes it
hard to untangle the code and split this patch into many, but here are some of
the changes (paper-only), that now get into coal:

a9c9f5ef6abf - hgweb: color line which is linked to in file source view
1555d017cac7 - hgweb: highlight line which is linked to at annotate view
a46863946982 - hgweb: code selection without line numbers in file source view
636594df4244 - hgweb: add line wrapping switch to file source view
cc6bee069ce6 - hgweb: use css margin instead of empty <p> before diffstat table

It also fixes line anchor in annotateline template (#42 vs #l42).
2015-09-13 21:01:34 +08:00
Gregory Szorc
7769f0b9ff revlog: optionally cache the full text when adding revisions
revlog instances can cache the full text of a single revision. Typically
the most recently read revision is cached.

When adding a delta group via addgroup() and _addrevision(), the
full text isn't always computed: sometimes only the passed in delta is
sufficient for adding a new revision to the revlog.

When writing the changelog from a delta group, the just-added full
text revision is always read immediately after it is written because
the changegroup code needs to extract the set of files from the entry.
In other words, revision() is *always* being called and caching the full
text of the just-added revision is guaranteed to result in a cache hit,
making the cache worthwhile.

This patch adds support to _addrevision() for always building and
caching the full text. This option is currently only active when
processing changelog entries from a changegroup.

While the total number of revision() calls is the same, the location
matters: buildtext() calls into revision() on the base revision when
building the full text of the just-added revision. Since the previous
revision's _addrevision() built the full text and the the previous
revision is likely the base revision, this means that the base
revision's full text is likely cached and can be used to compute the
current full text from just a delta. No extra I/O required.

The end result is the changelog isn't opened and read after adding every
revision from a changegroup.

On my 2013 MacBook Pro running OS X 10.10.5 from an SSD and Python 2.7,
this patch impacted the time taken to apply ~262,000 changesets from a
mozilla-central gzip bundle:

  before: ~43s
  after:  ~32s

~25% reduction in changelog processing times. Not bad.
2015-09-12 16:11:17 -07:00
Gregory Szorc
7f63b5672e revlog: drop local assignment of cache variable
The purpose of this code was to provide thread safety. With the
conversion of hgweb to use separate localrepository instances per
request/thread, we should no longer have any consumers that need to
access revlog instances from multiple threads. Remove the code.
2015-09-12 15:16:47 -07:00
Gregory Szorc
7784d9ad76 revlog: rename generic "i" variable to "indexdata"
Increase readability.
2015-09-12 12:47:00 -07:00
Gregory Szorc
216aba88f8 hg: always create new localrepository instance
cachedlocalrepo.copy() didn't actually create new localrepository
instances. This meant that the new thread isolation code in hgweb wasn't
actually using separate localrepository instances, even though it was
properly using separate cachedlocalrepo instances.

Because the behavior of the API changed, the single caller in hgweb had
to be refactored to always call _webifyrepo() or it may not have used
the proper filter.

I confirmed via print() debugging that id(repo) is in fact different on
each thread. This was not the case before.

For reasons I can't yet explain, this does not fix issue4756. I suspect
there is shared cache somewhere that isn't thread safe.
2015-09-12 11:31:56 -07:00
timeless@mozdev.org
a14fb0ee13 help: fix help argument parsing and documentation
support combining -c and -e

previously -k was misdocumented:
 * the first line didn't mention it
 * the help half implied you could do help -k keyword topic

with these changes, -k just changes the search method

support -c and -e for -k searches
2015-09-10 20:22:37 -04:00
timeless@mozdev.org
ea3920eaa0 minirst: establish leveling for nested definitions 2015-09-10 10:48:20 -04:00
Jordi Gutiérrez Hermoso
b64649a4e1 dispatch: use the right context manager to deactivate demandimport
In 4bc3dc605581 I very embarrassingly wrote a patch with the
completely wrong function name. This should fix it.
2015-09-13 16:30:21 -04:00
Augie Fackler
62a104b3a9 ui: improve docs on ui.log
This makes the documentation on ui.log line up with the use of that
interface in blackbox.
2015-09-10 10:50:03 -04:00
Yuya Nishihara
80896f8bec templater: switch ctx of list expression to rev of revset() (BC)
Because revset() function generates a list of revisions, it seems sensible
to switch the ctx as well where a list expression will be evaluated. I think
"{revset(...) % "..."}" expression wasn't considered well when it was
introduced at 45e0e191755f.
2015-09-12 00:21:41 +09:00
Yuya Nishihara
375ffa2a98 fileset: handle error of string unescaping 2015-09-10 23:32:36 +09:00
Yuya Nishihara
b5477ed9b3 revset: handle error of string unescaping 2015-09-10 23:29:55 +09:00
Yuya Nishihara
9e9d73bc11 parser: move unescape helper from templater
revset and fileset have a similar problem, so let's make it a common helper
function.
2015-09-10 23:25:10 +09:00
Pierre-Yves David
ec3df4a4f5 unionrepo: take delta base in account with building unified revlog
When general delta is enabled, the base is actually meaningful and should be
used. With general delta is enabled, test-unionrepo.t crash without this fix.
2015-09-10 16:14:39 -07:00
Matt Harbison
99ffdaafef extdiff: enable -I/-X with --patch
Not sure how useful this really is, but it's trivial to add and ignoring the
existing arguments supported seems like a bad UI.
2015-09-09 22:27:48 -04:00
Matt Mackall
a8c75dcbec hgweb: drop unused import 2015-09-11 12:48:09 -07:00
Augie Fackler
f68e607993 help/config: back out dc22f967e9b0
This breaks building manpages, and by association breaks building
debs. timeless has a fix coming, but it turns out we'll need to back
out dc22f967e9b0 anyway, so just back it out now to fix building
packages.
2015-09-10 13:45:00 -04:00
Jordi Gutiérrez Hermoso
ccabd73556 filemerge: add non-interactive :merge-local and :merge-other
There are two non-interactive internal merge tools, :other and :local,
but they don't really merge, they just pick all changes from the local
or other version of the file. In some situations, it is known that we
want a merge and also know that all merge conflicts should be resolved
in one direction. Although external merge tools can do this, sometimes
it can be convenient to do so from within hg, without invoking a merge
tool. These new :merge-local and :merge-other tools can do just that.
2015-09-10 09:41:11 -04:00
Jordi Gutiérrez Hermoso
d752ffbdc0 simplemerge: enable option to resolve conflicts one way
With this change, the simplemerge algorithm grows an option to only
return the local or the other hunk in a conflicting region.
2015-08-12 08:53:01 -04:00
Matt Mackall
5b498724ca templater: add new docheader/footer components for XML (issue4135)
The existing header/footer components were templated per-changeset,
and thus couldn't be correctly printed for an empty log
2015-08-26 16:27:14 -05:00
Gregory Szorc
39247b40e9 hgweb: use separate repo instances per thread
Before this change, multiple threads/requests could share a
localrepository instance. This meant that all of localrepository needed
to be thread safe. Many bugs have been reported telling us that
localrepository isn't actually thread safe.

While making localrepository thread safe is a noble cause, it is a lot
of work. And there is little gain from doing so. Due to Python's GIL,
only 1 thread may be processing Python code at a time. The benefits
to multi-threaded servers are marginal.

Thread safety would be a lot of work for little gain. So, we're not
going to even attempt it.

This patch establishes a pool of repos in hgweb. When a request arrives,
we obtain the most recently used repository from the pool or create a
new one if none is available. When the request has finished, we put that
repo back in the pool.

We start with a pool size of 1. For servers using a single thread, the
pool will only ever be of size 1. For multi-threaded servers, the pool
size will grow to the max number of simultaneous requests the server
processes.

No logic for pruning the pool has been implemented. We assume server
operators either limit the number of threads to something they can
handle or restart the Mercurial process after a certain amount of
requests or time has passed.
2015-08-22 18:43:24 -07:00
Gregory Szorc
83818c1fca hg: establish a cache for localrepository instances
hgweb contained code for determining whether a cached localrepository
instance was up to date. This code was way too low-level to be in
hgweb.

This functionality has been moved to a new "cachedlocalrepo" class
in hg.py. The code has been changed slightly to facilitate use
inside a class. hgweb has been refactored to use the new API.

As part of this refactor, hgweb.repo no longer exists! We're very close
to using a distinct repo instance per thread.

The new cache records state when it is created. This intelligence
prevents an extra localrepository from being created on the first
hgweb request. This is why some redundant output from test-extension.t
has gone away.
2015-08-22 18:54:34 -07:00
Gregory Szorc
2aa478bfd2 hgweb: create function to perform actions on new repo
We perform some common tasks when a new repo instance is obtained. In
preparation for changing how we obtain repo instances, factor this
functionality into a standalone function.
2015-08-22 18:15:42 -07:00
Gregory Szorc
e03cfea13e hgweb: remove proxy to hgweb instance
We were temporarily routing attributes until all request-specific
attributes from hgweb were moved to requestcontext. We have finally
reached that juncture and we can remove the proxy.

At this point, only the repo instance is prone to race conditions
between threads. This will be dealt with shortly.
2015-08-22 17:50:28 -07:00