Commit Graph

746 Commits

Author SHA1 Message Date
Matt Mackall
d800d72300 merge with stable 2014-02-19 16:46:47 -06:00
Yuya Nishihara
cdb5aade4f hgweb: make sure sys module is loaded prior to reload hack
If sys is still a demandmod, reload(sys) fails with "TypeError: reload()
argument must be module".
2014-02-19 21:16:43 +09:00
Matt Mackall
fd6c6f9614 hgweb: hack around mimetypes encoding thinko (issue4160)
A correct patch for this has existed in Python's BTS for 3 years
(http://bugs.python.org/issue9291), so waiting for it to be fixed
upstream is probably not a viable strategy. Instead, we add this
horrible hack to workaround the issue in existing copies of Python
2.4-2.7.
2014-02-05 17:23:35 -06:00
Matt Mackall
b81a4c8743 merge with stable 2014-02-05 18:09:07 -06:00
Lucas Moscovicz
ef8bd69f5f revset: added baseset class (still empty) to improve revset performance
This class is going to be used to cache the set that is created from this list
in many cases while evaluating a revset.
2014-01-21 11:39:26 -08:00
Takumi IINO
db72b3b5e8 hgweb: avoid invalid infinity scroll request when overwritten web.style
Infinity scroll is broken when you override the web.style in the following ways:

    $ hg --config='web.style=gitweb' serve
    $ open http://localhost:8080/shortlog?style=paper

ajaxScrollInit should use http://localhost:8080/shortlog/%next%?style=paper.
however, http://localhost:8080/shortlog/%next% is used actually.
It is missing style parameter.

This patch add style parameter to request url.
2014-01-08 00:35:03 +09:00
Brodie Rao
7dec608ff1 hgweb: simplify branches with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Brodie Rao
adc7ea02cb hgweb: simplify summary with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Matt Mackall
b73357aaab merge with stable 2013-12-13 17:23:02 -06:00
Matt Mackall
03adb7cbe4 hgweb: avoid initialization race (issue3953) 2013-12-04 13:42:28 -06:00
Matt Mackall
40d3e4ba4e merge with stable 2013-11-22 17:26:58 -06:00
Isaac Jurado
b5e7be1139 hgweb: ignore non numeric "revcount" parameter values (issue4091) 2013-11-08 09:48:01 +01:00
Wagner Bruna
b966a63297 hgweb, i18n: do not translate search mode description
The search mode description can't be translated by itself, since
it's displayed as part of a template phrase (the "Assuming ..."
/ "Use ... instead" bits). Just drop the translation markers for
now, since the templates themselves currently do not support
translations.
2013-11-13 16:46:46 -02:00
Augie Fackler
9f876f6c89 cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
2013-11-06 16:48:06 -05:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
Alexander Plavin
91879c1d15 hgweb: use semantically suitable filelog.revs in filelog
The functions are equivalent in behaviour, so no behavior change.
2013-11-10 18:23:29 +04:00
Alexander Plavin
1fa7978d6b hgweb: always compute all entries and latestentry in filelog
This is the same thing which was done for changelog earlier, and it doesn't
affect performance at all. This change will make it possible to get the first
entry of the next page easily without computing the list twice.
2013-11-10 18:07:56 +04:00
Alexander Plavin
6a6391cdb6 hgweb: remove unused argument of entries function in filelog
This doesn't change the behavior as the argument wasn't used anyway.
2013-11-10 18:05:53 +04:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Alexander Plavin
24f9b953ea hgweb: remove now unnecessary explicit header() and footer()
They became unnecessary after allowing custom-named entries in templates.
2013-07-24 03:20:26 +04:00
Matt Mackall
397a3b5d72 merge with stable 2013-10-09 14:15:34 -07:00
Matt Mackall
e1cd16976f hgweb: add escaping of tags and bookmarks in graph view 2013-10-09 12:02:32 -07:00
Matt Mackall
1b8efe2652 hgweb: escape branch names in graph view 2013-10-07 15:21:17 -07:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
David Soria Parra
4e97756fe4 hgweb: log headers only if headers were successfully parsed
The headers attribute is not initialized in certain error situations
(e.g. http 400 bad request). Check for self.headers before we attempt
to access it.
2013-10-01 09:54:46 +02:00
Alexander Plavin
f7a860d1a8 hgweb: replace next(revs) to revs.next() to fix compatibility with Python 2.5- 2013-07-25 15:27:41 +04:00
Alexander Plavin
953f96e356 hgweb: fix duplication for some search queries
Given that N is maximum revision number in a repo, than if a revision with
number N-100n or N-100n+1 (for any integer n) is found with a hgweb search,
this revision is duplicated in search results.
2013-07-21 01:38:04 +04:00
Alexander Plavin
e2c135afa3 hgweb: add link to force literal keyword search
This makes it possible to make keyword search in case the search query also
specifies an exact revision (like '1234' or 'abcdef'), or a revset expression.
2013-09-06 13:30:56 +04:00
Alexander Plavin
ce8859ee70 hgweb: pass variable with current search mode name to the search template 2013-09-06 13:30:56 +04:00
Alexander Plavin
eee67f7bda hgweb: add nextentry variable for easy pagination in changelog
nextentry always contains the first entry not shown on current page (if there is
such entry)
2013-09-06 13:30:57 +04:00
Alexander Plavin
be32ad07fd hgweb: always compute all entries and latestentry in changelog
Get the whole list of entries before rendering instead of using lazy evaluation.
This doesn't affect the performance for usual case when the entries are shown
anyway. When both entries and latestentry are used, this performs unnoticeably
faster, and for pages which use only latestentry (quite uncommon case) it
would be a bit slower.
This change will make it possible to get the first entry of the next page easily
without computing the list twice.
2013-09-06 13:30:57 +04:00
Alexander Plavin
3f021369d6 hgweb: remove unused argument of changelist function in changelog
This doesn't change the behavior as the argument isn't used anyway, and
it's a preparation to the next patches,
2013-09-06 13:30:57 +04:00
Alexander Plavin
e1392e4ce2 hgweb: add revset syntax support to search
This mode is used when all the conditions are met:
- 'reverse(%s)' % query string can be parsed to a revset tree
- this tree has depth more than two, i.e. the query has some part of
revset syntax used
- the repo can be actually matched against this tree, i.e. it has only existent
function/operators and revisions/tags/bookmarks specified are correct
- no revset regexes are used in the query (strings which start with 're:')
- only functions explicitly marked as safe in revset.py are used in the query

