Commit Graph

387 Commits (5e7b2dea84a35163b599b88efc02cd7ef3e0ad46)

Author SHA1 Message Date
Joey Hess 5e7b2dea84 rename use_pagespec to pagespec_match_list
To avoid breaking plugins, also support the old pagespec_match_list
calling convention, with a deprecation warning.
2009-10-08 23:51:06 -04:00
Joey Hess 37ec6a8243 Merge branch 'master' into dependency-types
Conflicts:
	IkiWiki.pm
	IkiWiki/Render.pm
	debian/changelog
2009-10-08 20:33:58 -04:00
Joey Hess 3bb00d142a Optimize away most expensive file prune calls, when refreshing
Benchmarking refresh of a a wiki with 25 thousand pages showed
file_pruned() using most of the time. But, when refreshing, ikiwiki already
knows about nearly all the files. So we can skip calling file_pruned() for
those it knows about. While tricky to do, this sped up a refresh (that
otherwise does no work) by 10-50%.
2009-10-08 20:27:56 -04:00
Joey Hess d5f0144495 use_pagespec: do not fail with error when unable to match, unless it fails
with an ErrorReason
2009-10-08 18:47:48 -04:00
Joey Hess 5e236f5d25 add use_pagespec and deptype functions 2009-10-08 17:53:20 -04:00
Joey Hess f2b3d13414 fix handling of influences of pagespecs that fail to match
If a pagespec fails to match, I had been throwing the influences away, but
that is not right. Consider `backlink(foo)`, where foo does not exist.
It still needs to be added as an influence, because if it is created, it
will influence the pagespec to match.

But with that fix, `link(bar)` had as influences all pages, whether they
link to bar or not. Which is not necessary, because modifiying a page to
add a link to bar will directly cause the pagespec to match.

So, in match_link (and all the match_* functions for page metadata),
only return an influence if the match succeeds.

match_backlink had been implemented as the inverse of match_link, but that
is no longer completly true. While match_link does not return an influence
on failure, match_backlink does.

match_created_before/after also return the influence on failure, this way
if created_after(foo) currently fails because foo does not exist, it will
still update the page with the pagespec if foo is created.
2009-10-08 13:38:46 -04:00
Joey Hess 0cb08c9a4b bugfix 2009-10-07 22:08:19 -04:00
Joey Hess 5f9860e65c add type info to influence information 2009-10-07 21:52:37 -04:00
Joey Hess bb389a5ae2 convert add_depends to use influences
No more horrible special-case pagespec parsing.

OTOH, matching over all pages to determine influences is a lot of work.
2009-10-07 21:17:57 -04:00
Joey Hess 4002d7c1a4 add influence info to match_*
Also update docs, test suite.
2009-10-07 20:31:13 -04:00
Joey Hess c72fda7d69 make success and failreason objects carry an influences hash
The hash will be used used to record a set of pages that influenced the
result of a pagespec match.

The influences are merged together when boolean and/or are encountered
in a pagespec. That means using a non-short-circuiting OR operator. And
so I use & and | when translating pagespecs, since those bitwise operators
can be overloaded. ("and" and "or" cannot, apparently).
2009-10-07 19:59:26 -04:00
Joey Hess 7a8b492bcc add_depends should default to content dependencies if unknown type specified 2009-10-06 19:07:52 -04:00
Joey Hess e45e23a7f1 oops!! 2009-10-06 19:03:23 -04:00
Joey Hess 03ae087b43 support backlink() in pagespecs for links dependencies 2009-10-06 18:44:59 -04:00
Joey Hess 666a9613a1 implement links dependencies
Involved some code refactoring so that same code that detects
link changes for backlinks updating can be used for link dependency
checking. The nice thing is that link dep checking is thus
comopletly free!
2009-10-05 14:33:23 -04:00
Joey Hess 36c605cada add test suite for add_depends
and found a bug in my bitmath..
2009-10-04 23:27:00 -04:00
Joey Hess d3e0a54344 Merge branch 'master' into dependency-types 2009-10-04 20:37:09 -04:00
Joey Hess d797b9ab0e remove /i from regexp
Nothing case-oriented going on in here.
2009-10-04 20:35:02 -04:00
Joey Hess be032a7b87 rework dependency types code
Simplify, change default content depends number to 1,
change interface to make more sense.
2009-10-04 20:30:21 -04:00
Joey Hess da5c12e9eb expand the set of things that can be matched contentless 2009-10-04 16:01:56 -04:00
Joey Hess daafdf1acb optimise add_depends for simple pagespecs
We don't need to check if the pagespec is contentless; all simple ones are.
2009-10-04 15:43:38 -04:00
Joey Hess 5fd230f968 detect pagespecs that require content dependencies
When adding a contentless dependency, the pagespec also needs to be one
that does not look at any page content information.

