Commit Graph

759 Commits

Author SHA1 Message Date
Matt Mackall
7a68007f38 hgweb: avoid config object race with hgwebdir (issue4326)
Turns out hgwebdir passes full repo objects to each hgweb request
instance, but with a shared baseui. We explicitly break the sharing.
2014-08-10 13:53:36 -05:00
Matt Mackall
0257c423ac hgweb: avoid initialization race (issue4280) 2014-06-16 13:30:46 -05:00
FUJIWARA Katsunori
350af37dc3 hgweb: show revisions and hashes gotten from changelog in "comparison" page
Before this patch, revision numbers and hash values in "comparison"
page are gotten from not changelog but filelog.

Such filelog information is useful only for hgweb debugging, and may
confuse users.

This patch shows revision numbers and hash values gotten from
changelog in "comparison" page.
2014-04-17 09:36:09 +09:00
FUJIWARA Katsunori
62dac3c633 hgweb: show as same parents as "hg parents -r REV FILE" in pages for file
Before this patch, "parents" in pages for file doesn't show as same
parents as "hg parents -r REV FILE", when the specified file is not
modified in the specified revision.

For example, it is assumed that revision A, B and D change file "f".

    changelog   (A) ---> (B) ---> (C) ---> (D)
    filelog "f" (x) ---> (y) ------------> (z)

"/file/D/f" invokes "webutil.parents()" with filectx(z) gotten from
changectx(D), and it returns changectx(B). This is as same result as
"hg parents -r D f".

In the other hand, "/file/C/f" invokes "webutil.parents()" with
filectx(y') gotten from changectx(C), and it returns changectx(A),
because filectx(y') is linked to changectx(B), and works like
filectx(y) in some cases.

In this case, revision B is hidden from users browsing file "f" in
revision C.

This patch shows as same parents as "hg parents -r REV FILE" in pages
for file, by making "webutil.parents()" return:

  - "linkrev()"-ed revision only, if:

    - specified context instance is "filectx" (because
      "webutil.parents()" is invoked with changectx, too), and

    - (1) the revision from which filectx is gotten and (2) the one to
      which filectx is linked are different from each other

  - revision gotten from "ctx.parents()", otherwise
2014-04-17 09:36:08 +09:00
FUJIWARA Katsunori
fc4364cead hgweb: make "comparison" get parent from not filelog but changelog
Before this patch, "comparison" shows unexpected result, when the
specified file is not modified in the specified revision, even though
"diff" shows empty result.

When REV doesn't change specified FILE, "diff" shows:

  "hg diff -c REV FILE"

but "comparison" shows:

  "hg diff -c `hg parents -r REV FILE` FILE"

In other words, the former gets parent from changelog, but the latter
gets one from filelog.

This may confuse users browsing (and switching "diff" and
"comparison" of) files in the specified revision.

This patch makes "comparison" get parent from not filelog but
changelog, to show "hg diff -c REV FILE" in both "diff" and
"comparison" pages.
2014-04-17 09:36:08 +09:00
Pierre-Yves David
5d414d928b wireproto: introduce an abstractserverproto class
sshserver and webproto now inherit from an abstractserverproto class. This class
is introduced for documentation purpose.
2014-03-28 11:10:33 -07:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Lucas Moscovicz
441a4355fa webcommands: changed code to use lazy classes when calling dagwalker
This needs to be changed to use a baseset since dagwalker now expects to
receive a smartset. This is basically wrapping revs into a baseset to be
compatible with smartset implementations.
2014-03-14 08:47:57 -07:00
Augie Fackler
7581d243fc webutil: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:20:04 -04:00
Augie Fackler
0e4f8ed27f webcommands: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:29:07 -04:00
Augie Fackler
66b125778a hgwebdir_mod: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:15:37 -04:00
Matt Mackall
9fadaa2173 merge with stable 2014-02-27 14:48:36 -06:00
Paul Boddie
202d2d5cf4 hgweb: ensure isdirectory is None for repositories, replacing any True value
Until now, repositories did not provide any value for isdirectory in rows
produced for the index output, and thus isdirectory was generally evaluated as
None for each index entry representing a repository.

However, directories (visible when viewed with the descend and collapse
settings enabled) did provide a value of True and this value appeared to
persist in subsequent rows processed by the templater, causing isdirectory
tests in templates to produce incorrect results for index entries appearing
after directories.

This patch asserts the None value for repositories, thus erasing any such
persistent True values.
2014-02-27 00:24:06 +01: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
d800d72300 merge with stable 2014-02-19 16:46:47 -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