Add several new tests for different parsing conditions and exception handling.
2013-09-06 13:30:56 +04:00
Alexander Plavin
279ad45b7d hgweb: import the whole util module in webcommands instead of just one function
This is to allow using other functions from this module easily.
2013-09-03 20:02:53 +04:00
Alexander Plavin
0aac0cdac8 hgweb: add string constants for search mode names
It helps detecting mistakes in the mode names.
2013-09-04 19:40:04 +04:00
Alexander Plavin
eac9cb37ca hgweb: always run search when a query is entered (bc)
This changes the behavior for queries which point at a revision directly,
now the output is consistent to other cases: it results in only this matched
revision shown, not the log starting with it.
A new test checks this behaviour and fails for the old one.
2013-07-19 02:09:13 +04:00
Alexander Plavin
ea40ee8f63 hgweb: search() function supports direct pointing to revision
This doesn't change the behavior, as queries directly pointing to revisions
are not delegated to the search() function now.
2013-07-19 02:41:11 +04:00
Alexander Plavin
d2cc03584c hgweb: pass arguments which a function depends on explicitly in search
This changes makes clearer which arguments can a function depend on. Now all
the modified functions depend on the 'query' argument only, but future additions
will change it.
2013-08-22 16:42:10 +04:00
Alexander Plavin
44f0fb3b4e hgweb: add dynamic search function selection, depending on the query
This allows adding other specific search functions, in addition to current
keyword search.
2013-08-22 16:45:23 +04:00
Alexander Plavin
1a5c5a0196 hgweb: cleaner if conditions in changelog() function
This removes unneeded extra nesting level and extra variable, which makes
the code easier to understand.
2013-07-19 02:08:19 +04:00
Alexander Plavin
888e02c499 hgweb: separate search itself and template generation
This will make it simpler to add other search modes.
2013-07-15 01:10:22 +04:00
Augie Fackler
c8819014d3 hgweb: force connection close on early response
Not all WSGI servers close the socket when an early response is sent
to a large POST request, which can cause the server to interpret the
already-sent request body as an incoming (but hopelessly invalid)
request.
2013-05-11 20:40:15 -05:00
Alexander Plavin
0b5af3690c hgweb: fix incorrect revisions count in graph (issue3977)
Actual amount of revisions is used now instead of their numbers in the repo
before to deal with skipped numbers correctly.
2013-07-25 02:41:22 +04:00
Alexander Plavin
553f7e5d2b hgweb: fix incorrect way to count revisions in log (issue3977)
Actual amount of revisions is used now instead of their numbers in the repo
before to deal with skipped numbers correctly.
This iterates starting from the newest revision (which is shown on top)
yielding up to the specified count, instead of the reversed order used before.
Effect of this change on efficiency is negligible, when the same changesets are
returned.
2013-07-25 02:22:39 +04:00
Alexander Plavin
f8894d94ab hgweb: always start graph with the revision in url
It is the same fix for graph command, as was recently for log. This makes the
specified revision be always on top of the graph view.
Before the patch, for example with repo having revisions 0, 1, 2, 3 and revision
in url being '2', all revisions were shown and the specified one wasn't
the first.
2013-07-25 02:48:21 +04:00
Alexander Plavin
39b918d7ca hgweb: always start log with searched revision
This makes the specified revision be always on top of the list.
Before the patch, for example with repo having revisions 0, 1, 2, 3 and user
searching for '2', all revisions were shown and the specified one wasn't
the first.
2013-07-13 02:36:29 +04:00
Alexander Plavin
f36cebc920 hgweb: run search instead of showing wrong error for ambigious identifier
Before this when multiple changesets hashes in the repos started with the
search query string, error was given that the revision isn't found, and it
was misleading. Now a simple keyword search runs in this case.
2013-07-12 01:58:48 +04:00
Alexander Plavin
79f178845b hgweb: move local changelist function to the beginning of the parent one 2013-07-15 01:05:42 +04:00
Alexander Plavin
b84ced8343 hgweb: show current search query in the input field 2013-07-11 17:01:54 +04:00
Pierre-Yves David
e23948d63d hgweb: handle filtered "0" rev in navigation
Before this changeset, navigation generation crashed if revision "0" was
filtered. We introduce a `_first` methods on revision navigation that return the
lowest unfiltered element and use it in two place were the "0" changeset was
explicitly referenced.

Test case are introduced.
2013-04-30 13:53:49 +02:00