As a first approximation of that, only allow glob-based pagespecs in
contentless dependencies. While there are probably a few other types of
pagespecs that can match contentless, this will work for most of them.
2009-10-04 15:42:24 -04:00
Joey Hess 743f69c675 add dependency type parameters to add_depends
Dependency types are represented by bits in the values of the %depends
and %depends_simple hashes.

Change the dependslist array saved to the index to a depends hash.
depends_simple is also converted from an array to a hash.

Note that the depends field used to be a string, and we still
have compat code to handle upgrades from that, as well as from the arrays.
I didn't use ikiwiki-transition because I don't want ikiwiki to break if
users forget to run it; also we're going to recommend a full rebuild on
upgrade to this version to get the improved dependency handling. So
this compat code can be removed or moved to ikiwiki-transition later.
2009-10-03 15:31:51 -04:00
Joey Hess ffa73790b5 Fix a bug that could lead to duplicate links being recorded for tags.
Here I was bitten by perl's aliasing of foreach variables
to the loop array contents, and match_link accidentially changed
the contents of %links.

In Jon's testcase, a tag added an absolute link, which was
made relative by the above bug, and then the link was added
again in preprocess, and turned into a duplicate.
2009-10-03 14:16:28 -04:00
Joey Hess e4eca63767 do not need to qualify %links 2009-10-03 14:01:19 -04:00
Joey Hess 81a9b5feff Merge branch 'master' into cvs 2009-09-10 13:44:27 -04:00
Joey Hess 98ed7cb1d7 Fix parsing web commits from ipv6 addresses.
I weakended the regexp, so this matches ipv6 addresses too. It does not
ensure that the address is valid, but that should not matter here.

Note that addresses ending in "::" are not matched, so eg, the unspecified
address will not match -- but should never appear here anyway.
2009-09-10 13:32:13 -04:00
Joey Hess 2a99ebf276 underlay: Also allow configuring additional directories to search for template files in. 2009-09-08 17:27:37 -04:00
Joey Hess 93ab004cc2 memoize template_file
This avoids a lot of unncessary stats, and trims about 1 second
off a docwiki rebuild here.
2009-09-08 17:20:04 -04:00
Amitai Schlair c36d2fa896 Merge branch 'master' of git://github.com/joeyh/ikiwiki 2009-08-30 03:02:15 -04:00
Joey Hess 125c6ec650 <pedant>rename depends_exact to depends_simple
It's not "exact" since case munging has to be done, and I think
"simple" captures the optimisation better.</pedant>

With apologies to smcv, who probably has to rebuild his wiki now.
2009-08-28 15:13:45 -04:00
Simon McVittie 2a7f3b91d4 Force %depends_exact to lower case, fixing incorrect case-sensitivity 2009-08-28 15:42:04 +01:00
Simon McVittie b6992ec566 Auto-detect "simple dependencies" instead of requiring callers to use add_depends_exact() 2009-08-28 15:41:26 +01:00
Simon McVittie c80a3cbcfd Add depends_exact: simplified dependency tracking for dependencies on a single page
Let E be the number of dependencies per page of the form "A depends on B and
nothing else", let D be the number of other dependencies per page,
let P be the total number of pages, and let C be the number of changed
pages in a refresh.

This patch should speed up a refresh from O(E*C*P + D*C*P) to
O(C + E*P + D*C*P), assuming that hash lookups are O(1).

In practice, plugins like inline and map produce a lot of these very simple
dependencies, and my album plugin's combination of inline with a large
number of pages causes it to suffer particularly badly.

In testing on a wiki with about 7000 objects (3500 full pages, 3500
images), a full rebuild continued to take about 5:30, and a refresh
after touching about 350 pages and 350 images reduced from 5:30 to 1:30.

As with my previous optimizations, this change will result in downgrades not
working correctly until the wiki is rebuilt.
2009-08-28 15:34:35 +01:00
Joey Hess b3d65aee18 Merge commit 'remotes/smcv/ready/remove-pagespec-merge' 2009-08-25 17:21:19 -04:00
Joey Hess 5bcdc39999 Revert "Allow add_depends to take an arrayref"
This reverts commit e4cd168ebe.

There was no benefit to this change.
2009-08-25 17:11:29 -04:00
Simon McVittie 1ea8580a5f Remove now-unused function pagespec_merge
Now that dependencies are a list of pagespecs with an implicit "or"
operation, there's no need to try to merge pagespecs under normal use.

ikiwiki-transition contains the only use of the function, so move
it there rather than deleting it entirely (it's used to concatenate all
admins' lists of locked pages).
2009-08-25 00:31:40 +01:00
Simon McVittie 275dd5c4ea IkiWiki::pagename: memoize results
This relies for its correctness on %config, %hooks and pagetype() not
changing.
2009-08-25 00:31:24 +01:00
Simon McVittie e4cd168ebe Allow add_depends to take an arrayref 2009-08-25 00:31:24 +01:00
Simon McVittie 7227c2debf Use a hash to de-duplicate dependencies 2009-08-25 00:31:16 +01:00
Simon McVittie 2cf26fd709 Don't bother to save {depends} to the index
As per Joey's review.
2009-08-24 23:18:19 +01:00
Simon McVittie fe4f176f72 Optimize the dependencies list
On a large wiki you can spend a lot of time reading through large lists
of dependencies to see whether files need to be rebuilt (album, with its
one-page-per-photo arrangement, suffers particularly badly from this).

The dependency list is currently a single pagespec, but it's not used like
a normal pagespec - in practice, it's a list of pagespecs joined with the
"or" operator.

Accordingly, change it to be stored as a list of pagespecs. On a wiki
with many tagged photo albums, this reduces the time to refresh after
`touch tags/*.mdwn` from about 31 to 25 seconds.

Getting the benefit of this change on an existing wiki requires a rebuild.
2009-08-24 23:18:10 +01:00
Joey Hess e8fd858340 created_before/after: throw error if specified page does not exist
This assumes that no ctime means the page doesn't exist, which seems
reasonable.
2009-08-16 13:47:04 -04:00
Joey Hess 46a6e27347 fix error message display
The gettext call can clear $@ in at least some cases.
2009-08-16 13:43:31 -04:00
Joey Hess 830c9e59b2 Add discussionpage configuration setting
By adding this setting, we get both more configurability, and a minor
optimisation too, since gettext does not need to be called continually
to get the Discussion value.
2009-08-13 21:41:33 -04:00
Amitai Schlair 2b7a003794 Add my CVS plugin and related patches. 2009-08-13 16:56:26 -04:00
Joey Hess ec965fc92c Merge branch 'master' into po
Conflicts:
	debian/changelog
2009-07-19 12:36:01 +02:00
Simon McVittie e12b7f5e54 Move OpenID pretty-printing from openid plugin to core
On various sites I have two IkiWiki instances running from the same
repository: one accessible via http and only accepting openid logins,
and one accessible via authenticated https and only accepting httpauth.
The https version should still pretty-print OpenIDs seen in git history,
even though it does not itself accept OpenID logins.
2009-07-10 18:41:16 +01:00
Joey Hess 5418385336 Optimise use of gettext, and avoid ugly warnings if Locale::gettext is not available.
The test suite was emitting a lot of ugly gettext warnings;
setting LC_ALL didn't solve the problem for all locale setups
(since ikiwiki remaps it to LANG, and ikiwiki didn't know about
the C locale).

People also seem generally annoyed by the messages when
Locale::Gettext is not installed, and I suspect will be
generally happier if it just silently doesn't localize.

The optimisation came about when I noticed that the gettext
sub was doing rather a lot of work each call just to see
if localisation is needed. We can avoid that work by caching,
and the best thing to cache is a version of the gettext sub
that does exactly the right thing.

This was slightly complicated by the locale setting,
which might need to override the original locale (or lack
thereof) after gettext has been called. So it needs to invalidate
the cache in that case. It used to do it via a global variable,
which I am happy to have also gotten rid of.
2009-06-08 18:33:54 -04:00
intrigeri 86edd73d16 Merge commit 'upstream/master' into pub/po
Conflicts:

	debian/changelog
	debian/control

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-06-06 14:03:40 +02:00