1
0
mirror of https://github.com/vitalif/viewvc-4intranet synced 2019-04-16 04:14:59 +03:00

Compare commits

...

1989 Commits
V0_9 ... master

Author SHA1 Message Date
3c1cfef827 fix glob pattern interpretation 2015-06-16 16:17:01 +03:00
6c18327bbf fix fulltext comment search type radiobutton 2014-12-03 16:38:21 +03:00
cd14ba3825 Fix patch view 2014-04-02 15:29:04 +04:00
8ca4b5b85a Enable branch field if roottype != svn, not if is == cvs 2013-11-20 17:07:20 +04:00
8b3d3363f2 Use non-destructive subconfigs instead of in-place per-root patching of config object 2013-11-20 17:03:33 +04:00
44c5f2bb1a Remove binary_mime_re option 2013-11-20 17:03:33 +04:00
d3d81490e3 Use REQUEST_URI instead of SCRIPT_NAME 2013-09-11 17:05:26 +04:00
5814634779 Fix auth for repository root 2013-08-16 20:18:21 +04:00
b3000cf63b More fixes for globalauth 2013-08-12 16:48:21 +04:00
0a6f6a7a66 OK, now globalauth works without apache2 fixup handler 2013-08-12 16:27:54 +04:00
3ddd0caa42 Start new globalauth implementation 2013-08-09 20:13:57 +04:00
983f9c7379 Post-merge debug.
Also return some lost files back, document 4intra.net modifications
in CHANGES and README files, remove 'union' authorizer and rewritehtml
as the similar functionality is already provided by the core.

Also fix diffs for non-bash (sh/ash/dash) shells.
2013-07-24 17:37:59 +04:00
56c2b61458 Merge with original r2905 2013-07-18 19:13:28 +04:00
vfilippov
479a5b4506 Bug 124910 - Fix indexing file deletions (f**king undocumented swig bindings!!!)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1653 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:24 +04:00
vfilippov
5d442fac7d Bug 113586 - Suppress UNSAFE STATEMENT warning
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1628 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:24 +04:00
vfilippov
57e1ca8909 Bug 113586 - Suppress UNSAFE STATEMENT warning
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1626 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:24 +04:00
vfilippov
8492aa772e Bug 82651 - Limit content length for CALL SNIPPETS
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1609 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:24 +04:00
vfilippov
e854e254f9 Bug 106871
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1603 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
4b06eeeb94 Bug 105184 - Force annotation using client.blame3()
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1593 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
ac063ff93a Bug 82651 - 500 instead of 404 on module import errors
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1591 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
b5ac9522cc Bug 82651 - Allow index entries overwrite mode for Sphinx content indexing
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1588 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
a071627c59 Bug 82651 - Pass force to handle_revision
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1587 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
24e0a24ca9 Bug 99105 - Exact match on repo using last part of name
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1585 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:12:23 +04:00
vfilippov
dfff9c0cc2 Bug 82651
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1573 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:05 +04:00
vfilippov
0bd2b940f9 Bug 82651
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1452 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:05 +04:00
vfilippov
24b979d9e2 Bug 88900 - Force cvs_ondisk_charset
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1451 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:05 +04:00
vfilippov
7d06bd21bc Bug 82651
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1447 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:05 +04:00
vfilippov
fa08478619 Bug 82651 - () -> None
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1446 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
7d15648286 Bug 82651 - Fix for inaccessible repos
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1445 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
76987f0851 Bug 82651 - Retrieve text file contents from SVN when searching (debug)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1444 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
928bf6f1a6 Bug 82651 - Retrieve text file contents from SVN when searching
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1443 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
4cd52560ac Bug 88267 - Partial rebuild ability for CVS
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1442 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
a0a40b6047 Bug 87710
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1424 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:04 +04:00
vfilippov
e8c05fc096 Bug 87133
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1423 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:03 +04:00
vfilippov
999c9de4d3 Bug 87501 - Add must-revalidate headers
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1422 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:03 +04:00
vfilippov
131171943d Bug 87501 - Guess for full diff
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1421 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:03 +04:00
vfilippov
e415cd7bb0 Bug 87501 - init charset guesser
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1417 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:03 +04:00
vfilippov
575b4d8a49 Bug 63447 - 1/20 probability for cache clean
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1411 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:03 +04:00
vfilippov
3ec2c244a8 Bug 82651 - simple buffered reader for diff pipes
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1402 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:02 +04:00
vfilippov
160233f758 Bug 82651 - Content size limit (4MB Sphinx)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1401 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:02 +04:00
vfilippov
72934bf6cd Bug 82651 - Content size limit (4MB Sphinx), enable snippets setting
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1400 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:02 +04:00
vfilippov
a564b02d18 Bug 82651 - Store contents for snippet retrieval in MySQL
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1399 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:02 +04:00
vfilippov
80ccb26b20 Bug 82651 - Store contents for snippet retrieval in MySQL
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1398 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
1b75ada880 Bug 82651 - Remove rest of UTF-8 ugly hacks
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1396 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
ecadbf9fd3 Bug 82651 - Remove rest of UTF-8 ugly hacks
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1394 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
8dc02448bc Bug 82651
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1393 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
8aca8406a3 Bug 82651 - Non-verbose mode
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1392 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
639d1c25db Bug 82651 - Tika&Sphinx&chardet content indexing (done!)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1389 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:01 +04:00
vfilippov
e363cf19b1 Bug 82651 - Tika&Sphinx&chardet content indexing (done!)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1388 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
83c7e6fe49 Bug 82651
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1371 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
361a00ff13 Bug 82651 - Fix cvsdb glob search, TODO index file contents
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1365 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
e8f25d9c7b Bug 63447 - Cache expiration using mtime; Clean cache sometimes! (with 1/1000 probability)
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1345 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
c6582d1480 Bug 79260 - Fix cvsntacl auth for Python 2.6
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1265 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
ceb4990dec Bug 79260 - Fix cvsntacl auth for Python 2.6
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1264 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:07:00 +04:00
vfilippov
12434cb5b7 Bug 57786 - Fix ViewVC pipe errors through use of inetd "cvsnt rcsfile" service
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1242 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:59 +04:00
vfilippov
f4f2e432a7 Bug 76690 - Index
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1231 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:59 +04:00
vfilippov
7eb621bcd1 Bug 76690 - Optimize "only svn" / "only cvs"
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1230 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:59 +04:00
vfilippov
5de0639a9c Bug 76690 - Check glob match for being really an exact one
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1229 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:59 +04:00
vfilippov
e25a91837e Bug 74522 - Ignore spaces in ViewVC diffstat
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1225 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:59 +04:00
vfilippov
6df7a894d1 Bug 70605
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1219 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
04d3d504e0 Bug 73748 - Use real paths for repositories
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1195 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
33fffa82e8 Bug 71273 - Fix exception in ViewVC diffs
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@1041 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
fdd255f0ff Bug 63447 - /i
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@894 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
0b5123e1b8 Bug 63447
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@884 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
56614d0f13 Bug 63447 - Support for FOF_Sudo authorization
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@883 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
94c0c90329 Bug 63447 - include fof_sudo in rss links
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@879 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:58 +04:00
vfilippov
a4c3bd1a46 Bug 63447
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@877 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
a9701721e2 Bug 63447 - Cache security
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@875 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
5c1ac512d1 Bug 57786
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@871 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
cd9c47fe46 Bug 57786Show diff href
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@870 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
bb906c1f70 Bug 63447
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@869 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
b9a894f708 Bug 63447 - Global auth with external config file
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@868 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
1fae3f7e3e Bug 63447
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@865 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:57 +04:00
vfilippov
c73ba23f6e Bug 63447 - AnyJSON instead of simply json, debug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@864 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
0f323a50a4 Bug 63447 - Single sign-on for ViewVC
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@862 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
f3ba9d5e0a Bug 63447 - Single sign-on for ViewVC
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@861 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
1cda6497e1 Debug "unsecure patch" detection for queries across multiple repos,
debug vcauth grp


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@771 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
b9f2b63c09 Bug 45675: Bug 60603 displayed an empty patch
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@661 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
b1cffd5f2d Bug 60409 - Output correct link rel=self in RSS feeds
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@644 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:56 +04:00
vfilippov
323a4d5629 Bug 59499
Show diffs for moved files in query results


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@633 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
d65737cc43 Bug 57786
Ignore SIGPIPE


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@587 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
67b205634e Bug 37020
Удалил изврат, добавив чуть меньший изврат:
Теперь в процессе установки bin-файлы не модифицируются,
а только добавляется рядом с ними файл viewvcinstallpath,
в котором прописываются пути.


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@539 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
4e9089255c Bug 57246
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@538 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
bf062cc41b Bug 57245
Hyperlink bug URLs

[rewritehtml]
name.find = REGEXP
name.replace = REPLACEMENT


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@537 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
ab7e1bdc64 Bug 37020
SP4 lexer


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@529 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
e17b0dce21 Bug 56474
Honor repository for build_commit


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@518 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
552d04e882 Bug 45200
remove temp files


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@517 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:55 +04:00
vfilippov
f0a1418fbf Bug 45200
USE SHELL!!!
The bug was probably somewhere in file descriptor cloning + Apache webserver


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@516 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
75be406156 Bug 45200
Use temp file


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@512 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
964531a7a9 Bug 37020
mystical empty diffs


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@421 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
4304976db7 Bug 37020
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@280 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
8a649198d4 Bug 37020
Bug 32155
remove date & author from table


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@272 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
e78c234550 Bug 37020
Bug 32155
Fix an EVERLASTING error for all RSS generator:
Generating dates via strftime() with non-english LC_TIME


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@271 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
8367e08370 Bug 37020
Don't verify comments


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@270 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
vfilippov
b7c8b5eb6f Bug 37020
Bug 32155
RSS with committed file lists


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@269 6955db30-a419-402b-8a0d-67ecbb4d7f56
2013-07-18 17:06:54 +04:00
06bfb6a5fe Record merge with r2243 in git 2013-07-18 17:05:41 +04:00
cmpilato
4251b52987 Fix buglet in (unused) ViewVCHtmlFormatter.get_result() function.
* lib/viewvc.py
  (ViewVCHtmlFormatter.get_result): Remove some unnecessary
    statements, and fix the fact that this was disregarding the 'maxlen'
    parameter.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2905 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-07-10 16:29:13 +00:00
cmpilato
0ac2f63f71 * conf/viewvc.conf.dist: Minor comment formatting tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2904 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-05-01 15:49:29 +00:00
cmpilato
aa724feae4 Fix issue #527 ("ViewVC markup/annotate views raise exceptions
depending on Python version").

* lib/viewvc.py
  (transcode_text): Avoid using keyword arguments with unicode() and
    .encode(), support for which wasn't added until Python 2.7.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2902 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-25 14:52:58 +00:00
cmpilato
9e97bd332d * CHANGES
Merge 1.1.20 changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2901 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-24 14:12:41 +00:00
cmpilato
89d478a933 Bump latest advertised release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2899 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-24 13:31:36 +00:00
cmpilato
a1fd08948a * lib/viewvc.py
(markup_stream, DiffSource._format_text): Fix still more buglets
    around tab-to-space conversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2895 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-23 20:17:01 +00:00
cmpilato
d2e7f4aff2 * lib/vclib/ccvs/__init__.py
(find_root_in_parent): Minor comment tweak only.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2893 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-23 18:53:15 +00:00
cmpilato
ece31e7369 * lib/vclib/ccvs/__init__.py
(_is_cvsroot): New helper function.
  (expand_root_parent, find_root_in_parent): Rework these to now
    use _is_cvsroot().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2892 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-23 18:49:10 +00:00
cmpilato
16d7e0af8a Fix issue #526 ("Subversion roots not longer accessible").
This is a big-time regression in root handling which unfortunately
found its way into the 1.1.19 release.

Reported by: Michael Theys <michael.th90{_AT_}gmail.com>,
             olli hauer <ohauer{_AT_}gmx.de>

* lib/vclib/ccvs/__init__.py
  (expand_root_parent): Avoid unnecessary convenience variable.
  (find_root_in_parent): Don't return a rootpath that we've not
    checked for existence!!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2891 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-23 18:43:15 +00:00
cmpilato
75e503a16b * CHANGES
Merge in 1.1.19 changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2888 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-22 19:28:18 +00:00
cmpilato
3fbaffa2fd Bump latest advertised release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2885 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-22 19:20:06 +00:00
cmpilato
a4ad1b13c2 * lib/viewvc.py
(make_time_string): A little syntax change to be more Pythonic.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2881 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-19 20:34:46 +00:00
cmpilato
1f58e41376 Finish issue #46 ("ISO 8601 date/time format").
* lib/viewvc.py
  (make_time_string): If cfg.options.iso8601_timestamps is set,
    generate ISO-8601-compliant timestamp strings.

* lib/config.py
  (Config.set_defaults): Initialize 'iso8601_timestamps' option value.

* conf/viewvc.conf.dist
  (iso8601_timestamps): New option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2880 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-19 20:31:15 +00:00
cmpilato
4fd9cc0811 Fix some latent bugs whitespace handling.
* lib/viewvc.py
  (markup_stream): Only expand tabs if the tabsize > 0.
  (DiffSource._format_text): Only strip EOL stuffs from the ends of
    lines -- preserve other whitespace forms.  Also, only expand tabs if
    the tabsize > 0.

* conf/viewvc.conf.dist
  (tabsize): Use the term "horizontal tab character" rather than
    "tabstop".  The latter is the destination; the former is the
    character that tells the text flow to resume there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2876 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-18 13:49:15 +00:00
cmpilato
7026dcb498 Fix an exception recently introduced.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.filesize): Recombine path_parts before
    calling _get_dirents().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2874 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-17 18:16:48 +00:00
cmpilato
6406b106a1 More work on issue #11 ("Universal UTF-8 output from ViewVC").
* lib/viewvc.py
  (markup_stream): When transcoding, handle the whole body of file
    contents at once rather than trying to go line-by-line.  Why?
    Because until transcoded, the concept of a "line" is rather
    meaningless.  (NOTE: There is almost certainly some fallout to
    occur in the annotate view as a result of this work, since each VC
    system's annotation support also uses the naive concept of a
    line.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2873 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-17 17:59:41 +00:00
cmpilato
a2090ce90b Make some additional dents on issue #11 ("Universal UTF-8 output from
ViewVC").

Use the 'chardet' module where available and enabled by configuration
to detect source file content encoding, and transcode the output to
UTF-8.  We supported this already via Pygments when
'enable_syntax_coloration' was set; now we can also support this when
it isn't.

* lib/viewvc.py
  (detect_encoding, transcode_text): New helper functions.
  (markup_stream): Use the new helper functions to attempt to
    transcode text into UTF-8 even when syntax coloration is *not* in
    use.

* conf/viewvc.conf.dist
  (detect_encoding): Remove notation about this only being used when
    'enable_syntax_coloration' is also enabled.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2872 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-17 15:23:42 +00:00
cmpilato
0ca6106034 Fix issue #525 ("Tarball output is double-compressed when
allow_compress=1").

* lib/viewvc.py
  (get_writeready_server_file): Add 'allow_compress' parameter, and
    handling to give callers the power to disable response-level
    compression.
  (download_tarball): When calling get_writeready_server_file(),
    disable compression (if any) since we're doing our own gzipping
    herein.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2870 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-16 18:15:50 +00:00
cmpilato
801eaff764 Fix an ancient code concern by no longer reading file content fully
into memory when generating tarballs.

* lib/viewvc.py
  (generate_tarball): Avoid reading file contents fully into memory.
    Rather, query the filesize from the vclib provider and chunk the
    output.  If the filesize must be calculated, use two chunked
    passes over those contents (one to measure, one to write to the
    tarball).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2867 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-15 19:06:30 +00:00
cmpilato
1ca3dc4195 Fix issue #524 ("Give administrators a way to limit the size of files
processed by markup and annotate views").  This introduces a new
'max_filesize_kbytes' configuration option for limiting markup and
annotate operations on really big files (whose contents unfortunately
must be read fully into memory sometimes).  By default, a 512-kilobyte
limit will be in place.

* lib/vclib/__init__.py
  (Repository.filesize): New.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.filesize): New function.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.filesize): New function.

* lib/vclib/ccvs/bincvs.py
  (BaseCVSRepository.filesize): New function (returns -1 aka "not
    implemented")

* conf/viewvc.conf.dist
  (max_filesize_kbytes): New configuration option.

* lib/config.py
  (Config.set_defaults): Set default value for new
    'max_filesize_kbytes' configuration option.

* lib/viewvc.py
  (assert_viewable_filesize): New helper function.
  (markup_or_annotate): Use assert_viewable_filesize() and the new
    repos.filesize() API to honor the new 'max_filesize_kbytes'
    configuration option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2866 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-15 19:04:40 +00:00
cmpilato
814bee3e4a Over in Subversion-land, I finally got around to exposing the
svn_cmdline_create_auth_baton() function via the SWIG Python
bindings.  So now use it if it's available!

* lib/vclib/svn/svn_ra.py
  (setup_client_ctx): New compatability-sensitive function.
  (RemoteSubversionRepository.open): Use setup_client_ctx() now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2864 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-04-12 15:05:28 +00:00
cmpilato
b67254fcf2 Optimize the mapping of a single root name to a root path by avoiding
a potentially costly directory listing within the root parent paths.
This has been shown to reduce the initial ViewVC startup overhead by
400% in some situations where disk I/O is especially sluggish.

* lib/vclib/ccvs/__init__.py
  (find_root_in_parent): New function.

* lib/vclib/svn/__init__.py
  (find_root_in_parent): New function.

* lib/viewvc.py
  (find_root_in_parents): Use the new find_root_in_parent() functions
    offered by the vclib implementations rather than the more expensive
    full root expansion stuffs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2862 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-20 13:15:34 +00:00
cmpilato
decb5e375b * lib/viewvc.py
Drop in some more timestamp debugging sections.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2860 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-18 18:38:51 +00:00
cmpilato
af996b9b49 Finish issue #487 ("Preserve Subversion symlinks in generated
tarballs") for remote Subversion repositories, too.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.get_symlink_target): New function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2858 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-04 20:23:09 +00:00
cmpilato
388c55e564 * lib/vclib/svn/svn_ra.py
(cat_to_tempfile): Renamed from temp_checkout().  Callers updated.
  (RemoteSubversionRepository.openfile): Use cat_to_tempfile() now,
    and try to head off a race condition that could leave tempfiles
    lying about.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2857 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-04 19:57:35 +00:00
cmpilato
ab923539dd Finish issue #487 ("Preserve Subversion symlinks in generated tarballs")
for local Subversion repositories.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.get_symlink_target): New function.

* lib/viewvc.py
  (generate_tarball_header): Add the ability to generate private
    headers for long symlink names, too.
  (generate_tarball): Use the Repository object's get_symlink_target()
    function (if available) to determine whether a versioned object is a
    symlink, and use that information to preserve symlinks in
    generated tarballs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2855 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-04 19:37:31 +00:00
cmpilato
701ba24454 * lib/viewvc.py
(generate_tarball_header): Indentation fixes only.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2854 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-04 16:52:19 +00:00
cmpilato
eaeb527802 * lib/viewvc.py
Fix spelling error ('typefrag' should be 'typeflag') throughout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2853 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-04 16:51:38 +00:00
cmpilato
819915112e * templates/default/docroot/styles.css
Revert r2835.  Not liking the yellow.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2852 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-03-01 15:52:29 +00:00
cmpilato
33eeb41763 * CHANGES: Merge in 1.1.18's changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2851 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-28 19:34:22 +00:00
cmpilato
345e7ceb8d Bump the advertised latest release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2849 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-28 19:26:50 +00:00
cmpilato
63563517d7 * bin/make-database
Be less sloppy about what this script reports as default behavior
  around hostnames and ports.  If a hostname isn't supplied,
  "localhost" isn't strictly passed to 'mysql'; same for the port.
  And on UNIX, the lack of an explicit hostname (or an explicit
  "localhost" one) will cause 'mysql' to use a UNIX socket rather than
  a TCP/IP one, regardless of what the provided port is.  So it's not
  strictly accurate to imply that by not providing a hostname and
  port, 'make-database' will use "localhost/3306" for that
  information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2844 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-26 16:51:03 +00:00
cmpilato
b8a7f32fb4 When querying the commits database, explicitly name columns in case
someone has a modified/customized database with additional or
reordered columns.

* lib/cvsdb.py
  (CheckinDatabase.CheckCommit, CheckinDatabase.PurgeRepository):
    Name columns in SELECT statement rather than using '*'.

Patch by: Grant Bremer <gbremer{__AT__}tigris.org>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2843 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-26 16:43:12 +00:00
cmpilato
8854a73040 * bin/make-database
Use "ENGINE=MyISAM" rather than "TYPE=MyISAM" throughout.  The
  latter syntax was deprecated in MySQL 5.0 and dropped in 5.5.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2842 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-26 16:15:35 +00:00
cmpilato
9b57e7d6a6 Fix issue #521 ("make-database does not allow the database port to be
specified").

* bin/make-database
  (__main__): Add a --port option and handling thereof, passing the
    value off to 'mysql'.

Patch by: Grant Bremer <gbremer{__AT__}tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2841 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-25 20:51:01 +00:00
cmpilato
3edd7de4d1 Fix issue #347 ("ccvs module handling of "dead" files doesn't jive
with that of bincvs logic").

* lib/vclib/ccvs/ccvs.py
  (InfoSink.define_revision): Tweak the revision matching logic a bit
    to include branch points as valid revisions when examining branch
    tags.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2839 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-25 20:35:56 +00:00
cmpilato
07ac7f5e54 Mark busted ,v files with no revisions as "absent" in the rcsparse-
driven CVS backend, fixing an inconsistency between rcsparse-based and
binary-based parsing.

* lib/vclib/ccvs/ccvs.py
  (InfoSink.__init__): Init new 'saw_revision' flag.
  (InfoSink.define_revision): Set 'saw_revision'.
  (InfoSink.parse_completed): If 'saw_revision' is not set, set the
    'absent' flag.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2837 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-25 20:01:45 +00:00
cmpilato
41858c6f89 * templates/default/docroot/styles.css
Follow up to r2835, removing an unnecessary "!important" CSS
  declaration.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2836 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-22 16:56:26 +00:00
cmpilato
bbe8b42877 * templates/default/docroot/styles.css
Highlight file content lines in yellow when hovered over.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2835 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-22 16:48:33 +00:00
cmpilato
3d3f677b3c * templates/default/file.ezt
Reduce a bit of redundancy.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2834 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-22 16:44:51 +00:00
cmpilato
572554fa89 * lib/viewvc.py
(markup_stream): Strip EOL characters from the ends of marked-up
    lines.  Templates can re-add line breaks, but they can't easily
    strip them.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2832 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-02-22 16:34:10 +00:00
cmpilato
281ed5ca84 Correct a royally botched CHANGES entry.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2830 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-01-31 19:49:49 +00:00
cmpilato
bb4a748eda Fix issue #519 ("Stack trace while accessing a BDB repository if last
commit deleted a file or directory").

* lib/vclib/svn/svn_repos.py
  (_get_change_copyinfo): Only call svn_fs_copied_from() on "add" and
    "replace" change items (which might actually be copies).  This
    avoids raising an exception caused by running svn_fs_copied_from()
    on a missing (via deletion) root/path pair.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2827 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-01-29 15:57:57 +00:00
cmpilato
f48add83f7 Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2820 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-01-04 19:01:54 +00:00
cmpilato
b57831ade8 Fix the handling of diff options throughout.
* lib/viewvc.py
  (DiffDescription.__init__): Don't set self.diff_options.
  (DiffDescription.get_content_diff, DiffDescription.get_prop_diff):
    Rename local variable 'options' to 'diff_options', and actually
    populate *it* rather than the otherwise unused (and now removed)
    'diff_options' class variable.
  (DiffDescription._get_diff, DiffDescription._line_idiff_sidebyside,
   DiffDescription._line_idiff_unified, DiffDescription._content_fp,
   DiffDescription._prop_fp): Rename 'options' to 'diff_options'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2818 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 20:21:13 +00:00
cmpilato
19818e269c * lib/viewvc.py
(view_patch): Honor the "show functions" option when generating
    patches, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2817 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 20:14:16 +00:00
cmpilato
0d1da3c79b * templates/default/include/diff_display.ezt
Show the "extra" diff info stuff, too.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2816 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 19:56:52 +00:00
cmpilato
d018467937 Revert r2649, as the default templates *should* support the property
diff stuff now if I recall correctly.

* conf/viewvc.conf.dist,
* lib/config.py
  Use "templates/default" now for the default templates.  Duh.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2815 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 19:16:18 +00:00
cmpilato
cea54da382 * CHANGES
Merge 1.1.17 changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2812 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 14:06:06 +00:00
cmpilato
6fcc2b5992 Bump most recent reported release. Again.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2811 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 14:05:24 +00:00
cmpilato
dcb7e17dc6 Fix issue #516 ("Regression: UnboundLocalError: local variable
'log_pagestart' referenced before assignment").

* lib/viewvc.py
  (view_log): Initialize the 'log_pagestart' variable.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2808 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-25 13:46:15 +00:00
cmpilato
e8f975475e Update link to the CHANGES file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2807 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 18:50:57 +00:00
cmpilato
06910f29e3 * CHANGES
Include 1.1.16 and 1.0.13 changes, too.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2806 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 18:46:52 +00:00
cmpilato
64b0994f2f Bump most stable release version.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2804 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 18:21:47 +00:00
cmpilato
a8d3373025 Fix issue #514 (Simple file view has page title with "Annotation of:").
* templates/classic/file.ezt,
* templates/default/file.ezt
  Set the page's <title> attribute to "Annotation of ..." or "Contents
  of ...", depending on whether the output is annotated.

Patch by: John McNally <jmcnally{__AT__}collab.net>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2796 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 16:57:59 +00:00
cmpilato
de517ae29c Fix issue #515 ("XSS bug in diff view (CVE-2012-4533)").
* lib/viewvc.py
  (DiffSource._get_row): Pass the "extra" line information through the
    formatter code so that, at a minimum, it's HTML-escaped.

Patch by: Nicolás Alvarez <nicolas.alvarez{__AT__}gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2792 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 13:26:36 +00:00
cmpilato
4a98f512f7 * conf/viewvc.conf.dist
Show the default value of 'hr_funout' as 1 (which matches the
  programmatic default).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2791 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-24 13:22:14 +00:00
cmpilato
f4945fd7d9 Oops! Fix the diff view I broke in r2784.
* lib/viewvc.py
  (view_diff): Add 'cfg' convenience variable (to avoid a stack trace
    caused by using such a thing a few lines later).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2790 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-03 14:33:38 +00:00
cmpilato
4590ebbd6b Fix issue #512 ("'Select for diffs' does not work across pages").
* lib/viewvc.py
  (view_log): Preserve the 'log_pagestart' query value when generating
    the 'select for diff' links so that clicking the link returns you to
    the same page (modulo repagination due to new commits in the race
    window ... but let's not think about that).  Also, preserve the
    'r1' query parameter when generating the paging form.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2788 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-10-03 14:22:48 +00:00
cmpilato
ace5d55f0e * bin/cgi/query.cgi,
* bin/cgi/viewvc.cgi
  Add some commented-out logic for renice-ing the ViewVC CGI process.

Inspired by:  Karl Berry <karl{__AT__}freefriends.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2786 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-09-05 15:52:27 +00:00
cmpilato
00feefc3dc Finish issue #510 ("Block the expensive display of binary files").
Add a new configuration option 'binary_mime_types' which accepts a
comma-delimited list of MIME content type patterns ('text/plain', or
'image/*', etc.) against which versioned file MIME types are
compared for the purposes of deciding whether to allow their display
in the 'markup', 'annotate', 'diff' and 'patch' views.

* conf/viewvc.conf.dist
  (binary_mime_types): Describe new option.

* lib/config.py
  (_force_multi_value): Add 'binary_file_types' to the list of
    multi-value options.
  (Config.set_defaults): Initialize cfg.options.binary_mime_types.

* lib/viewvc.py
  (is_binary_file_mime_type): New function.
  (get_file_view_info): Use is_binary_file_mime_type() to determine
    whether to return links to content-ful views of the input file.
  (markup_or_annotate, view_diff): Use is_binary_file_mime_type() to
    deny display of so-deemed binary files.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2784 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-09-05 12:55:19 +00:00
cmpilato
adfa50c9b4 * lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.itemlog): Only fetch lock and size
    information for files, not directories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2781 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-22 20:22:49 +00:00
cmpilato
5e815bc101 * docs/release-notes/1.1.0.html
Update some of the warnings with notes about their subsequent
  resolutions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2780 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-22 19:30:10 +00:00
cmpilato
ca040b2361 Merge changes from 1.1.15 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2779 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-22 19:29:31 +00:00
cmpilato
b5d66b7afe Bump latest advertised release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2777 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-22 18:52:43 +00:00
cmpilato
1a6390d78a * templates/default/docroot/images/lock-icon.gif
New icon file.

* templates/default/directory.ezt,
* templates/default/docroot/styles.css
  Add template bits for displaying a lock-icon "overlay" for locked
  items in the directory view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2774 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-19 20:01:39 +00:00
cmpilato
698e9db4f2 * lib/viewvc.py
(LogFormatter.get): Fix a regression introduced in 1.1.14's handling
    of log messages when not HTML-ifying them (for example, when serving
    them up via RSS).

Patch by: Christoph Sommer <christoph.sommer{__AT__}uibk.ac.at>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2771 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-19 18:45:36 +00:00
cmpilato
163f63ed15 Fix some breakage in the annotate view for remote SVN repositories.
* lib/viewvc.py
  (markup_or_annotate): Don't forget to cross copies when requesting
    the item's log.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.itemlog): Treat 'svn_latest_log' option
    specially, as in the svn_repos case.  (Ugh.)
  (RemoteSubversionRepository.annotate): Pass 'svn_show_all_dir_logs'
    option to itemlog().  Also, upgrade to svn_client_blame2() API.
  (RemoteSubversionRepository._get_last_history_rev): Now return both
    the info-provided create_rev, and the more accurate
    last_history_rev.  Callers updated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2770 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-19 15:26:41 +00:00
cmpilato
44ec30da8e Abstract some code into a helper function, and fix some brokenness therein.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._revinfo_fetch): New.  Holds the guts of
    the revision info harvesting (plus some bugfixes thereto) from...
  (RemoteSubversionRepository._revinfo): ...this, which now calls the
    helper function.  Also, don't tuple-ize the already-tupled cache
    info.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2768 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-16 01:38:39 +00:00
cmpilato
1380dba9ba Normalize some variables before hitting the Subversion API.
* lib/vclib/svn/svn_ra.py
  (client_log): Convert incoming 'cross_copies' and 'include_changes'
    values to integers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2767 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-16 01:36:11 +00:00
cmpilato
6533b4fc7c Optimize revision info fetches for remote SVN repositories to avoid
unnecessary (and somewhat expensive) work.

* lib/vclib/svn/svn_ra.py
  (client_log): Add 'include_changes' parameter, pass to the
    Subversion log APIs.  Callers updated.
  (_revinfo): Was _revinfo_raw().  Add 'include_changed_paths'
    parameter.  Now handles the revinfo cache, only fetches changed
    paths when required, and bails out early of authz checks when
    possible.  All internal callers of revinfo() have been updated to
    use this interface instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2765 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-16 01:13:25 +00:00
cmpilato
6964b067e6 Fix a couple of correctness/performance regressions in the remote SVN
annotate view recently introduced.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.annotate): Pass 'svn_cross_copies'
    option to itemlog() so that annotation history isn't unnaturally
    truncated.
  (RemoteSubversionRepository._blame_cb): Only consult the revinfo
    cache when authz checks are required.  This improves the speed of
    the operation when universal read access is granted to the user.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2763 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-16 00:51:25 +00:00
cmpilato
fee21df5d7 Finish, I believe, issue #353 ("Remote Subversion repositories not
fully honoring authz rules").  In doing so, this makes the svn_ra
module the most accurate it has ever been, hopefully without too
terribly much extra cost.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.listdir): No longer check access here.
    That's handled down in _get_dirents() now.
  (RemoteSubversionRepository.dirlogs): Don't check dirent access here.
    Just ensure that the returned entries are those which are
    represented in the (filtered) set return from _get_dirents().
    Also, replace the revision metadata stored on each dirent with
    values from the revinfo cache (which does authz sanitizing).
  (RemoteSubversionRepository._get_dirents): Do authz-checking of
    dirents here, and use _get_last_history_rev() to populate a useful
    created_rev.
  (RemoteSubversionRepository._get_last_history_rev): Because
    Subversion's RA layer doesn't consider copy events when
    determining an item's last-committed-rev, compensate for this with
    a bounded log operation which does.  This brings created-rev
    parity with the svn_repos module (at the cost of the extra RA
    work, but with the benefit of, you know, accuracy.
  (RemoteSubversionRepository._revinfo_raw): Leave a TODO about a
    future optimization.
  (RemoteSubversionRepository._log_cb): Set found_unreadable when
    sanitizing an unreadable copyfrom path, too.
  (RemoteSubversionRepository.created_rev): Now just a thin wrapper
    around the beefed-up _get_last_history_rev() function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2760 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-15 23:34:01 +00:00
cmpilato
ada79bc6e7 * lib/vclib/svn/svn_ra.py
(LogCollector.add_log): Allow the access_check_func to be None (and
    avoid trying to call it in that case).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2759 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-15 23:07:22 +00:00
cmpilato
01ebe77beb Fix a security issue: When a readable path is copied from an
unreadable one, Subversion will obscure the fact that the operation
was a copy (by removing copyfrom info) and will deem the log message
for the revision in which the copy occurred to be unreadable.  ViewVC
was only doing the former bit; now it does the latter, too.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._get_changed_paths): Set found_unreadable
    when we have to hide a copyfrom path, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2758 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-15 23:05:47 +00:00
cmpilato
87b574b3ee For issue #353, check path access in the annotation view code for
remote SVN repositories.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.annotate): Examine revision logs to
    determine the legal annotation range we are allowed to request,
    and use the revinfo cache to strip sensitive author/data info from
    the annotation data.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2757 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-15 02:17:55 +00:00
cmpilato
fc7d9b1da4 For issue #353 ("Remote Subversion repositories not fully honoring
authz rules"):

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.get_locations): Check authz on the
    result of a get_locations lookup (being sure to use the original
    path in the error message, if any).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2756 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-15 02:11:12 +00:00
cmpilato
4cc840b54a For issue #353, check path access in the code that backs the revision
log view for remote SVN repositories.

* lib/vclib/svn/svn_ra.py
  (LogCollector.__init__): Add 'access_check_func' parameter, stashed
    away as a member variable.  Initialize 'done' variable to False.
  (LogCollector.add_log): Use access_check_func() to test for access.
    If access is denied, set 'done' to True and ignore future
    invocations.
  (RemoteSubversionRepository.itemlog): Add _access_checker inner
    function, passed as a callback to LogCollector.__init__().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2755 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-13 21:57:38 +00:00
cmpilato
3df47b625e * notes/releases.txt
Add some URLs for the announce@ and freecode postings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2753 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-12 13:02:34 +00:00
cmpilato
836e643dc5 * CHANGES: Merge in the 1.1.14 changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2752 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-12 12:57:12 +00:00
cmpilato
ca52fe277d Bump latest release version number.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2750 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-12 12:54:04 +00:00
cmpilato
bfe2cbe5ca Fix issue #246 ("Add support for issue tracker links in commit-log
viewer").

NOTE: There are some limitations here, most prominantly that commas
can't be used in the regular expressions which define replacements,
and that only match groupings 0-9 can be used in the replacement
format string.

* conf/viewvc.conf.dist
  (custom_log_formatting): New configuration option.

* lib/config.py
  (Config._force_multi_value, Config.set_defaults): Add handling of
    new 'custom_log_formatting' option.

* lib/viewvc.py
  (ViewVCHtmlFormatter.format_custom_url): New formatter callback.
  (LogFormatter.get): Register the new formatter callback for rules
    found in the 'custom_log_formatting' option value.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2746 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-06-12 11:11:18 +00:00
cmpilato
91654688a1 * templates/default/file.ezt
Fix some markup validation issues.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2743 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-04-20 21:04:14 +00:00
cmpilato
9d75ed19f8 Finish issue #506 ("Log message tokenization results could be reused
for better performance").

* lib/viewvc.py
  Replace uses of format_log() throughout with calls to LogFormatter()
  (to get a formatter "lf") then lf.get() (to get the formatted log
  string).  Also...
  (format_log): Remove as unused.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2741 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-04-17 15:29:27 +00:00
cmpilato
f65b03fcdc For issue #506 ("Log message tokenization results could be reused for
better performance"), make the first step of two in trying to avoid
parsing log messages twice when once will suffice.

* lib/viewvc.py
  (ViewVCHtmlFormatterTokens): New class for generating HTML-formatted
    text from a set of provided ViewVCHtmlFormatter tokens.
  (ViewVCHtmlFormatter.get_result): Track renamed function, and defer
    the work of the text generation to the token object's get_result()
    method.
  (ViewVCHtmlFormatter.tokenize_text): Renamed from _tokenize_text(),
    and now return a ViewVCHtmlFormatterTokens object.
  (LogFormatter): New class for encapsulating the log formatting logic.
  (format_log): Make a wrapper around LogFormatter for now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2740 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-04-17 15:25:56 +00:00
cmpilato
60b80bd3b2 Fix issue #505 ("Username case normalization breaks when browsing
anonymously").

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer.__init__): Don't try to convert a None username to
    lower- or upper-case.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2738 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-03-28 14:15:51 +00:00
cmpilato
272ae0fa37 Remove erroneous CHANGES entry.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2736 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-02-07 21:10:18 +00:00
cmpilato
23714979e4 Follow-up to r2512, trying to, you know, get that change right this
time.

* lib/vclib/svn/__init__.py
  (_canonicalize_path): New helper function.
  (canonicalize_rootpath): Rework this to perform the URL -> absolute
    path conversion any time it can, not only when using really old
    Subversion versions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2735 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-02-07 21:10:04 +00:00
cmpilato
1b63870590 Follow-up to r2731, trying to ensure that users with pre-1.4 Subversion
won't hit AttributeError's on account of svn_path_canonicalize() not 
being exposed through Subversion's Python bindings.

* lib/vclib/svn/svn_repos.py
  (_canonicalize_path): New helper function.
  (_rootpath2url): Use _canonicalize_path() instead of
    core.svn_path_canonicalize().

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._geturl): Use (imported)
    _canonicalize_path() instead of core.svn_path_canonicalize().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2733 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-02-01 19:45:35 +00:00
cmpilato
1296106171 Fix issue #504 ("annotate view fails on filenames with colon (:)
characters in their names"), another in a long string of annotate view
brokennesses.  (Is that word?)  This time, the problem was a disparity
between Python's urllib encoding and what Subversion deems canonical.

* lib/vclib/svn/svn_repos.py
  (_rootpath2url): Canonicalize URLs for use with Subversion.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._geturl): Canonicalize URLs for use with
    Subversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2731 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-02-01 16:24:29 +00:00
cmpilato
3297f45285 * lib/vclib/svn/__init__.py
(canonicalize_rootpath): Add a TODO comment.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2730 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-31 22:37:32 +00:00
cmpilato
91d1b75856 * notes/releases.txt
Minor tweaks/corrections to the release procedure.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2729 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 18:58:02 +00:00
cmpilato
8f39d274f5 Merge 1.1.13's CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2727 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 18:52:01 +00:00
cmpilato
86449bdec7 Bump pointer to latest version.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2726 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 18:51:45 +00:00
cmpilato
7043120d2c * tools/bump-copyright-years
(update_license): Remove.
  (bump_years): Print reminder about amending the change history
    section of the LICENSE.html file.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2722 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 18:31:20 +00:00
cmpilato
ad0c0dd5fa * tools/bump-copyright-years
(replace_end_year): Remove debugging print statements, and simplify code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2721 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 17:57:10 +00:00
cmpilato
9e9b82218c Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2720 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 17:52:47 +00:00
cmpilato
85df9e6ba4 * tools/bump-copyright-years
New tool for bumping copyright years.  I'm tired of trying to
  micromanage these things.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2719 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 17:51:58 +00:00
cmpilato
8fc1166f2d Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2716 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 16:42:03 +00:00
cmpilato
25ab342bbf * lib/vclib/svn/svn_repos.py
(_rootpath2url): Get the absolute path before splitting off the
    drive, not afterward.  Otherwise, (some) drive letter will just get
    tacked back onto the path!  As we now verify elsewhere that
    rootpaths aren't relative, we needn't worry that .splitdrive() will
    return a relative rootpath.

Suggested by: Jens Peters <jp7677{__AT__}gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2714 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-06 21:34:58 +00:00
cmpilato
ccb7f2e3f1 Ensure that we are dealing with absolute repository paths. Who knows
what kind of chaos may ensue otherwise.

* conf/viewvc.conf.dist
  Note that paths should be absolute filesystem paths.

* lib/vclib/svn/__init__.py
  (canonicalize_rootpath, expand_root_parent): Assert that local
    repository paths are absolute.

* lib/vclib/ccvs/__init__.py
  (canonicalize_rootpath, expand_root_parent): Assert that local
    repository paths are absolute.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2713 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-05 15:35:39 +00:00
cmpilato
0cd9f664d6 * INSTALL
Per issue #474, describe how to setup static icon/stylesheet
  delivery, warning about alias ordering.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2712 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-04 17:19:27 +00:00
cmpilato
6fe390a642 Move a customization out of ezt.py to eliminate unnecessary deltas
against the upstream version of this module.

* lib/common.py
  (TemplateData): Moved here...

* lib/ezt.py
  ...from here.

* lib/query.py,
* lib/viewvc.py
  Import 'TemplateData' from 'common' now, and update references to this
  relocated class.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2711 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-04 15:35:12 +00:00
cmpilato
5d68a5f883 * lib/vclib/svn/svn_repos.py
(_rootpath2url): "drive" already carries the colon, so don't append one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2709 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-03 20:07:30 +00:00
cmpilato
6418278d55 * lib/vclib/svn/svn_repos.py
(_rootpath2url): Try a different approach that should actually
    handle spaces in the "in-repos" path, too, and maybe (if I'm super
    lucky) also work on Windows.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2707 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-03 15:18:21 +00:00
cmpilato
1dd1a21537 * lib/viewvc.py
(): Stop importing the pygments stuff at the module-global scope,
    and go back to doing so...
  (markup_stream): ...here.
  (markup_or_annotate): No longer consider access to Pygments when
    making the first pass at colorizing -- if we don't have it,
    markup_stream() will fail quickly and we can take the second
    (non-colorizing) pass.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2702 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-12 20:01:30 +00:00
cmpilato
06a3feec90 Reintegrate the 'issue-495-dev' branch into the trunk. This
reintroduces the issue #495 feature ("Syntax highlight/colorize
scripts without extensions") while building much more fault tolerance
into the system.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2699 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-06 14:22:48 +00:00
cmpilato
a03cd82de5 On the 'issue-495-dev' branch, make what I think are some pretty
useful improvements to the syntax coloration and annotation codepaths.
First, settle on the file contents as fetched via repos.openfile() as
the canonical source of such.  But also, allow any exceptions thrown
while colorizing those file contents to trigger a second attempt
without colorization enabled.  This should allow for non-error-ful
display of binary files which lack both an extension and VC content
type hint (those are treated by default as text files).

* lib/viewvc.py
  (markup_stream): Add docstring.  Replace 'fp' parameter with
    'file_lines' parameter.  Add 'colorize' parameter.  No longer try
    to munge 'blame_data' -- expect that callers have done that.  Lose
    first_line tracking stuff, as fetching the first line of the file
    is no longer destructive.  Always use 'file_lines' as the source
    of file contents; never the text attached to the 'blame-data'.
  (markup_or_annotate): Rework this to do more of the cheap work of
    annotating and markup up so that markup_stream() can be called
    more than once if necessary -- once to attempt colorization, and
    again without that feature if the first pass fails.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2698 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 21:11:29 +00:00
cmpilato
094024a0ec On the 'issue-495-dev' branch:
* lib/vclib/__init__.py
  (Repository.annotate): Rewrite docstring for clarity.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2697 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 20:06:11 +00:00
cmpilato
56e645ecb8 ### NOTE FROM THE FUTURE: This commit probably broke the ###
###  "annotate view without syntax coloration" codepath.   ###

On the 'issue-495-dev' branch:  Let vclib API consumers request that
annotation data come with or without the associated text.

* lib/vclib/__init__.py
  (Repository.annotate): Add optional 'include_text' parameter.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.annotate): Add 'include_text' parameter
    and, if False, have the annotation callback drop the text on the floor.

* lib/vclib/svn/svn_repos.py
  (BlameSource.__init__): Add 'include_text' param; squirrel away the value.
  (BlameSource._blame_cb): Don't keep text we're asked not to keep.
  (LocalSubversionRepository.annotate): Add 'include_text' parameter,
    passed to BlameSource.__init__.

* lib/vclib/ccvs/bincvs.py
  (BinCVSRepository.annotate): Add 'include_text' parameter, passed to
    blame.BlameSource().

* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.annotate): Add 'include_text' parameter, passed to
    blame.BlameSource().

* lib/vclib/ccvs/blame.py
  (BlameSource.__init__): Add 'include_text' param; squirrel away the value.
  (BlameSource.__getitem__): Don't keep text we're asked not to keep.

* lib/blame.py
  (HTMLBlameSource.__init__): Update call to repos.annotate().



git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2696 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 19:58:38 +00:00
cmpilato
2f722f39b9 On the 'issue-495-dev' branch:
* lib/viewvc.py
  (markup_stream): Was markup_stream_pygments().  Caller changed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2695 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 18:31:55 +00:00
cmpilato
402dfd831f On the 'issue-495-dev' branch:
* lib/viewvc.py
  (markup_stream_pygments): Remove level of indentation made
    unnecessary by r2693.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2694 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 18:30:50 +00:00
cmpilato
738d17f71f On the 'issue-495-dev' branch:
* lib/viewvc.py
  (): Try to import the pygments code at the global scope instead of...
  (markup_stream_pygments): ...here.  Add/move some comments, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2693 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-05 18:28:05 +00:00
cmpilato
fdc0bcd420 On the issue-495-dev branch: Add BRANCH-README.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2692 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 19:49:45 +00:00
cmpilato
db032720a8 On the 'issue-495-dev' branch: Re-apply the most recently committed
(then reverted) bits of the issue #495 work.

* lib/viewvc.py (markup_stream_pygments)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2691 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 19:48:24 +00:00
cmpilato
c9256effc4 Create a branch for issue #495 development.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-495-dev@2690 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 19:38:59 +00:00
cmpilato
b42a4a0915 * lib/viewvc.py
(markup_or_annotate): Don't show annotation warnings for markup
    views of images.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2688 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 18:35:01 +00:00
cmpilato
d2275afb6d * lib/viewvc.py
(markup_stream_pygments): Re-make the semantic changes from r2680,
    which were (I believe) good ones, even if the lexer guessing stuff
    hasn't yet work out entirely.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2686 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 18:18:23 +00:00
cmpilato
5db50e6bcc Revert r2657, r2680, and r2681, effectively removing support for
Pygments' lexer guessing functionality (closing the REOPENED bug issue
#501, and necessitating that feature issue #495 be itself REOPENED).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2684 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 17:51:41 +00:00
cmpilato
7b6ecd807c * templates/classic/file.ezt
Say "Content type" rather than "File MIME type".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2683 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-12-02 16:10:57 +00:00
cmpilato
e8a0caeef5 *** THIS REVISION WAS REVERTED IN r2684 ***
For issue #501 ("Stack trace when trying to 'view' binary files"):

* lib/viewvc.py
  (markup_stream_pygments): On second thought, allow guessing to
    happen on non-None MIME types iff they appear to be text-y.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2681 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-29 15:33:20 +00:00
cmpilato
dfeb3b5d90 *** THIS REVISION WAS REVERTED IN r2684 ***
For issue #501 ("Stack trace when trying to 'view' binary files"):

* lib/viewvc.py
  (markup_stream_pygments): Rework the Pygments lexer-choosing logic a
    bit.  First, don't try any of it when syntax highlighting is
    disabled.  Secondly, don't guess at a lexer if we know the file's
    MIME type and have already failed to get a matching lexer.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2680 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-29 15:25:00 +00:00
cmpilato
5943e01304 * lib/viewvc.py
(markup_or_annotate): Pass 'mime_type' to common_template_data() so
    it can properly set the 'prefer_markup' bit.  Otherwise, it will
    guess without out svn:mime-type at its disposal.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2679 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-29 15:17:59 +00:00
cmpilato
6a8d5debd6 Template-y changes for file views.
* templates/default/markup.ezt
  Delete as unused.

* templates/default/include/fileview.ezt
  Delete, after merging contents into...

* templates/default/file.ezt
  ...here.  Also, port the [hide_binary_garbage] stuff from the classic
  templates.

* templates/default/docroot/styles.css
  (.vc_notice): New class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2678 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-29 14:59:49 +00:00
cmpilato
537c59c516 Port a change from the 'classic' templates to the new 'default' ones.
* templates/default/query_results.ezt
  Display warning text when query results are superficially truncated.

* templates/default/docroot/styles.css
  (.vc_warning): New style.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2676 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-18 20:31:59 +00:00
cmpilato
92b7b65707 Fix annotate views of files in Subversion repository whose paths
contain non-URI-safe characters (spaces, non-ASCII stuff, etc.)

* lib/vclib/svn/svn_repos.py
  (_rootpath2url): Use urllib.pathname2url to URL-encode the path
    portion of the URL we are building.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2674 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-14 21:28:46 +00:00
cmpilato
46e17662d5 Fix issue #499 ("svndbadmin fails on deleted files").
* bin/svndbadmin
  (SvnRev.__init__): Update the logic used to calculate change types
    and diff objects to no longer assume that deleted paths have None
    for their change.path.  (Subversion's 1.7 bindings always populate
    change.path.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2671 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-14 20:14:14 +00:00
cmpilato
7ab960262a Merge in 1.1.12's CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2670 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-03 14:45:17 +00:00
cmpilato
6f47cef67d Add a step to the release procedure.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2668 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-03 14:43:57 +00:00
cmpilato
a592e3b0bc Bump latest version number.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2666 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-03 14:39:40 +00:00
cmpilato
94d9f0ef49 * templates/default/log.ezt,
* templates/default/include/pathrev_form.ezt,
* templates/default/directory.ezt,
* templates/default/diff.ezt,
* templates/default/docroot/styles.css
  Still more template stylistic tweaks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2662 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-01 18:45:27 +00:00
cmpilato
b566f297b3 * templates/default/include/diff_display.ezt
Track recent rename of diffs.display_as to diffs.diff_block_format.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2661 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-01 14:14:40 +00:00
cmpilato
a6be4da978 * templates/default/log.ezt,
* templates/default/docroot/styles.css
  Layout/style tweaks to the new default template set.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2660 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-01 14:12:58 +00:00
cmpilato
8cdccc1ea5 Fix a bug which prevented certain directory diff displays.
* lib/viewvc.py
  (diff_side_item): Pass the option to repos.itemlog() which says to
    include directory logs even for revisions in which the directory
    itself was not explicitly modified (props changed).

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2659 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-11-01 13:40:01 +00:00
cmpilato
ccb53d164e *** THIS REVISION WAS REVERTED IN r2684 ***
Finish issue #495 ("Syntax highlight/colorize scripts without
extensions").

* lib/viewvc.py
  (markup_stream_pygments): Failing all else, use the Pygments
    guess_lexer() function to guess a file's content type from the
    first line of its text.  (Most of this patch is compensation for
    the first that if this heuristic codepath is traversed, we've eaten
    a line of text from the file object that we don't expect to have
    been eaten.

Patch by: Chris Mayo <cjmayo{__AT__}tigris.org>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2657 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-31 21:39:33 +00:00
stilor
441da057cc * lib/viewvc.py
(DiffSource): Do not switch to flush state. Such switch causes changes
  to be displayed as removal and readdition.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2656 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-28 20:37:01 +00:00
cmpilato
a69597e29c Finish issue #470 ("No links to repository root logs").
* lib/viewvc.py
  (view_roots): Generate a log_href -- the revision log for the root
    directory of the repository -- where it makes sense to do so.

* templates/classic/roots.ezt,
* templates/default/roots.ezt
  Markup the last-modified-revision as a link to the log view where we can.

* docs/template-authoring-guide.html
  Note the additional data dictionary item.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2653 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-28 19:24:37 +00:00
cmpilato
43f001ef25 * templates/default/file.ezt,
* templates/default/log.ezt,
* templates/default/docroot/styles.css,
  More markup changes to the default templates.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2652 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 21:14:02 +00:00
cmpilato
4341dab5b7 * templates/default/revision.ezt,
* templates/default/log.ezt,
* templates/default/graph.ezt,
* templates/default/diff.ezt,
* templates/default/include/diff_display.ezt
  Take a stab at updating the new default templates to handle the
  property diff stuff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2651 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 20:59:38 +00:00
stilor
6e81b5eb1e * docs/template-authoring-guide.html
* templates/classic/include/diff_display.ezt
* lib/viewvc.py
  Rename 'display_as' to 'diff_block_format', as discussed on ML.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2650 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 18:20:06 +00:00
cmpilato
dc1763b37b * lib/config.py,
* conf/viewvc.conf.dist
  Use the "classic" templates until the "default" ones can be updated
  to reflect recent improvements (such as the property-diff stuff).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2649 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 18:10:37 +00:00
cmpilato
65137920a8 Begin the work of making the 'newvc' contributed template set into the
new default for ViewVC 1.2.  We'll keep the old templates around as a
"classic" option.

* lib/config.py,
* conf/viewvc.conf.dist
  (Config.set_defaults): Set cfg.options.template_dir to
    "templates/default", and make the matching edit in the pristine
    configuration file.

* templates/:
  Now just a container for...

* templates/classic/,
* templates/classic/*:
  ...the old default templates (which were 'templates' and 'templates/*'.

* templates/default/,
  templates/default/*:
  ...and the new default, copied from the 'templates-contrib/1.1' area.




git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2647 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 18:05:14 +00:00
cmpilato
00d96de446 * CHANGES: Note the addition of prop-diff support.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2646 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 14:53:49 +00:00
cmpilato
6008bc6a7b Reintegrate the ^/branches/property-diff branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2645 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-27 14:51:43 +00:00
cmpilato
753d2d5320 On the 'property-diff' branch:
* docs/template-authoring-guide.html
  Update the template authoring guide in light of the changes I made
  in r2643.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2644 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-26 19:18:20 +00:00
cmpilato
2b5e7b51a0 On the 'property-diff' branch: rename the 'diff' template data
dictionary item to 'diffs' for consistency with other multi-value
items.  Yes, I know it makes the template usage itself weird
... "diffs.changes" instead of "diff.changes", but...

* lib/viewvc.py
  (view_diff): Store the desc.changes in the 'diffs' data dictionary
    item, not the 'diff' item.

* templates/diff.ezt
* templates/include/diff_display.ezt
  Replace uses of 'diff' with 'diffs'.  Selectively, of course.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2643 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-26 19:11:41 +00:00
stilor
6453447c63 * docs/template-authoring-guide.html
(top level) Introduce formatting rules for  4th and 5th levels of variables.
  (diff.ezt) Update for the changes on the property-diff branch. Describe
  missing parts (intraline diffs, patch_href). Fix some typos and copy-paste
  errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2642 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-24 20:05:37 +00:00
cmpilato
5e3c53e592 Sync the 'property-diff' branch with outstanding trunk changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2641 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-21 14:47:51 +00:00
cmpilato
24cbe623e7 * docs/template-authoring-guide.html
Update to refer to ViewVC 1.2, not 1.0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2640 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-21 14:47:02 +00:00
cmpilato
48a59d30ad * docs/release-notes/1.2.0.html
New stub file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2639 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-21 14:46:35 +00:00
cmpilato
605e66e56f * docs/release-notes/1.1.0.html
Add some helpful markup comments.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2638 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-21 14:46:15 +00:00
cmpilato
661e7fc569 * notes/releases.txt
Try to document the creation of new release branches (though it's been a
  while since I've done that, so this is all subject to my imperfect memory.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2637 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-21 14:42:33 +00:00
cmpilato
055e1dad53 * docs/upgrading-howto.html
Add stub section for "from 1.1" section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2635 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-20 19:48:55 +00:00
cmpilato
51f194d4ad * docs/upgrading-howto.html
Dial back the color intensity a bit.  Sheesh.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2634 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-20 19:48:00 +00:00
cmpilato
3f19b50a08 * docs/upgrading-howto.html
Tweak the "from 0.8" section for a bit of consistency with other sections.
  (As if anyone is still running 0.8.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2633 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-20 19:47:14 +00:00
cmpilato
5e22b37a56 Sync the property-diff branch with the latest trunk changes. (Yawn.)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2632 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-19 13:20:57 +00:00
stilor
1e14eccbe0 * diff_display.ezt
(anchor): Replace <a name="xxx"/> with <p id="xxx"/> for XHTML compliance.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2629 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-17 19:13:12 +00:00
stilor
4bf50b31f7 * viewvc.py
Follow existing conventions on indenting function arguments/hash initializers
  carried over to the next line.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2628 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-17 19:06:27 +00:00
stilor
68496ebc9f * diff_display.ezt
* viewvc.py
  Expand tabs to spaces, as per review.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2627 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-17 18:51:52 +00:00
stilor
a789c13698 * viewvc.py
(Request.run_viewvc): Select diff view for directories if r1/r2 arguments
  are provided.
  (view_revision): Generate a link to diff view on directories if there was
  a change in properties.

* log.ezt
  (revision links): Generate 'diff to previous' and 'diff to selected' for
  directories as well as files. Check for URL, not revision when determining
  if 'diff to previous' link should be created (for consistency with 'diff
  to selected')


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2626 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 19:02:32 +00:00
stilor
44a6fe7465 * viewvc.py
(view_diff): Pass anchor locations to the diff template.

* diff_display.ezt
  (top-level): Generate anchors.

* revision.ezt
  (path links): Use anchors to point to content and property parts of the diff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2625 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 18:50:08 +00:00
stilor
90a1d6cae2 * viewvc.py
(DiffDescription): Add support for property diffs.
  (diff_side_item): Store properties hash in the side items.
  (view_diff): Generate property diffs.

* diff_display.ezt
  (headers): Indicate the property being diffed, if applicable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2624 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 08:12:51 +00:00
stilor
4fe882972a * viewvc.py:
(view_diff): Remove unused local variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2623 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 07:58:18 +00:00
stilor
f57be6e516 * viewvc.py
(DiffDescription): New class. Move the diff format selection and processing
  to this new class. Split the processing into "preparation" and actual diff.

The ideas behind this new class are:
1. It will accumulate the diff "blocks". Currently, it will handle content and
properties. In the future, it can be easily reused to accumulate diffs for
recursive ("revision") diff.
2. It separates the diff method from the selection of content to be diffed.
We have two content inputs (content, properties), four formats (raw, traditional
side-by-side, intraline side-by-side, intraline unified). The former two expect
a stream (fp), the latter two expect array of lines. This class makes each of
these chunks separate from each other.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2622 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 07:29:23 +00:00
stilor
c819b3a3fc * diff_display.ezt
(raw): Gracefully handle the case where there are no changes (output
  "No changes" instead of not displaying anything).

* viewvc.py
  (diff_parse_headers): Detect if there were no input from diff stream,
  report RCSDIFF_NO_CHANGES in this case.
  (view_diff): If binary/empty changes are detected, relay that information
  to the template.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2621 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 07:06:51 +00:00
stilor
682ff6c9b9 * viewvc.py
(diff_side_item): Do not return log_entry, it is not used. Rename
  "bare" and "links" items to more descriptive "prop" and "content".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2620 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 06:48:47 +00:00
stilor
988f5b535e * viewvc.py
(view_diff): In preparation for factoring out the "differ" code, make view_diff
  always pass the differences as 'changes' array/stream. The format is now selected
  via new 'display_as' argumnet.

* diff_display.ezt
  (all formats): Accommodate changes in viewvc.py



git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2619 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 06:25:38 +00:00
stilor
4780023396 * diff_display.ezt
(all formats): Remove the use of empty <h3> as spacer, instead add margin-top on tables.
  (sidebyside, unified): Specify column widths. Otherwise, files with narrow content
  are displayed with line number columns occupying 50% of the screen.
  (unified): Remove cut-n-paste "width" attribute specification.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2618 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 06:09:42 +00:00
stilor
63227ef2a1 * diff_display.ezt
Remove definitions which have been moved to start of the file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2617 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 05:57:39 +00:00
stilor
6253fec4fb * diff_display.ezt
(left_header/right_header): Define common left/right side descriptions,
  use them in all diff output formats (adding them to raw and unified, which
  didn't have headers before)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2616 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 05:55:29 +00:00
stilor
7cdab259b8 * viewvc.py
(is_undisplayable): New function to check if property name/value
  can be displayed. Use this function in current file/dir/revision views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2615 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 05:33:25 +00:00
stilor
d1427e6639 * diff.ezt
(legend): Remove references to revisions (revisions may be the same, e.g.
  if diffing same revision on different branches). There are detailed references
  in the headers.
  (legend): Mention that colors designate not only affected lines, but also
  characters (if intraline diffs are enabled).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2614 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-16 04:48:01 +00:00
stilor
04329a707b * viewvc.py
(view_diff): Make diff an iterable (sequence); later property changes will be
  added to the sequence. Pass hide_legend, left_rev, right_rev outside of the
  diff[] array to untie diff.ezt from include/diff_display.ezt. Rename format
  to diff_format for consistency with template name.

* diff.ezt
  Same, plus small fixes in legend: capitalize first letter in 'changed',
  refer to revision as such, not as 'v.XXX' - such references are not used
  anywhere else.
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2613 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-06 05:37:56 +00:00
stilor
888f7ee302 * viewvc.py
(view_diff): Restore try-except block. It is unused for SVN,
  but still used for CVS.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2612 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-06 05:07:49 +00:00
cmpilato
205484b0f2 * INSTALL
Fix pointer to Subversion project website.

Found by:  Daniel Shahaf <d.s@daniel.shahaf.name>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2609 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-04 14:59:08 +00:00
stilor
7466b03e7c * viewvc.py
(view_diff): Factor out common code preparing left/right item information into a new
  function, diff_side_item.
  (diff_side_item): New function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2607 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 19:25:00 +00:00
stilor
737b5d2b23 * viewvc.py
(view_diff): Remove try-except block, exceptions are now handled in
    setup_diff with more specific error messages. Merge the 'if fp'
    block with the preceding conditional - which is the only way fp
    is set to non-None.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2606 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 07:10:10 +00:00
stilor
c6775f5b89 * common.py
New file to house common definitions; _item and _RCSDIFF_*
  for now. Remove local definitions in the rest of modules.

* idiff.py
  (sidebyside, unified): Return _RCSDIFF_NO_CHANGES type if
  the generator failed to yield anything else.
  (sidebyside): Add type attribute to the returned tuple so
  that template can check the type.

* diff_display.ezt
  (top-level): Define messages to be used if diffs cannot be
  displayed. Use the definitions in all non-raw displays.
  (sidebyside,unified): Handle _RCSDIFF_IS_BINARY and
  _RCSDIFF_NO_CHANGES; the former is not returned yet - will
  be passed to the template once properties are diffed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2605 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 06:33:22 +00:00
stilor
eba17bcbd7 * viewvc.py
(view_diff): Encapsulate into a single _item parts that would
  be repeated when multiple "diffable" items will be passed to diff.ezt.
  At that time, diff will be changed to a sequence.

* diff_display.ezt, diff.ezt
  Prefix those repeatable parts with 'diff'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2604 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 05:35:15 +00:00
stilor
3e5836cdb4 * diff.ezt
Split the actual diff-formatting part into a separate includable template.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2603 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 04:50:35 +00:00
stilor
35544ecbef Create a branch for property diffs integration (issue 383).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/property-diff@2602 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-10-01 04:26:15 +00:00
cmpilato
a6c9d3ac49 Loop until receiving a definitive answer to the interactive overwrite
query, rather than croaking on an empty response.

* viewvc-install
  (install_file): If raw_input() return an empty string, re-ask the
    question.

Patch by: Alexey Neyman <stilor@att.net>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2599 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-30 19:09:38 +00:00
cmpilato
f44c50a5ed Fix issue #494 ("allow override config from in mod_python"). This
commit allows environmental overrides to trump programmatically
passed-in configuration paths.

* INSTALL
  Mention the VIEWVC_CONF_PATHNAME override environment variable.

* lib/viewvc.py
  (load_config): Document this function and the order in which it
    searches for a configuration path.  Use server.getenv() instead of
    os.environ.get() where we can so that environmental overrides work
    in mod_python.

Patch by: Alon Bar-Lev <alon.barlev@gmail.com>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2597 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-30 15:45:39 +00:00
cmpilato
b96b8d4003 Revert r2595.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2596 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-30 15:15:11 +00:00
cmpilato
814e0d4d6c *** This commit was reverted in r2596 ***
For issue #494 ("allow override config from in mod_python"), use
server.getenv() instead of os.environ.get() to look for the special
VIEWVC_CONF_PATHNAME environment variable.

* INSTALL
  Mention the VIEWVC_CONF_PATHNAME override environment variable.

* lib/viewvc.py
  (load_config): Use server.getenv() instead of os.environ.get().

Patch by: Alon Bar-Lev <alon.barlev@gmail.com>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2595 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-30 14:59:28 +00:00
cmpilato
1ae87bb8b6 * conf/viewvc.conf.dist
Note the importance of the MIME type maps for syntax coloration, and
  point folks to the 'mime_types_files' option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2593 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-14 17:53:23 +00:00
cmpilato
ec2a0a3f3b Finish issue #491 ("Explain in viewvc.conf.dist the views (used for
allowed_views, etc.)").

* conf/viewvc.conf.dist
  (allowed_views): Add descriptions of the various views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2591 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-09-07 17:42:59 +00:00
cmpilato
ac75dc9651 * bin/svndbadmin
Fix a minor buglet in the usage message.

Reported by: Jean-Yves Avenard <jyavenard@gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2588 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-07-01 17:57:10 +00:00
cmpilato
59f55fecb6 (More) gracefully handle some errorful input conditions.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._getrev): Re-raise all exceptions as
    InvalidRevision exceptions.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._getrev): Re-raise all exceptions as
    InvalidRevision exceptions.

Found by:  Daniel Shahaf <d.s@daniel.shahaf.name>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2586 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-06-23 15:25:07 +00:00
cmpilato
7da44377c5 Fix issue #488 ("Allow 'rrNNN' formatting for Subversion revision
specifiers (with multiple 'r')").

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._getrev): Accept multiple leading 'r's
    in revision specifiers.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._getrev): Accept multiple leading 'r's
    in revision specifiers.

Patch by:  Daniel Shahaf <d.s@daniel.shahaf.name>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2584 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-06-23 15:09:11 +00:00
cmpilato
9228cc9a89 * CHANGES
Fix a mistaken issue reference.

* INSTALL
  Add a step allowing access to your ViewVC install directory, and delay the
  Apache restart by a step.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2582 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-06-14 13:29:09 +00:00
cmpilato
c355d1ce3e Fix issue #486 ("OperationError raised when trying to do a glob search").
Add code to workaround the fact that in Python 2.6,
fnmatch.translate() stopped returning strings that ended with '$'
(which work fine as MySQL regular expressions) and started instead
returning strings that ended with '\Z(?ms)' (which... don't).

* lib/cvsdb.py
  (CheckinDatabase.SQLQueryListString): If the returned regexp ends
    with '\Z(?ms)', replace those characters with a single '$'

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2580 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-06-06 19:57:51 +00:00
cmpilato
47c12cb194 Fix issue #485 ("Patch view hiding path details").
* lib/viewvc.py
  (diff_parse_headers): Add 'path1' and 'path2' parameters, and use
    those paths in the returned header lines.
  (view_patch, view_diff): Pass paths into diff_parse_headers() now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2577 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-27 18:58:59 +00:00
cmpilato
c9f9c96db2 * www/index.html
Update latest revision to 1.1.11.

* CHANGES
  Copy 1.1.11's changes into this file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2574 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-17 12:38:13 +00:00
cmpilato
18a52bd5ce More copyright updates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2570 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-17 12:17:35 +00:00
cmpilato
02bd4d70db Update some copyright notices.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2569 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-17 12:02:28 +00:00
cmpilato
aac6bbafb9 Add '--help' option to standalone.py.
* bin/standalone.py
  (usage, badusage): New functions.
  (main): Separate the option parsing from the option validation.  Add
    support for a '--help' option.  On bad input, now print a suggestion
    to run the script with '--help' for usage hints.

Patch concept by: Prabhu Gnana Sundar <prabhugs@collab.net>
                  (Heavily, heavily tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2565 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 18:34:12 +00:00
cmpilato
90d35a6fc1 * bin/standalone.py
(main): Revert (mostly) a wording change made in r2562.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2563 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 13:47:04 +00:00
cmpilato
91995a4241 * bin/standalone.py
(main): Rework the usage message for conciseness, and fix an old typo, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2562 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 13:39:12 +00:00
cmpilato
eef47fbb1f * bin/standalone.py
(main): Use a pristine Options() object when printing the usage
    message (so the stated default values of options aren't affected
    by what the user provided).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2561 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 13:15:32 +00:00
cmpilato
63ddc213ae * bin/standalone.py
(main): Restore alphabetical order of options listed in the usage message.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2560 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 13:10:36 +00:00
cmpilato
8eeac0cd59 * bin/standalone.py
(main): Switch to sequence syntax to prevent future headache:
    '-h' in ('--help') returns True, which is not what we expect.
    '-h' in ['--help'] returns False, which is what we want.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2559 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-12 13:09:27 +00:00
cmpilato
5132017538 Fix issue #444 ("ViewVC stumbles over revisionless ,v files when
sticky tag is specified").

* lib/vclib/ccvs/bincvs.py
  (_get_logs): Only try to skip the "rest of the file" if there's
    reason to believe there's a "rest of the file".  While here,
    ensure that the 'tag' variable is defined in all cases (though it
    shouldn't matter).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2557 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-05-05 14:36:27 +00:00
cmpilato
a00c6ee5cb Fix issue #483 ("Error skipping newphrases when parsing RCS data").
* lib/vclib/ccvs/rcsparse/common.py
  (_Parser.parse_rcs_admin): Chew up newphrases found while parsing
    the admin block.

Patch by: Giovanni Pellicciotta <giovanni.pellicciotta@anubex.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2555 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-21 16:03:31 +00:00
cmpilato
868300daf4 Fix spelling errors introduced in r2551.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2553 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-20 15:01:17 +00:00
cmpilato
61bcf03fcd Fix (to the degree that I believe is reasonable at this time) issue
#433 ("queries return only partial results").  When a database query
is artificially limited by the 'row_limit' setting, inform the user
that the returned data is incomplete.

* lib/cvsdb.py
  (CheckinDatabase.CreateSQLQueryString): Add 'detect_leftover'
    parameter, used internally to check for a reached query limit.
  (CheckinDatabase.RunQuery): Update call to CreateSQLQueryString(),
    and check for leftover query response rows.  If any are found, set
    the appropriate flag on the query object.
  (CheckinDatabaseQuery.__init__): Set initial values for new
    'executed' and 'limit_reached' members.
  (CheckinDatabaseQuery.SetExecuted,
   CheckinDatabaseQuery.SetLimitReached,
   CheckinDatabaseQuery.GetLimitReached,
   CheckinDatabaseQuery.GetCommitList): New functions.

* lib/viewvc.py
  (view_query): Use query.GetCommitList() now instead of poking into
    the query object directly.  Also, check query.GetLimitReached(),
    reporting the findings through the data dictionary (via a new
    'row_limit_reached' item) to the templates.

* lib/query.py
  (run_query): Use query.GetCommitList() now instead of poking into
    the query object directly.  Now return a 2-tuple of commits and a
    limit-reached flag.
  (main): Update expectations of run_query() call.  Populate
    'row_limit_reached' data dictionary item.

* templates/query_results.ezt,
* templates/query.ezt
  Display a warning if the query results are incomplete.

* templates/docroot/styles.css
  (.vc_warning): New style definition.

* docs/template-authoring-guide.html
  Document the new 'row_limit_reached' template item.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2551 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-20 14:50:40 +00:00
cmpilato
1e4c3f92f6 Move a bunch of duplicated statements into a helper function.
While here, add notes to the 'row_limit' and 'rss_row_limit'
configuration option descriptions.

* lib/cvsdb.py
  (CheckinDatabase.GetCommitsTable): New helper.
  (CheckinDatabase.AddCommit, CheckinDatabase.CreateSQLQueryString,
   CheckinDatabase.CheckCommit, CheckinDatabase.sql_delete): Use new
    GetCommitsTable() helper instead of hard-coding the version-specific
    selection of the commits table.

* conf/viewvc.conf.dist
  (row_limit, rss_row_limit): Make it clear what exactly is getting
    limited here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2550 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-20 14:05:16 +00:00
cmpilato
df71275a13 Try to make some sense of the various CVSdb-related limitation
mechanisms, namely by removing the largely redundant "global" limit
and allowing the per-query row limit (which already exist, too) to do
its work.

While here, remove a poorly conceived (but thankfully unhighlighted)
mechanism for overriding the administrative limit on database rows
which was accessible via URL CGI params.

* lib/viewvc.py
  (_legal_params): Remove 'limit' as a legal parameter.
  (view_query): No longer allow an undocumented URL parameter to
    override the admin-declared SQL row limit.  That should have never
    been allowed!

* lib/cvsdb.py
  (CheckinDatabase.__init__): Remove 'row_limit' parameter and
    associated self._row_limit member.
  (CheckinDatabase.CreateSQLQueryString): No longer fuss with
    self._row_limit.  Let the individual query carry the row limit.
  (ConnectDatabase): Update call to CheckinDatabase().

* lib/query.py
  (form_to_cvsdb_query): Now accept 'cfg' parameter, and set the
    query's row limit from the configured defaults.
  (run_query): Update call to form_to_cvsdb_query().

* docs/url-reference.html
  Remove reference to the 'limit' parameter.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2547 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-19 20:40:04 +00:00
cmpilato
4818a56012 Fix (I think...) issue #479 ("annotate a file, which uses
CVS-keywords").  This changes causes the checkout of CVS file
contents -- when used as part of the markup/annotate logic -- to not
expand keywords.  This helps it to be consistent with the results of
the annotate information query.

* lib/vclib/__init__.py,
* lib/vclib/svn/svn_ra.py,
* lib/vclib/svn/svn_repos.py
* lib/vclib/ccvs/ccvs.py
  (openfile): Add 'options' parameter (unused).  Callers updated.

* lib/vclib/ccvs/bincvs.py
  (openfile): Add 'options' parameter, and look for a 'cvs_oldkeywords'
    option to govern the use of -kkv or -ko in the 'co' command.
    Callers updated.

* lib/viewvc.py
  (markup_or_annotate): Pass 'cvs_oldkeywords' option to repos.openfile().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2545 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-01 16:59:11 +00:00
cmpilato
f12cef277c Fix issue #477 ("Large log messages trigger excessive memory
consumption").

* lib/viewvc.py
  (ViewVCHtmlFormatter._tokenize_text): Switch to a line-based
    approach.  This provides a *vast* improvement in performance and
    memory usage, especially for large log messages with many
    mark-up-able regions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2543 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-04-01 14:37:24 +00:00
cmpilato
0ca7fac7fb Finish issue #478 ("Client-facing unhandled exceptions, traceback
dumped") by raising a cleaner error message when asked to display a
"checkout" of a non-file.

* lib/viewvc.py
  (view_checkout): If the target isn't a file, raise a
    ViewVCException().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2541 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-03-29 16:35:54 +00:00
cmpilato
35a55c317e * lib/vclib/ccvs/blame.py
(CVSParser.extract_revision): Fix a typo (aka "syntax error").

Found by: Cristian Tibirna <tibirna{__AT__}kde.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2540 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-03-28 17:46:28 +00:00
cmpilato
963a3a2094 * bin/standalone.py
(main): Fix broken option handling: -d expected an argument, -c
    didn't and was doubly associated with both --config-file and
    --htpasswd-file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2538 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-03-15 20:40:23 +00:00
cmpilato
5ce98d04d6 Bump latest version statement and links, and copy CHANGES from 1.1.10 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2536 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-03-15 16:36:35 +00:00
cmpilato
49957ea54b Hopefully, fix issue #475 ("regression: required authorization to
root") and issue #476 ("Stack trace for some users if last commit
deleted a file or folder") by preventing ViewVC from trying to look up
the path type of a deleted path at an invalid location.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._gettype): New helper function.
  (LocalSubversionRepository.itemtype): Now use _gettype() helper.
  (_get_change_copyinfo): New helper.
  (_simple_auth_check): Rework this function to definitively resolve
    the path type of paths it passes through the authz system,
    handling the complication of determining the path of a now-deleted
    path by consulting its last location prior to deletion.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2531 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-03-11 20:17:21 +00:00
cmpilato
bd3323410a Add some helpful URLs to the release instructions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2529 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 20:01:13 +00:00
cmpilato
fce93313e5 Post-release twiddling.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2527 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 19:55:28 +00:00
cmpilato
76dae127d6 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2524 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 19:24:59 +00:00
cmpilato
2f8af5fdb7 * conf/viewvc.conf.dist (log_pagesextra): Set value to match defaults.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2522 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 18:27:58 +00:00
cmpilato
c3dc73d840 Followup to r2517, for issue #457.
* templates/roots.ezt
  Also show the last author, and mark only the "Name" header as the
  sort choice.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2519 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 16:56:16 +00:00
cmpilato
0fe6e33643 Finish issue #457 ("Display repository metadata (last-commit stuff) in
roots view").

* lib/viewvc.py
  (view_roots): Include revision metadata in the data dictionary.
  (list_roots): If configured to do so, calculate some last-modified
    metadata for Subversion roots.

* lib/config.py
  (Config.set_defaults): Set default value for new show_roots_lastmod
    option.

* conf/viewvc.conf.dist
  (show_roots_lastmod): New option.

* templates/roots.ezt
  Show some roots metadata if configured to do so.

* docs/template-authoring-guide.html
  Document new 'roots' view data dictionary items.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2517 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-18 15:11:01 +00:00
cmpilato
f7df7da7f0 Finish issue #455 ("ViewVC 1.1.x missing URL parsing in file contents
view").

* lib/viewvc.py
  (_re_rewrite_escaped_url): New compiled regexp.
  (markup_escaped_urls): New helper function.
  (markup_stream_pygments): Use markup_escaped_urls() to wrap URLs in
    <a> tags, something Pygments won't do for us.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2514 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-17 16:05:46 +00:00
cmpilato
bc2ab5c093 * lib/vclib/svn/__init__.py
(canonicalize_rootpath): Per the thought found in issue #446
    ("Specifying repo location using file:// prefix in svn_roots leads
    to lack of hyperlinks on revision view"), convert file:/// and
    file://localhost/ URLs into local paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2512 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-16 20:27:33 +00:00
cmpilato
2e69660725 Make what should be some decent performance improvements in the
Subversion revision metadata harvesting logic.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._revinfo): Split this into two logical
    codepaths, one that needs changed-path information along with the
    revision metadata, one which does not.  (Because if we don't need
    it, there are faster ways to get what we *do* need.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2509 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-11 21:33:28 +00:00
cmpilato
51fe3f9d1c * lib/vclib/svn/svn_repos.py
(_get_history, _log_helper): Move these into...
  (LocalSubversionRepository._get_history,
   LocalSubversionRepository._log_helper): ...here.  Update callers.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2507 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-11 21:16:13 +00:00
cmpilato
77bf7001a6 * lib/vcauth/svnauthz/__init__.py
(ViewVCAuthorizer._get_paths_for_root): Trap and return a cleaned-up
    error when the authzfile isn't parse-able.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2505 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-11 16:55:11 +00:00
cmpilato
2dfe9c55f0 Clarify that Python 3.x is not yet supported.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2502 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-02-07 14:47:22 +00:00
cmpilato
c39a091b83 * lib/vclib/svn/svn_ra.py
(client_log): Check for the correct exception.

Reported by: Phil Jeary <Phil.Jeary@dovetailservices.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2500 8cb11bc2-c004-0410-86c3-e597b4017df7
2011-01-04 19:22:32 +00:00
cmpilato
5678e463ad Make the number of "extra pages" of log output configuration. (An old
TODO item I'd forgotten about.)

* lib/config.py
  (Config.set_defaults): Set cfg.options.log_pagesextra default value.

* lib/viewvc.py
  (EXTRA_PAGES): Removed.
  (paging_sws): Add 'extra_pages' parameter, used instead of static
    EXTRA_PAGES variable.
  (view_log): Update call to paging_sws().  Replace uses of static
    EXTRA_PAGES with cfg.options.log_pagesextra.

* conf/viewvc.conf.dist
  (log_pagesextra): New configuration item.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2498 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-09 17:10:58 +00:00
cmpilato
e8ba12d66d Fix issue 425 ("Authorization subsystem needs some optimization").
Give the 'vcauth' subsystem a way to make universal access
determinations, which can seriously improve performance in situations
where a user has universal read access to a repository.

* lib/vcauth/__init__.py
  (GenericViewVCAuthorizer.check_universal_access): New skeletal function.
  (ViewVCAuthorizer.check_universal_access): New function.

* lib/vcauth/svnauthz/__init__.py (ViewVCAuthorizer.check_universal_access),
* lib/vcauth/forbidden/__init__.py (ViewVCAuthorizer.check_universal_access),
* lib/vcauth/forbiddenre/__init__.py (ViewVCAuthorizer.check_universal_access)
  New functions.

* lib/vclib/ccvs/bincvs.py
  (BaseCVSRepository.open): New function.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.open): Now check for universal read access.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.open): Now check for universal read access.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2496 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-09 16:10:04 +00:00
mhagger
31d16b42fe Provide better error info for invalid CVS timestamps.
Patch by: Craig Leres <leres@tigris.org>
Expanded by: me

The original version of this patch was submitted to cvs2svn issue #141:
http://cvs2svn.tigris.org/issues/show_bug.cgi?id=141

* lib/vclib/ccvs/rcsparse/common.py
  (_Parser._parse_rcs_tree_entry): If there is an error when parsing a
  CVS timestamp, include the revision number in the exception message.
  The calendar.timegm() function is not very picky, but it does emit an
  error if the month number is invalid.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2495 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-09 08:37:18 +00:00
cmpilato
31bf260508 Cruft removal. Don't tempt folks to configure the path to their
Subversion client, as ViewVC no longer uses that information.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.__init__): Don't look for svn client path
    in the 'utilities' dictionary.  We don't use it anyway.

* lib/config.py
  (Config.set_defaults): Don't populate utilities.svn any more.

* conf/viewvc.conf.dist
  (utilities/svn): Remove as unused.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2493 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-06 19:08:20 +00:00
cmpilato
4c965a521d Add some notes about issue #439.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2491 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-03 20:50:43 +00:00
cmpilato
ce4f396604 * lib/vclib/ccvs/bincvs.py
(_path_join): Fix one of my more pathetic coding errors.  (How do
    you lose track of the proper valid variable name in a two-line
    function.  Honestly...)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2490 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-03 17:25:34 +00:00
cmpilato
0c38626f18 * CHANGES
Add 1.1.8 changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2489 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-02 21:37:04 +00:00
cmpilato
6ac853c1f4 Update website to reflect latest release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2487 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-02 20:58:13 +00:00
cmpilato
beb2205b64 Minor tweak to the release process notes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2483 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-12-02 20:37:36 +00:00
cmpilato
060ef83f0e Issue #472 ("Using view=markup on folder causes errors").
* lib/viewvc.py
  (view_markup, view_annotate): Raise a more graceful error message
    when asked for markup or annotate view on a non-file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2480 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-11-30 21:11:19 +00:00
cmpilato
de95d36720 * bin/standalone.py
(has_crypt, _check_passwd): If 'crypt' isn't available, look for
    'fcrypt' and use it instead.
  (main): Always show --htpasswd-file option, but raise an informative
    error if someone tries to use it when there's no cryptographic support.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2478 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-11-30 18:19:28 +00:00
cmpilato
f0e2fa721a * lib/config.py
(Config._is_allowed_section, Config._is_allowed_override): Lose
    unused 'parser' parameter.  Callers updated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2476 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-11-30 08:49:20 +00:00
cmpilato
f3629550dd * lib/viewvc.py
(view_directory): Add some more debug timers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2475 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-11-24 21:34:16 +00:00
cmpilato
5f50e82bda Fix issue #471 ("standalone.py won't start on Windows: no module named
'crypt'") by making htpasswd file support optional (based on the
availability of the 'crypt' module).

* bin/standalone.py
  (): Conditionally import 'crypt' and define _check_passwd() helper function.
  (ViewVCHTTPRequestHandler.validate_password): Use _check_passwd() now.
  (main): Conditionally built accepted options list and usage string based
    on whether 'crypt' is available.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2473 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-11-16 16:02:46 +00:00
cmpilato
400eb13d76 Fix issue #467 (I think...) by not claiming a particular content
length when compression would skew that.

* lib/viewvc.py
  (get_writeready_server_file): Add optional 'content_length'
    parameter, and the code to handle it.
  (view_doc): Update call to get_writeready_server_file().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2471 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-10-05 15:01:41 +00:00
cmpilato
c123490436 * CHANGES
Copy in the 1.1.7 changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2469 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 18:50:06 +00:00
cmpilato
ce5a303c02 Bump latest release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2467 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 18:47:55 +00:00
cmpilato
40df73e111 Bump some copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2463 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 18:19:03 +00:00
cmpilato
239844c040 * conf/viewvc.conf.dist
(viewvc_base_url): Add another example showing a relative ViewVC
    base URL.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2460 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 15:23:35 +00:00
cmpilato
d6a4d294fb Fix the query script's WSGI and FastCGI deployments.
* lib/sapi.py
  (WsgiServer.FieldStorage): Don't pass self._headers to
    cgi.FieldStorage() -- that parameter is for *input* headers, and
    self._headers is a collection of output headers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2459 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 14:10:35 +00:00
cmpilato
1d33308f90 Allow users to tell the query script where ViewVC is located while
still generating the same defaults as before.

* conf/viewvc.conf.dist
  (query, query.viewvc_base_url): New section and value.

* lib/config.py
  (_base_sections): Add 'query'.
  (Config.set_defaults): Set default value for cfg.query.viewvc_base_url.

* bin/asp/query.asp,
* bin/cgi/query.cgi,
* bin/mod_python/query.py,
* bin/wsgi/query.fcgi,
* bin/wsgi/query.wsgi,
  Ask the configuration for the location of ViewVC before falling back
  to old defaults.

* templates/query.ezt
  Don't reference unset variables.  Do test the log message for
  empty-ness, dropping a non-breaking space in place where it is.

* templates/include/footer.ezt
  Don't reference unset variables.  

* lib/query.py
  (build_commit): Allow ob.log to be empty.  Don't generate ViewVC
    links if we don't have a base URL for ViewVC.
  (main): Calculate docroot in light of possible absent viewvc_link.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2458 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 13:40:42 +00:00
cmpilato
2012320bfc * lib/vclib/ccvs/ccvs.py
Lose more explicit invocations of 'string' module functions (which
  no worky because we aren't importing that module any more).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2457 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-09 11:44:09 +00:00
cmpilato
e2433ea8e9 * lib/viewvc.py
(_re_rewrite_svnrevref): Wrap the regexp with word boundaries.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2455 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-08 18:26:15 +00:00
cmpilato
1d8e32110c * lib/vclib/svn/svn_repos.py
(_split_revprops): Special-case the handling of empty input.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2454 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-08 18:11:28 +00:00
cmpilato
b6f0d36c72 * notes/releases.txt
Tweak the release procedure to include pegging the externals
  definition which pulls in the 'templates-contrib' subdirectory.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2452 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-08 17:03:30 +00:00
cmpilato
42f1c80e74 * CHANGES
The FastCGI support is now coming in 1.1.x.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2448 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 19:20:50 +00:00
cmpilato
8360e07a97 Stop importing the 'popen2' module -- we aren't using it.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2446 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 19:09:07 +00:00
cmpilato
a0b87889dc * CHANGES: Note recent FastCGI support addition.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2445 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 15:50:24 +00:00
cmpilato
8b78e4d0b3 Finish issue #464: Add support for FastCGI (using a WSGI end-around).
* bin/wsgi/viewvc.fcgi,
* bin/wsgi/query.fcgi
  New scripts.

* INSTALL
  Note the additional configuration/deployment option.

* viewvc-install
  Install the .fcgi files, too.

Patch by: Mark A. Ziesemer <ziesemer{_AT_}tigris.org>
          (Tweaked minorly by me.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2444 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 15:47:53 +00:00
cmpilato
42208db4aa Typo fix. Patch by Mark A. Ziesemer <ziesemer{_AT_}tigris.org>
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2442 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 15:41:00 +00:00
cmpilato
ed975ad336 Typo fix. Patch by Mark A. Ziesemer <ziesemer{_AT_}tigris.org>
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2441 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 15:40:36 +00:00
cmpilato
6b7c9d066f Finish issue #113: Support auto-markup of revision references.
* lib/viewvc.py
  (_re_rewrite_svnrevref): New regular expression.
  (ViewVCHtmlFormatter.format_svnrevref): New.
  (format_log): Accept 'request' parameter instead of 'cfg' (which can
    be obtained via the request).  For Subversion repositories,
    register a formatter which marks up revision references as links
    to the revision view.
  (): Update callers of format_log().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2439 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-07 15:17:32 +00:00
cmpilato
fb5ca5c1d9 * CHANGES
Note new minimum Python version.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2438 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-03 16:50:33 +00:00
cmpilato
a5df176395 Wow. Drop a "general code cleanup" kind of bomb on the codebase. All
of this is aimed at not paying the maintenance price of supporting
Python versions prior to 2.4 any longer, plus a little bit of just
getting dead code out of the way.

* lib/compat.py
  Remove as unused.

* bin/cvsdbadmin,
* bin/loginfo-handler,
* bin/make-database,
* bin/svndbadmin,
* lib/accept.py,
* lib/blame.py,
* lib/cvsdb.py,
* lib/popen.py,
* lib/query.py,
* lib/sapi.py,
* lib/vcauth/forbidden/__init__.py
* lib/vcauth/forbiddenre/__init__.py,
* lib/vcauth/svnauthz/__init__.py,
* lib/vclib/__init__.py,
* lib/vclib/ccvs/blame.py,
* lib/win32popen.py,
* tests/timelog.py
  Replace explicit import and use of the 'string' module with newer constructs.

* bin/standalone.py,
* lib/viewvc.py 
  No longer use 'compat' module.  Replace explicit import and use of
  the 'string' module with newer constructs.

* lib/dbi.py
  Use calender.timegm() instead of compat.timegm().

* lib/vcauth/__init__.py
  Lose unused module imports.

* lib/config.py,
  Replace explicit import and use of the 'string' module with newer
  constructs where possible.  Lose old ConfigParser patch-up code for
  Python 1.5.1.

* lib/vclib/ccvs/ccvs.py
  Replace explicit import and use of the 'string' module with newer
  constructs where possible.  Import _path_join() from bincvs, and use
  it instead of a bunch of copy-and-pasted string join() statements
  throughout.

* lib/vclib/ccvs/__init__.py
  (cvs_strptime): Moved here from the 'compat' module.

* lib/vclib/ccvs/bincvs.py
  (): No longer use 'compat' module.  Replace explicit import and use
    of the 'string' module with newer constructs.
  (_path_join): New, used now instead of a bunch of copy-and-pasted
    string join() statements throughout.

* viewvc-install
  Don't use the 'compat' module any more.

Also, so some rearranging of non-critical bits.

* misc/:              New directory.
* misc/py2html.py:    Moved from 'lib/py2html.py'.
* misc/PyFontify.py:  Moved from 'lib/PyFontify.py'.
* misc/elemx/:        Moved from 'elemx/'.
* misc/tparse/:       Moved from 'tparse/'.
* tools/make-release
  Omit 'misc' directory from releases, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2437 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-03 16:49:52 +00:00
cmpilato
a86bac818e * lib/vclib/svn/svn_repos.py
(BlameSource.__init__): Use client.create_context() instead of
    client.ctx_t() to avoid "NULL proxy object pool" error.

(I should have done this with the changes in r2421, but overlooked it,
I guess.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2435 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-03 16:18:55 +00:00
cmpilato
07ba91e7d9 * lib/vclib/svn/svn_repos.py,
* lib/vclib/svn/svn_ra.py
  Remove explicit import and use of 'string' module.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2434 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-02 19:46:14 +00:00
cmpilato
41bc85c437 * viewvc-install
Purge explicit import and use of the 'string' module.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2433 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-02 19:43:35 +00:00
cmpilato
0e0c657341 * INSTALL
Python 2.4 is now the required Python for trunk.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2432 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-09-02 19:39:52 +00:00
cmpilato
6b35895704 Parse the "; charset=..." bit out of Subversion's svn:mime-type
property, and use it to inform Pygments as to the file's encoding in
the markup and annotate views (while still providing that information
to the user agent in the checkout view).

* lib/viewvc.py
  (parse_mime_type): New helper function.
  (calculate_mime_type): Now also return the encoding as possibly
    parsed from the svn:mime-type property.  Callers updated.
  (get_writeready_server_file): Add 'encoding' parameter.
  (markup_stream_pygments): Add 'encoding' parameter which, if
    provided, becomes the encoding passed to Pygments.
  (view_checkout): Pass the encoding as/if provided by calculate_mime_type()
    to get_writeready_server_file().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2430 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-08-25 20:09:39 +00:00
cmpilato
3f5c86fe85 ViewVC's options are defined and described to be lower-case, with the
only exception being the freeform [vhost] section values and key-value
file stuffs.  In those places, user-defined case could be helpful, and
is certainly not documented as broken.  So allow it, per issue #466.

* lib/config.py
  (Config.load_config, Config.load_kv_files): Override
    ConfigParser.optionxform() to avoid case normalization of option names.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2428 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-08-23 20:25:58 +00:00
cmpilato
8c2b5cd63a * lib/viewvc.py
(ViewVCHtmlFormatter): Was HtmlFormatter.  Which, uh, has the same
    name as an object imported from Pygments.
  (format_log): Track renamed class.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2426 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-08-19 04:18:56 +00:00
cmpilato
ab1f329994 Empower the revision view for remote Subversion repositories to
display node kind information and, by extension, links to the markup
and diff views for files.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository._revinfo_raw): Tweak _log_cb() inner
    function to make use of the svn_log_changed_path2_t information
    where available.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2424 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-08-13 17:48:31 +00:00
cmpilato
6444e57831 Build the Subversion client context object correctly (thus avoiding a
weird NULL proxy object pool error).

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.open): Use svn_client_create_context()
    instead of svn_client_ctx_t().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2421 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-08-13 16:17:39 +00:00
cmpilato
6e5703686a Note the removal of standalone.py's GUI mode.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2416 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 21:02:01 +00:00
cmpilato
f548912f9a Finish issue #49 - authentication support for standalone.py.
* bin/standalone.py
  (Options.htpasswd_file): New variable.
  (AuthenticationException): New.
  (ViewVCHTTPRequestHandler.handle_request): Handle AuthenticationException.
  (ViewVCHTTPRequestHandler.validate_password): New.
  (ViewVCHTTPRequestHandler.run_viewvc): If htpasswd authentication is
    enabled, then complain about missing authn creds, and validated
    any presented creds.
  (main): Present and handle the new --htpasswd-file option.  Also, do
    some rudimentary validation of --htpasswd-file and --config-file values.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2414 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 20:50:54 +00:00
cmpilato
8f9eaf9e26 * bin/standalone.py
(main): Don't accept the -g option.  (This is leftover from a
    previous change.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2413 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 20:31:17 +00:00
cmpilato
9ce6a651c7 More improvements to standalone.py.
* bin/standalone.py
  (NotViewVCLocationException): New exception.
  (ViewVCHTTPRequestHandler.do_GET, ViewVCHTTPRequestHandler.do_POST):
    Now just thin wrappers around...
  (ViewVCHTTPRequestHandler.handle_request): ...this new function.
  (ViewVCHTTPRequestHandler.is_viewvc): Allow for the case where the
    script alias is empty (a server root deployment).
  (ViewVCHTTPRequestHandler.redirect): Remove as unused (the code's
    been merged into handle_request()).
  (ViewVCHTTPRequestHandler.run_viewvc): Do the is_viewvc() check here
    now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2411 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 20:22:36 +00:00
cmpilato
28b4383a7b Remove the GUI mode from standalone.py. Great idea when the tool was
simpler, but I've not done it justice in terms of upkeep.

* bin/standalone.py
  (__author__, __date__, __version__, __credits__): Removed in favor of a
    a simple header comment.
  (Options.start_gui): Removed this member variable.
  (nogui, gui): Removed.
  (main): Was 'cli'.  Remove all option handling for, and usage
    references to, GUI mode.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2409 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 19:06:09 +00:00
cmpilato
e3042df5a3 * bin/standalone.py
(Options): Minor formatting and noop logic changes.
  (ViewVCHTTPServer): Was ViewVC_Server; move to module scope.
  (ViewVCHTTPRequestHandler): Was ViewVC_Handler; move to module scope.
  (serve): Track class renames.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2408 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 18:55:23 +00:00
cmpilato
26522f7f71 * bin/standalone.py
Reformat this file for consistency with other bits of ViewVC.  There
  *should* be no meaningful logic changes in this commit.  (If there
  are, it's probably a mistake.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2407 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-07-15 18:43:10 +00:00
cmpilato
ff990c90b5 Record change for previous commit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2406 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-17 20:51:56 +00:00
cmpilato
5a87b383e9 Finish issue #441: Allow "rNNN" formatting for Subversion revision specifiers.
* lib/vclib/svn/svn_repos.py (LocalSubversionRepository._getrev),
* lib/vclib/svn/svn_ra.py (RemoteSubversionRepository._getrev):
  Now accept revision strings that begin with 'r'.

Patch by: Daniel Shahaf <d.s{__AT__}daniel.shahaf.name>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2405 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-17 20:43:28 +00:00
cmpilato
f17e5a76a2 Fix a bug which prevented 'standalone.py -r REPOS' from being used
without a configuration file.

* lib/config.py
  (Config.get_authorizer_and_params_hack): Make sure to always return
    a 2-tuple.  Callers will be expecting that, ya know?

Reported by: Daniel Shahaf <d.s{__AT__}daniel.shahaf.name>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2403 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-17 20:06:59 +00:00
cmpilato
10d460902d Finish issue #453 by teaching ViewVC to display all displayable
Subversion revision properties.

NOTE: The svn_ra logic attempts to do the right thing when
      pre-Subversion 1.5 libraries are install, but I haven't had the
      chance to actually test this out myself.

* templates/revision.ezt
  Include the props.ezt property handler template fragment for use
  with revision props.  Also, minor markup change to a header.

* templates/docroot/styles.css
  Lose some unnecessary stylation.
 
* lib/viewvc.py
  (get_itemprops): Lose unused variable has_binary_props.
  (view_revision): Handle new return value from repos.revinfo(),
    processing extra revision props similarly to the way that file/dir
    props are processed and passing them to the template data
    dictionary.

* lib/vclib/svn/svn_ra.py
  Import _split_revprops() from svn_repos.
  (client_log): New compatibility wrapper.
  (add_log): Reformat as an svn_log_entry_receiver_t callback.
  (RemoteSubversionRepository.dirlogs, _date_from_rev): Track changes
    to self.revinfo().
  (RemoteSubversionRepository.itemlog): Now use client_log().
  (RemoteSubversionRepository._revinfo_raw): Now use client_log() and
    return revprops dict, too.
  (_log_cb): Reformat as an svn_log_entry_receiver_t callback.

* lib/vclib/svn/svn_repos.py
  (_split_revprops): New helper.
  (_log_helper, LocalSubversionRepository.dirlogs, _date_from_rev):
    Track changes to repos._revinfo().
  (_revinfo): Use _split_revprops(), and now return revprops, too.
  (_revinfo_helper): Now return revprops dict, too.
  (_date_from_rev): 

* lib/vclib/__init__.py
  (Repository.revinfo): Update docstring to indicate that this
    interface now returns a revprops dictionary, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2401 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-15 15:18:48 +00:00
cmpilato
c6f65cb422 Offer a little more help to folks trying to configure the root_parents
option.

* conf/viewvc.conf.dist
  (root_parents): Rewrite the documentation for this to be more clear
    and to note the valid root type strings.
  
* lib/viewvc.py
  (Request.run_viewvc, expand_root_parents): Make some error strings
    provide more helpful information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2399 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-03 19:42:33 +00:00
cmpilato
f90d575dd2 Oops. Forgot that direct SVN access requires authn.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2398 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:49:01 +00:00
cmpilato
bcb28885a9 i can haz logo?
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2397 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:47:43 +00:00
cmpilato
60c2e59707 Trade broken link for working one.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2396 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:44:31 +00:00
cmpilato
90e5df36c9 Minor process and verbiage tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2393 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:37:39 +00:00
cmpilato
29cba5c197 Remove now-unused Announcements link.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2392 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:25:18 +00:00
cmpilato
b60b4148ba Merge in CHANGES from 1.0.12 and 1.1.6.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2391 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:20:46 +00:00
cmpilato
0df74987cc Bump latest version.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2390 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 14:19:03 +00:00
cmpilato
bf31982901 Shorten the update/copy instructions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2381 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-06-02 12:50:08 +00:00
cmpilato
bee9ac95be Fix issue #452 - Unable to purge data from query database for
non-existent repository.

* bin/svndbadmin
  (main): Do repository existence checking here, like the corresponding
    code in cvsdbadmin does.  (In fact, structure this function like that
    corresponding cvsdbadmin code.)
  (__main__): No longer do existence checks here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2379 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-20 19:41:33 +00:00
cmpilato
9e2ee8277b Fix issue #451 - ViewVC RSS feed does not correctly escape contents of
<title>.

* templates/rss.ezt
  Apply the necessary formatting for RSS feed title and description
  elements.  Too bad so many readers have developed their own
  individual ideas about presentation of this under-documented format.

(See also r2376.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2377 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-20 19:10:06 +00:00
cmpilato
b07b83d252 Teach the EZT library to handle nested [format] blocks rather than its
current only-use-the-most-recently-noticed formatter approach.

* lib/ezt.py
  (Template._cmd_format): Rename 'printer' parameter to 'formatter'.
  (_print_formatted): New helper function.
  (_write_value): Now pop/restore the whole stack of formatters, and
    use _print_formatted() to do the real output writing.
  (Context.__init__): Rename 'printers' member to 'formatters'.
    Consumers updated.
  (_raw_formatter, _html_formatter, _uri_formatter): Renamed from
    _raw_printer(), _html_printer(), and _uri_printer() respectively.
    Consumers updated.
  (_xml_formatter): New.
  (_formatters): Renamed from _printers.  Consumers updated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2376 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-20 19:06:11 +00:00
cmpilato
aa3f355ec2 Fix issue #449 - RSS feed returned with no mime type set
* lib/viewvc.py
  (generate_page): Actually pass the content_type to
    get_writeready_server_file().

Patch by: Tom Throckmorton <throck{_AT_}tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2374 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-20 15:06:44 +00:00
cmpilato
a04e0a3297 Optimizations for rcsparse.
* lib/vclib/ccvs/rcsparse/default.py
  (_TokenStream): Convert token_term into a frozenset if the Python
    version supports such.
  (_TokenStream.get): Remove unnecessary buffer length calculations.

Patch by: Brian Harring <ferringb{_AT_}tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2372 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-20 14:56:08 +00:00
cmpilato
b922b3604d Fix issue #454 - AttributeError exception trying to escape non-string input.
* lib/sapi.py
  (escape): Ensure that the input is string-ified before doing string
    transformations on it.

Patch by: Michael Henry <drmikehenry{__AT__}tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2369 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-06 13:51:30 +00:00
cmpilato
cadb94c8b4 * INSTALL
Fix some formatting, and -- Ooh!  Did you see that?  Why, yes, I
  *did* just pull on some armor-plated underwear in the WSGI
  deployment section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2367 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-05-05 15:26:07 +00:00
cmpilato
0d2cad4c2d Lose bogus MIME type in favicon link tag.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2364 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-04-21 19:07:30 +00:00
cmpilato
4a96cb39f5 * lib/viewvc.py
(view_revision): Include a self-referential 'revision_href' item in
    the template data dictionary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2362 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-04-14 17:16:57 +00:00
cmpilato
ec36a17b1c Bump published latest version number.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2361 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-30 15:15:04 +00:00
cmpilato
d899df1771 * lib/vclib/ccvs/rcsparse/__init__.py,
* lib/vclib/ccvs/rcsparse/common.py
  Add some much-needed interface docs and comments.

Patch by: Jon Foster <jon.foster {_AT_} cabot.co.uk>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2360 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-29 18:22:04 +00:00
cmpilato
8af6e2d824 Copy CHANGES items from 1.1.5 and 1.0.11 releases.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2359 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-29 16:51:11 +00:00
cmpilato
16f6728f48 Duh. Bump copyright year in LICENSE.html file, too.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2352 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-29 15:37:05 +00:00
cmpilato
1da4f1a0e3 Copyright bumps only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2349 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-29 15:30:00 +00:00
cmpilato
8af29de901 There were too many ways to do something as simple as HTML escaping in
the ViewVC codebase.  Simplify, conjoin, remove, etc.

* lib/sapi.py
  (escape): New function.  *The* preferred HTML-escaping mechanism.
  (Server.escape): New common Server object escape mechanism (which
    uses the aforementioned escape(), of course).
  (CgiServer.escape, WsgiServer.escape, AspServer.escape,
   ModPythonServer.escape): Lose as unnecessary.

* lib/viewvc.py
  (Request.get_form): Escape hidden form variable names and values.
  (htmlify): Remove.
  (): Replace all uses of cgi.escape() and htmlify() with (directly or
    indirectly) sapi.escape().
  
* lib/query.py
  (main): Use server.escape() instead of cgi.escape().

* lib/blame.py
  (HTMLBlameSource.__getitem__): Use sapi.escape() instead of
    cgi.escape().

* lib/idiff.py
  (_mdiff_split, _differ_split): Use sapi.escape() instead of
    cgi.escape().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2344 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-11 19:56:22 +00:00
cmpilato
8018ab4a95 Oops! Fix version typo.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2342 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-10 22:01:27 +00:00
cmpilato
eb245f2cde Copy in CHANGES entries for 1.0.10 and 1.1.4 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2341 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-10 21:57:44 +00:00
cmpilato
19cc8e7e7b Bump latest release note.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2335 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-10 21:40:11 +00:00
cmpilato
26fa0600c6 Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2330 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-10 21:17:28 +00:00
cmpilato
82c5390d06 * lib/viewvc.py
(view_queryform): Escape user-provided input before passing it
    directly off to the templates.  Can you say "XSS attack vector"?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2326 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-02-10 19:19:53 +00:00
cmpilato
3bfefeaaff * lib/viewvc.py
(query_backup): Switch to using the sapi interface for output file
    I/O instead of using 'print'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2325 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-02-10 19:18:18 +00:00
cmpilato
3563f77bc0 Fix use of 'allow_tar' in an example immediately after saying that it's been
removed.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2322 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-01-29 14:30:22 +00:00
cmpilato
9dc26d4a01 Fix issue #447: Annotate view broken for local SVN repo.
* lib/vclib/svn/svn_repos.py
  (BlameSource.__init__): Add 'config_dig' parameter, and use it to
    register the Subversion configuration directory.
  (LocalSubversionRepository.__init__): Recognize an empty-string
    config_dir as None.  (Yay for configuration file nuances!)
  (LocalSubversionRepository.annotate): Pass self.config_dir to
    BlameSource().

Patch (mostly) by: Jan Parthey <jpar{_AT_}tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2320 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-01-19 15:10:58 +00:00
cmpilato
9fbedaeded * conf/viewvc.conf.dist
Comment tweaks, primarily to note in the authorizer parameter
  sections that those options only apply when 'authorizer' has been
  set to the correct respective authorizer name.

Suggested by: Dan Poirier <poirier{_AT_}pobox.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2318 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-01-08 17:24:47 +00:00
cmpilato
2d0fced231 Add a bit of a workaround -- which fortunately applies to probably 99%
of ViewVC users -- for issue #445 (standalone.py throws exception on
root listing after visiting a root).

* conf/viewvc.conf.dist
  Add warning about using per-root options with standalone.py.

* lib/config.py
  (Config.overlay_root_options): Move the assertion/recording related
    to the one-time-only overlay stuffs down to the point where
    problems might occur.  This gives standalone.py users who don't
    use per-root configuration options the requisite mercy to let
    their servers continue to function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2316 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-01-07 15:56:29 +00:00
cmpilato
167a98ca4e * INSTALL
Fix a typo.  Found by Arfrever F. T. A. <arfrever.fta{_AT_}gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2315 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-22 21:43:15 +00:00
cmpilato
fa33ac3990 Bump latest version on website.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2314 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-22 20:50:32 +00:00
cmpilato
e5f533a115 Copy in 1.1.3 CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2313 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-22 20:50:19 +00:00
cmpilato
bedf47ea58 * conf/viewvc.conf.dist
(docroot): Add admonishment about how this interplays with per-root
    configuration of the 'template_dir' option.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2308 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-08 17:12:44 +00:00
cmpilato
4979fd6091 * conf/viewvc.conf.dist
Try to consistify the way our admonishments appear herein.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2306 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-08 17:05:36 +00:00
cmpilato
94708561eb Move the viewvc.org website directory to the root of the repository.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2303 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-04 21:49:18 +00:00
cmpilato
050eb3c433 Add some screenshots, and make some minor style tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2302 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-04 21:48:26 +00:00
cmpilato
2d091dc582 Some security-related improvements/fixes.
Make per-root authorizer-related configuration work so that admins can
feel comfortable exposing their root listing views again.

Also, make the query interface require that queried roots be
configured (explicitly or implicitly) to use either the 'forbidden'
authorizer or none at all.  This is a security fix, since
administrators might reasonably have thought that if they configured a
root to use another authorizer, the query interface would have honored
that configuration.

* lib/config.py
  (Config.__init__): Now track whether root options have been overlayed.
  (Config.overlay_root_options): Assert that no root options have been
    overlayed (and then noted that they now have).
  (Config.get_authorizer_and_params_hack): New function to workaround
    our inability to un-overlay root-specific options.  It's only the
    query interface and root listing views that really need to act on
    multiple roots at once, and really only the authorization options
    that matter there anyway.
  (Config.get_authorizer_params): Remove per-root overlay hacks from
    this function.

* lib/viewvc.py
  (Request.run_viewvc): Update call to setup_authorizer() (to not
    specify the rootname).
  (setup_authorizer): Make the rootname parameter option, as a flag
    for whether to consult the current configuration or instead use
    the hack which manually digs around for per-root overrides of
    authorizer stuffs.

* lib/query.py
  (is_forbidden): Don't try to apply the 'forbidden' authorizer where
    some other (or no) authorizer has been configured for a given
    root.  But do complain if another authorizer has been configured,
    rather than simply letting stuff leak through that an
    administrator might reasonably expect to have been hidden.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2300 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-03 06:04:32 +00:00
cmpilato
fe6b7afb66 * lib/query.py
(run_query): Expand roots so we're playing with a full deck.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2297 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-03 05:57:22 +00:00
cmpilato
a6565f89f9 Appease the monster in me who growls every time he finds a website
whose primary navigation links aren't preserved on every page.

* viewvc.org/who.html,
* viewvc.org/faq.html,
* viewvc.org/download.html,
* viewvc.org/contact.html
  Lose the 'Project Page' and 'Contributing' nav links.

* viewvc.org/index.html
  Lose the 'Project Page' and 'Contributing' nav links.  Put the
  (short) license on this page.

* viewvc.org/contributing.html
  Lose the 'Project Page' and 'Contributing' nav links.  Put info
  about the viewvc.tigris.org site on this page.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2295 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-02 19:49:25 +00:00
cmpilato
59e6fa414e Fix issue #442: Standalone server 1.1.2 fails to start under Python 1.5.2
* lib/viewvc.py
  (load_config): Tweak lambda usage for 1.5.2-compliance.

Patch by:  Dmitry Bulgakov <dvb{_AT_}tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2293 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-02 16:01:49 +00:00
cmpilato
eda31f6050 Take a crack at revamping the configuration subsystem to allow for a
clear understanding of per-vhost and per-root configuration overrides.
This should resolve issue #411 (Can't override authz-* sections in
virtual host).

* conf/viewvc.conf.dist
  Add comments about the scope and permissability of per-vhost and
  per-root overrides.

* lib/config.py
  (): Add some comments about option layering -- including a fancy
    schmancy ASCII art diagram! -- and make some minor comment
    formatting tweaks.
  (Config._base_sections): Was Config._sections.  Add 'authz-*'.
  (Config._force_multi_value): Reformat and comment.
  (Config._allowed_overrides): New mapping of valid overrides.
  (Config.__init__): Track renamed _base_sections member, and avoid
    instantiating _sub_config items for non-explicitly-name base
    sections found therein.
  (Config.load_config): Add docstring.  Use _is_allowed_section() to
    determine which sections to process.
  (Config.load_kv_files): Add docstring.
  (Config.path): Minor docstring tweak. 
  (Config._process_section): Instantiate missing _sub_config() items.
    Add a FIXME comment.
  (Config._is_allowed_section, Config._is_allowed_override): New
    functions.
  (Config._process_vhost): Now use _is_allowed_override() for section
    filtering.
  (Config._process_root_options): Removed, merged with tweaks into...
  (Config.overlay_root_options): ...here, which now uses
    _is_allowed_override for section filtering.
  (Config.get_authorizer_params): Look in the calculated configuration
    rather than specific configuration file regions.  Add a FIXME
    comment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2292 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-01 20:16:17 +00:00
cmpilato
438eb061bb * lib/config.py
(Config.load_config): Remove 'rootname' parameter that's unused by
    callers, and the code that employs it within this function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2291 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-01 17:36:41 +00:00
cmpilato
3a4ca4d18a * lib/viewvc.py
(common_template_data): Default 'roots_href' to None, and only
    populate it if the roots listing is one of the configured allowed
    views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2288 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-01 14:58:32 +00:00
cmpilato
d1cbb81fb5 Finish issue #440 (Database query by glob/exact match fails).
Defer validation of certain query-view-related input whose format is
unknown at the time of validation.  That includes all the form fields
whose interpretation (as an exact match, a blog, a regular expression,
etc.) changes based on the another field's value.  Instead, do that
validation in the view funcs themselves.

* lib/viewvc.py
  (_legal_params): Set the validator for the 'branch', 'file', 'who',
    and 'comment' parameters to None.
  (validate_query_args): New function for more careful query arg validation.
  (view_queryform, view_query): Call validate_query_args().

Tested by: Jon Foster <jonfoster{_AT_}tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2286 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-12-01 14:53:10 +00:00
cmpilato
cd62600043 Fix issue #438, a regression caused by a botched function signature
change in r2244.

* lib/viewvc.py
  (view_checkout, view_cvsgraph_image, view_doc, view_patch): Fix
    calls to copy_stream().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2281 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-11-10 22:16:17 +00:00
cmpilato
7e3a9d7f4d Make ViewVC cross copies in Subversion history by default.
* lib/config.py
  (Config.set_defaults): Make 'options.cross_copies' default to 1.  At
    a minimum that makes it jive with the commented out default value
    shown in viewvc.conf.dist, but I believe that it's also the better
    of the two ways to resolve that disparity in terms of user experience.

Noticed by: Tom Throckmorton <throck{_AT_}gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2279 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-11-05 16:35:05 +00:00
cmpilato
11efd97b23 For issue #434, mark up URLs and email addresses in item property
values as we do for revision property values.

* lib/viewvc.py
  (get_itemprops): Pass property values through format_log().

Patch by: Senthil Kumaran S <senthil@collab.net>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2277 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-25 22:06:54 +00:00
cmpilato
54086fd651 Finish issue #431 - make revision metadata available in diff view.
* lib/viewvc.py
  (view_diff): Use repos.itemlog() to fetch revision metadata about
  the left- and right-hand diff objects and expose 'author', 'log',
  'ago', and 'size' to the templates.

* docs/template-authoring-guide.html
  Document the newly added template data dictionary items.

* templates/diff.ezt
  Display the revision authors in the diff view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2275 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-25 20:46:09 +00:00
cmpilato
1f8c5aca37 Fix a bug that caused log message in the query view to be truncated to
a single character.

* lib/viewvc.py
  (build_commit): Fix calls to format_log().  It turns out that
    parameter ordering is, you know, somewhat important.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2273 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-08 17:53:14 +00:00
cmpilato
f182d12e97 As part of issue #397, add initial support for mod_wsgi deployments.
* lib/sapi.py
  (WsgiServer): New class.

* bin/wsgi,
* bin/wsgi/viewvc.wsgi,
* bin/wsgi/query.wsgi
  New stubs.

* viewvc-install
  (FILE_INFO_LIST): Also install WSGI scripts.

* INSTALL
  Add instructions for WSGI deployment.

Patch (mostly) by: Rune Halvorsen <runefh{_AT_}gmail.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2271 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-08 14:56:25 +00:00
cmpilato
4c9aa8e1a6 Minor tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2270 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-08 14:50:04 +00:00
cmpilato
6e4710d1c6 Clarify the Apache configuration instructions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2269 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-08 14:48:02 +00:00
cmpilato
98f1b93068 * lib/vclib/svn/svn_repos.py
(LocalSubversionRepository.open): Remove custom SIGTERM handler.
    It's causing problems for mod_python deployments, and I can't seem
    to make it do anything meaningful for CGI deployments either.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2268 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-06 19:11:28 +00:00
cmpilato
9015d12885 Fix issue #427 - regex filtering broken by bogus validator function.
* lib/viewvc.py
  (_validate_regex): Try compiling the incoming regex, returning True
    on success and None otherwise.  (Simply 'pass'ing caused all
    regexs to fail validation.)

Patch by: Robert Fleming <flemingr{_AT_}tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2265 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-09-09 18:54:15 +00:00
cmpilato
0f376ac9a4 [singing] A spoonful of proofreading helps the temperature go down...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2263 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-09-09 16:03:02 +00:00
cmpilato
761a97cb47 * conf/viewvc.conf.dist
(utilities): Clarify what we mean by "the directories in which
    certain programs live".

Suggested by: Eric McCarty <emccarty{_AT_}ostendo.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2261 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-09-09 15:57:43 +00:00
cmpilato
f72e67fa3e * templates/file.ezt
Don't point folks to the checkout view if it's disabled.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2259 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-09-09 14:18:15 +00:00
cmpilato
0b42d41e43 * lib/viewvc.py
(HtmlFormatter._tokenize_text): Give preference to the longer of
    overlapping matches that begin at the same point.  Add some
    comments that better explain what we're doing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2257 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-31 14:54:26 +00:00
cmpilato
e7a9e33a36 Make some tweaks to the HtmlFormatter to allow more complex usages.
* lib/viewvc.py
  (HtmlFormatter): Add docstring.
  (HtmlFormatter.get_result): Now return the total number of readable
    characters, too.
  (format_log): Update expected return values from lf.get_result().  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2255 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-27 15:17:37 +00:00
cmpilato
8a8e8cd1f5 Make the installing of the 'templates-contrib' tree optional.
* viewvc-install
  (TREE_LIST): Add a new field -- a boolean "is-optional" flag.
  (install_tree): New parameter 'is_optional', used to avoid whining when
    something in the source tree is missing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2252 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-25 15:25:16 +00:00
cmpilato
40581a211c * lib/viewvc.py
(view_diff): Tweak some logic ordering, and ensure that 'changes' is
    initialized as a sequence (instead of None) as some template logic
    paths seem to care.

Reported by: Lawrence Cutlip-Mason <rena.larry.cm{_AT_}gmail.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2251 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-25 15:22:04 +00:00
cmpilato
6b4297e7f5 Add configurable support for tabstop-to-space translation.
* conf/viewvc.conf.dist
  (options.tabsize): New.

* lib/config.py
  (Config.set_defaults): Set default value for the 'tabsize' option.

* lib/viewvc.py
  (markup_stream_pygments): Pass the 'tabsize' parameter to Pygments' lexers.
    When not using pygments, use 'string.expandtabs' to do tab-to-space
    conversion (possibly with a new object that wraps BlameSource objects
    solely for that purpose).
  (DiffSource._format_text): Honor the tabsize configuration options when
    expanding tabs to spaces.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2249 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-24 15:08:58 +00:00
cmpilato
884a5de16d Follow-up to r2244 and r2245, supplying a way for the HtmlFormatter to
indicate that truncation happened (so callers can tack on an ellipsis
or somesuch).

* lib/viewvc.py
  (HtmlFormatter.format_email_truncated): Fix logic to use ellipsis
    for mangling but not for truncation.  (Also fix an off-by-one
    error in the logic.)
  (HtmlFormatter.get_result): Now return the result string and a
    "was-truncated" flag.
  (format_log): Update call to HtmlFormatter.get_result, and tack on
   an ellipsis if the log was truncated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2247 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-21 15:58:19 +00:00
cmpilato
589f111f20 Follow-up to r2244 with some changes that allow you to register
userdata along with the log message formatters for use by the
conversion functions.  While ViewVC doesn't use this right now, the
feature has proven useful in writing an add-on that allows somewhat
generic highlighting of issue/bug IDs to URLs.

* lib/viewvc.py
  (HtmlFormatToken): Remove.
  (HtmlFormatter.format_url, HtmlFormatter.format_email_obfuscated,
   HtmlFormatter.format_email_truncated, HtmlFormatter.format_email,
   HtmlFormatter.format_text): Now accept (unused) 'userdata' parameter.
  (HtmlFormatter.add_formatter): Now accept 'userdata' parameter, associated
    with the formatter for future use.
  (HtmlFormatter.get_result): Pass the 'userdata' from the token to its
    converter.
  (HtmlFormatter._tokenize_text): Switch to using _item()s instead of
    HtmlFormatTokens.  Associate with each item the userdata for its converter.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2245 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-21 15:05:21 +00:00
cmpilato
a2cd81f304 Begin taking steps toward customizable log message markup/formatting,
and I think, actually fix ancient issue #3 ("URL cut off in elipsis")!

Incidentally, this change also makes the email address obfuscation
stuff work as documented.  Not sure how I started munging data when
mangle_email_addresses=1 (by substituting " at " for the at-sign), but
no more.

* lib/viewvc.py
  (htmlify): Drop 'mangle_email_addresses' parameter, which was mostly
    unused, and no longer do anything except very basic HTML encoding.
    Callers updated.
  (_re_rewrite_url): Tweak to match *non*-HTML-encoded URLs now.
  (HtmlFormatToken, HtmlFormatter): New classes for log formatting.
  (mangle_email_addresses): Remove as unused.
  (format_log): Add 'maxlen' parameter, allowing this function to be used
    for both long- and short-form log message formatting.
  (copy_stream): Drop unnecessary 'cfg' parameter.  Update call to htmlify().
  (MarkupPipeWrapper.__init__): Drop 'cfg' parameter as unused.
  (MarkupPipeWrapper.__call__): Update call to htmlify().
  (markup_or_annotate, view_revision, view_directory, view_log,
    build_commit): Use format_log() to format both long- and
    short-form log messages.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2244 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-20 20:38:32 +00:00
vfilippov
04d3b88f6a Bug 37020
Merge with r2243 from official SVN


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@268 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-08-20 12:43:52 +00:00
vfilippov
d85d6578da Bug 53107
For Wiki Template:cvs


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@256 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-08-17 14:30:37 +00:00
cmpilato
eb69c40687 Merge in 1.0.9 and 1.1.2's changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2242 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-11 16:00:21 +00:00
cmpilato
6cbb3fadac Note new latest release on project homepage.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2241 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-11 15:58:09 +00:00
cmpilato
cc4589ab10 Rename 'Source tarballs' left-nav as 'Downloads'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2240 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-11 15:26:33 +00:00
cmpilato
fcff592db3 Rename 'Subversion' left-nav as 'Source Code'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2239 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-11 15:25:55 +00:00
cmpilato
694a14e0d2 Update 'Mailing Lists' left-nav link.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2238 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-08-11 15:25:14 +00:00
vfilippov
7a40e1c902 Bug 52230
A fix for potential bug when no Subversion repositories are visible



git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@206 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-07-24 17:35:25 +00:00
cmpilato
205b3b67e1 Make it easier for folks to show/hide binary file contents in the
markup/annotate views.

* templates/file.ezt
  Add some customizable template logic to hide the contents of file's with
  non-human-readable file formats.  Were Greg Stein dead, he'd be rolling
  over in his grave right now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2228 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-16 19:28:29 +00:00
cmpilato
8df8e878f4 * lib/viewvc.py
(view_error): Settle for simple HTML-escaping of error messages
    rather than full htmlification.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2225 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-14 20:43:46 +00:00
cmpilato
f038efef96 Fix issue #422: syntax coloration dropping initial blank lines from
files.

* lib/viewvc.py
  (markup_stream_pygments): Pass stripnl=False to Pygments lexers so
    they won't strip out leading blank lines from the files they are
    colorizing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2223 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-13 17:13:16 +00:00
cmpilato
52584dec66 Document some shortcomings of the path-based authz subsystem.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2222 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-13 14:09:17 +00:00
cmpilato
5c9f504727 * conf/viewvc.conf.dist
(allow_compress): Add a note about the speed penalty this option causes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2220 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-07 14:05:12 +00:00
cmpilato
7817608915 Try to avoid content spoofing errors. Prior to this change, a URL
like this:

   http://localhost/viewvc/subversion/?view=foo%22)%20was%20passed\
   %20as%20a%20parameter.20%20Visit%20http://www.baddy.com%20to%20\
   figure%20out%20why%20(%22foo

Would result in an error page that read as follows:

   An illegal value ("foo") was passed as a parameter. Visit
   http://www.baddy.com to figure out why ("foo") was passed as a
   parameter.

(where "http://www.baddy.com" was linkified, and could potentially
point to a malicious website.)

With this change, we will avoid printing unknown parameter names, and
will show the parameter name rather its value when a bogus value is
detected.  Yes, there's admittedly some information loss here that
might be useful to the well-meaning but fat-fingered user, but the
security aspect is more important.

* lib/viewvc.py
  (_validate_param): Don't print illegal parameter names, and show the
    (legal) parameter name rather than its value when that value is
    illegal.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2217 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-06 19:03:06 +00:00
cmpilato
0292a54ec0 Some more around input validation, cleaning up some code and
tightening up some other bits.

* lib/viewvc.py
  (_validate_view, _validate_mimetype): New validation functions.
  (_re_validate_mimetype): Removed as unused.
  (_legal_params): Tweak the validation routines for 'view' and
    'content-type' to point to _validate_view() and _validate_mimetype(),
    respectively.
  (_validate_param): Now check for non-zero result from validation
    functions as the "valid" indicator, rather than requiring each of
    them to raise an exception in troubled times.
  (Request.run_viewvc): Lose now-unnecessary validation of
    'content-type' parameter -- the normal parameter validation stuff
    should catch problems there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2213 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-06 15:05:23 +00:00
cmpilato
6c93d8c8d1 * lib/viewvc.py
(Request.run_viewvc): Move the logic that maps view=rev to
    view=revision into the parameter validation loop.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2212 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-06 14:48:53 +00:00
cmpilato
4f622d375b * lib/viewvc.py
(Request.run_viewvc): Use an intermediate variable to simplify some
    logic around input parameter validation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2211 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-07-06 14:46:21 +00:00
stas
c8dbd38e0c Bug 51239
try: except: pass
FUCKING PYDON


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@198 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-07-02 13:46:38 +00:00
stas
82ea92e4a4 Bug 44995
Unicode() string in format_log


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@196 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-07-02 11:22:55 +00:00
vfilippov
be67aab7dc Bug 32155
Fix RSS urls in multi-repository feeds


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@194 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-07-01 10:29:45 +00:00
cmpilato
867514f9ef Minor comment tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2209 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-17 21:22:14 +00:00
cmpilato
b36d8584e8 * conf/viewvc.conf.dist
Comment out all the options here, forcing folks to uncomment the
  stuff they want to modify.  This allows the parsing of this file to
  be optimized toward doing less work, while maintaining a consistent
  initial presentation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2207 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-17 14:32:16 +00:00
stas
8ecc076ebc Bug 37020
Fix build_commit access check


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@186 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-06-17 12:13:05 +00:00
stas
6a0562d708 Bug 37020
debug


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@185 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-06-16 16:54:14 +00:00
cmpilato
8e848a4025 Finish issue #415 - ModPythonServer shouldn't call sys.exit().
(This doesn't really fix anything, and hopefully doesn't break anything
either, but is merely a "good programming practice" cleanup item.)

* lib/viewvc.py
  (Request.run_viewvc): Ensure that server.redirect() is the last
    thing this function does (when it does it).

* lib/sapi.py
  (CgiServer.redirect): Avoid calling sys.exit().  Also, fix a use of
    print() that should be sys.stdout.write() (for consistency).
  (AspServer.redirect, ModPythonServer.redirect): Avoid calling sys.exit().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2205 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-16 15:04:24 +00:00
vfilippov
6835e74f20 Merge with ViewVC 1.2-dev http://viewvc.tigris.org/svn/viewvc@2204
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@184 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-06-16 14:11:20 +00:00
cmpilato
e7e8beca0a Finish issue #336 - Custom cvsgraph rendering via CGI parameters.
* conf/viewvc.conf.dist
  (allowed_cvsgraph_useropts): New option.

* lib/config.py
  (Config.set_defaults): Set default value for new
    'allowed_cvsgraph_useropts' option.

* lib/viewvc.py
  (_legal_params): Add new legal parameters: 'gflip', 'gbbox',
    'gshow', 'gleft', and 'gmaxtag'.
  (cvsgraph_make_reqopt, cvsgraph_normalize_gshow, cvsgraph_extraopts):
    New helper functions.
  (view_cvsgraph_image): Now pass the -O option set to the cvsgraph
    binary.
  (view_cvsgraph): Now pass the -O option set to the cvsgraph binary.
    Also, add new template data stuff for generating a user-configurable
    graph display options form.

* templates/graph.ezt,
* templates/docroot/styles.css
  Add template stuff for generating a user-configurable graph display
  options form.

* docs/url-reference.html,
* docs/template-authoring-guide.html
  Update documentation.

* CHANGES
  Note this change.

Patch by:  Bertho Stultiens <bertho{_AT_}j.auh.dk> (originally),
           Jene Jasper <tigris{_AT_}shadowland.demon.nl> (port to 1.1.x),
           me (tweaks for official ViewVC inclusion)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2204 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-15 20:18:35 +00:00
cmpilato
c3bdeea60b Correct some inconsistent markup in documentation.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2201 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-15 20:11:33 +00:00
cmpilato
3d8aecfd95 Tighten up some input validation.
* lib/viewvc.py
  (_re_validate_boolint): New.
  (_legal_params): Switch the validation function to _re_validate_boolint
   for the following: 'hideattic', 'makeimage', 'parent', 'tarball',
   and 'hidecvsroot'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2199 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-15 19:41:30 +00:00
cmpilato
c713952d5e Minor documentation wording tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2197 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-15 19:06:26 +00:00
svnuser
4b05147064 Bug 50473
A workaround for line counts when moving


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@178 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-06-15 15:53:35 +00:00
cmpilato
8910c295cc Finish issue #420 - "cvsdbadmin rebuild" and "svndbadmin rebuild"
complain about unknown repositories.

* bin/svndbadmin
  (main): When rebuilding, ignore the UnknownRepositoryError; when
    purging, turn that sucker into something readable.

* bin/cvsdbadmin
  (__main__): When rebuilding, ignore the UnknownRepositoryError; when
    purging, turn that sucker into something readable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2195 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-08 15:50:51 +00:00
cmpilato
1d496a8f51 Make error handling in cvsdb a little more flexible.
* lib/cvsdb.py
  (UnknownRepositoryError, DatabaseVersionError): New Exception classes.
  (CheckinDatabase.Connect): Raise DatabaseVersionError instead of a
    generic Exception.
  (CheckinDatabase.PurgeRepository): Raise UnknownRepositoryError
    instead of a generic Exception.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2194 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-08 15:23:16 +00:00
cmpilato
892a951493 Finish issue #419: svnauthz module doesn't match Subversion's
case-handling semantics.

* conf/viewvc.conf.dist
  (force_username_case): New option.

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer.__init__): Find and handle new force_username_case
    authorizer option.
  (ViewVCAuthorizer._get_paths_for_root): Replace ConfigParser.optionxform()
    (which does normalization of option names) with an identity function
    of sorts.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2192 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-05 19:03:07 +00:00
cmpilato
1371a71f20 Consistify the layout -- at least on a section-by-section basis -- of
the viewvc.conf.dist file.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2190 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-05 17:52:47 +00:00
cmpilato
aba3033c27 Remove CHANGES item for change that should appear in 1.1.2 instead of 1.2.0.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2189 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-04 15:43:55 +00:00
cmpilato
74bfd3e9d8 Post-release fun.
* CHANGES
  Copy 1.1.1's changes here.

* www/index.html
  Update 'latest release' notes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2186 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-06-03 15:05:32 +00:00
cmpilato
7cb54076fe Finish (for now) the 1.1.0 release ntoes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2183 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-29 18:16:41 +00:00
cmpilato
197f352804 * templates/file.ezt
Use "Contents of /path/to/file" instead of "Annotate of /path/to/file" as
  the page title.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2181 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-29 17:57:03 +00:00
cmpilato
f48559766a * lib/cvsdb.py
(CheckinDatabase.PurgeRepository): Don't allow the purge operation
    to actually *create* a "repositories" table entry.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2179 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-29 15:09:51 +00:00
cmpilato
546501816b Fix issue #417 - "cvsdbadmin rebuild" fails to record some of the
commit/repository info.

* lib/cvsdb.py
  (CheckinDatabase.PurgeRepository): Clear all the ID caches after
    running a purge operation so that, if the purge is actually part
    of a rebuild, the subsequent update doesn't merely pull IDs from
    the cache (with the side-effect of not readding them to the database).

Reported by: Naran Babhu <naranbabhu{_AT_}tigris.org
             Martin Dessureault <martin{_AT_}austin.rr.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2178 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-29 15:08:32 +00:00
cmpilato
8089335fc6 Fix issue #416 - Can't see query form due to missing template variables.
* lib/viewvc.py
  (view_queryform): Add 'query_action' and 'query_hidden_values' back
    to the data dictionary, as they were accidentally dropped in r2123.

Reported by: Naran Babhu <naranbabhu{_AT_}tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2175 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-28 13:59:47 +00:00
svnuser
a208ec46ab Bug 37020
Search by revision number


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@165 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-05-21 14:42:39 +00:00
cmpilato
d739127ea4 Update external to point to 1.2 versions of contributed templates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2172 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-18 13:28:53 +00:00
cmpilato
4b4f450ecb Update CHANGES list for 1.1.0 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2169 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 17:11:27 +00:00
cmpilato
588f9000e9 Update the viewvc.org site.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2168 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:44:58 +00:00
cmpilato
7ecae1790a One last tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2167 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:43:13 +00:00
cmpilato
a154179492 Need ... homepage ... beauty...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2166 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:41:52 +00:00
cmpilato
cc4f8254d6 More Tigris homepage tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2165 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:40:24 +00:00
cmpilato
c695ede476 Update Tigris homepage.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2164 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:31:11 +00:00
cmpilato
c910df0835 Add left-nav link to source tarballs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2163 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-13 14:20:53 +00:00
cmpilato
914e0e7521 Copy 1.0.8's CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2152 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 17:26:04 +00:00
cmpilato
4c81b1fd91 Note new version of ViewVC.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2151 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 17:25:04 +00:00
cmpilato
92a95601d1 Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2146 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 17:08:54 +00:00
cmpilato
211bc90343 Finish issue #402: Split the 'use_pagesize' configuration directive
into two: 'log_pagesize' and 'dir_pagesize', individually controlling
the size of pages used (if at all) for the revision log and directory
views, respectively.

* conf/viewvc.conf.dist
  (use_pagesize): Removed, in favor of...
  (dir_pagesize, log_pagesize): ...these.

* lib/viewvc.py,
* lib/config.py,
* bin/standalone.py
  Replace the use and tooling around 'use_pagesize' with
  'dir_pagesize' and 'log_pagesize' as appropriate.

* templates/include/paging.ezt,
* templates/include/dir_header.ezt
  Stop using the option value to determine whether or not to show
  pagination UI.  Use the presence of some pages instead.
  
* docs/upgrading-howto.html
  Note the changes in options.

Patch by: Lei Zhang <thestig{_AT_}google.com>
          (Tweaked by me.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2142 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 15:45:25 +00:00
cmpilato
fdff86c5f4 Fix the GUI mode of standalone.py -- it wasn't even starting
correctly, and we don't need a toggle for 'enscript' any more.

* bin/standalone.py
  (GUI.__init__): Pass the configuration file to handle_config().
    Lose 'enscript'-related stuff.
  (GUI.toggle_use_enscript): Remove.
  (cli): Fix call to gui(), dropping bogus parameter.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2140 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 15:34:11 +00:00
cmpilato
7ca7528869 Fix issue #409, an exception thrown when sorting by revision in a
remote Subversion directory view.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.dirlogs): Store the entry's revision as
    a string, for consistency with other vclib modules.

Reported by: Wojciech Wróblewski <wojtek{_AT_}elmi.pl>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2137 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-05 14:52:35 +00:00
cmpilato
dfa98b490f Fix an exception in log views of Subversion repositories with 0
revisions.

* lib/vclib/svn/svn_repos.py
  (_get_history): Add easy-out for repositories with 0 revisions.

Reported by: Wojciech Wróblewski <wojtek{_AT_}elmi.pl>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2134 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-05-04 14:53:24 +00:00
cmpilato
bacb71b1d2 Call make-release correctly.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2132 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-04-20 17:47:50 +00:00
cmpilato
3da11f485a Slight terminology tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2129 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-04-20 17:40:51 +00:00
cmpilato
a8e6f976ef * tools/make-release
Make this able to build any branch, not just trunk and tag names.

* notes/releases.txt
  Update example of using make-release.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2128 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-04-20 17:38:57 +00:00
stas
86c313bcf8 Bug 37020
rss_href


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@163 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-04-10 10:26:29 +00:00
vfilippov
a2e45b4468 Bug 37020
404 not found on log_href's of removed files
More request.roottype ---> my_repos['roottype']


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@157 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-03-31 13:07:48 +00:00
stas
5ed8c4967a Bug 47903
Incorrect exam_rev for SVN deleted files


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@150 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-03-25 18:14:54 +00:00
cmpilato
6d6a0287ac * lib/viewvc.py
(view_directory, view_log): Add some comments explaining the
    presence of certain data dictionary dummy values.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2124 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-24 17:01:53 +00:00
cmpilato
63af297920 Try to make ViewVC provide a consistent, predictable data dictionary
in all of its templated views.  Do this with a custom, dictionary-like
class that prevents the creation of new keys after an initial
instantiation of keys and (possibly dummy) values.

* lib/ezt.py
  (TemplateData): New.

* lib/viewvc.py
  (common_template_data): Now return an ezt.TemplateData() object.
  (make_comma_sep_list_string): New.
  (markup_or_annotate): Use new ezt.TemplateData() interface now.  Use
    make_comma_sep_list_string() where applicable.
  (view_roots, view_log, view_cvsgraph, view_diff, view_revision,
   view_queryform, view_query): Use new ezt.TemplateData() interface now.
  (view_directory): Use new ezt.TemplateData() interface now.  Drop
    'search_re_form' dictionary item.

* lib/query.py
  (main): Use new ezt.TemplateData() interface now.  While here, drop
    'script_name' calculation (it isn't used).

* templates/include/dir_header.ezt
  Display the search form if 'search_re_action' is set, not 'search_re_form'.

* docs/template-authoring-guide.html
  Remove 'search_re_form'.  Update 'search_re_action' description.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2123 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-24 16:55:25 +00:00
cmpilato
d7ac8ee2d4 * templates/include/file_header.ezt
Lose template reference of 'log_href_rev', which was removed in
  r2116 as unused.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2121 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-24 16:32:29 +00:00
cmpilato
11b4c4f4f8 Clutterkiller! Put the default configuration files into a conf/
subdirectory.

* conf/
  New subdirectory.

* cvsgraph.conf.dist,
* mimetypes.conf.dist,
* viewvc.conf.dist
  Move these from here ...

* conf/cvsgraph.conf.dist,
* conf/mimetypes.conf.dist,
* conf/viewvc.conf.dist
  ... to here.

* viewvc-install
  (FILE_INFO_LIST): Track new locations of configuration files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2119 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-19 20:41:41 +00:00
cmpilato
c6671ecc50 Attempt to compensate for the fact that some versions of Subversion's
Python bindings do not correctly set the .apr_err and .message members
of SubversionException objects by patching up those exceptions using
the exception arguments.

(Unfortunately, I don't have a version of these bindings installed for
testing.)

* lib/vclib/svn/svn_repos.py
  (_fix_subversion_exception): New helper function.
  (_get_history, BlameSource.__init__, LocalSubversionRepository.rawdiff,
   LocalSubversionRepository.get_location, LocalSubversionRepository.last_rev):
    Use _fix_subversion_exception().

* lib/vclib/svn/svn_ra.py
  (): Import _fix_subversion_exception from svn_repos.
  (RemoteSubversionRepository._date_from_rev, 
   RemoteSubversionRepository.get_location): Use _fix_subversion_exception().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2117 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-19 18:02:35 +00:00
cmpilato
0bcb42c158 * lib/viewvc.py
(common_template_data): Stop initializing an unused value.

* docs/template-authoring-guide.html
  Lose docs for unused (and spelled wrong, to boot) template variable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2116 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-19 17:46:54 +00:00
cmpilato
586c6bfb9e * lib/ezt.py
(Template._cmd_for): Raise a more useful exception message when the
    to-be-looped-over variable ain't a sequence.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2115 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-19 17:44:07 +00:00
cmpilato
ca12b5257c * lib/ezt.py
(Template._cmd_print): Raise a more helpful exception to give some
    clues to template authors who tried to, say, print a sequence
    reference.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2111 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-19 15:21:30 +00:00
cmpilato
7fd9e405a1 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2107 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-18 16:43:33 +00:00
cmpilato
6361a849a6 Update release notes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2106 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-18 16:15:49 +00:00
cmpilato
e72184e288 Fix namespace problem with raised Exception.
* lib/viewvc.py
  (view_revision): raise *debug.*ViewVCException.

Patch by: Kamesh Jayachandran <kamesh@collab.net>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2103 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-18 12:45:47 +00:00
cmpilato
2dc51276ce Finish issue #401: Support MIME type overrides in ViewVC configuration.
Trade the 'mime_types_file' option for 'mime_types_files' -- an
ordered list of MIME mapping files to consult.  And provide our own
(empty) mapping file that folks can use to override the mappings
provided by other such files.

* mimetypes.conf.dist
  New file.

* viewvc.conf.dist
  (mime_types_files): Was mime_types_file, and now accepts multiple values.

* lib/config.py
  (Config._force_multi_value): Add "mime_types_files" to the list of
    multi-value configuration options.
  (Config.set_defaults): Track rename of mime_types_file parameter,
    now setting the default to a list containing only "mimetypes.conf".

* lib/viewvc.py
  (load_config): Track new name and format of mime_types_files option.

* viewvc-install
  (FILE_INFO_LIST): Also install mimetypes.conf.dist as itself and as
    mimetypes.conf.

* INSTALL
  (INSTALLING VIEWVC): Update reference to renamed configuration option.

* docs/upgrading-howto.html
  Update this document.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2101 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-03-06 16:43:04 +00:00
cmpilato
e1575692be Finish issue #396 - Malformed accept-language header crashes viewvc
* lib/accept.py
  (AcceptLanguageParseError): Was AcceptParseError.
  (_parse): Track renamed Exception.

* lib/viewvc.py
  (Request.__init__): Catch and handle raised AcceptLanguageParseError.

Patch by: Rune Halvorsen <runefh{_AT_}gmail.com>,
          me


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2097 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-26 16:12:15 +00:00
cmpilato
748efe3815 Add FAQ entry about exposing ViewVC at a vhost root.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2096 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-24 13:36:41 +00:00
cmpilato
d681df85d3 Allow ViewVC to (optionally) use the 'chardet' module during syntax
coloration to perform character encoding detection (and subsequent
translation to UTF-8).

(Thanks to Jeremy Whitlock <jcscoobyrs@gmail.com> for pointing me in
this direction, if inadvertantly.)

* viewvc.conf.dist
  (options.detect_encoding): New.

* lib/config.py
  (Config.set_defaults): Initialize the 'detect_encoding' parameter.

* lib/viewvc.py
  (markup_stream_pygments): If the configuration asks for character
    encoding detection, try to import the 'chardet' module and -- if all
    goes well -- tell Pygments to use it.

* CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2095 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-20 17:23:27 +00:00
cmpilato
e53b3af42f ViewVC doesn't "do" directory entry sorting by revision for CVS, so
don't imply that it does in the UI.

* lib/viewvc.py
  (view_directory): Don't provide sortby_rev_href to the template.

* templates/directory.ezt
  Only offer sort links when those links are provided by ViewVC.

* templates/dir_new.ezt
  Only offer sort links when those links are provided by ViewVC.  Use
  date-based sorting if rev-based sorting isn't available.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2090 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-20 15:20:15 +00:00
stas
dbd3e4af59 Bug 46528
Bug 46710
default format


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@134 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-16 12:57:47 +00:00
vfilippov
5349a36a18 Bug 46528
Bug 46710
OR in group formats


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@133 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-16 12:55:32 +00:00
stas
81df47c357 Bug 46528
strip's


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@132 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-16 12:44:38 +00:00
stas
c916450eac Bug 46710
Bug 46528
Debugw


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@131 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-16 11:43:17 +00:00
stas
e4ea3a9f85 Bug 46710
Bug 46528
debug cvsntacl authorizer


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@130 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-16 11:41:16 +00:00
vfilippov
e6be979387 Bug 46528
By root group check specification


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@128 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-13 10:43:39 +00:00
vfilippov
2896c70f26 Bug 46528
New authorizers: grp, union, cvsntacl


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@127 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-12 16:37:15 +00:00
vfilippov
50b67b3ddb Bug 45076
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@126 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-11 12:57:01 +00:00
vfilippov
3c7ad9405c Bug 46239
Look in CVS/SVN/All repos link on query results page


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@121 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-03 12:19:33 +00:00
cmpilato
d1a7412c6d Remove dead code.
* lib/popen.py
  (pipe_cmds, _copy): Remove as unused.

* bin/standalone.py
  (StandaloneServer.run_viewvc): Tweak comment that referred to pipe_cmds().

Found by: Rune Halvorsen <runeh {AT} sanedefaults.net>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2088 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-03 03:53:25 +00:00
cmpilato
ee692db2b0 Fix issue #398 (File Log Viewer Shows Wrong Log Message) by asking the
vclib layer for revision-sorted output rather than "whatever you want
to give me".

* lib/viewvc.py
  (markup_or_annotate): Pass vclib.SORTBY_REV instead of vclib.SORTBY_DEFAULT
    to the itemlog() interface.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2086 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-02-02 18:10:59 +00:00
vfilippov
ab286694fe Bug 46239
Search only CVS/SVN repositories option


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@119 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-02-02 17:20:11 +00:00
vfilippov
1cf0815b3d Bug 45675
Unsecure patch detection fix for SVN roots


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@108 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-01-27 11:27:05 +00:00
cmpilato
544ca74ed9 Add a skeletal version of some semblance of 1.1.0 release notes, taken
from an email response I gave on the dev@ list.  Will massage this
into something a little more ready for publicity later.

* docs/release-notes,
* docs/release-notes/1.1.0.html
  New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2085 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-15 16:56:44 +00:00
vfilippov
355033b015 Bug 45675 -- debug
!!previous commit also was related to bug 45675


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@100 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-01-15 10:18:33 +00:00
vfilippov
2f99f7b72c Bug 45675 -- better way of diffing added/removed files
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@99 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-01-15 10:00:38 +00:00
vfilippov
e8d7fb16ff Bug 45675
debug


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@98 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-01-15 09:11:40 +00:00
vfilippov
e1cc47c375 Bug 45675: Patches from query results
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@97 6955db30-a419-402b-8a0d-67ecbb4d7f56
2009-01-14 14:07:41 +00:00
cmpilato
f6844dda91 Finish issue #334 by adding an empty CSS class def and some references
to it for line number columns in the diff view.

* templates/docroot/styles.css
  (.vc_diff_line_number): New.

* templates/diff.ezt
  Use new vc_diff_line_number class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2083 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-13 19:10:09 +00:00
cmpilato
5fdfefa137 Document the new database schema stuff.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2081 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-13 18:44:43 +00:00
cmpilato
cd64b5da8b Add some real command-line parameter handling to 'make-database',
effectively allowing for non-interactive operation.

* bin/make-database
  (INTRO_TEXT): Removed, merged into the usage message printed by...
  (usage_and_exit): ...this new function.
  (__main__): Add new command-line parsing logic, including support of
    new options (--username, --hostname, --password, --dbname) and the
    replacement of the --bonsai-compatible option with a more generic
    --version.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2079 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-13 18:18:46 +00:00
cmpilato
623ab85805 Merge to trunk all changes made on the issue-366-dev branch,
completing issue #366 (cvsdb purge operation is painfully slow).

* lib/cvsdb.py,
* bin/make-database


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2078 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-13 18:16:11 +00:00
cmpilato
ceb7057b9f Remove unnecessary empty svn:mergeinfo.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2077 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-01-13 18:14:52 +00:00
cmpilato
b6486f5324 On the 'issue-366-dev' branch: add 'make-database --help' parameter.
* bin/make-database
  (BONSAI_COMPAT): Tweak a little bit.
  (__main__): Add support for a --help parameter that prints a usage message.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-366-dev@2076 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-22 21:22:46 +00:00
cmpilato
af83138e5c On the 'issue-366-dev' branch: Rename the 'checkins' table to
'commits' in schema version 1 (so that old version-ignorant code will
croak on a version-1 database).

* lib/cvsdb.py
  (CheckinDatabase.AddCommit, CheckinDatabase.CreateSQLQueryString,
   CheckinDatabase.CheckCommit, CheckinDatabase.sql_delete,
   CheckinDatabase.PurgeRepository): Account for the fact that in
    version 1 of the commits database schema, the 'checkins' table has
    been renamed to 'commits'.

* bin/make-database
  (DATABASE_SCRIPT_VERSION_1): Rename the 'checkins' table to 'commits'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-366-dev@2075 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-22 21:04:12 +00:00
stas
5a55d3c0cd O_o max context value = 2^25-1 ... workaround for Bug 45200
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@76 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-22 18:13:08 +00:00
vfilippov
00d1ffe3e0 fix
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@75 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-22 18:00:37 +00:00
cmpilato
8f8dea6051 On the 'issue-366-dev' branch: Add a new index to version 1 of the
commits database schema, and use it (when present) in the 'purge'
operation.

* lib/cvsdb.py
  (CheckinDatabase.sql_purge): New function.
  (CheckinDatabase.PurgeRepository): If we have a schema version that
    supports it, use a much faster approach of purging.  Otherwise, we
    have to suffer through a slow purge process.

* bin/make-database
  (DATABASE_SCRIPT_VERSION_1): Add a new index of 'descid's to the
    'checkins' table.

Patch (mostly) by: Larry Shatzer, Jr. <larrys@gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-366-dev@2074 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-22 15:38:09 +00:00
cmpilato
ba9cf67fae On the issue-366-dev branch: Add a new version of the commits database
schema that includes a `metadata' table (in which may be found the
schema version).

* lib/cvsdb.py
  (CVSDB_VERSION): New global variable.
  (CheckinDatabase.__init__): Init a new _version variable.
  (CheckinDatabase.Connect): Fetch a list of tables and see if the new
    `metadata' table is present.  If so, use it to query the database
    schema version.  (Else, assume version 0.)
  (CheckinDatabase.GetTableList, CheckinDatabase.GetMetadataValue,
   CheckinDatabase.SetMetadataValue): New functions.

* bin/make-database
  Rework this to be able to write two different schemas -- the
  original, Bonsai-compatible one, and a new one -- triggered by the
  presence/absence of a command-line --bonsai-compatible parameter.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-366-dev@2073 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-22 15:30:16 +00:00
cmpilato
09a5adb85d Create branch for issue #366 (cvsdb purge operation is painfully slow) work.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/issue-366-dev@2072 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-22 15:23:18 +00:00
cmpilato
0b1ac97f75 Try to deal with Subversion versions that lack the
SVN_ERR_CEASE_INVOCATION error code.

* lib/vclib/svn/svn_repos.py
  (_SVN_ERR_CEASE_INVOCATION): New compatibility variable.
  (NodeHistory.add_history, _get_history): Use compatibility variable
    instead of testing for SVN_ERR_CEASE_INVOCATION directly.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2070 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-19 19:48:43 +00:00
cmpilato
3e77755819 Document new num_changes item in upgrade notes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2068 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-19 19:45:44 +00:00
cmpilato
1433941124 Expose to revision.ezt a count of the total number of changed paths.
* lib/viewvc.py
  (view_revision): Add new 'num_changes' data dictionary item.

* templates/revision.ezt
  Expose new 'num_changes' item as a header on this page, and tweak
  the way the more/first changes links appear.

* docs/template-authoring-guide.html
  Document num_changes dictionary item.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2067 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-19 19:43:18 +00:00
vfilippov
0d3176a320 bug 45200
'rcsdiff' workaround for fucking cvsnt


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@73 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-19 14:47:24 +00:00
vfilippov
053cc33ffd bug 44943
blame_source ---->> utf8string


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@68 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-16 14:29:30 +00:00
vfilippov
93144b2168 bug 37020
bug 44996
more CVS charset fixes


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@62 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-12 16:19:41 +00:00
vfilippov
c102b6b2a0 utf8string cvs logs
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@61 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-12 12:36:39 +00:00
vfilippov
7cd0e372bb russian filenames in cvs fix
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@60 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-11 16:02:02 +00:00
vfilippov
4e047ae281 bug 44931
s.encode('utf-8') in ezt


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@59 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-11 10:46:42 +00:00
cmpilato
c733fceb9f Rework the 'rlog-ended-early' FAQ bit with a more generic entry.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2066 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-10 18:12:29 +00:00
cmpilato
ca5a2bfbc9 Fix issue #385 (Hide/show annotations links mismanaged for binary
files).

* lib/viewvc.py
  (markup_or_annotate): Make the default value for the 'annotation'
    data dictionary member 'none' (instead of None) to simplify
    template logic.

* docs/template-authoring-guide.html
  Update docs for 'annotated'.

* templates/file.ezt
  Use simplified logic to avoid missing links.  (No, not *that* kind ...)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2064 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-10 17:26:37 +00:00
cmpilato
77fd2759c7 Remove unnecessary module imports.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2063 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-10 17:25:11 +00:00
vfilippov
1128625ac3 bug 44887
debug Magic MIME type guessing


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@58 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-10 13:21:37 +00:00
stas
15e2d27b7d xml
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@57 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-10 13:06:59 +00:00
vfilippov
86dcf849e3 debug magic code
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@56 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-10 13:03:55 +00:00
vfilippov
5f66346633 bug 44887
do not annotate binary files


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@55 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-10 12:26:16 +00:00
vfilippov
6586c8e4d7 bug 37020
enc fix


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@54 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 18:44:05 +00:00
vfilippov
d34f8f5946 bug 37020
debug


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@53 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 16:52:16 +00:00
vfilippov
842f0e712a bug 37020
templates for multi-repos query form


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@52 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 16:46:42 +00:00
vfilippov
0ad8ee1554 debug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@51 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 16:46:28 +00:00
vfilippov
0f545ca76b del
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@50 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 16:36:37 +00:00
vfilippov
c3f2777a4e bug 37020
multi-root query form


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@49 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 16:34:49 +00:00
vfilippov
45c636fd11 bug 37020
no pagesize by default


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@48 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 15:18:31 +00:00
vfilippov
2d9276a06d KEY descid
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@47 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 14:54:40 +00:00
vfilippov
eb6edef712 cvs logs -----> utf8
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@46 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-09 11:23:21 +00:00
vfilippov
b574b8594d utf8
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@45 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-08 13:00:51 +00:00
vfilippov
3bfb004158 asynchronous SVN update script
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@44 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-08 12:32:42 +00:00
cmpilato
08a8b110ac Allow admins to enable/disable diff/patch views via the allowed_views
configuration bit.

* lib/viewvc.py
  (view_diff, view_patch): Only show diffs if 'diff' is one of the
    allowed views.

* lib/config.py
  (Config.set_defaults): Add 'diff' to the set of allowed_views (and
    sort the values alphabetically where here).

* viewvc.conf.dist
  (allowed_views): Add 'diff' to the set of views you can specify, and
    include it in the default values.  While here, sort the values
    alphabetically.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2058 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-12-05 17:01:39 +00:00
vfilippov
23eea873fa fix a bug in setup cvs hooks script
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@43 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-04 21:51:19 +00:00
vfilippov
9f0557ff85 testing ViewVC hooks
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@42 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-04 21:32:44 +00:00
vfilippov
00f38a1b55 utf8string diffs
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@41 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-04 15:47:45 +00:00
vfilippov
3b4f7698af rights
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@40 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-02 14:55:27 +00:00
vfilippov
0114b46db0 fix directory rights
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@39 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-02 14:53:23 +00:00
vfilippov
a0c895b5a6 debug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@38 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-02 14:46:25 +00:00
vfilippov
e74a8ac42d Apache config via virthost
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@37 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-02 14:15:01 +00:00
vfilippov
d94e658457 cvs_ondisk_charset
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@36 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-02 10:39:18 +00:00
vfilippov
cbcffad79a physical charset
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@35 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-12-01 18:16:46 +00:00
vfilippov
025eb36df4 multiple repos co CVSROOT
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@34 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-27 15:20:35 +00:00
vfilippov
33a8f2849c CustIS install script, it's done and tested now
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@33 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-26 14:18:40 +00:00
vfilippov
1bbf731b83 setup-svn-hooks
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@32 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-26 14:15:32 +00:00
vfilippov
cd68fb0f79 improved ACL import script
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@31 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-21 17:06:03 +00:00
vfilippov
97e5d91c18 import
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@30 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-18 17:25:26 +00:00
vfilippov
28ba6929af cvsacl
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@29 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-18 17:24:50 +00:00
vfilippov
3187e57026 None
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@28 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-18 13:49:12 +00:00
vfilippov
a30b597260 check access rights when querying commit database
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@27 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-18 13:36:33 +00:00
vfilippov
1480000938 debug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@26 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-17 17:04:16 +00:00
vfilippov
bfe175e5cd setup cvs hook script
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@25 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-17 16:19:31 +00:00
vfilippov
2cadb542a2 pygments
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@24 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-14 19:42:47 +00:00
vfilippov
13b23a5696 total plus/minus lines
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@23 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-14 17:57:57 +00:00
vfilippov
822ec29624 bug 37020
fucking encodings


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@22 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-14 14:53:48 +00:00
cmpilato
38a7338c9d Add a configuration option for telling ViewVC to *not* honor the
svn:mime-type property.

* lib/config.py
  (Config.set_defaults): Set options.svn_ignore_mimetype default value.

* viewvc.conf.dist
  (svn_ignore_mimetype): New.

* lib/viewvc.py
  (calculate_mime_type): Consult cfg.options.svn_ignore_mimetype
    before looking up the 'svn:mime-type' property.

* docs/upgrading-howto.html
  Add a note about the new configuration option.

Patch (mostly) by: JJ <eggsgloriouseggs {_AT_} gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2055 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-13 21:44:15 +00:00
cmpilato
bf40ef2683 It's very confusing to comment out the authorizer configuration line
and have that mean "use an authorizer".  So let's just prevent that
confusion right now, okay?

* lib/config.py
  (Config.set_defaults): Set 'authorizer' by default to None.

* viewvc.conf.dist
  (authorizer): Update comments for correctness, and don't imply that
    "forbidden" is the default authorizer.

* docs/upgrading-howto.html
  Stop saying that "forbidden" is the default authorizer.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2053 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-13 21:20:29 +00:00
cmpilato
11f5685955 Finish issue #384 - repos._revinfo_raw() is doing far too much work
when no authz is in use.  Vastly improves performance of
repos.itemlog() for local Subversion repositories *not* protected by
an authorizer.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository._revinfo): Was ._revinfo_raw().  Now
    encapsulates the caching logic that used to live in .revinfo(), plus
    the old logic of _revinfo_raw() modified to avoid changed-path
    processing when that processing isn't strictly required by callers.
  (LocalSubversionRepository.revinfo): Make this just a thin wrapper
    around ._revinfo() now.  Internal callers of this function updated
    to use ._revinfo() instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2051 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-13 21:14:14 +00:00
cmpilato
4904e03324 Minor improvements to the debug timer code.
* lib/debug.py
  (t_dump): Was dump().  Now accepts an output file handle, and sorts
    the output in a predictable fashion.

* lib/viewvc.py
  (main): Track changes to debug.dump().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2048 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-13 19:45:13 +00:00
vfilippov
f9b1b8a50c encodings
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@21 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-13 16:51:57 +00:00
vfilippov
6978ac9e5d merged
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@20 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-13 14:56:58 +00:00
vfilippov
230e2f1700 bug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@19 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 20:17:34 +00:00
vfilippov
899204468b cron reload
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@18 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 19:04:57 +00:00
vfilippov
712761df3f fast cvsdbadmin
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@17 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:52:54 +00:00
vfilippov
73eaad686b bug 37020
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@16 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:48:25 +00:00
vfilippov
6556287ff3 bug 37020
debug


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@15 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:46:44 +00:00
vfilippov
4b51a62390 bug 37020
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@14 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:45:01 +00:00
vfilippov
5ea538f50e Pygments from tarball
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@13 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:26:03 +00:00
vfilippov
521261bb34 bug 37020
automatic hook setup


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@12 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 18:14:50 +00:00
vfilippov
9e55dba9f9 bug 37020
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@11 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 17:40:19 +00:00
vfilippov
9ac8f10967 bug 37020
http_proxy


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@10 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 17:08:12 +00:00
vfilippov
6ef2a85ae9 debug
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@9 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 16:42:44 +00:00
vfilippov
1200a15887 bug 37020
config


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@8 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 16:39:48 +00:00
vfilippov
0fddc0bb87 Bug 37020
Install script


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@7 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 16:12:45 +00:00
vfilippov
28a41fb268 fix pygments
git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@6 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-12 16:12:19 +00:00
cmpilato
bd1254aa5f Avoid returning huge lists of variables from get_file_view_info(), and
use an ad-hoc class to hold all that stuff instead.

* lib/viewvc.py
  (get_file_view_info): Now return an object with interesting member variables
    instead of a nasty long list of values in an easy-to-goof-up order.
  (common_template_data, view_directory, view_log, view_diff): Update
    uses of get_file_view_info to track new calling semantics.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2047 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-11 16:21:58 +00:00
vfilippov
585580ec57 bug 37020
Ability to connect to MySQL through UNIX socket
diff links in query.py are shown now (moved expand_root_parents to config.py)
full-text comment searches in query and query_form are supported using MySQL FULLTEXT indexes
<select> for repository selection in query


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@5 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-11 14:25:07 +00:00
vfilippov
f3aa325419 bug 37020
viewvc 1.1.0-beta1 initial commit


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@4 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-11 14:17:41 +00:00
vfilippov
9b00bc278f bug 43834
dirs


git-svn-id: svn://svn.office.custis.ru/3rdparty/viewvc.org/trunk@3 6955db30-a419-402b-8a0d-67ecbb4d7f56
2008-11-11 14:12:33 +00:00
cmpilato
8b6e568ae1 * viewvc.org/faq.html: Minor wording tweak.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2046 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-10 22:05:27 +00:00
cmpilato
bc13ce9938 * viewvc.org/faq.html: Update the answer to the authz question.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2045 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-10 14:29:47 +00:00
cmpilato
0ddf057bbc Minor website tweakage.
* viewvc.org/index.html
  Lose 'Future Plans' section, and overhaul the feature and requirements lists.

* viewvc.org/contributing.html
  Fix the link to the Template Authoring Guide.

* viewvc.org/download.html
  Add a section for upgrading existing ViewVC installations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2044 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-06 20:36:37 +00:00
cmpilato
5dbdea76ce docs/upgrading-howto.html: Don't claim as removed options not in 1.0.x.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2043 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-05 21:13:54 +00:00
cmpilato
8a9b9562f3 Merge r2040 from the 1.1.x branch:
* CHANGES: Combine some changes, and remove a now-bogus one.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2041 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-05 16:31:47 +00:00
cmpilato
51994aabc9 Doh! Remove empty <div> section.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2039 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-04 21:45:28 +00:00
cmpilato
f3edee505d Website and CHANGES file updates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2038 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-11-04 21:44:44 +00:00
cmpilato
bcfb8f2c97 * lib/viewvc.py (__version__): Bump to '1.2-dev'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2034 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-30 17:37:04 +00:00
cmpilato
c481fe3ace Support rule inversion in the 'svnauthz' module, just as Subversion supports.
* lib/vcauth/svnauthz/__init__.py
  (_userspec_matches_user): New, abstracted from _process_access_section(),
    but now with support for the inversion indicator (~).
  (_process_access_section): Use new _userspec_matches_user().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2032 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-30 17:10:13 +00:00
cmpilato
563b5a9f6d * docs/upgrading-howto.html
Reorder some sections, and documenting the known issues with the
  authz stuff.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2031 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-29 18:33:08 +00:00
cmpilato
360bdfd5a9 Remove redundant CHANGES line.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2030 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-24 15:15:24 +00:00
cmpilato
d4749c20f2 Add FAQ entry about installation docs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2029 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-22 13:32:37 +00:00
cmpilato
bf7676d7f1 * lib/vcauth/svnauthz/__init__.py
(ViewVCAuthorizer._process_access_section): Add support for the
    "$anonymous" and "$authenticated" magic user specifications
    introduced in Subversion 1.5.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2028 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-20 16:12:30 +00:00
cmpilato
8d5d67888d Note per-root configuration override change.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2027 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-15 00:28:05 +00:00
cmpilato
08454df121 Add support for allowing/disallow the root listing view.
* lib/viewvc.py
  (view_roots): Check to see if the root listing view is an allowed
    one before serving it up.

* viewvc.conf.dist
  Add 'roots' to the description of, and default value of, allowed_views.

* lib/config.py
  (Config.set_defaults): Add 'roots' to the default value of
    cfg.options.allowed_views.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2026 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-15 00:22:05 +00:00
cmpilato
a5b8f9176f Get per-root overrides of authorizer stuffs working, and advertise
this feature in viewvc.conf.

NOTE: Root listing views still currently suffer a bit here.  We can't
just overlay per-root options as we loop over roots because each root
will wind up with the union of the overrides for roots previously
handled in the loop.  We either need to find a way to clone the Config
object before overriding its values with per-root options (so the
original Config object is untouched) or find an elegant way to
*unoverlay* per-root options.  I suspect we'll have better luck with
the former approach.

* lib/viewvc.py
  (Request.run_viewvc): Overlap per-root options *before* setting up
    the authorizer for the root because, you know, the authorizer or
    its configuration might be what's being overridden.

* viewvc.conf.dist
  Note the existence of (and way to use) the per-root configuration overrides.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2025 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-15 00:11:54 +00:00
cmpilato
badc9e3ff0 Expose the authenticated username in the templates.
* templates/docroot/styles.css
  (#vc_nav_header): Drop 'font-weight: bold'.

* templates/include/header.ezt
  Convert vc_nav_header contents into a 1-row, 2-column table
  featuring the nav path and (if present) the authenticated username.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2024 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-14 23:53:55 +00:00
cmpilato
9d6c204efb Merge 1.0.7 changes into CHANGES file (and fix a long line while here).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2023 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-14 22:21:44 +00:00
cmpilato
429a9e5aed Bump the version named as the latest release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2022 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-14 22:09:35 +00:00
cmpilato
574de8ddac Minor tweaks to the release process docs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2021 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-14 22:08:26 +00:00
cmpilato
cf5491852c Fix issue #373: Regression: "as text" view no longer transmits
Content-type: text/plain header.

* lib/viewvc.py
  (Request.run_viewvc): Add 'text/plain' to the list of content types
    allowed to be specified via the CGI query params.
  (view_checkout): Revert the change from r1978 which caused this to
    ignore the content-type query param; we'll go back to paying
    attention to that, and simply trust that Request.run_viewvc() has
    sanitized it.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2016 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-10-02 15:46:19 +00:00
cmpilato
d525dd0737 * lib/viewvc.py
(setup_authorizer): Use the prescribed mechanism for dynamically loading a
    submodule.

Patch by: Bernd Kuemmerlen <bkuemmer {at} gmx.net>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2011 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-22 18:57:48 +00:00
cmpilato
502b9891d4 Tigris.org homepage updates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2010 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 19:36:39 +00:00
cmpilato
e72570dc20 Copy 1.0.6 changes into trunk CHANGES file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2009 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 19:15:46 +00:00
cmpilato
1fa6bf4978 Lose fixed-width formatting of a URL.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2008 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 19:08:11 +00:00
cmpilato
f00bf732df Bump most recent release version in website note.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2007 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-16 19:07:50 +00:00
cmpilato
d13fd6f02a * lib/viewvc.py
(setup_authorizer): Avoid try/except/finally syntax, which isn't
    supported by some older Python versions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2002 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-11 14:11:39 +00:00
cmpilato
ba0e4598d3 * viewvc.conf.dist
No longer recommend that folks set use_enscript (since it has been
  removed) and use_cvsgraph (since it seems most folks these days are
  using Subversion anyway).



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2001 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-10 14:40:33 +00:00
cmpilato
899de5536f * lib/viewvc.py
(setup_authorizer): Use the 'imp' module instead of exec() commands
    to load a dynamically-determined (and arbitrarily named module).

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2000 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-09-08 13:30:31 +00:00
cmpilato
5b8d3cf325 Finish issue #105 (add option hide_errorful_entries).
* viewvc.conf.dist
  (hide_errorful_entries): New.

* lib/config.py
  (Config.set_defaults): Init cfg.options.hide_errorful_entries to 0.

* lib/viewvc.py
  (view_directory): If cfg.options.hide_errorful_entries is enabled,
    skip any directory entries that carry errors.

* docs/upgrading-howto.html
  Note the new option.

* CHANGES
  Note this (and the previous) change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1998 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-21 13:56:30 +00:00
cmpilato
0855e910ac Add some svn:ignore properties.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1997 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-21 13:50:22 +00:00
cmpilato
fbb4e04dbc In the CVS vclib providers, mark entries which have no revisions on
the requested tag as 'absent', rather than calling such a situation an
error.  This is for issue #105 (add option hide_not_readable).

* lib/vclib/ccvs/bincvs.py
  (CVSDirEntry.__init__): Add 'absent' parameter and handling.
  (_get_logs): Rather than raise such as an error, not files which
    have no revs on the selected branch/tag as "absent" (a
    non-error-ful state).

* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.dirlogs): Init the .entry member of the dirent.
  (InfoSink.admin_completed): If we found nothing for a particular
    tag, and we're looking at a file, mark the entry as absent.

* lib/viewvc.py
  (view_directory): If a CVS file is marked as absent (meaning, "No
    revisions found on the requested branch"), don't show it at all.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1996 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-21 13:37:46 +00:00
cmpilato
329ec7e9bf Reverse-merge changes made in r1536 and r1537 (in which our mod_python
modules were renamed), and merge r1933 (in which the 'imp' module is
used to more directly deal with the import cycle problem).

* docs/upgrading-howto.html
  Remove upgrading notes about renamed modules since, now, they aren't
  renamed any more.

* viewvc-install
  Note re-renamed paths.

* bin/mod_python/viewvc_mp.py,
* bin/mod_python/query_mp.py
  Rename these back ...

* bin/mod_python/viewvc.py,
* bin/mod_python/query.py
  ... to these, and use the 'imp' module to load libraries from
  specific locations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1994 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 18:01:37 +00:00
cmpilato
e9d1da3b8f * lib/viewvc.py
(build_commit): Ahem.  And then commit the fixes necessary to make
    r1991 actually work.

NOTE TO SELF: Be sure to test the right version of the software before
              committing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1992 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 17:12:39 +00:00
cmpilato
3f8ecf1b67 * lib/viewvc.py
(build_commit): Remove duplicated authz checks, and try to tighten
    up the path/rev used in those checks.  While here, fix issue #368's
    complaint about the RSS feeds throwing an exception due to use of a
    non-existent variable.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1991 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 17:09:27 +00:00
cmpilato
b35d6b27d0 * lib/viewvc.py
(calculate_mime_type): Gracefully handle exceptions returned from
    .itemprops(), and fall back to guessing based on path name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1990 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 14:45:34 +00:00
cmpilato
3738505ad7 * lib/vclib/svn/svn_repos.py
(LocalSubversionRepository._revinfo_raw): Fix a logic-o.  It's if
    a copy source path is *not* authorized for read that we want to say
    the original path was not copied.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1989 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-20 14:40:13 +00:00
cmpilato
a74cefa63c Finish issue #361 - Support reasonable copy-pasting of the path.
* templates/include/header.ezt
  Collapse the EZT logic for the navpath into a single line[1], and
  wrap the path separators (/) with custom styles.

* templates/docroot/styles.css
  (.vc_navheader .pathdiv): Define custom style with some left-right padding.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1987 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-18 18:13:12 +00:00
cmpilato
b90ed5fffa * lib/blame.py
Only import vclib.ccvs.blame for the one function that cares.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1986 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-13 20:13:15 +00:00
cmpilato
c264c62e3d Finish issue #364 - Recognize Subversion's svn:mime-type property.
* lib/viewvc.py
  (Request.run_viewvc): No longer set the request's mime_type member.
  (calculate_mime_type): New helper function.
  (common_template_data): Add optional 'mime_type' parameter, passed
    to get_file_view_info().
  (get_file_view_info): Use guess_mime() as the MIME type fallback,
    instead of consulting the now-absent request.mime_type.
  (markup_or_annotate, view_log, view_checkout, build_commit): Use 
    calculate_mime_type().

* templates/file.ezt
  Display a file's MIME type.

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1982 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-08-05 16:25:38 +00:00
cmpilato
286b8a2925 Update the URL reference in light of r1978 and r1979.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1980 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-07-28 19:26:35 +00:00
cmpilato
3a499652df Finish issue #354: Lose ability to set Content-type via CGI params.
For security purposes (because spoofing Content-type headers can have
undesirable side effects), no longer recognize 'content-type' CGI
parameters whose values aren't one of the magic MIME types ViewVC uses
for its own (non-MIME-type-setting) purposes.

* lib/viewvc.py
  (Request.run_viewvc): Ignore content-type CGI parameters whose
    values aren't one of the magic ViewVC MIME types used to indicate
    that folks want the markup view.
  (view_checkout): No longer consult the query parameters for a MIME type.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1978 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-07-28 18:51:51 +00:00
cmpilato
d272630eac Fix issue #360 - Purge functionality can orphan rows in checkins table.
* lib/cvsdb.py
  (CheckinDatabase.sql_delete): Add keep_fkey parameter, used to
    prevent deletion of keys that are still in use in the 'checkins'
    table.
  (CheckinDatabase.PurgeRepository): Pass keep_fkey parameter when
    deleting rows from tables other than 'checkins'.

* bin/cvsdbadmin,
* bin/svndbadmin
  Update script usage messages to indicate that rebuilding includes
  purging.

Patch by: Larry Shatzer (larrys {at} gmail.com)
          (Tweaked by me.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1974 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-07-07 13:21:48 +00:00
cmpilato
cb79c1f793 Add support for Subversion authz-file aliases, a feature new to
Subversion 1.5.  (This was filed as issue #359.)

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer._get_paths_for_root): Parse the 'aliases' section,
    and fix username checks to include aliases, too.

Patch by: Thom May <thom {at} clearairturbulence.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1973 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-30 18:46:07 +00:00
cmpilato
43337f8b0f * lib/vclib/svn/svn_ra.py (SelfCleanFP.readlines): New.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1972 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-26 08:00:21 +00:00
cmpilato
7f149c01d0 More authz stuff for remote SVN repositories.
* lib/vclib/svn/svn_ra.py
  (date_from_rev): Removed as unused.
  (LogCollector): Leave an authz-related TODO comment.
  (RemoteSubversionRepository.rawdiff): Hook into the authz-aware code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1971 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-26 07:57:21 +00:00
cmpilato
2df94a5d37 Add some more authz checks for remote SVN repositories, and fix some
inconsistencies (versus local SVN repository views) in the revision
returned from openfile().

* lib/vclib/svn/svn_ra.py
  (LastHistoryCollector): Removed.  The main logic of this class now
    lives (with major tweaks) in RemoteSubversionRepository._revinfo_raw().
  (_get_rev_details): Removed.
  (RemoteSubversionRepository.open): Init _revinfo_cache member.
  (RemoteSubversionRepository.openfile): Use _get_last_history_rev()
    for the returned revision.
  (RemoteSubversionRepository.dirlogs): Use self.revinfo() now.
  (RemoteSubversionRepository.revinfo): Rework as a wrapper around
    _revinfo_raw().
  (RemoteSubversionRepository.rawdiff): Add some comments.
  (RemoteSubversionRepository._get_last_history_rev): New.
  (RemoteSubversionRepository._revinfo_raw): New, taking from old
    LastHistoryCollector interface, but reworked toward the goal of
    some authz interaction.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1970 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-26 07:52:18 +00:00
cmpilato
91c5418de7 Add a helper function, use it, and fix a little authz oopsy along the way.
* lib/vclib/svn/svn_repos.py
  (_path_parts): New, and now used throughout for path-to-parts
    conversions.
  (_cleanup_path): Rewrite as a wrapper around _path_parts().
  (_fs_path_join): Rewrite as a wrapper around _cleanup_path().
  (LocalSubversionRepository._revinfo_raw): Fix an authz check made
    against the wrong path.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1969 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-26 07:43:52 +00:00
cmpilato
1adb46f2b3 Fix a regression against 1.0.x which caused the wrong revision metadata
to be displayed for certain rev != rev-in-which-item-was-changed
Subversion markup and annotate displays.

* lib/viewvc.py
  (common_template_data): Add optional 'revision' argument, used to
    override other automated revision-figuring-outin' mechanisms.
  (markup_or_annotate): Use the revision returned by the openfile() or
    annotate() interfaces in the call to common_template_data().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1968 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-26 06:47:46 +00:00
cmpilato
410a80df6b Address issue #358 as best as possible (I believe).
* lib/viewvc.py
  (build_commit): Perform authz checks, dropping unreadable paths and
    stripping log messages for commit groupings with contain
    unreadable paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1967 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-25 06:43:23 +00:00
cmpilato
eb6c6964c4 Make the check-the-database-for-roots-before-creating-RSS-and-query-links
behavior optional (since the penalty otherwise could be deemed too
high to be worth paying).

* viewvc.conf.dist
  (check_database_for_root): New.

* lib/config.py
  (Config.set_defaults): Populate default cvsdb.check_database_for_root value.

* lib/viewvc.py
  (is_querydb_nonempty_for_root): Only do database root checks if
    cfg.cvsdb.check_database_for_root is set.

Patch by: Larry Shatzer <larrys {at} gmail.com>
          (Tweaked by me.)

* lib/cvsdb.py
  (GetCommitListFromRCSFile): Update call to Repository.itemlog().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1966 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-23 23:50:52 +00:00
cmpilato
e157f923ed * lib/cvsdb.py
(GetCommitListFromRCSFile): Update call to Repository.itemlog().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1965 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-23 23:50:45 +00:00
cmpilato
a8a6d5c10b I *thought* something seemed wrong. We don't *want* ViewVC to claim
some path is forbidden.  We want it to claim the path doesn't exist at
all!  So remove some unused cruft from a previous manifestation of the
authz support.

* lib/debug.py
  (ViewVCNotAuthorizedException): Remove as unused.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1964 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-21 00:35:26 +00:00
cmpilato
473951fa96 * lib/debug.py
(ViewVCNotAuthorizedException.__init__): Use "403 Forbidden" instead
    of the bogus "501 Not Authorized" status.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1963 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-21 00:28:11 +00:00
cmpilato
0aaeeb4398 * bin/standalone.py
(cli): Add 'host' to the list of accepted long options.

Patch by: Larry Shatzer, Jr. <larrys {at} gmail.com>



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1962 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-19 20:06:26 +00:00
cmpilato
9761bb7818 Add CHANGES line for issue #357 change.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1961 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-19 20:04:30 +00:00
cmpilato
46f42bf09a Finish issue #357.
Only populate rss_href and queryform_href if query support is enabled
*and* the current root has a presence in the commits database.

* lib/viewvc.py
  (common_template_data): Use is_querydb_nonempty_for_root() to
    conditionally set rss_href and queryform_href.
  (is_querydb_nonempty_for_root): New.

Patch partially by: Larry Shatzer, Jr. <larrys {at} gmail.com>
                    (I butchered it.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1960 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-19 19:51:13 +00:00
cmpilato
24984a78d1 * bin/svndbadmin
Import 'vclib' so bad stuff doesn't happen.  (Such as referencing a
  non-imported module.)



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1959 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-19 19:48:17 +00:00
cmpilato
ec3deccc34 * viewvc.conf.dist
Fix example use of 'svn_dir' to 'svn'.

Patch by: Larry Shatzer, Jr. <larrys {at} gmail.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1958 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-19 14:50:39 +00:00
cmpilato
7e85c56317 Formatting changes only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1957 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-13 17:29:15 +00:00
cmpilato
371a97fbb2 * viewvc.conf.dist
(hide_cvsroot): Move closer to 'authorizer', and note that someday
    it may go away.
  (diff_format): Document the 'f' option.
  (hr_breakable): Tweak description.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1956 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-13 15:09:45 +00:00
cmpilato
3effe02607 * viewvc.conf.dist
(log_sort): Rename 'cvs' value to 'none'.

* docs/upgrading-howto.html
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1955 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-13 14:54:33 +00:00
cmpilato
7e5d3b27b1 Some intra-page link tweaks.
* lib/viewvc.py
  (Request.run_viewvc): Special-case the handling of self.where,
    self.pathtype, and self.path_parts when we're looking at the
    revision or root-listing views.
  (common_template_data): Take the current directory revision into
    account when generating a revision view link from the directory view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1954 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 19:36:20 +00:00
cmpilato
079b596424 Interpret the per-template override options as relative to the
configured template directory now.

* lib/viewvc.py
  (get_view_template): Rework this to interpret per-template overrides
    as relative to the template-dir, which itself is relative to the
    configuration location.

* viewvc.conf.dist
  (templates): Strip 'templates/' from the sample template locations,
    and note that these paths are relative to the configured template
    directory.

* docs/upgrading-howto.html
  Note this change of interpretation.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1953 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 18:24:28 +00:00
cmpilato
fb0264a563 Make annotations work again for Subversion repositories.
* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.annotate): Keep the return value from
    self.itemtype() so we can pass it to _get_history().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1952 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 18:20:09 +00:00
cmpilato
c58fc4008b Update the upgrade documentation.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1951 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 17:40:17 +00:00
cmpilato
16ccaa931c Add vclib-specific path canonicalization and root-parent expansion
routines (and use them).

Background: I had delusions of adding root-parent expansion for remote
Subversion repositories, but I lacked the requisite motivation.
Still, these are good changes which further move VC-specific knowledge
out of ViewVC's core moddules and back into the vclib abstraction
layer, which such knowledge belongs.

* lib/viewvc.py
  (Request.run_viewvc): Use vclib.*.canonicalize_rootpath() to get
    version-control-specific rootpath canonicalization.
  (expand_root_parents, find_root_in_parents): Rework to use the
    expand_root_parent() vclib implementations.
  (locate_root): Docstring typo fix.

* lib/vclib/ccvs/__init__.py
  (canonicalize_rootpath, expand_root_parent): New.
  (CVSRepository): Use canonicalize_rootpath().

* lib/vclib/svn/__init__.py
  (_re_url): Make module-global.
  (canonicalize_rootpath, expand_root_parent): New.
  (SubversionRepository): Use canonicalize_rootpath().

* bin/cvsdbadmin
  (__main__): Use canonicalize_rootpath() before passing the root path
    to vclib.ccvs.CVSRepository().

* bin/svndbadmin
  (__main__): Use canonicalize_rootpath().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1950 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 16:26:33 +00:00
cmpilato
656a46ad8c Don't specify how syntax highlighting is provided.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1949 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-12 14:44:17 +00:00
cmpilato
8404a211c0 Tweak website credits text just a bit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1948 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-11 18:27:06 +00:00
cmpilato
71d3617c0d Shrink the title image a bit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1947 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-11 18:23:49 +00:00
cmpilato
67d4261729 Add favicon.ico, and try to settle on a background color.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1946 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-11 18:17:54 +00:00
cmpilato
066b22585a More color tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1945 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-11 18:13:12 +00:00
cmpilato
0ad2b1f095 Re-brand the viewvc.org pages.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1944 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-11 18:07:57 +00:00
cmpilato
f89786a6fa * lib/vclib/svn/svn_ra.py
Fix a syntax error.  (This is what I get for testing a fix on one
  machine, but trying to commit an untested duplicate change from
  another.)



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1943 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-06 18:08:50 +00:00
cmpilato
417e2bbedf * lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.itemlog): Don't index into an empty
    path_parts list.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1942 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-05 20:12:27 +00:00
cmpilato
d6bae15b7d * CHANGES: Note the change committed in r1940.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1941 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-05 18:57:43 +00:00
cmpilato
cad4e52746 Finish issue #351, which solves a regression against 1.0.x *and*
improves upon things to boot (finishing issue #339)!

This implements support for a configuration Subversion runtime config
directory location, which is useful for employing cached authn
credentials against remote repositories that require them, as well as
avoiding complaints the Subversion library might make when trying to
ensure the existence of a runtime configuration directory.

* viewvc.conf.dist
  (options.svn_config_dir): New.

* lib/config.py
  (Config.set_defaults): Initialize options.svn_config_dir variable.

* lib/viewvc.py
  (Request.run_viewvc): Update call to vclib.svn.SubversionRepository().
  (list_roots): Update call to vclib.svn.SubversionRepository().

* lib/vclib/svn/__init__.py
  (SubversionRepository): Add 'config_dir' parameter, passed to
    updated calls to RemoteSubversionRepository() and
    LocalSubversionRepository()

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.__init__): Add 'config_dir' parameter,
    and squirrel it away in a member variable.
  (RemoteSubversionRepository.open): Add the key thing I've been
    missing for years to make custom runtime config directories work:
    setting the configuration directory location in the auth baton!
    God bless Eric Gillespie <epg@pretzelnet.org>.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.__init__): Add 'config_dir' parameter,
    and squirrel it away in a member variable (currenty unused).

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1940 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-05 18:52:45 +00:00
cmpilato
9acf966bd7 Make dates appear again in remote Subversion directory views.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.dirlogs): Don't try to do
    string-to-number conversion of the entry date -- we already have
    the numeric value.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1938 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-03 18:00:37 +00:00
cmpilato
6c635e75a4 * lib/viewvc.py
(check_freshness): Move a comment closer to the code it addresses.
  (markup_or_annotate): Restore cache control header checks
    inadvertantly lost in a recent commit.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1937 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-03 17:11:34 +00:00
cmpilato
5b51bf9008 Finish issue #233: tarball entries from Subversion repositories don't
preserve executability.

* lib/vclib/__init__.py
  (Repository.isexecutable): New.

* lib/vclib/ccvs/bincvs.py
  (BaseCVSRepository.isexecutable): New.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.isexecutable): New.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.isexecutable): New.

* lib/viewvc.py
  (generate_tarball): Use repos.isexecutable() to get the executable
    bit for file tarball members.  (This loses old code which directly
    consulted the ,v file in the CVS case.)

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1936 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-03 17:02:55 +00:00
cmpilato
b5a2dd486d * lib/viewvc.py
(_get_diff_path_parts): Store the result of _path_parts() in
    'parts', not 'path', to avoid raising an exception when
    deferencing the former.

Found by: Jay Chang <Jay.Chang {at} intrado.com>
          (Folks who test nightly builds rawwwwwk.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1935 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-03 00:35:37 +00:00
cmpilato
041c83fabe * lib/vclib/svn/svn_ra.py
Begin adding authz checks where necessary.  Still need to take care
  of rev metadata filtering and history truncation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1934 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 19:34:43 +00:00
cmpilato
850422c786 * lib/vclib/svn/svn_repos.py
(LocalSubversionRepository): Throughout, don't clobber 'rev'
    variables before passing them off to .itemtype(), and ensure there
    *is* a local 'path' variable in case the .itemtype() failure case
    (which expects one) is raised



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1933 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 19:32:01 +00:00
cmpilato
1273f1da81 Add missing authz checks for rcsparse-backed CVS module.
* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.dirlogs, CCVSRepository.itemlog,
   CCVSRepository.rawdiff, CCVSRepository.annotate,
   CCVSRepository.openfile): Add missing authz checks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1932 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 18:52:46 +00:00
cmpilato
c1b351f78b * lib/vclib/ccvs/bincvs.py
(BaseCVSRepository, BinCVSRepository): Use Repository.itemtype()
    throughout as a combination authz check and file type sanity check.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1931 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 18:48:16 +00:00
cmpilato
c4ad7fc501 * viewvc.conf.dist
(show_subdir_lastmod): Tweak description to imply that this feature
    is for CVS only.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1930 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 17:59:03 +00:00
cmpilato
31a1a6f49c Ensure zero-padded dates in the nightly tarball names.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1929 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-06-02 17:15:03 +00:00
cmpilato
b0fb8b3ad7 * templates/include/dir_header.ezt,
* templates/include/dir_footer.ezt,
* templates/directory.ezt
  Move search box to metadata header section, and eliminate redundant "Current
  Search" header.  Make properties show up for dir_new.ezt, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1928 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 21:12:57 +00:00
cmpilato
0d0aafe7b2 * lib/vclib/svn/svn_ra.py
(svn_client_ls3): New helper (to deal with brokenness in Subversion
    1.4.x Python bindings).
  (RemoteSubversionRepository.itemlog, 
   RemoteSubversionRepository._get_dirents): Use svn_client_ls3 helper.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1927 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 21:02:31 +00:00
cmpilato
0fb5f8eb85 Workaround some Subversion 1.4.x Python bindings shortcomings.
* lib/vclib/svn/svn_ra.py
  (SVN_INVALID_REVNUM): Try to set from core.SVN_INVALID_REVNUM, but
    fallback to an explicit -1.
  (RemoteSubversionRepository.created_rev): Use SVN_INVALID_REVNUM
    compatability value.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1926 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 20:45:05 +00:00
cmpilato
19643d366c * lib/viewvc.py
(markup_stream_pygments): CGI-escape the original blame text lines
    so that if they wind up getting used, the output is valid.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1925 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 18:05:32 +00:00
cmpilato
4492bbaa1b * lib/viewvc.py
(markup_stream_pygments): Use 'utf-8' output in the Pygments HtmlFormatter().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1924 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 17:57:50 +00:00
cmpilato
e41d5a9064 Update online help documents.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1923 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 17:32:29 +00:00
cmpilato
2a4b0eeb99 Promote a ViewVC logo idea to The Real Thang(tm).
* notes/logo
  New directory.

* notes/logo/viewvc-logo.svg,
* notes/logo/viewvc-logo.odg,
* notes/logo/viewvc-logo.pdf
  Moved (with some margin tweaks) from ...

* notes/logo-ideas
  ... this directory, which is now deleted.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1922 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 17:07:33 +00:00
cmpilato
d768f2c850 Update ViewVC logo, and add favicon.
* templates/docroot/images/logo.png
  Removed.

* templates/docroot/images/viewvc-logo.png,
* templates/docroot/images/favicon.ico
  New.

* templates/docroot/help_dirview.html,
* templates/docroot/help_log.html,
* templates/docroot/help_query.html,
* templates/docroot/help_rootview.html
  Update icon references to point to viewvc-logo.png.

* templates/include/header.ezt
  Update icon reference to point to viewvc-logo.png, and add reference
  to new favicon.ico.

* templates/docroot/styles.css
  Use sans-serif fonts.  Serifs are so 1993.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1921 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 17:01:58 +00:00
cmpilato
88d4d62c39 Merge the work done on the 'merged-file-views' branch in full. For
the details of those changes, run:

   svn log --stop-on-copy --verbose \
   http://viewvc.tigris.org/svn/viewvc/branches/merged-file-views@1917

Basically, this change unifies the annotate and markup views at the
cost of dropping support for all but one of our syntax highlighting
engines -- Pygments.  (So, goodbye to 'enscript', 'highlight',
'source-highlight', 'py2html', and 'php'.)  By settling on a single
markup engine (and a Python-module-based one with a BSD license, at
that), we:

   * added syntax highlighting to the annotate view

   * added line numbers to the markup view (prior to this, you
     sometimes had 'em and sometimes didn't, depending on which
     highlighting engine you used).

   * essentially unified the markup and annotate views -- they even
     share the same template now.

   * can ship ViewVC with Pygments and syntax highighting enabled so
     folks don't have to do additional config work to get that feature.

This change may be controversial.  Depending on the overlap of
supported syntaxes across the various engines we supported prior to
this change, we may be losing support for some languages.  And we're
also losing URL markup-ing (which was, again, partially supported
depending on the markup engine you were using).  Somebody is going to
get upset that their pet benefit is now missing.  I understand that.
I'm optimistic, though, that we can identify the lossages that really,
really matter, and address them in low-maintenance-hassle ways using
this slimmer, trimmer codebase as the baseline.

Also in this commit (in addition to the merged changes):

* templates/docroot/styles.css
  Minor stylation tweaks.

* viewvc.conf.dist
  (enable_syntax_coloration): Tweak the comment to indicate that
    Pygments is required for syntax coloration to work.

* CHANGES
  Note these changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1918 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 14:38:09 +00:00
cmpilato
64c38e8248 * nightly/build-viewvc-snapshot
Duh.  Actually removing the temporary directory.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1915 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-30 13:15:31 +00:00
cmpilato
3f8390b18a * lib/viewvc.py
(MarkupPygments.__call__): The parameter is "nowrap", not "linenowrap".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1910 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 20:04:50 +00:00
cmpilato
62883ba20b Avoid having the Pygments integration keeping two copies of the file
contents in memory at once.  One is bad enough, but will have to do
for now.

* lib/viewvc.py
  (MarkupPygments): New, constructed from the primary logic that used
    to live in ...
  (markup_stream_pygments): ... this function, which is now just a thin
    wrapper around MarkupPygments().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1909 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 19:40:52 +00:00
cmpilato
e400232039 Unify the option for enabling line numbers, and add support for line
number generation to the Pygments integration logic.

* viewvc.conf.dist,
* lib/config.py
  (Config.set_defaults): Collapse 'source_highlight_line_numbers' and
    'highlight_line_numbers' into just markup_line_numbers.

* lib/viewvc.py
  (MarkupHighlight.__init__, MarkupSourceHighlight.__init__): Trace
    option renames.
  (markup_stream_pygments): Recognize the markup_line_numbers option,
    and when set, use a custom LineNoHtmlFormatter class to generate
    line numbers similar to the way 'highlight' does.

* templates/docroot/styles.css
  (.line, .linenum): Tweak comment.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1908 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 19:22:33 +00:00
cmpilato
12c81ffae6 As part of issue #394, add support for integration with Pygments, the
Python-based syntax highlighting library.

* lib/config.py
  (Config.set_defaults): Add cfg.options.use_pygments option with a
    default value of 0.

* viewvc.conf.dist
  (use_pygments): Add use_pygments option under [options].

* lib/viewvc.py
  (markup_stream_pygments): New.
  (markup_or_annotate): Call markup_stream_pygments() before falling
    back to the command-line program options.

* templates/docroot/styles.css
  Add stylations for Pygments.

* CHANGES
  Note this change.

* INSTALL
  (TO THE IMPATIENT): Add Pygments to the list of supported
    highlighting engines.
  (ENABLING SYNTAX COLORATION): Rewrite this.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1906 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 18:42:43 +00:00
cmpilato
c252e41fc4 * bin/make-database
(__main__): Add some comments, and don't use the --host option with
    'mysql' if you don't have to.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1904 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 16:27:51 +00:00
cmpilato
940bac640b Add support for remote creation of ViewVC checkins database, and
handle Control-C more cleanly.

* bin/make-database
  (INTRO_TEXT): Update this text for accuracy and clarity.
  (__main__): Prompt the user for the database server hostname
    (defaulting to 'localhost'), and use the result with the --host
    argument to 'mysql'.  While here, catch the KeyboardInterrupt
    exception and silently terminate rather than raising a stacktrace.

Patch partially by Philip M. Gollucci <pgollucci {at} p6m7g8.com>.

Also:

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1902 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-23 12:41:46 +00:00
cmpilato
20c13ec06a * lib/viewvc.py
(view_directory): Always show the search form if enabled.  (If
    templates want to hide it when there are no files to search, they
    can.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1899 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-22 18:18:48 +00:00
cmpilato
8274303424 * lib/viewvc.py
(common_template_data): Generate RSS hrefs for files, too, by using
    a directory search of its parent limited to the specified file.

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1898 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-22 17:58:21 +00:00
cmpilato
e689f77881 * templates/include/dir_footer.ezt
Fix an old reference to a long-since-renamed data dictionary object,
  and while here, make the regex search form look mo' betta.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1896 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-22 17:33:58 +00:00
cmpilato
43f5b14afa Continuing the endless quest to purge all HTML generation from
ViewVC's core libraries, turn the form hidden-values objects from HTML
strings to iterable objects that templates can use to *make* HTML strings.

* lib/viewvc.py
  (Request.get_form): Now prepare hidden values as an iterable list of
    objects with .name and .value attributes.
  (common_template_data): Don't add 'change_root_action' and
    'change_root_hidden_values' data dictionary items.
  (prepare_hidden_values): Remove as unused.

* templates/include/diff_form.ezt,
* templates/include/dir_footer.ezt,
* templates/include/dir_header.ezt,
* templates/include/paging.ezt,
* templates/include/pathrev_form.ezt,
* templates/include/sort.ezt,
* templates/diff.ezt,
* templates/log_table.ezt,
* templates/query_form.ezt,
* templates/revision.ezt
  Iterate over hidden-values items to generate <input type="hidden"
  .../> output.

* docs/upgrading-howto.html,
* docs/template-authoring-guide.html
  Note these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1894 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-21 19:51:26 +00:00
cmpilato
263920a326 Give template authors the ability to reveal the active username.
* lib/viewvc.py
  (common_template_data): Add request.username to the common template
    data as 'username'.

* docs/template-authoring-guide.html
  Document the addition.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1893 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-21 13:21:14 +00:00
cmpilato
97ed841022 Add some variations on the eye theme.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1892 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-16 17:18:01 +00:00
cmpilato
802cf3cc5a Group some similarly-colored regions.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1891 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-15 14:30:05 +00:00
cmpilato
2253c4361c Fix issue #348 by making the 'co' parser more resilient to multiple
"special" lines of output.

Previously, output like the following would choke because the code was
able to deal with the first "special" line (the warning about unknown
phrases), but then wasn't able to handle the second "special" line
(about no side branches).

   $ co -pTAG_NAME /cvs/repos/some-file,v
   /cvs/repos/some-file,v  -->  standard output
   co: /cvs/repos/some-file,v: warning: Unknown phrases like `commitid ...;' are present.
   co: /cvs/repos/some-file,v: no side branches present for 1.1

If either of these lines had been the only special ones, stuff worked
fine.  But in concert, it all fell apart.

* lib/vclib/ccvs/bincvs.py
  (_parse_co_header): Use a line-reading loop instead of trying to
    expect certain output on specific lines.

Verified by: Ross Becker <ross {at} trapezenetworks.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1888 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-14 16:53:00 +00:00
cmpilato
debb3c26a3 Make the .itemprops() interface work for remote Subversion files, too.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.itemprops): Use svn_client_proplist2()
    instead of the RA interfaces.
  (RemoteSubversionRepository.created_rev): Rework this a little to
    handle the missing path case, and add some comments about the
    implementation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1887 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-13 13:53:45 +00:00
cmpilato
2e6f3713c9 At least in one area of the codebase, avoid requiring a Python-2.3-ism.
* lib/config.py
  (Config._get_parser_items): New.
  (Config.get_authorizer_params): Use _get_parser_items() instead of
    the parser's items() function directly.

Reported by: Michael Leib <michael.leib {at} hypermediasystems.com>
(and even better...)
Verified by: Michael Leib <michael.leib {at} hypermediasystems.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1886 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-12 21:13:14 +00:00
cmpilato
e7a8f0336f Don't show dead files at all when using search-based filtering.
* lib/viewvc.py
  (view_directory): Do search-based filtering before filtering on dead
    files (while still avoiding searches on dead files)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1883 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-12 18:48:53 +00:00
cmpilato
f81abbfd39 Avoid problems caused by trying to search files in a given CVS tag
that don't exist in that tag by doing tag-based filtering first, then
fulltext searching.  I think this fixes issue #346.

* lib/viewvc.py
  (search_file): New function, cored from the guts of ...
  (search_files): ... this now-removed function.
  (view_directory): Narrow the file field down by tag selection first
    before doing fulltext searches.

Reported by: Ross Becker <ross {at} trapezenetworks.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1882 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-12 18:23:49 +00:00
cmpilato
555614bf5d Reduce the size of the 'highlight dots', and add an SVG version.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1881 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-05-06 23:03:06 +00:00
cmpilato
14e815a39b Don't ignore whitespace by default. That can be confusing to folks
expecting a diff.

* lib/config.py
  (Config.set_defaults): Default hr_ignore_white to 0 now.

* viewvc.conf.dist
  (hr_ignore_white): Default to 0 now.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1880 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-29 02:05:01 +00:00
cmpilato
e33aea9c56 Note the bugfix made in r1878.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1879 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-29 01:00:49 +00:00
cmpilato
3a3f309545 Fix issue #259 - the latest revision details page gets cached incorrectly.
* lib/viewvc.py
  (view_revision): Tell browsers not to cache the view of the youngest
    revision in a Subversion repository.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1878 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-29 00:59:09 +00:00
cmpilato
48eb269c38 Support a couple of different flavors of email address mangling.
* viewvc.conf.dist
  Update description of mangle_email_addresses option.

* lib/viewvc.py
  (mangle_email_addresses): New helper function.  Now supports a level of
    obfuscation without data loss.
  (htmlify): Use mangle_email_addresses() for address mangling.
  (format_log): Test for an explicit mangling level.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1877 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-28 19:20:17 +00:00
cmpilato
f30ceb4336 * viewvc.conf.dist
Clarify that only one authorizer can be in use at a time.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1876 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-28 18:25:06 +00:00
cmpilato
efd0ac1c26 Fix some URI encoding level issues with remote Subversion repository.
Noticed (and partial patch) by Jeffrey Klein <Jeffrey.Klein {at}
priorityhealth.com>.

* lib/vclib/svn/svn_ra.py
  Import urllib.
  (RemoteSubversionRepository._geturl): New helper function.
  (temp_checkout, RemoteSubversionRepository.openfile,
   RemoteSubversionRepository.itemlog, RemoteSubversionRepository.annotate, 
   RemoteSubversionRepository._get_dirents): Use the new .geturl() helper
    function.
  (RemoteSubversionRepository.itemprops): Wrap svn_ra_get_dir() in a
    try/except block to deal with older, busted versions of that AI.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1875 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-28 18:11:34 +00:00
cmpilato
f5cb5c1517 * lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.created_rev): Rename 'full_name'
    parameter to 'path' for consistency with other interfaces.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1874 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-28 18:05:45 +00:00
cmpilato
3d2cf8380d Lose gzip-binary-using fallback code, and actually make the
allow_compress option do something useful.

. o O ( What other dead code exists in this software? )

* lib/viewvc.py
  Import the 'gzip' module unconditionally.
  (Request.__init__): Determine if gzip output encoding is allowed.
  (get_writeready_server_file): New.
  (download_tarball): Lose the code that falls back to using a gzip
    binary.  Use get_writeready_server_file()
  (generate_page, view_checkout, view_cvsgraph_image, view_doc,
    view_patch): Use get_writeready_server_file(), allowing it to do
    server header output finalization.

* lib/config.py
  (Config.set_defaults): No longer initialize self.utilities.gzip.
    Now initialize cfg.option.allow_compress to 0.

* viewvc.conf.dist
  (utilities.gzip): Lose.
  (options.allow_compress): Lose note that indicates that 'gzip' must
    be installed and accessible in the program path.

* docs/upgrading-howto.html
  Don't note the addition of cfg.utilities.gzip ... because I just
  un-added it.

* CHANGES
  Note support for gzip-encoded output.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1873 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-23 16:18:05 +00:00
cmpilato
e11d706f30 * lib/viewvc.py
(view_revision): Use repos.get_youngest_revision() instead of
    peeking at repos.youngest directly.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1872 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-22 18:58:35 +00:00
cmpilato
d2d405513e Add 'viewvc' text to the logo.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1871 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-22 16:53:57 +00:00
cmpilato
45cf2fa972 Cleanup the design a bit: contrast the greens some more, thicken the 'V'
border, and in general pay closer attention to line landings and such.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1870 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-22 16:04:59 +00:00
cmpilato
89b012eb9f Restore website files to XHTML validation standards.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1869 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-21 20:04:50 +00:00
cmpilato
2c6ccc0191 Add some ViewVC logo ideas I've been sitting on for a while.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1868 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-18 15:48:24 +00:00
cmpilato
acff76174e Add upgrading notes about the removal of 'roots' from most views.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1867 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-17 20:25:29 +00:00
cmpilato
5fb74427f2 Remove the roots collection from the common-to-every-page data
dictionary stuffs.  It can be expensive to generate (especially when
authorization is in place) and brings little value considering we have
a roots listing view.  The sole known casualty in this change is the
little drop-down roots listing box, which is often one of the first
customizations (removing this) that folks make to their ViewVC
instances anyway.

* lib/viewvc.py
  (find_root_in_parents, locate_root): New functions.
  (common_template_data): Move the root listing data dictionary stuff ...
  (view_roots): ... to here.  Now uses expand_root_parents().
  (load_config): This, however, no longer uses expand_root_parents.
  (Request.run_viewvc): Use locate_root() to find a requested root
    name rather than expecting cvs_roots and svn_roots to be fully
    populated.

* templates/include/header.ezt
  Lose the root listing drop-down box, and de-table-ize the breadcrumbs.

* templates/docroot/styles.css
  (.vc_navheader): Add some padding.

* docs/template-authoring-guide.html
  Move the 'roots' stuff from the COMMON template data collection to
  the section specific to the root listing view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1865 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-17 19:52:30 +00:00
cmpilato
4f45a6b364 Minor code refactoring.
* lib/viewvc.py
  (expand_root_parents): New, factored out of ...
  (load_config) ... this.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1864 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-17 18:23:51 +00:00
cmpilato
f38dfba74d Fix some inconsistencies in the way the roots listing is handled and
referred to when root_as_url_component is disabled.

* lib/viewvc.py
  (Request.run_viewvc): Only assume the default rootname if we're not
    in root_as_url_component mode *and* we're aren't being asked to view
    the root listing.
  (common_template_data): Always calculate a roots_href.  Also,
    gracefully deal with request.rootname being None.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1863 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-17 17:07:28 +00:00
cmpilato
f97eeac785 * lib/vclib/ccvs/ccvs.py
(CCVSRepository.rawdiff): Update calls to itemlog() overlooked in r1857.

Found by: Daniel Berlin <danielberlin {at} tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1862 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-17 12:42:19 +00:00
cmpilato
f8ae6503fd * lib/viewvc.py
(common_template_data): Remove an obsolete TODO comment.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1861 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-16 20:51:20 +00:00
cmpilato
7cdabe099a * CHANGES
Add a note about recent pagination improvements.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1860 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-15 18:41:33 +00:00
cmpilato
e8123f68c2 Merge changes from the 'log-paging' branch:
$ svn merge -c1849,1850,1853,1854,1855,1856 \
    http://viewvc.tigris.org/svn/viewvc/branches/log-paging

This brings sliding-window-style pagination to the log revision view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1857 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-15 18:17:02 +00:00
cmpilato
c1d3602bf3 * lib/vclib/svn/svn_ra.py
(RemoteSubversionRepository.itemprops): Pass the relative path to
    svn_ra_get_dir(), not the full URL.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1851 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-11 20:30:31 +00:00
cmpilato
18954aa9a9 Fix another bug in directory views that appeared when pagination was
enabled (in CVS).

* lib/viewvc.py
  (view_directory): Init the DirEntry.dead field.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1847 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-11 18:30:32 +00:00
cmpilato
c227c0a6e3 Fix a bug in directory views that appeared when pagination was enabled.
* lib/viewvc.py
  (view_directory): Init the DirEntry.lockinfo field.  (moral: The
    problem with cheating is that you eventually get caught.)



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1846 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-11 14:53:55 +00:00
cmpilato
4783fa5642 * lib/viewvc.py
(_legal_params): Move some params to a new grouping labeled as
    deprecated.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1845 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-11 14:52:27 +00:00
cmpilato
e2b02ff5f2 Add CHANGES item for property display.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1842 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-09 20:16:27 +00:00
cmpilato
3ab9ffbbc0 For issue #39, bang in some rudimentary support for displaying version
controlled item properties.  (Of course, this doesn't apply to CVS.)

* lib/vclib/__init__.py
  (Repository.itemprops): New.

* lib/vclib/ccvs/bincvs.py
  (BaseCVSRepository.itemprops): New.

* lib/vclib/svn/svn_repos.py
  (LocalSubversionRepository.itemprops): New.
  (LocalSubversionRepository._revinfo_raw): Fetch the whole revision
    proplist instead of repeatedly querying the filesystem.

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.itemprops): New.

* lib/viewvc.py
  (get_itemprops): New.
  (markup_or_annotate, view_directory): Use get_itemprops().

* templates/docroot/styles.css
  (.vc_properties, .vc_properties h2): New style defs.

* templates/include/props.ezt
  New.

* templates/markup.ezt,
* templates/directory.ezt,
* templates/annotate.ezt
  Include the new props.ezt template chunk.

* docs/template-authoring-guide.html,
* docs/upgrading-howto.html
  Document the new data dictionary bits.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1841 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-09 20:14:33 +00:00
cmpilato
81b39b70a1 Add support to standalone.py for specifying a configuration file
location on the command-line.

* bin/standalone.py
  (handle_config): Add 'config_file' parameter.
  (serve): Update call to handle_config().
  (cli): Parse the -c / --config-file argument, and describe it in the
    usage message.  Also, disallow it when asked to be in GUI mode.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1840 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-08 16:38:25 +00:00
cmpilato
35a1dd9938 Mostly just formatting changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1839 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-04 17:30:28 +00:00
cmpilato
b4bf269cf2 Clarify the working copy / repository distinction for CVS newbies.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1838 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-04-01 00:55:05 +00:00
cmpilato
62f82645fd * templates/docroot/styles.css
Add "white-space: nowrap" to table headers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1837 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-18 21:39:55 +00:00
cmpilato
8acb06b609 Rename the forbiddenre authorizer's configuration token to avoid
confusing folks upgrading from ViewVC 1.0.x.

* lib/vcauth/forbiddenre/__init__.py
  (ViewVCAuthorizer.__init__): Look for a configuration option called
    "forbiddenre" instead of "forbidden".

* lib/config.py
  (_force_multi_value): Remove "forbidden" from this list, as we don't parse
    its value directly any more.

* docs/upgrading-howto.html
  Update the section about migrating forbiddenness settings.

* viewvc.conf.dist
  Rename the authz-forbidden.forbidden option to authz-forbidden.forbiddenre.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1836 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-18 21:08:19 +00:00
cmpilato
96be9c14cd Stop generating tarball URLs that are outside the URL namespace of the
repository with which they are associated, and use the Content-Disposition 
HTTP header to suggest names for tarball downloads.

* lib/viewvc.py
  (Request.get_link): No longer generate tarball URLs with the .tar.gz
    magic suffix.  We'll stick with explicit view=tar from now on.
  (download_tarball): Use the Content-Disposition HTTP header to
    dictate the recommended tarball name to browser agents.

Patch by: Martijn Ras <Martijn.Ras {at} gmail.com>
          me


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1835 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-17 23:34:55 +00:00
cmpilato
eda0309c55 * lib/vclib/ccvs/bincvs.py
(BaseCVSRepository.itemtype): Initialize the 'kind' variable to
    prevent referencing a non-existent variable.

Patch by: Stephane Chazelas <stephane_chazelas {at} yahoo.fr>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1834 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-04 17:28:30 +00:00
cmpilato
b03113f864 When I added the various view hrefs to the common template data (long
ago), I inadvertantly cross namespaces with the log view's use of
those variables as links to the HEAD versions of files.  Disambiguate
the head versions by renaming the data dictionary variables with head_
prefixes.

* lib/viewvc.py
  (view_log): Store HEAD href stuff in variables with "head_" prefixes
    so we don't clobber the global href variables.

* docs/upgrading-howto.html
  Note renames of annotate_href, download_href, download_text_href,
  prefer_markup, and view_href to head_annotate_href, head_download_href, 
  head_download_text_href, head_prefer_markup, and head_view_href
  (respectively).

* docs/template-authoring-guide.html,
* templates/include/log_header.ezt
  Track template variable renames.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1833 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-04 14:25:14 +00:00
cmpilato
5f8d6a1ff4 Truncate Subversion item log history if it dips into unreadable
(authz-wise) territory.  This should also filter unreadable revisions
from the annotate view, but I'm not as confident about that change.

* lib/vclib/svn/svn_repos.py
  (_get_history): Add 'path_type' parameter, rename 'full_name'
    parameter to 'path',  and truncate history at the first unreadable
    location (if any).
  (BlameSource.__init__): Pass 'first_rev' as the starting revision to
    the Subversion annotate logic, but leave a comment here questioning
    whether it was the right thing to do.
  (LocalSubversionRepository.itemlog): Update call to _get_history(),
    and filter unreadable copyfrom paths.
  (LocalSubversionRepository.annotate): Update call to _get_history().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1832 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-03 21:36:27 +00:00
cmpilato
8bc4d0109c Make some minor (though nice in terms of code readability)
optimizations to the way history is crawled in Subversion backends.

* lib/vclib/svn/svn_repos.py
  (NodeHistory): Make this into an iterable object instead of relying
    on a peek into a member variable.
  (NodeHistory.__init__): Make histories a list instead of
    dictionary.  We need the ordering.
  (NodeHistory.add_history): Validate the order in which revision info
    is received -- order matters now.
  (NodeHistory.__getitem__): New.
  (_get_history): Return the NodeHistory object, which is now iterable.
  (_log_helper): Swap the order of the 'path' and 'rev' parameters
    (for consistency).
  (_fetch_log): Merged into its only caller, which was ...
  (LocalSubversionRepository.itemlog): ...this.  Update the use of
    NodeHistory here to avoid unnecessary sorts and reverses and such.
  (LocalSubversionRepository.annotate): Update the use of NodeHistory here.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1831 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-03 21:00:45 +00:00
cmpilato
261db1bb7f * lib/vclib/svn/svn_repos.py
(LocalSubversionRepository.openfile, LocalSubversionRepository.listdir, 
   LocalSubversionRepository.dirlogs, LocalSubversionRepository.annotate): 
    Use self.itemtype() to pull off both an authz check as well as 
    kind-in-light-of-operation validation.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1830 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-03-03 20:35:19 +00:00
cmpilato
e1f287360a Add some missing module imports.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1829 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 16:14:15 +00:00
cmpilato
4395bc3b1c Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1828 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 16:11:24 +00:00
cmpilato
c58e82a6e2 Update the www/ area and CHANGES file in light of 1.0.5 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1827 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-28 15:49:20 +00:00
cmpilato
8916fe3969 Forward-port tweak to forbiddenre support made in r1817 on the 1.0.x branch.
* lib/vcauth/forbiddenre/__init__.py
  (ViewVCAuthorizer._check_root_path_access): Lose 'rootname' and
    'path_parts' parameters and logic to combine them; just accept the
    combined form as a new 'root_path' parameter.
  (ViewVCAuthorizer.check_root_access): Update call to 
    _check_root_path_access().
  (ViewVCAuthorizer.check_path_access): Do root and path combination
    here, and Update call to _check_root_path_access().

* viewvc.conf.dist
  (forbiddenre.forbidden): Update documentation and examples.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1818 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 21:07:06 +00:00
cmpilato
301281228b merge from 1.0.x -r1815, whose log message read thusly:
Fix the plus/minus line change counting in query results to ignore
   values from unreadable files.
   
   * lib/viewvc.py
     (build_commit): Calculate total plus/minus line change count for a
       given commit item (based on the sums of those values in
       non-forbidden file commits associated with it).
     (view_query): Update plus/minus line change count totals only
       *after* trimming unauthorized files
   
   * docs/template-authoring-guide.html
     (query_results): Note new commits.plus and commits.minus items; fix
       description of the plus_count and minus_count items.

While here, also:

* lib/viewvc.py
  (build_commit): Fix the authz check to use vclib.check_path_access,
    and feel vindicated by the fact that I actually found a use for
    that function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1816 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-25 19:32:21 +00:00
cmpilato
7ed848b084 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1813 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 15:11:27 +00:00
cmpilato
cf1f2ff5dd * viewvc.org/nightly/build-viewvc-snapshot
Completely rework this thing, in Python, to support more flexible branch
builds.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1812 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-22 14:49:12 +00:00
cmpilato
af559e2665 Fix a buglet that, for some reason, only shows up when viewing CVSROOT
directories.

* lib/vclib/ccvs/bincvs.py
  (_get_logs): Initialize CVSDirEntry item's lockinfo member to None.

* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.dirlogs): Initialize CVSDirEntry item's lockinfo
    member to None.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1808 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 21:59:45 +00:00
cmpilato
8dadbb3674 Honor hide_cvsroot more like the CVSROOT is forbidden than simply obscured.
* lib/viewvc.py
  (is_cvsroot_path): New helper function.
  (view_directory, generate_tarball, build_commit): Use is_cvsroot_path().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1806 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 21:41:17 +00:00
cmpilato
343ca81dbd * viewvc.conf.dist: Note that you can use this to hide roots, too.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1805 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 20:33:55 +00:00
cmpilato
0e129c4c77 Forward-port the r1800 bugfixes made in the 1.0.x branch, whose log
message read thusly:

   On the 1.0.x branch:
   
   Fix buglets (and minor security leak) related to the files attached
   to commit items in the query view and query.cgi script results.  These
   views still returned commit objects with all attached metadata even
   when all the files associated with that commit were blocked due to
   configured forbiddenness.  The generic query.ezt template masked this
   bug (because it was keyed on the files more so than on the commit
   items), but query_results.ezt revealed it.  Also, we were doing change
   limiting at the wrong time, so you'd get results that showed 2 files
   but read "Only first 5 files shown...".
   
   * lib/viewvc.py
     (build_commit): Trade the 'limited_files' parameter for a
       'max_files' parameter, and change the way file counting and
       filtering happens so we get accurate file counts and the maximum
       number of allowed files when limiting changes.  Now returns None
       if the would-be-returned commit item has no associated allowed
       files, and defers building of the commit item until necessary.
     (view_query): Don't do file limiting here, defer it to
       build_commit().  Also, watch for (and ignore) None returns from
       build_commit(), too.
   
   * lib/query.py
     (run_query): Strip out commits which have no associated files.
       Since commits in the query view are file-driven, the only way we
       could have a commit that has no files is if the files were
       stripped by forbiddenness checks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1804 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 20:26:58 +00:00
cmpilato
f535d8e599 Tweak authz changes a bit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1803 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-21 20:14:17 +00:00
cmpilato
08e86c9a45 Minor fixes required by new authz logic.
* lib/viewvc.py
  (_strip_suffix): If no path_parts are provided, return None.
  (Request.run_viewvc): Tweak the 404 error to, among other things,
    always have a leading slash on the path (so the empty path doesn't
    look so odd).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1799 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-15 20:50:22 +00:00
cmpilato
5a238e6a56 Tweak the contact summary a bit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1796 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-14 15:53:23 +00:00
cmpilato
6ac32c2f1b Put a link to the FAQ and open issues on the Contact page.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1795 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-14 15:48:35 +00:00
cmpilato
7cf7328238 * lib/vclib/svn/svn_repos.py
Tweak all uses of vclib.svn.core.* to be just core.*


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1794 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 21:34:31 +00:00
cmpilato
10fa46063c * lib/vclib/svn/svn_repos.py
(LocalSubversionRepository.dirlogs): Oops!  Fix a buglet caused by
    looking at the wrong revision-holding variable.
 

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1791 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 17:39:12 +00:00
root
02f7f5b203 Committed through web interface.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1790 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 03:47:13 +00:00
root
431e05efd2 auto commit for alm editor.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1789 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 03:47:13 +00:00
root
13a6a53f9d auto commit for alm editor.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1788 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-13 03:47:12 +00:00
cmpilato
3cbf07551b Finish issue #57 with more support for showing locked status.
* lib/vclib/__init__.py
  (Repository.dirlogs): Update comment.
  (Revision.__init__): Add 'lockinfo' parameter, used to populate
    similarly named class member.

* lib/vclib/svn/svn_repos.py
  (Revision.__init__): Add 'lockinfo' parameter, and update call to
    vclib.Revision().
  (_log_helper): Update call to Revision(), and lose custom lockinfo handling.
  (LocalSubversionRepository.dirlogs): Populate entry lockinfo with a
    call to svn_fs_get_lock() for each entry.

* lib/vclib/svn/svn_ra.py
  (LogCollector.__init__): Add 'lockinfo' parameter, used to populate
    similarly named class member.
  (LogCollector.add_log): Pass self.lockinfo to updated call to Revision().
  (RemoteSubversionRepository.itemlog): Pass lock info to
    LogCollector(), and lose custom lockinfo handling.
  (RemoteSubversionRepository.itemtype, RemoteSubversionRepository.listdir): 
    Update expected return value from _get_dirents().
  (RemoteSubversionRepository.dirlogs): Populate entry lockinfo from
    updated return value from _get_dirents().
  (RemoteSubversionRepository._get_dirents): Rework to trade in
    dirents and locks instead of only dirents.

* lib/vclib/ccvs/bincvs.py
  (Revision.__init__): Update call to vclib.Revision().
  (_get_logs): Add 'lockinfo' member to DirEntry() items.

* lib/vclib/ccvs/ccvs.py
  (InfoSink.__init__): Init lockinfo dictionary.
  (InfoSink.set_locker): New.
  (InfoSink.define_revision): Set lockinfo on Revision item.
  (InfoSink.set_revision_info): Populate DirEntry lockinfo from
    Revision lockinfo data.

* lib/viewvc.py
  (view_directory): Populate entry lockinfo.
  (common_template_data): Populate the 'lockinfo' data dictionary item.

* templates/directory.ezt,
* templates/dir_new.ezt
* templates/annotate.ezt,
* templates/markup.ezt
  Tweak to show lock status.

* docs/template-authoring-guide.html
  Note new data dictionary items.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1787 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 21:06:40 +00:00
cmpilato
d620498e9e Add support for display of locked status.
* docs/template-authoring-guide.html
  Document the new appearances of the lockinfo data.

* templates/log.ezt,
* templates/log_table.ezt
  Show lock status information.

* templates/docroot/images/lock.png
  New icon.

* lib/viewvc.py
  (view_log): Populate the log revision entry's new "lockinfo" member.

* lib/vclib/svn/svn_repos.py
  (_log_helper): Accept 'lockinfo' parameter, used to populate the
    similarly named member of the Revision() object.
  (_fetch_log): Query the lock status of the input path, and update
    calls to _log_helper().

* lib/vclib/ccvs/ccvs.py
  (CCVSRepository.itemlog): Update call to _file_log(), passing lockinfo.
  (TreeSink.__init__): Init new lockinfo dictionary.
  (TreeSink.set_locker): New.

* lib/vclib/ccvs/bincvs.py
  (_parse_log_header): Now parse and return lock information, too.
  (_file_log): Add 'lockinfo' parameter, used to populate the
    similarly named Revision() object members.
  (BinCVSRepository._get_tip_revision, BinCVSRepository.itemlog):
    Expect lockinfo back from _parse_log_header(), and pass to updated
    calls to _file_log().
  (_get_logs): Expect lockinfo back from _parse_log_header().

* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.itemlog): Use svn_client_ls3() to fetch
    lock information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1783 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 19:41:19 +00:00
cmpilato
2a9584a0fb Finish issue #238 by not making HTML out of short log messages in RSS
format mode.

* lib/viewvc.py
  (format_log): Now accept optional 'htmlize' parameter.
  (build_commit): Accept 'format' parameter, and use it to determine
    what value to pass for the 'htmlize' parameter of an updated call
    to format_log().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1779 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:29:28 +00:00
cmpilato
e6d8e1306d * bin/loginfo-handler,
* bin/cvsdbadmin
  Update calls to vclib.ccvs.CVSRepository() to account for new
  'authorizer' parameter.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1778 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:27:12 +00:00
cmpilato
34f764bc8f * lib/config.py
(Config.get_authorizer_params): Rework this to avoid Python 2.4-ism
    (dict.update() able to accept an iterable key/value sequence) and
    to favor root-specific parameters over general ones.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1777 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 15:02:41 +00:00
cmpilato
34e7003241 Minor typo fix.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1776 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-12 14:48:41 +00:00
cmpilato
cedb97c3d4 Finish issue #305 by allowing "markup" to be the configured default
file view.  This causes less-than-perfectly-compact URL generation in
some cases, but frankly, we'd have fewer URL-compatibility issues if
we hadn't been trying to discard information in the first place.

* lib/viewvc.py
  (Request.run_viewvc, Request.get_link): Honor "markup" as a valid value for
    default_file_view.

* viewvc.conf.dist
  (default_file_view): Note that "markup" is now a valid option here.

* CHANGES
  Record this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1775 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 22:16:00 +00:00
cmpilato
47ad6e149c Fix some minor oversights.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1774 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 22:11:16 +00:00
cmpilato
c7a392b75c Be so bold as to claim that the authz subsystem is in 1.1.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1773 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 21:14:02 +00:00
cmpilato
e0dff2601a Mostly unify the markup and annotate view logic. This does *not*
unify the views themselves; just the code that generates them.

* lib/viewvc.py
  (markup_or_annotate): New, carved from the guts of ...
  (view_markup, view_annotate): ... these, which are now just thin
    wrappers around markup_or_annotate().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1772 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 20:51:56 +00:00
cmpilato
fcf52b5c5f * lib/vclib/svn/svn_repos.py
(BlameSource._blame_cb): Increment the line number by 1;
    Subversion's annotate APIs are 0-based.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1771 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 20:47:11 +00:00
cmpilato
8f0623abc0 This is a cleanup commit, mostly around making sure that Repository.revinfo()
consistently returns a date, *not* a date string.

* lib/viewvc.py
  (_get_diff_path_parts): Fix the call to _path_parts to, you know,
    not reference bogus variables and actually use the value returned.

* lib/vclib/svn/svn_ra.py
  (LastHistoryCollector.add_history): Convert the date string to a real date.  
  (temp_checkout): Keep a handle on the name of the temporary file
    created, since that's what is returned by this function.
  (rawdiff): Look for Subversion exceptions in the proper namespace.

* lib/vclib/svn/svn_repos.py
  (_date_from_rev): Make this an inner function of rawdiff(), its only
    consumer.
  (_log_helper, LocalSubversionRepository.dirlogs): Don't convert the
    returned date.
  (LocalSubversionRepository._revinfo_raw): Return a date, not a date string.
  (BlameSource.__init__): Expect exceptions in the right namespace.
  (LocalSubversionRepository.rawdiff): Update call to _date_from_rev;
    expect exceptions in the right namespace.
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1770 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-11 16:53:20 +00:00
cmpilato
c3572f452c Fix a little buglet -- referencing a non-existant object.
* lib/vclib/svn/svn_ra.py
  (RemoteSubversionRepository.open): Use self.ctx.*, not just ctx.*

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1769 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-07 22:53:16 +00:00
cmpilato
a9243564bb * INSTALL: Recommend adding ViewVC to the site-wide robots.txt file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1765 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-07 02:20:24 +00:00
cmpilato
b049f1dca8 * viewvc.conf.dist
(authorizer): Update comment to describe provided authorizers and
    mention forbiddenre.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1764 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 21:21:00 +00:00
cmpilato
057ab0fe25 Introduce a new authz module, like 'forbidden' but with support for
checking all roots and paths against regular expressions.

* viewvc.conf.dist
  (forbidden): New authz-forbiddenre section.

* lib/vcauth/forbiddenre,
* lib/vcauth/forbiddenre/__init__.py
  New authorizer based on simple regular expressions.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1763 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 21:16:51 +00:00
cmpilato
220792f72c Merge to trunk all the changes from the 'vcauth-reorg' branch as of
r1761, which see for logs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1762 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 19:22:53 +00:00
cmpilato
c696f32d70 * lib/config.py
(Config.set_defaults): Clear the default admin address.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1758 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-02-06 17:48:45 +00:00
cmpilato
3a8717b11d Formatting and comment changes only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1750 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-28 17:55:44 +00:00
cmpilato
edaae720da * lib/viewvc.py
(Request.__init__): Stop calculating and storing the 'may_compress'
    and 'no_file_links' values -- we don't use them anywhere!

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1749 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-28 17:46:23 +00:00
cmpilato
eb363507cb * INSTALL
Note that we now expect source-highlight 2.6.

* templates/docroot/styles
  Add style definitions to match the style names used by
  source-highlight.

* lib/viewvc.py
  (MarkupSourceHighlight.__init__): Use the 'xhtml-css' output format,
    and pass the --quiet option to suppress any noise that would
    wind up on stderr.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1748 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-24 22:02:19 +00:00
cmpilato
44f0356312 Try to use Python's gzip module for the tarball generation view, thus
reducing the list of binary dependencies by one for users of ... well,
any Python version that I could find as of at least 1.5.2.

TODO:  Are there any versions of Python supported by ViewVC in general
that don't provide the 'gzip' module?  Should we just rip out the use
of the external binary altogether?

(This was tracked in issue #319.)

* lib/viewvc.py
  (download_tarball): Use Python's gzip module if available, only
    falling back to a pipe through the gzip binary if it isn't.

* viewvc.conf.dist
  (cfg.utilities.gzip): Note that this setting is optional if Python
    provides the 'gzip' module.

Patch by: Gabriel Genellina <ggenellina@tigris.org>
(Tweaked by me.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1747 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-24 19:40:37 +00:00
cmpilato
d966338c1d Add an href to the root listing view to the common template data dictionary.
* lib/viewvc.py
  (common_template_data): Calculate and add 'roots_href' to the dictionary.

* templates/include/header.ezt
  Use new 'roots_href' data dictionary item.

* docs/template-authoring-guide.html
  Note this new dictionary member.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1746 8cb11bc2-c004-0410-86c3-e597b4017df7
2008-01-10 19:21:26 +00:00
cmpilato
8f49d24d7f Add some hints to INSTALL about getting Subversion and its bindings.
Suggested by user 'johnkw' in IRC.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1745 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-12-04 17:43:18 +00:00
cmpilato
aa6b9dcf8e Merge changes (r1735:1738) from the (misnamed) options-overhaul
branch.  This reduces the number of vclib plugins to two -- one for
each of CVS and Subversion.

* lib/viewvc.py
  (): Update callers of vclib.svn.created_rev(), vclib.svn.get_location(),
    vclib.svn.get_youngest_revision(), and vclib.svn.last_rev() to use
    request.repos.* instead.
  (Request.run_viewvc): For CVS, invoke only
    vclib.ccvs.CVSRepository(), but pass the use_rcsparse setting to
    it.  For Subversion, invoke only vclib.svn.SubversionRepository().

* lib/vclib/ccvs/ccvs.py
  Renamed from lib/vclib/ccvs/__init__.py, and tweaked to look for
  stuff common to the bincvs implementation in the sibling 'bincvs'
  module.

* lib/vclib/ccvs/__init__.py
  New, a replacement by a new stub file with a factory function
  that selects which CVS implementation to use.

* lib/vclib/ccvs/bincvs.py
  Moved from lib/vclib/bincvs/__init__.py.

* lib/vclib/bincvs
  Removed (it's now empty).

* lib/vclib/svn/svn_repos.py
  Renamed from lib/vclib/svn/__init__.py.
  (LocalSubversionRepository.created_rev,
   LocalSubversionRepository.get_location,
   LocalSubversionRepository.get_youngest_revision, 
   LocalSubversionRepository.last_rev): Moved into the class from outside.

* lib/vclib/svn/svn_ra.py
  Moved from lib/vclib/svn_ra/__init__.py.
  (RemoteSubversionRepository.created_rev,
   RemoteSubversionRepository.get_location,
   RemoteSubversionRepository.get_youngest_revision, 
   RemoteSubversionRepository.last_rev): Moved into the class from outside.

* lib/vclib/svn/__init__.py
  New, replacing previous incarnation with a file that contains only a
  single factory function.

* lib/vclib/svn_ra/
  Removed (it's now empty).

* bin/loginfo-handler
  (ProcessLoginfo): Now use vclib.ccvs.CVSRepository(), disabling use_rcsparse.

* bin/cvsdbadmin
  (__main__): Now use vclib.ccvs.CVSRepository(), disabling use_rcsparse.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1739 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-12-03 15:25:51 +00:00
mhagger
37373d8ab2 Change the way that rcsparse components are imported in run-tests.py.
The new method will work even if the contents of the "rcsparse"
directory are stored to a directory with a different name (as is the
case, for example, in cvs2svn).

* lib/vclib/ccvs/rcsparse/run-tests.py: Change how rcsparse.parse()
  and parse_rcs_file.LoggingSink are imported.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1734 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 22:59:09 +00:00
mhagger
5ab76ea1cf Change the way that rcsparse.parse() is imported in parse_rcs_file.py.
The new method will work even if the contents of the "rcsparse"
directory are stored to a directory with a different name (as is the
case, for example, in cvs2svn).

* lib/vclib/ccvs/rcsparse/parse_rcs_file.py: Change how
  rcsparse.parse() is imported.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1733 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 22:53:35 +00:00
mhagger
0e6c162246 Add method _Parser._read_until_semicolon(), and use it in other methods.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._read_until_semicolon):
  New method.

  (_Parser._parse_admin_access, _Parser._parse_rcs_tree_entry): Use
  the new method.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1732 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:15:27 +00:00
mhagger
1f2a3399ea Fix and simplify the handling of dates in _Parser._parse_rcs_tree_entry().
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
  Adjust the handling of dates to conform more strictly to
  rcsparse(5), and simplify logic a bit.

* lib/vclib/ccvs/rcsparse/test-data/default,v,
  lib/vclib/ccvs/rcsparse/test-data/default.out: Change test case to
  include dates before the year 2000.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1731 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:13:53 +00:00
mhagger
53b48c9b4f Don't carry zeros along in date tuple.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
  Append zeros to the end of the date tuple only when they are needed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1730 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:05:16 +00:00
mhagger
e906090e8c Simplify _Parser._parse_rcs_tree_entry().
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
  Simplify logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1729 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:01:16 +00:00
mhagger
af7956447b Extract method _Parser._parse_rcs_tree_entry().
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_rcs_tree_entry):
  New method, extracted from parse_rcs_tree().

  (_Parser.parse_rcs_tree): Use new method.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1728 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 21:00:21 +00:00
mhagger
939c980e5b Simplify _Parser._parse_admin_access().
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_access):
  Simplify logic and use list.append(x) instead of "list = list +
  [x]".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1727 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:59:01 +00:00
mhagger
7a8d3c0453 Rename some local variables to better describe their uses.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_access,
  _Parser._parse_admin_symbols, _Parser._parse_admin_locks): Rename
  local variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1726 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:58:00 +00:00
mhagger
7e0b5d2a9c Use match() to handle semicolons when possible.
This simplifies the code without a measureable performance cost.

* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head,
  _Parser._parse_admin_branch, _Parser._parse_admin_comment,
  _Parser._parse_admin_expand): Use the token scanner's match() method
  to handle semicolons.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1725 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:57:02 +00:00
mhagger
d7c87b8b2f Change the token stream match() methods to raise RCSExpected exceptions.
Previously, they raised a naked RuntimeError.  This change should be
harmless because nobody seems to catch these exceptions specifically.

* lib/vclib/ccvs/rcsparse/default.py (_TokenStream.match): Raise
  RCSExpected exception in the case of a mismatch.

* lib/vclib/ccvs/rcsparse/texttools.py (_mxTokenStream.match): Raise
  RCSExpected exception in the case of a mismatch.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1724 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:56:26 +00:00
mhagger
8087c0e643 Improve the error message for RCSExpected exceptions.
* lib/vclib/ccvs/rcsparse/common.py (RCSExpected.__init__): Improve
  the error message passed to the base class constructor.  Also
  improve spacing around the exception class definitions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1723 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:53:40 +00:00
mhagger
4c04da27da Simplify the logic in texttools._mxTokenStream.match() (remove duplicate code).
* lib/vclib/ccvs/rcsparse/texttools.py (_mxTokenStream.match):
  Remove duplicate code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1722 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:52:39 +00:00
mhagger
34f76bdc87 Handle files with empty "delta" (a.k.a., "tree") part.
According to rcsfile(5), there don't have to be any deltas in an RCS
file.  File without deltas can be created using "rcs -i -t- foofile".
This change allows rcsparse to handle such files.

This change might help fix cvs2svn Issue #80:
http://cvs2svn.tigris.org/issues/show_bug.cgi?id=80

* lib/vclib/ccvs/rcsparse/common.py (_Parser.admin_token_map): Add an
  entry for "desc" (because if the tree is empty, the next thing
  encountered after the administrative information is "desc").

  (_Parser.parse_rcs_admin): Terminate loop if "desc" is seen.

* lib/vclib/ccvs/rcsparse/test-data/empty-file,v,
  lib/vclib/ccvs/rcsparse/test-data/empty-file.out: Add a test RCS
  file with no contents to test data, and the results expected when
  parsing the file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1721 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:51:40 +00:00
mhagger
57bf0cb554 Handle a "head" keyword with no revision number.
According to rcsfile(5), this is allowed.  In this situation, don't
invoke the set_head_revision() callback at all.

* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head): Handle
  the case that the "head" keyword doesn't list a revision.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1720 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:49:38 +00:00
mhagger
9adcdfae2f Remove dead code.
* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin): Remove
  dead code (the only way to escape from the loop is via "return").


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1719 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:47:29 +00:00
mhagger
075b580fdb Rewrite _Parser.parse_rcs_admin() to use a token lookup table.
* lib/vclib/ccvs/rcsparse/common.py (_Parser._parse_admin_head,
  _Parser._parse_admin_branch, _Parser._parse_admin_access,
  _Parser._parse_admin_symbols, _Parser._parse_admin_locks,
  _Parser._parse_admin_strict, _Parser._parse_admin_comment,
  _Parser._parse_admin_expand): New methods (one for each keyword that
  can appear in the admin section).

  (_Parser.admin_token_map): A map from keyword name to the method
  used to handle that keyword.

  (_Parser.parse_rcs_admin): Look up the keyword tokens in the map
  instead of using a big "if" statement.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1718 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:46:46 +00:00
mhagger
ae57f73e2f Separate handling of the "strict" keyword into a separate "if" branch.
This makes the keyword handling more uniform.

* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin):
  Separate handling of the "strict" keyword into a separate "if"
  branch.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1717 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:46:03 +00:00
mhagger
a70372d2ed Reorder definitions in the approximate order that they will be called.
Order the callbacks in Sink and the "if" branched in parse_rcs_admin()
in the approximate order that they will be encountered.

* lib/vclib/ccvs/rcsparse/common.py (Sink): Reorder method definitions.

  (_Parser.parse_rcs_admin): Reorder "if" statement branches.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1716 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-18 20:45:09 +00:00
cmpilato
9ce172e673 Welcome aboard, Michael.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1715 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:53:25 +00:00
cmpilato
bac09990f6 Fix a syntax error that was preventing compilation.
Submitted by: Michael Haggerty <mhagger@alum.mit.edu>

* tparse/tparse.h 
  (rcstoken::init): Fix declaration.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1714 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:49:22 +00:00
cmpilato
e2b783a403 * lib/vclib/ccvs/rcsparse/parse_rcs_file.py
Set svn:executable property for this file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1713 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:44:12 +00:00
cmpilato
db6fbcdf1f Add a very primitive testing infrastructure for rcsparse, and the first test.
Submitted by: Michael Haggerty <mhagger@alum.mit.edu>

* lib/vclib/ccvs/rcsparse/run-tests.py: New file.

* lib/vclib/ccvs/rcsparse/test-data/default,v,
* lib/vclib/ccvs/rcsparse/test-data/default.out
  Test data for a simple test.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1712 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:42:56 +00:00
cmpilato
fcf688c20c Add a new test/demonstration script.
Submitted by: Michael Haggerty <mhagger@alum.mit.edu>

This script was taken from the cvs2svn project, http://cvs2svn.tigris.org.

* lib/vclib/ccvs/rcsparse/parse_rcs_file.py: New demonstration script;
  illustrates the use of the rcsparse API.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1711 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-11-16 09:39:14 +00:00
cmpilato
6c7de54d87 * viewvc.org/faq.html
Add a FAQ entry for the "...but none match the current selection
  criteria" error.  Suggested by user "brasko" in IRC today.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1710 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-10-30 21:43:56 +00:00
cmpilato
94017f01e8 * docs/upgrading-howto.html
Add a note about the change to 'svndbadmin rebuild'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1709 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-10-09 13:21:13 +00:00
cmpilato
2856ac9ebc * viewvc.org/faq.html
(missing-files): Start answering this question.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1708 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-10-01 18:20:52 +00:00
cmpilato
525523e465 Prevent Exception when generating tarballs for remote Subversion
repositories.

* lib/vclib/svn_ra/__init__.py
  (SelfCleanFP.read): Add default parameter value for 'len' argument.

Patch by: Ceri Storey <cez@necrofish.org.uk>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1706 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-09-14 13:02:21 +00:00
cmpilato
7d4ce47182 * bin/cvsdbadmin,
* bin/svndbadmin
  (usage): Make it clear that the REPOSITORY command-line argument
    is a path to a repository (as opposed to a ViewVC rootname or
    relative URL or something else).

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1703 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-08-16 17:26:49 +00:00
cmpilato
efad0b6cd6 Add FAQ-n-A about RSS feeds.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1702 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-30 15:48:22 +00:00
cmpilato
3d6f1cc7d1 Finish issue #309: add links from diff view to revision views.
* lib/viewvc.py
  (view_diff): Rework the data dictionary: provide 'left' and 'right'
    container objects with members for stuff related to the files on
    the left and right side of the diff.  Also, add the usual
    per-file-revision view links to those containers, too.

* templates/diff.ezt
  Track the data dictionary changes, and add links to the preferred
  file views for each revision.

* docs/template-authoring-guide.html,
* docs/upgrading-howto.html
  Note template changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1701 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-26 20:56:10 +00:00
cmpilato
3d7b8a7a1a * docs/upgrading-howto.html
Followup to r1699, noting new 'rss_link_href' data dictionary item.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1700 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-26 20:44:41 +00:00
cmpilato
ed5898c37d Finish issue #307: RSS feeds should include a <channel><link> element.
* lib/viewvc.py
  (Request.get_url): Add new 'prefix' parameter, used to toggle
    whether or not the generated URL has the protocol and server name
    portions of the URL.  Move code from build_commit() to handle the
    prefix-inclusive case.
  (build_commit): Move URL prefix-generating code to
    Request.get_url(), and simply call that function with the new
    'prefix' option set.
  (view_query): Add new 'rss_link_href' data dictionary item.

* templates/rss.ezt
  Add <channel><link> bit to the output stream, populated with the new
  'rss_link_href' data dictionary item.

* docs/template-authoring-guide.html
  Add documentation for the new 'rss_link_href' data dictionary item,
  and note that query results also use rss.ezt.
  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1699 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-26 18:55:15 +00:00
cmpilato
c487361c95 Note some completed enhancements.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1698 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-20 14:31:31 +00:00
cmpilato
b037efb91e Add a FAQ item about path-based authz.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1697 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-13 19:18:22 +00:00
cmpilato
29057c811f Finish issue #306 - RSS content type should be more specific.
* lib/viewvc.py
  (view_query): Use "application/rss+xml" instead "text/xml" for 
    the RSS feed output stream's content type.  Suggested by 
    Phil Ringnalda <philringnalda@tigris.org>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1695 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-09 18:18:01 +00:00
cmpilato
8ca49db267 * viewvc.org/faq.html
(standalone-only): New question and answer about why stuff sometimes
    works under standalone.py but not under Apache with the same
    configuration.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1694 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-05 16:59:51 +00:00
cmpilato
d4e115bd3a * viewvc.org/faq.html
Answer the "no module named svn" question.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1693 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-05 16:22:16 +00:00
cmpilato
d09280ce6b * viewvc.org/faq.html
Reformat "questions" as (of all things) questions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1692 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-05 16:19:55 +00:00
cmpilato
98aeeab676 * viewvc.org/faq.html
Populate the answer to the "missing temporary directory" question.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1691 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-05 16:09:23 +00:00
cmpilato
061b30a108 * viewvc.org/styles.css
(faq-section): New style name.

* viewvc.org/faq.html
  Make h3's bear the new faq-section style.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1690 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-07-05 16:04:13 +00:00
cmpilato
01baf48a1b Update the vhosts config example to not use 'cvs' and 'svn' in vhost names.
This was too easily confused with root type declarations.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1688 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-28 15:54:49 +00:00
cmpilato
46e7cdf817 * templates/rss.ezt
For issue #238, properly XML-entity-encode the log message embedded
  in RSS feed items.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1686 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-27 17:41:57 +00:00
cmpilato
703327df1c Implement a more-or-less generic global revision info function in the
vclib.Repository interface, and adapt the Subversion vclib modules to
implement it.

* lib/vclib/__init__.py
  (ADDED, DELETED, REPLACED, MODIFIED): New static variables.
  (Repository.revinfo): New function.
  (ChangedPath): New class.
  (UnsupportedFeature): New exception type.

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.revinfo): New (just raises vclib.UnsupportedFeature).

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.revinfo): New (just raises vclib.UnsupportedFeature).

* lib/vclib/svn/__init__.py
  (SVNChangedPath): Was ChangedPath, now is a subclass of vclib.ChangedPath.
  (SubversionRepository.revinfo): Was get_revision_info().  Rework to
    use SVNChangedPath items.

* lib/vclib/svn_ra/__init__.py
  (): Import SVNChangedPath instead of ChangedPath.
  (LastHistoryCollector.add_history): Rework to use SVNChangedPath items.
  (SubversionRepository.revinfo): Was get_revision_info().

* lib/viewvc.py
  (view_revision): Rework this to use Repository.revinfo()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1685 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-27 16:41:03 +00:00
cmpilato
da80a5898a Minor code cleanups (doing in vclib.svn_ra what I recently did in vclib.svn).
* lib/vclib/svn_ra/__init__.py
  (get_logs): Merge this (and delete it) ...
  (SubversionRepository.dirlogs): ... into here.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1684 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-27 15:04:39 +00:00
cmpilato
2601c02f5d Minor code cleanups.
* lib/vclib/svn/__init__.py
  (get_logs): Merge this (and delete it) ...
  (SubversionRepository.dirlogs): ... into here.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1683 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-27 14:58:30 +00:00
cmpilato
ad877bd5a5 Minor code simplification.
* lib/vclib/svn_ra/__init__.py
  (SubversionRepository.__init__): Trade a bunch of list.append() calls for
    a static initializition of the list.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1682 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-27 14:24:56 +00:00
cmpilato
2fe022c3a4 * viewvc.conf.dist,
* lib/config.py
  Re-sync (and re-order) the options listed in the sample configuration file
  and the Config object.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1681 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-20 13:25:18 +00:00
cmpilato
f40a836c23 * lib/vcauth/forbidden/__init__.py
(ViewVCAuthorizer.__init__): Don't assume that the 'forbidden' parameter
    is present.  Noticed by Vairoj Arunyaangkul <va@waveman.com>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1680 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-20 13:23:52 +00:00
cmpilato
c791123a08 Add FAQ item for 'COMalformedOutput: ...' as suggested by Heather
Gordon <hgordon@shutterfly.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1679 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-15 18:27:17 +00:00
cmpilato
be4ee9d817 For issue #303, duplicate the commented-out LD_LIBRARY_PATH setting
code from view_cvsgraph() into view_cvsgraph_image(), too, and
cross-reference them in the surrounding comments.

* lib/viewvc.py
  (view_cvsgraph_image): Add commented-out LD_LIBRARY_PATH set, just
    like what's in view_cvsgraph().
  (view_cvsgraph): Update comment and example.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1678 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-15 14:08:18 +00:00
cmpilato
889b3cdb0e Fix some webstuffs spelling oopses.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1677 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-15 13:19:20 +00:00
cmpilato
e1f3b9f4f7 Tweak the tigris.org left-nav a bit.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1676 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-15 13:17:13 +00:00
cmpilato
5c26dab649 Flesh out the 'rlog output ended early' answer.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1675 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-15 12:57:05 +00:00
cmpilato
c089f3bd73 Website tweaks to support the FAQ page.
* viewvc.org/styles.css
  Tweak (and add) styles.

* viewvc.org/who.html
* viewvc.org/index.html
* viewvc.org/contributing.html
* viewvc.org/download.html
* viewvc.org/contact.html
* viewvc.org/nightly/build-viewvc-snapshot
  Add some more CSS-able <div>'s, and add links to the FAQ page.

* viewvc.org/faq.html
  Flesh out a little more the layout of this document, and add our first
  answer!

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1674 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-14 12:29:31 +00:00
cmpilato
01b87f562e The disconnected query interface throws all the root-centric handling
convention of ViewVC into a tizzy, so rework the way the auth handling
stuff works there.  We'll get root-specific handling of 'forbidden'
out of this as a result.

* lib/query.py
  (is_forbidden): New.
  (build_commit): Lose the 'auth' parameter, and call is_forbidden to
    determine if a given result may be displayed.
  (run_query): No longer grab an Authorizer object.  Update calls to
    build_commit().




git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1673 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-06 20:32:17 +00:00
cmpilato
d421c3bc22 For issue #290 - Re-work the way email address mangling is managed to
prevent mangling inside file contents.  Why?  Because file contents
should be sancred, and besides, we can't control what our various
syntax highlighting programs will do with such addresses anyway.

* lib/viewvc.py
  (htmlify): Lose 'cfg' parameter; add 'mangle_email_addrs'.
  (format_log, view_markup, view_log, view_annotate, view_revision,
   build_commit): Update call to htmlify, using the configured value
    for mangle_email_addresses.
  (copy_stream, view_diff, english_query, view_error): Update call to
    htmlify, with email address mangling disabled.
  (DiffSource._format_text): Was spaced_html_text().  Update call to
    htmlify(), with email address mangling disabled.

* viewvc.conf.dist
  (mangle_email_addresses): Note that this doesn't affect the display
    of file contents.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1672 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-04 16:50:06 +00:00
cmpilato
53e1cd8f30 Add email address mangling feature to CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1671 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-01 20:05:39 +00:00
cmpilato
6c80a17d45 Finish issue #290 - Introduce an option for mangling email addresses.
* viewvc.conf.dist
  (mangle_email_addresses): New option.

* lib/config.py
  (Config.set_defaults): Set defaults for new 'mangle_email_addresses'
    option.

* lib/viewvc.py
  In various functions, use 'cfg = request.cfg' to enhance readability.
  (htmlify): Add 'cfg' parameter.  Callers updated.  Honor the new cfg
    option 'mangle_email_addresses', showing only "username@..." when
    mangling.
  (copy_stream, MarkupPipeWrapper.__init__, MarkupShell.__init__): Add
    'cfg' parameter.  All callers updated.
  (MarkupEnscript.__init__, MarkupHighlight.__init__): Squirrel away
    the 'cfg' parameter.

* docs/upgrading-howto.html
  Note the new mangle_email_addresses option.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1670 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-01 20:03:56 +00:00
cmpilato
b5b1272ebb Add some notes on improving the vclib API.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1669 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-06-01 18:12:12 +00:00
cmpilato
8b0b3632ac Improve the vcauth stuffs error handling logic a bit.
* lib/viewvc.py
  (setup_authorizer): Rework this for tighter exception handling.

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer.__init__): Don't reveal server paths in the
    file-not-found exception.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1668 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-25 13:32:55 +00:00
cmpilato
3abdb58fc1 Fix the vcauth interactions of the tarball generation code.
* lib/viewvc.py
  (generate_tarball): Check every path -- not just top-level
    subdirectories -- for authorization.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1667 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-24 20:09:21 +00:00
cmpilato
65de16dd8f * lib/vcauth/forbidden/__init__.py
(): import vclib (so trying to use it later doesn't make bad stuff happen)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1666 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-21 14:45:00 +00:00
cmpilato
feca32c985 For issue #268: Merge the Authorizers' check_directory_access() and
check_file_access() functions into a single check_path_access().  Most
authorizers won't need to care about the distinction.

* lib/vcauth/__init__.py
  (GenericViewVCAuthorizer.check_path_access): New, replaces ...
  (GenericViewVCAuthorizer.check_file_access,
   GenericViewVCAuthorizer.check_directory_access): ...these
    now-removed functions.
  (ViewVCAuthorizer.check_path_access): New.
  (ViewVCAuthorizer.check_file_access,
   ViewVCAuthorizer.check_directory_access): Removed.

* lib/vcauth/forbidden/__init__.py
  (ViewVCAuthorizer.__init__): Squirrel away 'root' so we can use it ...
  (ViewVCAuthorizer.check_path_access): ...here.  Was
    check_directory_access(), and now optionally checks the path's type
    before making the access determination.
  (ViewVCAuthorizer.check_file_access): Removed.

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer.check_path_access): Was _check_path_access().  Add
    'rev' parameter.
  (ViewVCAuthorizer.check_file_access,
   ViewVCAuthorizer.check_directory_access): Removed.

* lib/viewvc.py
  (Request.run_viewvc, view_directory, _get_diff_path_parts,
   generate_tarball, view_revision, build_commit): Use the
    authorizor's check_path_access() instead of the now-removed
    check_directory_access() and check_file_access() functions.

* lib/query.py
  (build_commit): Use check_path_access() instead of
    check_directory_access().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1661 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-15 20:18:56 +00:00
cmpilato
c3bd8d5aea Consistify blockquote stylation, and update cvsweb link.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1660 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-15 18:38:24 +00:00
cmpilato
fc2e5b9bd1 Update URL for PEP 8.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1659 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-15 18:01:39 +00:00
cmpilato
9e64e86927 Remove vcauth/test module.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1657 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-14 19:44:30 +00:00
cmpilato
a98023499d Pass the Repository object to the vcauth modules so they can more
easily query the repository for information.

* lib/vcauth/__init__.py
  (GenericViewVCAuthorizer.__init__): Lose 'rootpath', 'roottype', and
    'rootname' for just 'root', so the authz modules can make queries
    of the backing VC system as necessary.

* lib/vcauth/forbidden/__init__.py
  (ViewVCAuthorizer.__init__): Lose 'rootpath', 'roottype', and
    'rootname' for just 'root'.

* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer.__init__): Lose 'rootpath', 'roottype', and
    'rootname' for just 'root'.

* lib/viewvc.py
  (Request.run_viewvc): Update call to setup_authorizer().
  (setup_authorizer): Lose 'rootpath', 'roottype', and 'rootname' for
    just 'root'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1655 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-10 21:44:28 +00:00
cmpilato
2ce86a5227 Ensure that vclib.Repository objects are aware of their name, path,
and type by forcing them to implement functions which query those
pieces of information.

* lib/vclib/__init__.py
  (Repository.rootname, Repository.rootpath, Repository.roottype): New.

* lib/vclib/bincvs/__init__.py
  (CVSRepository.rootname, CVSRepository.rootpath,
    CVSRepository.roottype): New.

* lib/vclib/svn/__init__.py
  (SubversionRepository.rootname, SubversionRepository.rootpath,
    SubversionRepository.roottype): New.
  
* lib/vclib/svn_ra/__init__.py
  (SubversionRepository.rootname, SubversionRepository.rootpath,
    SubversionRepository.roottype): New.

* lib/viewvc.py
  (Request.run_viewvc): Ask the Repository object for its roottype(),
    and translate the vclib value into a string.  (It would be nice to
    use the vclib value throughout the codebase, but not today.)

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1654 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-10 20:47:27 +00:00
cmpilato
5a5e3755f6 * lib/vcauth/svnauthz/__init__.py
(ViewVCAuthorizer.__init__): Look for the read ('r') code instead
    of trying to match specific permission strings ('r', 'rw', ...).
    Hopefully this gives us a little better resilience if Subversion grows
    more authz codes.  Suggested by Jan Grant <jan.grant@bristol.ac.uk>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1653 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-10 17:00:57 +00:00
cmpilato
10a2463c9f * lib/vcauth/svnauthz/__init__.py
(ViewVCAuthorizer.__init__): Perform some minor logic optimizations
    and cleanups.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1652 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-09 22:16:41 +00:00
cmpilato
abb8486da4 * lib/vcauth/svnauthz/__init__.py
(ViewVCAuthorizer.__init__): Fix a logic bug in access rights
    determination.  Patch by Jan Grant <jan.grant@bristol.ac.uk>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1651 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-09 22:06:00 +00:00
cmpilato
f5defb51ae Fix parse of multi-user svnauthz groups.
* lib/vcauth/svnauthz/__init__.py
  (ViewVCAuthorizer._process_group): Fix a usage of string.strip()
    where string.split() was intended.  Noticed by 
    Jan Grant <jan.grant@bristol.ac.uk>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1650 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-09 15:42:37 +00:00
cmpilato
0f57c5b5e3 Remove reference to merged-and-removed authz-dev branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1646 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-03 18:22:19 +00:00
cmpilato
0d6e57a823 * viewvc-install
(TREE_LIST): Install the contributed templates, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1644 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-03 18:02:36 +00:00
cmpilato
ed4c21c012 * lib/viewvc.py
Fix some long lines.  No functional changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1643 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-05-03 18:01:56 +00:00
cmpilato
e5d47a1314 * lib/viewvc.py
(view_directory): Move the tarball_href calculation from here...
  (common_template_data): ...to here (which I thought I'd already done...)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1633 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-28 23:06:49 +00:00
cmpilato
5321434ca4 * bin/loginfo-handler
(Cvs1Dot12ArgParse): Handle the imported sources case, too.  Thanks to
    Mark Keisler <mark@mitsein.net> for pointing this out in IRC today.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1627 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-26 19:36:46 +00:00
cmpilato
dc19cf90ba Merge the authz-dev branch work into trunk. Let's let the pluggable authz
subsystem go mainstream!

* notes/authz-dev-TODO
* lib/vcauth/*
  New, copied from the authz-dev branch.

* viewvc.conf.dist
* lib/viewvc.py
* lib/query.py
* lib/debug.py
  Merge changes from the authz-dev branch.

* lib/config.py
  Merge changes from the authz-dev branch.  Also, make 'forbidden' the
  default value for 'authorizer'.

* docs/upgrading-howto.html
  Add sections about handling forbidden modules.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1623 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-25 20:07:13 +00:00
cmpilato
fac695eec4 Add an externals definition which pulls in contributed template sets
for ViewVC 1.1.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1621 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-25 19:41:15 +00:00
cmpilato
93696bc9c2 * docs/upgrading-howto.html
Don't refer to "ViewCVS 1.0".  It was "ViewVC 1.0".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1618 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-18 16:00:37 +00:00
cmpilato
141419f852 * lib/blame.py
(make_html): Not that I think anybody actually cares, but fix this
    function to generate HTML properly.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1617 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-17 21:38:33 +00:00
cmpilato
e1f28b1bc0 * lib/viewvc.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/ccvs/blame.py
* lib/blame.py
* lib/popen.py
  Replace stray tabs with spaces.  (Hopefully) no logic changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1616 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-17 21:07:33 +00:00
cmpilato
ee45fd32af * lib/config.py
(Config.load_config): Stash a reference to the primary
    ConfigParser() object.
  (Config.overlay_root_options): Use the stashed ConfigParser()
    reference instead of re-parsing the configuration file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1612 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-17 03:47:34 +00:00
cmpilato
6982bbc7b0 Use forward-slash (/) as the separator in config section names between
override groupings and the base configuration section that is being
overridden.  Why?  Besides revealing a clear heirachy of information
(which seems more intuitive to me, at least), I anticipate it being
helpful for disambiguation later, especially since neither vhosts nor
root names should have forward slashes in them.

* viewvc.conf.dist
  (vhosts): Tweak the inline comments in accordance with this new plan.

* lib/config.py
  (Config._process_vhost, Config._process_root_options): Expect a
    forward slash (/) character where a hyphen (-) was previously
    expected.

* docs/upgrading-howto.html
  Update upgrade documentation with these changes.

* CHANGES
  Note that per-root configuration overrides are now supported.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1609 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-16 23:59:09 +00:00
cmpilato
204c6eb21c Add support for per-root option overrides using sections named
root-ROOTNAME-CONFIGSECTION.

In order to keep the configuration section naming conventions
consistent, change the way virtual host override sections are named
from VHOSTNAME-CONFIGSECTION to vhost-VHOSTNAME-CONFIGSECTION.

* lib/config.py
  (Config.load_config): Add optional 'rootname' parameter.  Actually
    make use of self.conf_path.  If there is a rootname provided,
    overlay per-root options.
  (Config._process_vhost): Now expect vhost section names to begin
    with the prefix "vhost-".
  (Config._find_canon_vhost): Minimize some logic.
  (Config.overlay_root_options, Config._process_root_options): New.
  (ViewVCConfigurationError, IllegalOverrideSection): New.
  (MalformedRoot): Now inherit from ViewVCConfigurationError.
  
* lib/viewvc.py
  (Request.run_viewvc): Once the rootname is determined, overlay
    per-root configuration options.

* viewvc.conf.dist
  (vhosts): Update vhosts docs and examples to note the new "vhost-"
    section name prefix.

* docs/upgrading-howto.html
  Note the change in vhost override section naming expectations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1607 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-16 14:54:01 +00:00
cmpilato
0c773e789b Finish issue #287 by ensuring that in a clash of root names, the
first-listed, cvs_roots-found, CVS repository wins.

* lib/query.py
  (run_query): Ensure that in a rootname clash situation, the CVS
    repository wins.

* lib/viewvc.py
  (list_roots): Ensure that in a rootname clash situation, the CVS
    repository wins.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1605 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-13 09:14:12 +00:00
cmpilato
63aba8c173 Move the 'use_rcsparse' option from 'general' to 'options'.
* viewvc.conf.dist
  (use_rcsparse): Move this from the 'general' section to the
    'options' section.

* lib/config.py
  (Config.set_defaults): Track the move of the 'use_rcsparse' section.

* lib/viewvc.py
  (Request.run_viewvc): Track the move of the 'use_rcsparse' section.

* docs/upgrading-howto.html
  Note the option changes, and re-work the upgrading-from-1.0.0 option
  changes section a little bit while I'm here.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1604 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-13 08:15:05 +00:00
cmpilato
a0a1ea7a42 * viewvc.conf.dist
Clean up some more option documentation.

* templates/include/footer.ezt
  Stop treating the cfg.general.address like a free-form field.  If admins
  don't like the way we display the address by default, they need only 
  tweak the footer.ezt template.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1603 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-13 07:40:39 +00:00
cmpilato
62dff59068 * viewvc.conf.dist
Take a stab at documenting ViewVC's vhost support.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1602 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-13 07:11:35 +00:00
cmpilato
a2d187d4be Add the nightly build scripts to version control.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1599 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 16:39:46 +00:00
cmpilato
0961f1bb6c "Gaaaaah."
That's what I say to the Universe.

"Gaaaaah."

* viewvc.org/license-1.html
  Remove symlink.

* viewvc.org/who.html
* viewvc.org/index.html
* viewvc.org/contributing.html
* viewvc.org/download.html
* viewvc.org/faq.html
* viewvc.org/contact.html
  Point the "License" nav item to the HEAD version of LICENSE.html.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1598 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 16:23:44 +00:00
cmpilato
5a4e2c343b The whole license file dance is annoying. Just put the thing where it
wants to be -- where folks expect to find it -- and be done with it.

* viewvc.org/license-1.html
  Moved this...

* LICENSE.html
  ...to here, and stripped out site branding stuffs...

* viewvc.org/license-1.html
  ...but re-added a symlink.

* viewvc.org/.htaccess
  Add a redirect rule to point license-1.html URLs to the latest
  LICENSE.html file.

* tools/make-release
  Don't bother copying the LICENSE.html file any more -- it's already
  in place.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1597 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 16:10:38 +00:00
cmpilato
25b411f04f Add some steps to releases.txt.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1592 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:37:13 +00:00
cmpilato
f5bfd66019 * tools/make-release
Uh... actually copy the LICENSE.html file into place like the
  comment claims we do.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1591 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:28:41 +00:00
cmpilato
0dfb93969d Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1590 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:26:36 +00:00
cmpilato
8336ed6dce * viewvc.org/license-1.html
Bump copyright years.

* viewvc.org/styles.css
  (blockquote): Tweak margins and add a dotted border.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1589 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:24:53 +00:00
cmpilato
bfa13e4161 Lose some .cvsignore files.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1588 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 15:02:50 +00:00
cmpilato
00b8f8a74e * tools/make-release
Fix some bugs in this script which prevented the to-be-deleted
  directories from actually being deleted.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1586 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 07:04:51 +00:00
cmpilato
ffe04321f3 Copy 1.0.4 CHANGES block to trunk.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1585 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 06:55:04 +00:00
cmpilato
90109ce020 Note new latest release of ViewVC.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1584 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 06:50:33 +00:00
cmpilato
e2c6ed5202 (Hopefully) really finish issue #262 by enabling auto-commit in CVSdb SQL.
* lib/cvsdb.py
  (CheckinDatabase.Connect): Issue "SET AUTOCOMMIT=1" so that InnoDB
    databases automatically commit changes made to the database.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1579 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 05:56:17 +00:00
cmpilato
1324797377 * templates/include/diff_form.ezt,
* templates/include/pathrev_form.ezt
  Fix various XHTML validation errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1577 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-10 05:09:14 +00:00
cmpilato
0d0f8c789d Finish issue #180 - Query results cache staleness under mod_python
Remove the code which attempts to cache database connection wrapper
objects.  That was useful long ago when the ViewVC code was sloppier,
but now the database handles get passed around in the call stack, so
there's a 1-to-1 mapping of ViewVC process to database connection.
The cache is, therefore, entirely unnecessary (and is causing
problems, in fact, for mod_python users).

* lib/cvsdb.py
  (gCheckinDatabase, gCheckinDatabaseReadOnly): Remove.
  (ConnectDatabase): Add 'readonly' optional parameter.  Don't try to
    play the connection caching game any more -- nobody cares.
  (ConnectDatabaseReadOnly): Reimplement as a wrapper around ConnectDatabase().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1573 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-09 13:45:18 +00:00
cmpilato
e144eb6942 * lib/viewvc.py
(common_template_data): Don't forget to take 'pathrev' into account
    when calculating the revision for Subversion views.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1572 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-06 17:37:24 +00:00
cmpilato
1d5c053757 Finish issue #296 - Query links for SVN deletions produce bad links.
* lib/viewvc.py
  (build_commit): Rework the view URLs so that, for Subversion, URLs
    related to deleted paths point to the previous revision.  And don't
    bother generating diff URLs for adds and removes -- only changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1569 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-06 16:36:27 +00:00
cmpilato
e2f383baf8 * templates/include/footer.ezt,
* templates/include/header.ezt
  Fix some XHTML validation problems.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1568 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-06 16:35:17 +00:00
cmpilato
f7095d713d * lib/viewvc.py
(redirect_pathrev): Automagically transform bogus input into,
    essentially, "HEAD".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1566 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-04 03:06:48 +00:00
cmpilato
3b5ae57380 * viewvc-install
(install_file): Use os.sep instead of '/' as the trailing slash in the
    "created" stdout line.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1564 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 19:35:56 +00:00
cmpilato
3b15cf11cc Turn on root_as_url_component by default for ViewVC 1.1.
* lib/config.py
  (Config.set_defaults): Enable options.root_as_url_component by default.

* viewvc.conf.dist
  (default_root): Describe this a little better.
  (root_as_url_component): Indicate that enabled is the default state.

* docs/upgrading-howto.html
  Add a note about the root_as_url_component option default change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1563 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 19:20:07 +00:00
cmpilato
a5f6b657cf * viewvc-install
(install_file): Test e.errno instead of e[0], because on Windows, a
    Windows-specific subclass of OSError (WindowsError) is raised, and the
    first item of its tuple representation is the Windows-specific
    error code.  But e.errno seems always to hold the OS-independent
    error value.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1561 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 16:32:13 +00:00
cmpilato
3edd4b3b01 Fix a bug reported by Jens Peters <jpeters7677@gmx.de> which causes
ViewVC to only generate links from a directory's "log view" to its
"directory view" when there's no sticky revision set.

* lib/viewvc.py
  (view_log): Always generate a directory's "directory view" link.  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1559 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 13:26:32 +00:00
cmpilato
d25e5e3098 * windows/README
Update Python for Windows Extensions URL (they now live at SourceForge).

* lib/win32popen.py
  Suggest that the Python for Windows Extensions might not be installed
  when importing a module from that collection fails.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1557 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-04-02 12:38:33 +00:00
cmpilato
9672b6d711 * bin/svndbadmin
(SvnRev.__init__): Don't use secs_from_timestr() -- it never
    learned to accept optional pools.  Do the math ourselves.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1556 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-29 06:00:04 +00:00
cmpilato
4ee8ea34e1 * INSTALL
(SECURITY INFORMATION): Update this with the latest information
    about the checkout view and how to toggle its enablement.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1554 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-29 02:07:27 +00:00
cmpilato
a0e92a8679 * templates/docroot/styles.css,
* templates/annotate.ezt
  Try to make the annotate view stylations look a little more like
  those of the markup view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1553 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-28 18:48:08 +00:00
cmpilato
bb246bf7c7 Begin the work of merging the markup and annotate views by at least
having them populate almost identical data dictionaries, and having
similar template headers.

* docs/upgrading-howto.html
  (Upgrading from 1.0.0): Note that 'mime_type', 'log', 'date', 'ago',
    'author', 'branches', 'tags', 'branch_points', 'changed', 'size',
    'state', 'vendor_branch', and 'prev' were added to annotate.ezt.

* docs/template-authoring-guide.html
  (Annotation View): Add 'mime_type', 'log', 'date', 'ago', 'author',
    'branches', 'tags', 'branch_points', 'changed', 'size', 'state',
    'vendor_branch', and 'prev'.

* templates/annotate.ezt
  Basically, replace the top of this thing with a copy of the top of
  markup.ezt.

* lib/viewvc.py
  (view_annotate): Populate almost an identical data dictionary to
    what the markup view uses.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1552 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-28 18:34:51 +00:00
cmpilato
2f9a4df28d Add recent changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1551 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-28 18:26:50 +00:00
cmpilato
f7bf5a511e Finish issue #244 by normalizing the input search directory values.
* lib/viewvc.py
  (view_query): Use _path_parts to cleanup the list of query directories.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1550 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-28 03:04:18 +00:00
cmpilato
d234219a4f Remove a change that was backported to 1.0.x.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1549 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 20:30:13 +00:00
cmpilato
580463a8ed Note some recently made CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1547 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 20:27:02 +00:00
cmpilato
5ce1ab531d Finish issue #224 by allowing svndbadmin to optionally accept a range
of revisions for the 'update' operation.

* bin/svndbadmin
  (): Update the script's header comment.
  (main): Now accept a 'revs' list instead of a single integer revision.
  (_rev2int): New helper function.
  (usage): Update usage message.
  (__main__): Now allow a revision range to be specified, with support
    for the 'HEAD' keyword, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1546 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 20:22:22 +00:00
cmpilato
2860672524 * bin/svndbadmin
De-pool-ize the use of the Subversion bindings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1545 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 20:17:49 +00:00
cmpilato
2efd7cc4af Unify the allowable views configury, and all support for disabling the
checkout view.  The former is for sanity, the latter for security.

* viewvc.conf.dist
  (allow_tar, allow_annotate, allow_markup): Removed.
  (allowed_views): New.

* lib/config.py
  (Config._force_multi_value): Add 'allowed_views'.
  (Config.set_defaults): Set default for 'allowed_views'; no longer set
    defaults for 'allow_tar', 'allow_annotate', 'allow_markup'.

* lib/viewvc.py
  (default_view, view_directory, download_tarball, get_file_view_info,
   view_annotate, view_diff, build_commit, view_revision, view_markup,
   view_checkout): Track changes, adding code to prevent checkout view
    URL generation when the view is disabled, and doing the same for
    markup views (which should have already been done, since we already
    had an allow_markup option!)

* templates/query_results.ezt
* templates/markup.ezt
* templates/directory.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/annotate.ezt
  Don't assume checkout and markup views are present.

* docs/upgrading-howto.html
  Update to show the configuration changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1544 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 19:03:37 +00:00
cmpilato
676ee09745 Rename the 'rev' view to the 'revision' view (at the CGI param level).
* lib/viewvc.py
  (_views): Rename the 'rev' view to the 'revision' view.  (This has
    always bugged me.)
  (Request.run_viewvc): Redirect old 'view=rev' URLs to 'view=revision'.

* docs/url-reference.html
  Update to reflect new URL syntax (and compatability support).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1543 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 17:39:43 +00:00
cmpilato
ac39b5ec6c * docs/url-reference.html
Reformat to (mostly) fit in 80 columns.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1542 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-27 17:31:33 +00:00
cmpilato
68a7d107e2 * lib/viewvc.py
(_orig_path, common_template_data, view_directory, view_revision,
   setup_diff): Catch vclib.InvalidRevision exceptions from
    repos._getrev(), and re-throw them as ViewVCExceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1539 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-12 15:06:50 +00:00
cmpilato
ea04c73b36 * templates/error.ezt
Only show the stacktrace when we've not provided a user-friend error
  message.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1538 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-12 14:54:10 +00:00
cmpilato
5443c117e6 * bin/mod_python/viewvc_mp.py,
* bin/mod_python/query_mp.py
  Remove unnecessary reload() statements.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1537 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-09 16:37:51 +00:00
cmpilato
ef89f0db73 Rename the Mod_Python stub scripts to avoid triggering an import loop
detection error.

* bin/mod_python/viewvc.py,
* bin/mod_python/query.py
  Renamed these ...

* bin/mod_python/viewvc_mp.py,
* bin/mod_python/query_mp.py
  ... to these.

* viewvc-install
  Track the renamed stub scripts.

* docs/upgrading-howto.html
  Note the change to the Mod_Python stub script names.
  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1536 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-03-09 16:04:31 +00:00
cmpilato
3c0ab3e163 * INSTALL
Add a note about the security implications of the checkout view,
  suggested by Moritz Naumann <security@moritz-naumann.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1535 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-27 15:38:49 +00:00
cmpilato
300a8236cb Robustness fixes in the query stuffs where empty or missing revision
metadata occurs.

* lib/cvsdb.py
  (Commit.SetTime, Commit.GetTime, CheckinDatabase.AddCommit): Handle
    missing dates.

* bin/svndbadmin
  (SvnRev.__init__): Handle missing or invalid datestamps.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1534 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-26 20:20:04 +00:00
cmpilato
891dfa4b85 Robustness fixes where empty or missing revision metadata occurs.
* lib/vclib/svn/__init__.py
  (_datestr_to_date): Make this function more robust in the face of
    bogus datestamps.

* lib/viewvc.py
  (htmlify, format_log, make_time_string, make_rss_time_string,
    build_commit, view_directory): Make this functions more gracefully
    handle "None" revision metadata, and not generate data like
    "Unknown date" or "&nbsp;".
  
* templates/log.ezt,
* templates/markup.ezt,
* templates/rss.ezt,
* templates/revision.ezt,
* templates/log_table.ezt
  Handle empty revision metadata more gracefully.  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1533 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-26 19:28:48 +00:00
cmpilato
e4527a3732 Un-bind ViewVC's core libraries from the assumption that sys.stdout is
the output stream.

* lib/viewvc.py
  (copy_stream): Don't supply a default value for 'dst', and don't
    special-case a value of None for it, either.
  (view_checkout, view_cvsgraph_image, view_doc): Pass
    request.server.file() as the 'dst' parameter to copy_stream().
  (view_patch): Pass request.server.file() as the 'dst' parameter to
    copy_stream().  Also, use request.server.file() instead of
    sys.stdout.
  (download_tarball): Use request.server.flush() instead of
    sys.stdout.flush().
  (view_error): Use server.file() instead of sys.stdout.

* lib/query.py
  (main): Use server.file() instead of sys.stdout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1532 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-26 18:07:19 +00:00
cmpilato
169aba8c30 * viewvc.conf.dist (use_source_highlight): Default to 0.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1531 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-13 15:21:39 +00:00
cmpilato
3c426916d4 Add new CHANGES item for source-highlight integration.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1530 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-01 22:30:46 +00:00
cmpilato
8254d2d876 I think I'm finished messing around with source-highlight integration
now.  No, really!

* INSTALL
  Okay, no more messing around with lesser version.  source-highlight
  2.5 it is.

* lib/viewvc.py
  (MarkupSourceHighlight.__init__): Use 'sed' to strip unnecessary
    leading and close tags generated by source-highlight.  Also, pass
    a value of "l_" for the line number reference prefix, which makes
    this consistent with highlight's line IDs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1529 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-01 22:16:44 +00:00
cmpilato
85f7720267 Miscellaneous cleanups around the source-highlight integration.
* templates/docroot/styles.css
  Remove source-highlight styles.  We can't reliably get that program
  to generate real style names.

* viewvc.conf.dist
  (source_highlight): Fix the sample path.

* lib/viewvc.py
  (MarkupSourceHighlight): Rework this to pipe the file contents into
    source-highlight on stdin, and don't try to enable CSS output or
    anything fancy, because source-highlight has too many bugs in this
    area.  Use --failsafe mode.

* INSTALL
  Change the recommendation for the version of source-highlight.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1528 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-01 21:52:30 +00:00
cmpilato
436e10e74c Add notes to INSTALL about using source-highlight.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1527 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-01 20:19:54 +00:00
cmpilato
473b853a5b Add optional integration with GNU source-highlight. Patch against
ViewVC 1.0.3 by Dirk Jagdmann <doj@tigris.org>, tweaked to adhere to
ViewVC 1.1-dev code and conventions by myself.

* viewvc.conf.dist
  (utilities.source_highlight, options.use_source_highlight,
   options.source_highlight_line_numbers): New.

* templates/docroot/styles.css
  Add new default styles for source-highlight output mode.

* lib/viewvc.py
  (MarkupSourceHighlight): New.

* lib/config.py
  (set_defaults): Set default values for utilities.source_highlight,
    options.use_source_highlight, and options.source_highlight_line_numbers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1526 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-02-01 16:42:48 +00:00
cmpilato
77446e313a * lib/vclib/svn_ra/__init__.py
(created_rev): Because the way ra.svn_ra_get_dir() seems to work
    differently across versions of the Subversion Python bindings,
    build in some fault tolerance.  
    Tested by Eric Hanchrow <offby1@blarg.net>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1525 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-31 21:08:45 +00:00
cmpilato
310db99e62 * lib/vclib/svn_ra/__init__.py
(created_rev): Update use of ra.svn_ra_get_dir().

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1524 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-31 19:39:13 +00:00
cmpilato
b597b6a485 Minor comment tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1523 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-26 20:03:03 +00:00
cmpilato
e7014db4cf Update the INSTALL file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1521 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-26 16:49:13 +00:00
cmpilato
8f5e381f21 Fix issue #284 - Regression: "Modify query" link no longer functions.
* lib/viewvc.py
  (view_query): Restore a queryform_href calculation incorrect
    abstracted out (probably by me).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1520 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 20:56:28 +00:00
cmpilato
b7af5fc568 * bin/loginfo-handler
Add some more debugging, and consume stdin so CVS's pipe doesn't
  back up (which causes an abort()).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1518 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 19:51:05 +00:00
cmpilato
7e0d117de8 * bin/loginfo-handler
Fix the loginfo-handler's argument handling so that it works with 
  single-file commits in CVS 1.12.x.  

  Patch by: Cristian Tibirna <ctibirna@giref.ulaval.ca>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1517 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 19:50:05 +00:00
cmpilato
95f5f3bc9c * CHANGES
Note the fix for issue #234, committed in r1515.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1516 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 19:46:13 +00:00
cmpilato
b9044a9a9d Finish issue #234 - standalone.py uses not registered port per default.
According to http://www.iana.org/assignments/port-numbers, "The
Dynamic and/or Private Ports are those from 49152 through 65535".

* bin/standalone.py
  (Options): Change default port to 49152.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1515 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 17:56:49 +00:00
cmpilato
9e07c413fa Improve the error display when trying to view annotations on a binary file.
* lib/vclib/__init__.py
  (NonTextualFileContents): New Exception.

* lib/vclib/svn/__init__.py
  (BlameSource.__init__): Translate the Subversion error
    SVN_ERR_CLIENT_IS_BINARY_FILE in the new vclib.NonTextualFileContents 
    exception.

* lib/viewvc.py
  (view_annotate): Catch the new vclib.NonTextualFileContents exception.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1514 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 17:47:37 +00:00
cmpilato
c8645305c5 * CHANGES
Add the bugfix for issue #221 completed in r1512.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1513 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 17:33:20 +00:00
cmpilato
4750fd345c Finish issue #221 - Annotate confused by long author names
* lib/vclib/svn/__init__.py
  (_rootpath2url): New helper, cored from BlameSource.__init__().
  (BlameSource): Rework this class to use the Subversion client Python
    bindings, specifically a call to svn_client_blame2().
  (SubversionRepository.annotate): Use new _rootpath2url(), and
    update the called to BlameSource().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1512 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 17:31:02 +00:00
cmpilato
4f1259d64d * lib/vclib/svn/__init__.py
(_rev2optrev): Moved here from the svn_ra module.

* lib/vclib/svn_ra/__init__.py
  (_rev2optrev): Moved to the svn module (now pulled in indirectly).
  (SubversionRepository.__init__): Fix a leftover instance of a pool.
    Also, add a comment about svn_cmdline_setup_auth_baton().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1511 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 17:22:17 +00:00
cmpilato
ead2d603a2 * CHANGES
Note new search-by-log-message feature, committed in r1509.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1510 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 16:24:49 +00:00
cmpilato
79fe3a2919 Finish issue #22 - Query on Log Messages.
Add the ability to query the commit database by log message comment in
addition to the existing query parameters.

Patch by: David Skyba <davidskyba@users.sourceforge.net>

* lib/cvsdb.py
  (CheckinDatabase.CreateSQLQueryString): Add support for filtering
    query results by log message.
  (CheckinDatabaseQuery.__init__): Add new comment_list member.
  (CheckinDatabaseQuery.SetComment): New.

* lib/viewvc.py
  (_legal_params): Add 'comment' and 'comment_match' as valid query
    parameters.
  (view_queryform): Populate new 'comment' and 'comment_match' data
    dictionary items.
  (english_query, view_query): Handle the new 'comment' and
    'comment_match' query items.

* templates/query_form.ezt
  Add UI for filtering queries by log message.

* docs/url-reference.html
  (Query View): Note new comment= and comment_match= URL parameters.

* docs/template-authoring-guide.html
  (variables-query_form): Note new comment and comment_match data
    dictionary items.





git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1509 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 16:22:40 +00:00
cmpilato
c3aabd8b7c Finish issue #12 -- Long paths in tarballs get truncated.
Use a GNU tar extension when path names longer than 100 characters are
being packaged in our tarball output.  

Patch by: Klaus Rennecke <marion@users.sourceforge.net>

I tested this on a Solaris box that had both the native tar program
and GNU tar.  Without the patch, but the native and GNU tar programs
created files with truncated filenames.  With the patch, GNU tar worked as
expected; the native tar program created a '././@LongLink' file
whose contents were the long path, and additionally created the
file with the truncated path.

* lib/viewvc.py
  (generate_tarball_header): For paths longer than 100 characters, use
    a GNU tar extension which allows arbitrary path links.  Also, fix
    the "version" header item to be '00', not \0.
    
* templates/include/dir_footer.ezt
  Change the "download tarball" link text to indicate that we are
  now generating GNU tarballs.

  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1507 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-23 15:35:44 +00:00
cmpilato
5977b3c4fe * lib/compat.py
(mkdtemp): Fix the compatibility implementation's use of mktemp(),
    which prior to Python 2.3 (the same release that mkdtemp() shows
    up) only supported a single "suffix" argument.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1506 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-22 17:25:07 +00:00
cmpilato
59ecb71c51 * lib/viewvc.py
(view_directory): Initialize file.size, too.  A follow-up to r1504.
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1505 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-22 17:15:24 +00:00
cmpilato
ed664972cb Optimize directory displays where paging is enabled and sorting by
filename by first sorting, then only fetching the extended revision
metadata information for the items that would survive the page
filtering.

Patch by: Gustavo De Nardin <gustavodn@mandriva.com>
          (Tweaked by me.)

* lib/viewvc.py
  (view_directory): Only fetch dirlogs for directory entries that will be 
    on "this page".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1504 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-18 20:38:03 +00:00
cmpilato
9b625017bb * viewvc.org/faq.html
Drop a skeletal FAQ page into place, but don't hook it into the rest
  of the site, seein' as how there's no real content here yet.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1503 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-11 13:29:41 +00:00
cmpilato
e0221b21bf Provide another hint to folks for whom ViewVC can't find Subversion bindings.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1502 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-08 21:28:19 +00:00
cmpilato
04cb1cd74d Finish issue #262 - svndbadmin doesn't commit data to MySQL InnoDB tables
* lib/cvsdb.py
  (CheckinDatabase.AddCommit): Set plus_count and minus_count
    explicitly to '0', which seems to be required for some folks'
    MySQL installations.

* bin/make-database
  Explicitly declare that we want tables of type "MyISAM".

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1500 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-05 23:05:14 +00:00
cmpilato
cf862e4e68 * lib/cvsdb.py
(CheckinDatabase.AddCommit): Add some newlines, to purty up the
    Exception string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1499 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-05 16:07:05 +00:00
cmpilato
497cc24bbe * lib/cvsdb.py
(CheckinDatabase.AddCommit): Add some more information to any Exceptions
    received while adding commits to the database.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1498 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-04 23:05:39 +00:00
cmpilato
39eab459b4 * lib/viewvc.py
(MarkupHighlight.__call__): Minor indentation fix.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1497 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-04 19:22:35 +00:00
cmpilato
942d84818e Fix issue #280. Follow-up to r1493 with tweaks to INSTALL for the new
svndbadmin usage.

* INSTALL
  (SQL CHECKIN DATABASE): Recommend the use of 'svndbadmin update REV'
    in post-commit hooks, and 'svndbadmin update --force REV' in
    post-revprop-change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1496 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-03 14:37:25 +00:00
cmpilato
6a03c7a4dd Add a new "uri" format to EZT.
NOTE: This is not currently used in ViewVC.  I needed it in another
piece of software, but wanted the tweaks to be publicly available
somewhere.

* lib/ezt.py
  (FORMAT_URI, _uri_printer): New.
  (_printers): Add mapping for new URI-formatting code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1495 8cb11bc2-c004-0410-86c3-e597b4017df7
2007-01-02 15:39:51 +00:00
cmpilato
dbf67f4c0b Add some missing issue IDs to CHANGES entries.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1494 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-21 21:44:42 +00:00
cmpilato
a1c093ca2c For Issue #271, implement 'purge' commands for both cvsdbadmin and
svndbadmin.  Teach the 'rebuild' commands to first purge existing data
and then crawl the repository.  Also, drop support for the 'rev'
parameter to 'svndbadmin rebuild', adding instead a '--force' option
to 'svndbadmin update'.

Suggested, and SQL commands offered, by Mark <mark@mitsein.net>.

* lib/cvsdb.py
  (CheckinDatabase.sql_delete, CheckinDatabase.PurgeRepository): New.

* bin/svndbadmin
  (handle_revision): Add 'force' parameter, used to force update of
    commits already recorded in the database.
  (main): Add 'force' parameter, passed on to handle_revision().
    Handle the new 'purge' command, and teach 'rebuild' to also purge.
  (usage): Update usage info.
  (__main__): Add support for 'update --force' and 'purge', and drop
    support for 'rebuild rev'.  Add a KeyboardInterrupt handler.

* bin/cvsdbadmin
  (usage): Add 'purge' usage info.
  (__main__): Rework command-line parameter handling.  Add support for
    'purge' command, and make 'rebuild' first do a purge.

* CHANGES
  Note this change.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1493 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-21 20:51:24 +00:00
cmpilato
c6db566501 Finish issue #276.
* bin/make-database
  Up the length of the people table's 'who' column to 128 characters.
  Suggested by: Ted Mielczarek <luserspaz@tigris.org>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1492 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-21 16:54:41 +00:00
cmpilato
1d2b2d9c35 Allow highlight to choose the syntax language based on the file's
extension and contents.

Patch by: Christophe Delmon <cdelmon@tigris.org>

(Now, if only we could make highlight stop telling us via Apache's
error_log every time it doesn't recognize a filetype...)

* lib/viewvc.py
  (MarkupHighlight.__init__): No longer calculate the file extension,
    and drop the --syntax argument to highlight.
  (MarkupHighlight.__call__): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1491 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-21 16:26:03 +00:00
cmpilato
862d5b7132 Make viewvc-install able to be run from an arbitrary location (instead
of requiring that you run it while sitting in its containing directory).

* viewvc-install
  (_actual_src_path): New helper function.
  (replace_file): Move this functionality into...
  (install_file): ...here.  Also, normalize some variable names for
    consistency with...
  (install_tree): ...this.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1488 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-20 18:08:44 +00:00
rey4
bc295fb361 Interpret relative paths in viewvc.conf as being relative to the
directory where that file resides, instead of being relative to the
grandparent directory of viewvc.py. 

This change lets you set up multiple installations of ViewVC that 
share a common library directory, but are otherwise independent. It
also allows ViewVC to work more nicely with Gentoo's webapp-config.

Warning: This change may break ViewVC installations that use
VIEWVC_CONF_PATHNAME settings pointing at configuration files outside
the ViewVC install directory.

* lib/config.py
  (Config.path): new method returning paths relative to config file

* lib/viewvc.py
  (_install_path): removed function
  (get_view_template, view_cvsgraph_image, view_cvsgraph, view_doc):
    call cfg.path instead of _install_path
  (load_config): replace call to _install_path with equivalent inline
    code

* viewvc.conf.dist
    update comments referring to ViewVC install directory

* CHANGES
    document this change


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1487 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-20 16:37:34 +00:00
cmpilato
87fb74e580 Prep PyFontify.py for Python 2.6 readiness, and make it stop giving
the following warning in Python 2.5:

   Warning: 'with' will become a reserved keyword in Python 2.6

Reported by: Philip M. Gollucci <pgollucci@p6m7g8.com>

* lib/PyFontify.py
  (replace): Removed.  Callers now use string.replace().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1486 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-19 18:41:56 +00:00
cmpilato
01e10dd1bb Minor improvements to some exception strings and their handling.
* lib/viewvc.py
  (view_doc): Lose newline characters in exception messages.
  (Request.run_viewvc): Rewrite the unfound root exception messages to
    be a little less cryptic.

* templates/error.ezt
  No longer wrap exception messages in <pre> tags.  Also, pad error
  output with a bunch of space characters to IE's "Friend Error
  Messages" don't show up.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1485 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-18 20:40:00 +00:00
cmpilato
44d86248d1 Minor stylistic tweaks.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1484 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-14 20:01:19 +00:00
cmpilato
cb78995c4a * viewvc-install
(install_file, install_tree): Replace '/' with the OS-specific
    directory separator character in the destination path before processing.
    This is follow-up to r1458.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1483 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-14 19:42:09 +00:00
cmpilato
1592197d08 Add some links to ViewVC instances.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1482 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-06 20:19:44 +00:00
cmpilato
bb39ba6b22 Finish issue #273.
* templates/docroot/styles.css
  (vc_row_special): New style.

* templates/annotate.ezt
  Markup annotation hunks whose revision matches the request one
  differently.  While here, remove some unnecessary [define] blocks.

Suggested by:  Marco Colombo <marcol@tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1481 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-04 19:07:04 +00:00
cmpilato
40c37a55f8 Fix a bug that prevented the population of 'rev' for annotate views.
* lib/viewvc.py
  (common_template_data): Accept the 'annotate' parameter as a valid source
    for the 'rev' data item.

Noticed by:  Marco Colombo <marcol@tigris.org>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1480 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-12-04 19:04:16 +00:00
cmpilato
9d16bcb2a7 * INSTALL
(SUBVERSION INTEGRATION): Tweak the example for testing Subversion
    Python bindings installation to be useful, showing how to find the
    installed version of those bindings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1479 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-30 21:36:56 +00:00
cmpilato
5fcdcd8b8a * lib/vclib/svn_ra/__init__.py
Purge the svn_ra module of unnecessary pools.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1476 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-09 21:09:05 +00:00
cmpilato
fa035c8ae7 * lib/vclib/svn/__init__.py
Bump version requirement to Subversion 1.3.1.  Also, remove
  unnecessary pools from the entirety of the module.

* lib/vclib/svn_ra/__init__.py
  Bump version requirement to Subversion 1.3.1.

* INSTALL
  Bump Subversion version requirement to Subversion 1.3.1.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1475 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-09 20:47:45 +00:00
cmpilato
d83ff39472 Followup to r1439, with the correct logic in generate_page().
* lib/viewvc.py
  (generate_page): Reverse the logic in the if/else to be correct.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1473 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-09 17:55:25 +00:00
cmpilato
118c6cc35e Allow ViewVC to work when rcsparse is backed by the tparse module.
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
  Use rcsparse.parse() instead of rcsparse.Parser.parse() throughout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1472 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-08 20:01:40 +00:00
cmpilato
5f22029349 * lib/vclib/ccvs/rcsparse/common.py
Remove dependency on compat.  It's time for rcsparse to be free, and by
  golly, it's okay if it requires Python 2.0 now to do it.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1471 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-08 19:59:11 +00:00
cmpilato
1920391b2a Add missing CHANGES item for full diff support.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1467 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 14:55:44 +00:00
cmpilato
a962fae87a * bin/loginfo-handler
(__main__): Fix a syntax error I overlooked.  Follow-up to r1463.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1465 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 03:56:53 +00:00
cmpilato
ff2ac1d824 (Effectively) whitespace changes only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1464 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 03:19:40 +00:00
cmpilato
e4967b894a Update loginfo-handler to be able to deal with the new loginfo format
introduced in CVS's 1.12 line.

Issue number(s): 257
Patch mostly by: Mark <mark@mitsein.net>, tweaked by me.

* bin/loginfo-handler
  (Cvs1Dot12ArgParse): New.
  (HeuristicArgParse): Update comment -- the problems is no longer
    with "current" CVS, but with "older" ones.
  (__main__): Detect the use of newer CVS loginfo formatting, and
    parse the arguments accordingly.  Also, clean up some indentation
    inconsistency.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1463 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 03:13:53 +00:00
cmpilato
3d65a28a3c Add support for two levels of quietness to the obnoxiously noisy
cvsdbadmin script.

* bin/cvsdbadmin
  (UpdateFile, RecurseUpdate, RootPath): Add new 'quiet_level'
    argument.  Callers updated.
  (usage): Rewrite to indicate the existence of the new -q flag, and
    to look more like the svndbadmin usage message.
  (__main__): Parse the new -q argument.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1462 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-02 02:00:35 +00:00
cmpilato
ac60888eaf Add some debug code to facilitate tarball generation debugging.
* lib/debug.py
  (SHOW_TIMES, SHOW_CHILD_PROCESSES): Add some explanatary comments.
  (TARFILE_PATH): New.

* lib/viewvc.py
  (download_tarball): When tarball debugging is enabled, generate the tarfile
    at the configured location, and deliver either a cheap success message
    or an error view to the browser.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1461 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-11-01 14:24:41 +00:00
cmpilato
9caee0c04d * viewvc-install
(install_file, install_tree): Replace '/' with the OS-specific
    directory separator character in src_path before processing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1458 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-27 14:58:04 +00:00
cmpilato
818c168978 Finish issue #266 -- Query result shows file names with @ as email
addresses.

The ultimate problem here was that email address recognition banks on
the final component of addresses "server" only have 2-4 characters in
it.  But the query code was doing a little more here than necessary
anyway, mistakenly using htmlify() instead of its subset, server.escape().

* lib/viewvc.py
  (view_query, english_query, build_commit): Use
    request.server.escape() instead of its superset, htmlify(), to
    format stuff that needs to be HTML-escaped, but doesn't
    necessarily need to try to recognize URLs and email addresses.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1456 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-18 01:11:33 +00:00
cmpilato
aaca4217a7 Try to note the changes so far which are aimed for release in 1.1.0.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1455 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-18 01:09:23 +00:00
cmpilato
63d07e6065 Begin a section for 1.1.0 in CHANGES.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1454 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-18 00:36:48 +00:00
cmpilato
21f68a5118 Finish issue #261 -- detect SVN repository from standalone.
* viewvc/bin/standalone.py
  (serve): Recognize Subversion repository paths provided via -r, too.
  (cli): Update the usage message.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1453 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-17 03:50:23 +00:00
cmpilato
7e55acdc5d * viewvc/bin/standalone.py
(serve): Fix some leftover references to the old cvsnt_exe_path
    config option.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1452 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-17 03:38:21 +00:00
cmpilato
9115900b3a * www/index.html
Bump the stated latest version number to 1.0.3.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1451 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:49:15 +00:00
cmpilato
8845bc551f Merge security fix made in r1446 from 1.0.x to trunk. That log message read:
Dictate UTF-8 as the output character set for all ViewVC
   template-driven views.
   
   * lib/sapi.py
     (CgiServer.header, ModPythonServer.header): Add "; charset=UTF-8" to
       the Content-type header in ViewVC output.
     (AspServer.header): If no content type is specified, set the content
       type to 'text/html; charset=UTF-8'.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1450 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:48:05 +00:00
cmpilato
4cebbf43df * CHANGES
Merge 1.0.3 change list from the 1.0.x branch.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1449 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 20:46:56 +00:00
cmpilato
1171d112b7 * lib/vclib/svn/__init__.py
(get_revision_info): Removing some debugging code accidentally
    committed in r1443.  Because life would be too easy if cmpilato
    weren't a sloppy coder, and we certainly can't have *that*.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1444 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 19:44:29 +00:00
cmpilato
c41ffe04e2 Followup to r1440, in which I butchered some code under the guise of
fixing issue #265.  Sheesh.

* viewvc/lib/vclib/svn/__init__.py
  (get_revision_info): Store ChangedPath items in a different hash
    than the one we get from the Subversion bindings so replacement
    detection works.  While here, add support for Subversion 1.4.0's
    new 'action' changed item member.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1443 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 19:26:03 +00:00
cmpilato
36e0d19fe3 Tweak releases.txt to point out our Tigris.org milestone sort key pattern.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1442 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 16:32:28 +00:00
cmpilato
5bf80b54f4 *** WARNING: THIS CHANGE BREAKS STUFF; ALSO NEED r1443 and r1444 ***
Finish issue #265 - ViewVC shows wrong path for items deleted from a
                    parent dir copied in the same revision

* lib/vclib/svn/__init__.py
  (ChangedPathSet): Remove.
  (get_revision_info): Stop using the streamy callback reporting form
    of repos.ChangeCollector(), because its got some ... deficiencies.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1440 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-13 15:59:00 +00:00
cmpilato
a6cad82e55 Remove some redundancy by teaching generate_page(), which is *always*
immediately preceded by a call to request.server.header(), to just
make that call itself.

* lib/viewvc.py
  (generate_page): Add 'content_type' parameter, and handle the call
    to request.server.header() here instead of it always preceding
    calls to this function.
  (view_markup, view_roots, view_directory, view_log, view_annotate,
   view_cvsgraph, view_diff, view_revision, view_queryform): Lose
    calls to request.server.header() -- generate_page() does this for
    us now.
  (view_query): Update calls to generate_page(), and lose calls to
    request.server.header().



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1439 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-10-12 17:04:15 +00:00
cmpilato
7784009c8e Bump the stated latest version of the software.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1438 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-29 17:15:31 +00:00
cmpilato
692f539c36 * notes/releases.txt
Fix sample `make-release' command-line, and recommended tag commit
  message.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1437 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-29 17:15:13 +00:00
cmpilato
bfdd4c0988 Merge 1.0.2 CHANGES into trunk's copy of the file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1436 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-29 16:57:48 +00:00
cmpilato
6b84e92bdf Follow-up to r1407, fixing some calls to modified APIs that I
overlooked in that revision.  This fixes issue #264, reported against
the nightly build.

* bin/loginfo-handler
  (ProcessLoginfo): Pass cfg.utilities instead of cfg.general to
    BinCVSRepository().

* bin/cvsdbadmin
  (usage): Pass cfg.utilities instead of cfg.general to
    BinCVSRepository()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1431 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-29 15:16:15 +00:00
cmpilato
3e882435f2 * viewvc.conf.dist
Make some tweaks recommended in IRC by user "[1]tony" to help folks
  better understand the configuration file format and usage.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1430 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-28 17:51:17 +00:00
rey4
aaf85a14a6 Update the PHP CGI hack and add a comment to the config file pointing
out the CLI/CGI distinction. Thanks to Mark <mark@mitsein.net> and
Brian G. Peterson <brian@braverock.com> for bringing this issue up
on the users' list.

* lib/viewvc.py
  (markup_stream_php): update the cgi hack

* viewvc.conf.dist
  (utilities.php): add comment


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1428 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-09-27 20:06:22 +00:00
cmpilato
acd8ab25e9 Minor vclib interface cleanup, adding a new Annotation object, and
having the Repository.annotate() implementations return lists of them
(instead of lists of those cool-but-overused-_item-thingies).

* lib/vclib/__init__.py
  (Repository.annotate): Note that this interface now returns
    Annotation objects.
  (Annotation): New.
  Also, do some docstring addition/modification elsewhere in this file.

* lib/vclib/ccvs/blame.py
  (BlameSource.__getitem__): Return vclib.Annotation objects now.
  (_item): Remove as unneeded.

* lib/vclib/svn/__init__.py
  (BlameSource.__getitem__): Return vclib.Annotation objects now.
  (_item): Remove as unneeded.

* lib/vclib/svn_ra/__init__.py
  (SubversionRepository._blame_cb): Store vclib.Annotation objects now.
  (_item): Remove as unneeded.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1427 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-18 22:35:14 +00:00
cmpilato
41e1ae4171 Expose the path for each root in the [roots] common template data
object, again with the same warnings applied to [rootpath] in r1425.

* lib/viewvc.py
  (common_template_data):  Expose the path for each root in the "roots"
    data item.

* docs/upgrading-howto.html,
* docs/template-authoring-guide.html
  Update the docs.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1426 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-18 16:05:29 +00:00
cmpilato
eb70cfaaec * lib/viewvc.py
(common_template_data): Expose request.rootpath as "rootpath".

* docs/upgrading-howto.html,
* docs/template-authoring-guide.html
  Note this new exposition, though with a warning about its use in an
  insecure environment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1425 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-17 15:20:44 +00:00
cmpilato
7a51a39ba0 * lib/compat.py
(mkdtemp): Flesh out the parameter list for mkdtemp(), passing those
    params to mktemp().

* viewvc/lib/viewvc.py
  (MarkupEnscript.__call__): Give the temporary directory a "viewvc"
    prefix so it is more easily identifiable in the case of a
    problem.  Also, fix a minor indentation inconsistency.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1424 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-16 23:59:12 +00:00
cmpilato
3dcc42d802 Fix a bug noticed by Michael Guntsche <mike@it-loops.com> which caused
file formats covered by custom "streamer" syntax highlighters to not
be passed through escript or highlight when their respective custom
stream was disabled.

* lib/viewvc.py
  (view_markup): Correct the syntax highlighter choosing logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1422 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-16 16:25:46 +00:00
cmpilato
696feb50e0 Fix some bugs introduced in r1407. Noticed by maxb.
* lib/viewvc.py
  (download_tarball): Don't reference non-existant variable cfg until
    creating it as a reference to request.cfg.
  (MarkupPHP.__init__): Drop the 'php_exe_path' variable, and add
    'cfg'.  Use 'cfg' to get at the 'php_path' configury.
  (markup_stream_php): Update call to MarkupPHP().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1421 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-03 21:39:46 +00:00
cmpilato
edc66442b4 Update contact information with the IRC channel.
* www/index.html
  Note the new IRC channel.

* viewvc.org/contact.html
  Note the new IRC channel, reorganize the text a bit, and provide a
  handy-dandy contact summary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1420 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-02 16:06:02 +00:00
cmpilato
f64490de1c Finish issue #245 by making the generated RSS feed URL match
scheme-wise with the URL used to access ViewVC.  Patch by Troels Arvin
<tarvin@tigris.org>, tweaked by cmpilato.

* lib/viewvc.py
  (build_commit): If the environment variable HTTPS is set to "on", then
    construct the rss_url data dictionary item with an "https" method instead
    of an "http" one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1417 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 18:12:30 +00:00
cmpilato
491e02f504 * lib/vclib/svn/__init__.py
(BlameSource.__init__):  Pass the --non-interactive flag to 'svn blame'
    so it doesn't wedge when cache authstuffs aren't available or
    sufficient.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1416 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 17:07:07 +00:00
cmpilato
60991a4743 Finish issue #208 (Annotate aborts on #include "./filename"). Patch
more or less by Russell Yanofsky.

* lib/blame.py
  (link_includes): Calculate include paths in such a way that '.' is
    dropped and '..' is normalized.  This should prevent us from
    sending paths through Subversion's APIs that aren't legal (and
    cause assertions to fire).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1414 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-08-01 16:45:35 +00:00
cmpilato
2bcda59f31 Fix some grammar issues and, while here, rant about SF.net a little bit.
Sorry -- unable to resist.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1413 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-31 21:23:09 +00:00
cmpilato
9a73f275ec Website tweaks, mostly visual and validational in nature.
* viewvc.org/who.html,
* viewvc.org/license-1.html,
* viewvc.org/download.html,
* viewvc.org/contributing.html,
* viewvc.org/index.html,
* viewvc.org/contact.html
  Add the cutesy, "Hey, we're valid XHTML" logo; remove the group email
  address (that's what the Contact page is for); fix XHTML validation issues; 
  add a working DOCTYPE marker; add <meta> definitions of a UTF-8 character
  set.

* viewvc.org/styles.css
  Minor tweaks to font sizes and margins, mostly.  Nothing altogether
  interesting.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1412 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-31 20:56:48 +00:00
cmpilato
aff7923450 Remove useless .cvsignore file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1411 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-31 20:54:00 +00:00
cmpilato
06c202f98a * docs/template-authoring-guide.html
Fill in the remaining blanks in the template authoring guide, and fix
  one erroneous "depth" indicator in the markup.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1410 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-31 18:53:17 +00:00
cmpilato
7a038950d7 * docs/upgrading-howto.html
Bring this, I think, up-to-date with the 1.1.0 work-in-progress.
  Also, fix some colors to avoid using green save for "added" variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1409 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-28 11:59:31 +00:00
cmpilato
e34725c830 Remove spurious blank line.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1408 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-28 11:10:17 +00:00
cmpilato
528d4aec3d Cleanup ViewVC's configuration and use of external utilities by
creating a new section of the configuration file strictly for defining
the locations of these helper applications.

This closes issue #229 (configurable path to sed) and issue #62
(configurable path to diff), and perhaps others I failed to find.

* viewvc.conf.dist
  Add a new "utilities" section for corraling all the various
  tool-location configurations, and relocate (with some tweaks) a
  bunch of options:
     general.rcs_path => utilities.rcs_dir
     general.cvsnt_ext_path = utilities.cvsnt
     general.svn_path => utilities.svn
     options.enscript_path => utilities.enscript
     options.highlight_path => utilities.highlight
     options.py2html_path => utilities.py2html_dir
     options.php_exe => utilities.php
     options.cvsgraph_path => utilities.cvsgraph
     utilities.diff (new)
     utilities.gzip (new)
     utilities.sed (new)
     options.use_py2html (new)

* lib/config.py
  (_sections): Add 'utilities' section.
  (Config.set_defaults): Reflect options tweaks made to
    viewvc.conf.dist in the code here.

* lib/viewvc.py
  (Request.run_viewvc): Track renamed utilities.svn option.  Now pass
    cfg.utilities into BinCVSRepository(), CCVSRepository(), and
    SubversionRepository().  Collapse now-identical
    SubversionRepository() calls.
  (markup_stream_python): Return immediately if options.use_py2html
    isn't set.  Track renamed utilities.py2html_dir option.
  (view_cvsgraph_image, view_cvsgraph): Track renamed
    utilities.cvsgraph option.
  (MarkupPHP.__init__): Track renamed utilities.php option, and allow
    for 'php' as a fallback value.
  (MarkupHighlight.__init__): Track renamed utilities.highlight option.
  (MarkupEnscript.__init__): Track renamed utilities.enscript option,
    and honor new utilities.sed option.
  (download_tarball): Use new utilities.gzip option.

* lib/vclib/__init__.py
  (_diff_fp.__init__): Add 'diff_cmd' parameter.

* lib/vclib/svn/__init__.py
  (SubversionRepository.__init__): Drop 'svn_path' parameter, and now
    accept 'utilities'.
  (SubversionRepository.rawdiff): Pass self.diff_cmd to _diff_fp().

* lib/vclib/svn_ra/__init__.py
  (SubversionRepository.rawdiff): Pass self.diff_cmd to _diff_fp().

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.rawdiff): Pass self.utilities.diff or 'diff' to _diff_fp().

* lib/vclib/bincvs/__init__.py
  (CVSRepository.__init__): Add 'utilities' parameter.
  (BinCVSRepository.__init__): Lose as no-longer-necessary.
  (BinCVSRepository.rcs_popen): Track renamed options, and renamed
    member variable that hold those options.

* docs/upgrading-howto.html
  Note these options changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1407 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-28 11:04:12 +00:00
cmpilato
789f13c9f7 Stub out a section in the upgrading-howto.html document for 1.1.0.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1406 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-28 10:22:17 +00:00
cmpilato
090dbd7d3b Add a step in releases.txt for updating the Issue Tracker configuration.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1405 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-28 08:18:20 +00:00
cmpilato
a92daef556 Add 'nightly' to the svn:ignores.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1404 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-26 20:43:48 +00:00
cmpilato
83b1c6937a * viewvc.org/download.html,
* viewvc.org/contributing.html,
* viewvc.org/index.html,
* viewvc.org/contact.html
  Oops.  Forgot to commit these removed nav references to upgrading.html.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1403 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-26 20:30:59 +00:00
cmpilato
f817d8149c Add .htaccess file. No sense in not versioning it.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1402 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-26 20:29:42 +00:00
cmpilato
8bbe853ffe Do a documentation reorganization I've been dying to do for some time
now.  Get stuff that's aimed at regular developers off our website,
get the website out of our release tarballs, while letting the docs/
that ViewVC admins need remain in the tarballs.

* docs/
  New directory.

* docs/url-reference.html,
* docs/template-authoring-guide.html
  Moved these documents, which hardly need to live on our public website, here ...

* viewvc.org/url-reference.html,
* viewvc.org/template-authoring-guide.html
  ... from here.

* docs/upgrading-howto.html
  Move (and renamed, and de-website-ized) this...

* viewvc.org/upgrading.html
  ... from here.

* notes/
  New directory for developer notes.

* notes/releases.txt
  New, cored out of the contributing.html file, and greatly updated to
  track the reality of our new Subversion-land release process.

* notes/TODO
  Move here ...

* TODO
  ... from here.

* viewvc.org/who.html,
* viewvc.org/license-1.html
  Lose references to upgrading.html.

* viewvc.org/contributing.html
  Lose references to upgrading.html, and move the release rolling
  instructions out to notes/releases.txt.
 
* tools/make-release
  Also delete viewvc.org/ and notes/ from the distribution.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1401 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-26 20:19:22 +00:00
cmpilato
0bb2dc9f16 * viewvc.org/template-authoring-guide.html
Track new location of tarball_href.  Followup to r1399.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1400 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-24 14:53:41 +00:00
cmpilato
8612acd3c2 * lib/viewvc.py
(common_template_data): Populate tarball_href data dictionary member here,
    instead of ...
  (view_directory): ... here.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1399 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-24 14:52:39 +00:00
cmpilato
3d98a33ce7 Fix issue #18 (Annotate not working in windows for subversion).
Thanks to Hernán Martínez Foffani <hernan.martinez@ecc.es> for testing
this patch on Windows.

* lib/vclib/svn/__init__.py
  (BlameSource.__init__): Patch up the URLs passed to 'svn blame' on
    systems that don't use forward-slashes for path separators.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1396 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 09:47:19 +00:00
cmpilato
362ff5cde6 * viewvc-install
Complete rework this script for uniform code formatting, more readable
  output, support for a fully non-interactive install mode, installation
  of the unmodified configuration files (so folks can see their customizations
  well after they make them), and any other cleanups I could get my hands on.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1394 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 09:36:10 +00:00
cmpilato
d6489c2026 * CHANGES
Merge in 1.0.1 changes.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1392 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 01:02:38 +00:00
cmpilato
b8cbcda7ae * www/index.html
Bump note about the latest release to 1.0.1.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1391 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-21 00:42:24 +00:00
cmpilato
2fa593f359 Repair a paragraph suffering from missing words.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1390 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-20 22:31:54 +00:00
cmpilato
dcc79ade05 Correct a bunch of paths in the INSTALL document. Reported by
Arnaud Quiblier <aquiblier@gmail.com>.

* INSTALL
  Tweaky tweaky...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1386 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-20 16:46:52 +00:00
cmpilato
323f09f7af Finish issue #250 -- Tarballs from Subversion repositories don't
preserve empty directories.

* lib/viewvc.py
  (generate_tarball): Add new (optional) dir_mtime parameter, used to specify
    the modification time of the current directory while generating tarball
    data.  Now, allow empty directories in Subversion tarballs (while
    preserving the "pruning" behavior for CVS tarballs).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1384 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 20:03:15 +00:00
cmpilato
b12a220928 Finish issue #249.
* lib/query.py
  (main): Add 'rss_href' to the data dictionary so the template
    doesn't freak out.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1382 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 18:32:42 +00:00
cmpilato
f448035ca4 * bin/standalone.py
(GUI.__init__): Fix minor spelling errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1381 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 18:23:29 +00:00
cmpilato
d8d2075d65 Finish issue #235.
* bin/standalone.py
  (Options):  Add daemon member.
  (cli): Add support for --daemon/-d option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1380 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 18:08:28 +00:00
cmpilato
08c145ddc0 * bin/standalone.py
(cli): Tweak the layout of the usage message, print it to stderr,
    and report error details.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1379 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 17:37:48 +00:00
cmpilato
bb4204af9a Finish issue #241.
* lib/viewvc.py
  (get_file_view_info): Fix an oops which caused some whack URL
    generation for download-as-text links on files whose path has changed
    over time.
   


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1377 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 15:47:18 +00:00
cmpilato
2fcd41ded0 Finish issue #237.
Patch by: Russell Yanofsky <russ@yanofsky.org>
Verified by: Oliver Koltermann <ok1@tigris.org>

* lib/vclib/bincvs/__init__.py
  (_tag_tuple): Return () instead of raising a ValueError for
    single-component revisions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1375 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-14 15:29:25 +00:00
cmpilato
df68135a6f Add some helpful text and warnings to the sample conf file, closing issue 248.
* viewvc.conf.dist
  Add a skeletal glossary of sorts, and warn that "forbidden" is only for
  modules, not roots.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1374 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-07-12 04:18:39 +00:00
maxb
87bbbba821 * lib/vclib/ccvs/rcsparse/texttools.py: Document what the texttools tag table
actually means, in terms of logical control flow.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1373 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-06-02 18:10:52 +00:00
maxb
3b40b8e245 * tparse/tparse.h: For istream, include <istream>, not <iostream>.
Incidentally, this avoids initializing the cin/cout/cerr/clog
    infrastructure - which is good, because that's somehow triggering a
    platform-specific bug on Cygwin, at the moment!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1372 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 23:31:41 +00:00
maxb
b9102d4649 Resolve some inconsistency in the rcsparse library, concerning the parsing of
colons, which has an impact on symbols and locks.

Fixes a bug where the texttools backend would fail to parse RCS files
containing locks.

Fixes inelegance in the default backend, which no longer needs to override a
rather large chunk of the common code.

* lib/vclib/ccvs/rcsparse/default.py
  (_TokenStream.token_term): Add colon to set.
  (_TokenStream.get): Handle colon as a discrete token, just like semicolon.
  (Parser.parse_rcs_admin): Remove override definition entirely.

* lib/vclib/ccvs/rcsparse/common.py
  (_Parser.parse_rcs_admin): Fix "locks" clause to be consistent with colon
    being a token.

Lastly, the tparse backend: the changes made here are roughly congruent to
those made to the default backend, however they are completely untested, since
the current tparse in the repository seems broken - it dies due to memory
corruption.

* tparse/tparse.cpp (Token_term): Add colon to set.
  (TokenParser::get): Handle colon as a discrete token, just like semicolon.
  (tparseParser::parse_rcs_admin): Remove bizarre code which attempted to
    handle both the case of being, and not being, a discrete token via runtime
    detection.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1371 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 23:18:46 +00:00
maxb
dba9027f85 * tparse/Setup.py: Set svn:executable.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1370 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 19:14:45 +00:00
cmpilato
70530d1018 Apply the patch in issue #239, provided by "mbroadbent (Mark B)".
* templates/include/footer.ezt
  Fix an XHTML validation error caused by not closing an <A> tag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1367 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-26 15:43:41 +00:00
cmpilato
464cf13729 * lib/viewvc.py
(DiffSource.__init__, DiffSource._get_row, DiffSource._flush_row):
    Add support for tracking the left-hand line numbers, too.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1366 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-20 07:19:32 +00:00
cmpilato
f70e9fdc4e * lib/viewvc.py
(view_diff): Fix call to common_template_data(), and avoid a path-from-parts
    reconstruction that's already been performed.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1365 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-20 07:08:53 +00:00
cmpilato
0e750439f8 Merge the commonize-navdata branch into the trunk. For change log
information, see these revisions:

r1348 | cmpilato | 2006-04-25 10:01:17 -0400 (Tue, 25 Apr 2006) | 17 lines
r1343 | cmpilato | 2006-04-20 04:00:21 -0400 (Thu, 20 Apr 2006) | 23 lines


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1364 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-19 15:40:24 +00:00
cmpilato
eedbe8b649 * tools/make-release
Only try to delete directories that exist (to reduce noise).

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1363 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-19 15:37:56 +00:00
cmpilato
a9de320c0e Consistify version heading formats, and lose intra-release dates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1360 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-18 17:30:06 +00:00
rey4
dabc194191 Update old paths in installation docs. Patch and bug report from
Jens Seidel (jensseidel) in issue 236

* INSTALL
* viewvc-install


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1358 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-15 22:37:24 +00:00
rey4
3fdfabc8ee Fix exception on log page when use_pagesize is enabled. Patch from
Jay Rossiter / Signe <signe@cothlamadh.net> on users' list.

* lib/viewvc.py
  (view_log): call paging() with right arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1357 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-15 22:21:15 +00:00
rey4
87c95ac6f8 Merge -r1354 from the `commonize-navdata' branch. It was an accidental
commit, the change was supposed to be for the trunk

* www/index.html
    update latest release section


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1355 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-02 13:38:42 +00:00
cmpilato
4b30fca3bf * CHANGES
Add date for the 1.0.0 release.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1353 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-01 21:21:30 +00:00
cmpilato
bebbc247c9 Merge -r1349 from the `commonize-navdata' branch (it was actually
intended for trunk anyway).

* viewcvs.sourceforge.net/
  Remove this tree.  It really doesn't need to persist in HEAD, and
  the SourceForge publishing directory isn't even a working copy of
  this location (because at the time, SF didn't support Subversion).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1350 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-05-01 19:30:54 +00:00
rey4
c72910f422 Add title attributes to links that don't have other descriptive text.
Change related to issue 227 filed by Steve Rowe (steve_rowe).

* templates/include/dir_header.ezt
* templates/include/header.ezt
* templates/dir_new.ezt
* templates/revision.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1347 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-24 02:18:02 +00:00
rey4
669ea3162b Implement support for full diffs. Change based on a patch from
Jacob Nevins (sourceforge user "jtn") in issue 153.

* lib/vclib/__init__.py
  (_diff_args): perform full diff when "context" option is None
  
* lib/viewvc.py
  (view_diff): add logic for full diffs
  
* templates/diff.ezt
* templates/include/diff_form.ezt
    add option for full diffs

* viewvc.org/template-authoring-guide.html
* viewvc.org/url-reference.html
    update documentation for "diff_format" template variable and url param
  
    


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1346 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-23 21:53:00 +00:00
rey4
d9777eef27 Fix possible incompatibility between loginfo-handler script and
cvs 1.12.9. Based on bug report and patch from sourceforge user
"grubert" in issue 151

* bin/loginfo-handler
  (HeuristicArgParse): accept alternate command lines for
    commits of new and imported directories


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1345 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-23 20:38:54 +00:00
rey4
eb5ccaf906 Fix bug intepreting EZT substitution patterns
* lib/ezt.py
  (_write_value): fix logic error from wrong indentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1344 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-21 13:27:20 +00:00
cmpilato
d61e0b8e2c * viewvc.org/download.html
Thomas Güttler points out that apparently tigris.org's new "guest"
  user password is the empty string.
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1341 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-20 06:59:01 +00:00
cmpilato
e0d1a728a5 Fix a bug in the revision view URL generation and auto-upgrade.
* lib/viewvc.py
  (Request.run_viewvc): Translate 'rev' parameter to 'revision'
    (instead of to 'pathrev') in the revision view.

* templates/revision.ezt
  Use "revision" instead of "rev" for the jump_rev form input box.
  Patch by fengxj <fengxiangjun@neusoft.com>.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1339 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-20 06:53:42 +00:00
cmpilato
b749971cdf * templates/dir_new.ezt
Use pixels instead of percentages for the first column.  Also, make sure all
  the *_icon_link items are defined for all path types.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1338 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-19 05:54:36 +00:00
cmpilato
171670a621 * templates/dir_new.ezt
Followup to r1335.  Drop whitespace from the icon column, and stop setting
  the font-size to 0 there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1337 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-19 05:40:40 +00:00
cmpilato
4c96e86027 Make the dir_new template able to show as much of the log message as
can fix on the screen, and have a fixed layout (which promotes rapid
navigation).

* lib/viewvc.py
  (view_directory): Don't truncate rows.log any more, but provide a
    new member rows.short_log that is truncate.

* viewvc.org/upgrading.html
  Note rename of directory entries' "log" variable to "short_log".

* viewvc.org/template-authoring-guide.html
  Describe entries.log and (new) entries.short_log.

* templates/docroot/styles.css
  (table.fixed, table.fixed td): New fixed table styles, for use with
    the dir_new template.

* templates/dir_new.ezt
  Use new fixed table styles, and display as much of the log messages
  as screen-real-estate-ily possible (with ellipsis for truncation on
  IE, even).

* templates/directory.ezt
  Use entries.short_log now instead of entries.log.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1335 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-14 04:58:33 +00:00
cmpilato
24558586a8 * templates/docroot/styles.css
New "vc_icon" style.

* templates/include/footer.ezt,
* templates/include/file_header.ezt,
* templates/dir_new.ezt,
* templates/query_form.ezt,
* templates/revision.ezt,
* templates/directory.ezt,
* templates/roots.ezt
  Use 'class="vc_icon"' instead of 'width="16" height="16"'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1334 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-14 04:35:13 +00:00
rey4
9bc2a1e1f2 Make rlog parsing compatible with output from Debian's 5.7-18
RCS package, which outputs CVS commit ids when present. Change
based on patch Olivier 'zer0' MATZ <zer0@droids-corp.org>
sent to the issues list.

* lib/vclib/bincvs/__init__.py
  (_re_log_info): update to match lines with commit ids


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1333 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-14 03:45:31 +00:00
rey4
9ec5d1f09e Doc updates
* CHANGES
* INSTALL
* viewvc.org/index.html
* viewvc.org/upgrading.html
* windows/README


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1331 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-09 16:02:01 +00:00
cmpilato
956482e96b * www/index.html
(Latest Release): New section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1330 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 20:48:18 +00:00
cmpilato
3c55e5eaf8 * lib/viewvc.py
(__version__): Bump to 1.1-dev.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1328 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 19:54:29 +00:00
cmpilato
d438a4b113 * viewvc.org/contributing.html
(Release Management): Update instructions to match new tag/branch naming
    scheme.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1326 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 19:27:42 +00:00
rey4
10a237f380 Change make-release script to generate ZIPs with CRLF line endings.
Also, no longer include the elemx, tests, tools, tparse, and www
directories in releases.

* tools/make-release


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1313 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 17:22:39 +00:00
rey4
a5c7a1279f Remove Codewarrior project file for aspfool. It's a good compiler,
but the bloated binary project file format sucks and nobody uses it.

* aspfool/aspfool.mcp
* aspfool/README


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1312 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-06 16:52:38 +00:00
rey4
c195eb1e46 Restore ViewCVS 0.9.x behavior when "checkout_magic" option is disabled
so disabling it doesn't break compatibility with old log URLs.

Add new "default_file_view" option so people who won't miss the old log
URLs can view static HTML sites in ViewVC without using checkout_magic.

Also, deprecate the "checkout_magic" option and make it disabled by
default. Don't want that last part to get lost, so I'll repeat:

  =================================================================
   WARNING: This commit changes the default "checkout_magic" value
  =================================================================

Reasons for disabling "checkout_magic" by default include the security
hole it leaves for people trying to do URL authorization and its general
ugliness. People who actually use "checkout_magic" for the static HTML
browsing should prefer the "default_file_view" syntax now that it
is available. And people who really need "checkout_magic" for the
compatibility with ViewCVS 0.9.x log URLs can easily enable it.

* lib/viewvc.py
  (Request.run_viewvc, Request.get_link):
     handle "checkout_magic" and "default_file_view" options

* lib/config.py
* viewvc.conf.dist
    add "default_file_view" option and disable "checkout_magic" by default

* CHANGES
* viewvc.org/upgrading.html
* viewvc.org/url-reference.html
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1311 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-04 03:11:02 +00:00
rey4
93e802daf4 Make various improvements to URL reference document. In particular,
go back and add required/optional/depends columns to the tables in the
URL syntax section.

Now the document does seem ok, so can we pretty please have a release?

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1310 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 23:54:34 +00:00
cmpilato
253c4bd625 Finish issue #226 - RSS feed title name always reads "CVS"
* templates/rss.ezt
  Make the RSS feed use "REPOSNAME commits[ (in DIRECTORY)]" for its title, 
  and "VC-SYSTEM commits to the[ DIRECTORY directory of the] REPOSNAME
  repository" for its description (where the all-caps words are replaced
  with the relevant data).



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1309 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 18:25:33 +00:00
cmpilato
a889e3280a * lib/viewvc.py
(Request.run_viewvc): Don't overwrite good parameters 'pathrev' and
    'revision' with old 'rev' values.  And revert a little change from r1299
    which caused some of the redirect logic to be skipped in we're already
    done the 'rev'-to-something-else translation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1308 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 14:50:32 +00:00
rey4
c3382c842f Basically finish up URL reference, filling out section on Backwards
compatibility and filling in some other gaps.

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1307 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 04:37:49 +00:00
rey4
e14ed404f8 * viewvc.org/url-reference.html
replace more occurrences of "rev" with "revision"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1306 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 02:26:13 +00:00
rey4
55287d6f16 Break up "url fragment" tables in URL reference document into separate
"path components" and "query parameters" tables as discussed on commit
list.

Turns out most of the "path components" tables only have a single row,
which kind of defeats the purpose of having a separate tables, but 
no reason to worry about that now...

* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1305 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 02:18:31 +00:00
rey4
a30f7b5dc8 Remove summary tables and brackets from URL document
* viewvc.org/url-reference.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1304 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-03 01:50:51 +00:00
rey4
9d9092cb08 Fix ambiguities in URL handling for tarballs. These ambiguites didn't
lead to problems that anyone was likely to encounter, but should be fixed
now that we're trying to come up with a solid URL specification.

Problem #1 is that the .tar.gz suffix was not always being stripped from
the URL path, instead it was only stripped when the path did not exist in
the repository. This meant that a tarball URL like 
"/viewvc.cgi/my/path.tar.gz?view=tarball" would stop working if a
real file or directory called "my/path.tar.gz" were ever added to the
repository. The new code just strips the ".tar.gz" suffix unconditionally.

Problem #2 is a little hairier. It is the topic of issue 210 that was
partially addressed in r1256. The issue after that change was that a URL
like "/viewvc.cgi/REPOS-root.tar.gz?view=tarball&root=REPOS" would stop
working correctly if a directory called "REPOS-root" was ever added to
to repository. Before the directory was added, the URL would download a tarball
of the whole repository. After, the tarball would contain the only the
directory. When "root_as_path_component" mode is enabled, the fix for this
is simple, we just change the syntax for a whole-repository tarball to look
like "/viewvc.cgi/REPOS.tar.gz", which leaves no ambiguity. When
root_as_path_component is disabled, the ambiguity has to be resolved in an
ugly way, by having ViewVC tack on an extra parameter ("parent=1") to root
tarball URLs to distinguish them from directory tarball URLs.

Old tarball URLs that worked before this change should continue to work,
though some of them will redirect to URLs using the "parent" parameter
and other newness.

* lib/viewvc.py
  (Request.run_viewcvs):
     add tarball suffix handling that doesn't depend on what paths exist in
     the repository. Keep the old tarball suffix code around, but only for
     the sake of handling old-style URLs and issuing redirects

  (Request.get_link):
     change the preferred links to root tarballs

  (_legal_params): add "parent" parameter

* viewvc.org/url-reference.html
    mention new "parent" parameter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1303 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 20:43:11 +00:00
rey4
95ad462037 * lib/viewvc.py
(view_log): don't add unused parameter to "select for diff" links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1302 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 18:39:40 +00:00
rey4
7572555e01 Add information about compatibility with old versions of Highlight
* windows/README
    put it here because there doesn't seem to be any other place in the
    documentation where we talk about known issues with 3rd party software.
    I don't want to reorganize the documentation right now but I don't want
    to lose this information either.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1301 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-04-02 18:21:53 +00:00
cmpilato
11127db6f6 * lib/viewvc.py
(_orig_path): Update comment which include 'rev=' examples.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1300 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-31 00:16:16 +00:00
cmpilato
da94713852 * lib/viewvc.py
(Request.run_viewvc): Move the 'rev' param auto-translation up a bit,
    and don't perform pathtype checks if we're already in need-to-redirect
    mode.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1299 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-31 00:05:45 +00:00
cmpilato
db3e7c3e00 Rename the 'rev' CGI parameter to 'revision' so that ViewVC can detect
URLs that predate the new 'pathrev' stuff, and graciously upgrade
those to the new format.  

NOTE: URLs created between the introduction of 'pathrev' and now might
break, but this was deemed an acceptable cost.

Suggested by:  Russell Yanofsky

* lib/viewvc.py
  (_legal_params): Add 'revision' as a copy of 'rev'.
  (Request.run_viewvc): Redirect URLs that have an old-style 'rev'
    parameter.  (For Subversion, those become 'pathrev' params; for
    CVS they become 'revision' params.)
  (): Generate URLs using the new 'revision' param instead of 'rev'.

* viewvc.org/url-reference.html
  Track the new URL syntax.  I did *not* do the work of documenting the
  old syntax and how it maps to the new.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1298 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 23:48:12 +00:00
cmpilato
92af4035f3 At Garrett Rooney's suggestion, use a fast-becoming-a-standard RSS
icon instead of my fast-whip-out-an-icon custom one.  Thanks to Paul
Cuerna for the URL (http://www.feedicons.com/).

* templates/include/footer.ezt
  Reference new RSS icon.

* templates/docroot/images/rss.jpg
  Remove, in favor of...

* templates/docroot/images/feed-icon-16x16.jpg
  ... this beauty.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1297 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 23:01:12 +00:00
cmpilato
e51335b5fe Advertise RSS capabilities even to browsers that don't have built-in
support for RSS.

* templates/docroot/images/rss.jpg
  New image.

* templates/include/footer.ezt
  Tweak bottom matter of ViewVC pages to include new RSS image (where
  available).  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1296 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-30 21:59:34 +00:00
cmpilato
5d0109e325 * viewvc.org/url-reference.html
Make the stylesheet more like that of the template authoring guide.

* viewvc.org/template-authoring-guide.html
  Collapse some style definitions, and add a little intro paragraph.

* viewvc.org/contributing.html
  Hook the template authoring guide and URL reference into this document.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1295 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-27 19:31:35 +00:00
rey4
f586a5ebed Add URL reference document, currently rough and incomplete. Idea from
C. Michael Pilato in dev-list discussion.

I wanted to knock this out this weekend, but didn't get too far. One
more weekend should be enough though, and I welcome any feedback, especially
ideas on how to organize it better.

* viewvc.org/url-reference.html
    new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1294 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-27 14:36:58 +00:00
maxb
6b98e0a8ec Improve viewvc-install's response to invalid arguments.
* viewvc-install: Move introductory info printing after argument passing, so
    that it is not shown if there is an argument parsing error.
  Catch GetoptError, and report nicely.
  Do not pass None to getopt where it wants a string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1293 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-26 20:23:14 +00:00
rey4
fe995627d3 Get rid of Highlight line number workaround. Highlight 2.4.5 came out
yesterday and fixes all the issues we had with line numbering. This change
also allows ViewVC to work with old versions of Highlight all the way back
to 2.2.10.

Also, remove "highlight_style" configuration option as suggested by
Andreas Amann (aamann) in issue 126.

* INSTALL
    document new version requirements
    
* lib/viewvc.py
  (MarkupHighlight.__init__):
    stop passing --style and --line-number-start options to highlight

* lib/config.py
* viewvc.conf.dist
* viewvc.org/upgrading.html
    remove "highlight_style" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1292 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-21 22:47:11 +00:00
rey4
176ede2fef Get rid of the "derived from cvsweb" notice at the top of viewvc.py
as Greg Stein suggested in issue 167.

* lib/viewvc.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1291 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-20 03:39:54 +00:00
rey4
72459917f7 Restore copyright statements for Curt Hagenlocher accidentally
deleted in r1288

* lib/blame.py
* lib/vclib/ccvs/blame.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1290 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-20 03:27:02 +00:00
rey4
95db9e7f64 * viewcvs-install
* viewvc-install
    rename one more file



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1289 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 02:08:47 +00:00
rey4
3efd3fa040 Clean for file headers and copyright notices for issue 167
* bin/asp/query.asp
* bin/asp/viewvc.asp
* bin/cgi/query.cgi
* bin/cgi/viewvc.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/make-database
* bin/mod_python/handler.py
* bin/mod_python/query.py
* bin/mod_python/viewvc.py
* bin/standalone.py
* bin/svndbadmin
* lib/accept.py
* lib/blame.py
* lib/compat.py
* lib/config.py
* lib/cvsdb.py
* lib/dbi.py
* lib/debug.py
* lib/idiff.py
* lib/popen.py
* lib/query.py
* lib/sapi.py
* lib/vclib/__init__.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/viewvc.py
* lib/win32popen.py
* tools/make-release
* tparse/tparse.cpp
* tparse/tparse.h
* tparse/tparsemodule.cpp
* tparse/tparsemodule.h
* viewcvs-install


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1288 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 02:07:36 +00:00
rey4
f74711446f Finish issue 168, the project rename. Change is mostly based on the patch
from Gerard Gerritsen (sigcafe), with some other stuff thrown in.

* bin/asp/viewcvs.asp
* bin/asp/viewvc.asp
* bin/cgi/viewcvs-strace.sh
* bin/cgi/viewvc-strace.sh
* bin/cgi/viewcvs.cgi
* bin/cgi/viewvc.cgi
* bin/mod_python/viewcvs.py
* bin/mod_python/viewvc.py
* lib/viewcvs.py
* lib/viewvc.py
* viewcvs.conf.dist
* viewvc.conf.dist
    the file renames

* bin/cvsdbadmin
* bin/loginfo-handler
* bin/svndbadmin
* bin/asp/query.asp
* bin/cgi/query.cgi
* bin/mod_python/query.py
* bin/make-database
* bin/standalone.py
* lib/debug.py
* lib/compat.py
* lib/blame.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/bincvs/__init__.py
* lib/query.py
* lib/config.py
* lib/dbi.py
* lib/sapi.py
* INSTALL
* TODO
* cvsgraph.conf.dist
* tests/timelog.py
* tools/make-release
* tparse/tparsemodule.h
* tparse/Setup.py
* tparse/INSTALL
* tparse/tparsemodule.cpp
* tparse/tparse.h
* tparse/tparse.cpp
* windows/README
* viewcvs-install
* viewvc.org/index.html
* viewvc.org/contributing.html
* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
* viewvc.org/license-1.html
    the other changes



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1287 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 00:33:54 +00:00
rey4
41296bf318 Avoid potential problem with pipe_cmds
* lib/popen.py
  (_pipe.close): use os.waitpid instead of os.wait to avoid messing with
    processes that dont belong us


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1286 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 20:25:34 +00:00
rey4
19fbe15fe9 Make cvsdbadmin script work correctly when it is used to update
individual modules or directories underneath a cvs root. It will
now crawl up the directory path looking for a CVSROOT directory
so it can use the right path for the "repositories" table and
allow results to show up in queries

* bin/cvsdbadmin
  (RootPath): new
  (__main__ section): use RootPath to find correct cvs roots


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1285 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 16:47:57 +00:00
rey4
49d332a996 Fix error messages when a path string is passed to vclib.ItemNotFound
instead of a list of path parts. We seem to do that a few places in
the svn module.

* vclib/__init__.py
  (ItemNotFound.__init__): accept path strings as arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1284 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-17 16:39:17 +00:00
cmpilato
66923a4982 * lib/viewcvs.py
(MarkupEnscript.__init__): Revert a change made in r1255 which
    tweaked the sed expression.  The goal was to try to also strip out
    the <PRE> and </PRE> tags from the output, but the expression I
    used also had the undesired effect of dropping the whole last line
    of a non-newline-terminated file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1283 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-16 04:13:19 +00:00
cmpilato
34d32b394e Some improvements to the py2html integration. Thanks (I think...) to
David Martínez Moreno (Ender) for sending me down this path.

* lib/py2html.py
  Update to version 0.8.  Patch by David Martínez Moreno <ender@debian.org>.

* lib/viewcvs.py
  (markup_stream_python):  Call PrettyPrint.set_mode_rawhtml_color().

* lib/PyFontify.py
  Rework this file to use spaces instead of tabs.  Use the 're' module
  instead of 'regex'.  Fix a bug which caused "raise" to not be
  noticed as a keyword (though "rais" would be).  Add "assert" and
  "exec" to the keywords list.

* templates/docroot/styles.css
  Reformat the highlight styles, and made the .kwd style have a little color.
  Also, add the styles that py2html uses.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1282 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 19:56:31 +00:00
cmpilato
342ec95573 * TODO
* bin/cvsdbadmin
  Minor spelling and whitespace fixes.  Patch by David Martínez 
  Moreno <ender@debian.org>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1281 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 15:41:44 +00:00
cmpilato
5912f400e6 Make py2html.py executable (it has a shell script mode).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1280 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-13 15:31:48 +00:00
cmpilato
73f5b59865 * bin/svndbadmin
(handle_revision):  Add 'verbose' parameter, and use it.
  (main):  Add 'verbose' parameter, and pass it off to handle_revision().
  (usage):  Update the usage message (and make it a little more ... useful).
  (__main__):  Look for the -v (verbose) flag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1279 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-10 15:26:58 +00:00
cmpilato
a2db8718cf Make some fixes to the pipe handling code to avoid zombie processes.
Patch by Paul Sokolovsky <psokolovsky@vasoftware.com>.

* lib/popen.py
  (pipe_cmds): Instead of storing only the process ID of the last
    child process in a multi-process pipe, keep them all, and wait on
    them all to finish.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1278 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-07 14:57:27 +00:00
cmpilato
71cf9e54ca Um. Character entities in comments are somewhat pointless. Replace the ones
I added in r1276 with double-semicolons.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1277 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 20:01:11 +00:00
cmpilato
3b592577a1 With Greg Stein's blessing, drop his name from the template comments.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1276 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 19:58:46 +00:00
cmpilato
e8a49a088c Remove SourceForge migration checklist, and lose implementation details of
features.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1275 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:55:38 +00:00
cmpilato
8977d400de Consistify capitalization.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1274 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:54:27 +00:00
cmpilato
16d80cb070 Add viewvc.org to the left-nav bar.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1273 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-06 18:53:41 +00:00
rey4
c2e18ca589 Make vhost configuration work under mod_python. Patch by
Robert Spier <rspier@pobox.com> from the dev list.

* bin/mod_python/viewcvs.py 
  (index): load_config needs a sapi object to properly handle vhosts


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1272 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-01 12:28:09 +00:00
cmpilato
0049b7fed9 * templates/markup.ezt
Check for existence of date, ago, and author before displaying them or their
  surrounding text.  This is a follow-up to r1270.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1271 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-28 18:08:23 +00:00
cmpilato
7aaf4dc8b7 Finish issue #215.
* lib/viewcvs.py
  (view_markup): Ensure initialization of variables when show_log_in_markup
    is disabled.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1270 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-27 14:07:07 +00:00
rey4
44131b424d Revert unintended change from r1267. Garrett Rooney
<rooneg@electricjellyfish.net> pointed it out on the
dev list.

* bin/mod_python/viewcvs.py


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1269 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-26 23:45:50 +00:00
rey4
4c51a8faf6 Fix windows install issues #213 and #214.
Yahor Sinkevich (_tom) made me do it.

* viewcvs-install
  (install_tree): dont copy "_svn" directories

* windows/README
    say up front that binary subversion bindings may tie you to a
    specific version of python. also make it clear that ViewVC
    doesn't need CVSNT to browse Subversion repositories


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1268 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-25 17:17:29 +00:00
rey4
10ff60245b Fix bug from r1266 in integrated query view reported by
Larry Silverman <cerulean47@gmail.com> on the users
list.

* lib/viewcvs.py
  (build_commit): handle the case where dir_strip is ""


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1267 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-25 16:52:24 +00:00
rey4
d8224da3c4 Make the integrated query page work when the repository directory
entered in cvs_roots is a subdirectory of a cvs root rather than a
top-level root directory.

Also, raise an exception when a repository being queried doesn't
exist in the database instead of returning 0 matches.

* lib/cvsdb.py
  (FindRepository): new
  (CleanRepository): add docstring

* lib/viewcvs.py
  (build_commit): strip off top-level directory paths from query results
    when the configured root is a subdirectory of the database root
  (view_query): call cvsdb.FindRepository and use information returned
    to convert paths relative to configured root to database paths



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1266 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-22 04:26:54 +00:00
rey4
f062872f9a Fix crippling bug in query.cgi reported by John L. Villalovos
<john@linux.intel.com> on the users list.

* lib/query.py
  (build_commit): set 'commits.log' template var instead of 'commits.desc'


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1265 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-18 15:38:28 +00:00
rey4
757e115829 Restore highlight "line-number-start" option. Quoth Andreas Amann
(aamann) in issue 126:

  "the --line-number-start is needed as of 2.4.2 (latest is 2.4.3)
  otherwise line numbers will start at 0 instead of 1"

* lib/viewcvs.py
  (MarkupHighlight.__init__):
    update highlight command line


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1264 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-16 18:24:11 +00:00
cmpilato
0b1a9fde95 Fix a bug which caused 404's for revision views of the default
repository when root_as_url_component is disabled.

* bin/standalone.py
  (StandaloneServer.is_viewcvs): Allow '?' as a path terminating
    character (just like '/') when checking to see if the input path is
    under ViewVC's control.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1263 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-15 19:06:23 +00:00
cmpilato
f93fb6d68a * viewcvs-install
(InstallFile): Whitespace tweak.
  (install_tree): Tweak text of installer prompts to assist folks with
    the somewhat obscure idea of DESTDIR.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1262 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-15 15:09:57 +00:00
cmpilato
0525532ef7 Use <em> instead of <i>, <strong> instead of <b>.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1261 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 22:18:33 +00:00
cmpilato
9803cd5958 Finish issue #178 -- remove references to symbolic revisions in
instructions for Subversion diffs.

* lib/viewcvs.py
  (setup_diff): Call repos._getrev() on the diff input revisions so
    'HEAD' gets resolved to a number.

* templates/include/diff_form.ezt
  Use tag-existence-aware instructions on the diff-form.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1260 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 22:09:54 +00:00
cmpilato
0aad71271f Re-order COMMITTERS based on first commit of each username.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1259 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:51:17 +00:00
cmpilato
ccab4b33ae Add a COMMITTERS file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1258 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:41:47 +00:00
cmpilato
2134d1f657 Finish issue #174 -- markup view of HEAD shows HEAD metadata, but
uses last-changed-rev for other display markings.

* lib/viewcvs.py
  (view_markup): Use the resolved revision instead of the input
    revision when fetching metadata.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1257 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 21:28:34 +00:00
cmpilato
c2434be105 Finish issue #210. Patch by Gerard Gerritsen <sigcafe@tigris.org>,
tweaked by me.

* lib/viewcvs.py
  (Request.run_viewcvs): Handle requests for [rootname]-root.tar.gz
    specially as tarball download views of the root of the repository.
  (Request.get_link): If we are prepping a URL for tarball generation
    on the root of a repository, use the filename [rootname]-root.tar.gz
    instead of just root.tar.gz.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1256 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 20:39:15 +00:00
cmpilato
59d97089e1 Finish issue #212 -- XHTMLify the highlight integration.
* lib/viewcvs.py
  (MarkupEnscript.__init__): Have sed strip the <PRE> wrappers around
    enscript output, too.
  (MarkupHighlight.__init__): Drop the --line-number-start and
    --include-style options to highlight; add --xhtml and --fragment.
    Lose the 'sed' invocation too, as it is no longer necessary.
  (view_markup): No longer pass '<pre>' and '</pre>' to the
    MarkupPipeWrapper() call -- the template will handle that.

* templates/markup.ezt
  Add <pre>...</pre> wrappers around the markup stream.  Also, name
  that whole <div> "vc_markup".

* template/docroot/styles.css
  Embed the highlight stylesheet.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1255 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 20:13:00 +00:00
cmpilato
e12dce81e1 Fixup <br> tags (to <br />).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1254 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-14 19:47:41 +00:00
cmpilato
09bddb189a Require Subversion 1.2.0 or better for the 'svn' module.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1253 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-13 22:26:39 +00:00
rey4
1f416a919f Fix EZT callback implementation so along with being able to write raw data
to the output, callbacks can also write formatted output (controlled by
[format] directives.) EZT now passes Context object arguments to callbacks
instead of file pointers, so more functionality can be exposed to Callbacks
in the future without loss of backwards compatibility.

Also make improvements to implementation of [format] so directives will
take effect in files included through variable references ([include path])
just like files included through string constants ([include "path"]).
And make it possible to specify custom format types (beyond "raw" "html"
"xml") with callbacks and without the need to modify ezt.py.

* lib/ezt.py
  (__doc__): update documentation
  (Template._printers, Template._cmd_print_html, Template._cmd_print_xml):
    remove
  (Template._parse, Template._cmd_format, Template._cmd_end_format, 
   _raw_printer, _html_printer, _printers): update [format] implementation
  (Template.parse): update call to _parse
  (Template.execute): update call to _execute
  (Template.generate, Template._execute, Template._cmd_print,
   Template._cmd_format, Template._cmd_include, Template._cmd_if_any,
   Template._cmd_if_index, Template._cmd_is, Template._do_if,
   Template._cmd_for, Template._cmd_define):
    move file pointer into Context object
  (_write_value): handle callbacks as printers and callbacks that use printers
  (_context, Context): rename _context class to Context and fill out methods
    since object is now exposed outside EZT as an interface for accessing EZT
    functionality from callback functions

* lib/viewcvs.py
  (MarkupPipeWrapper.__call__, MarkupShell.__call__):
    update for new (futureproofed) callback implementation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1252 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-10 04:24:12 +00:00
cmpilato
4a85813c24 * viewvc/lib/vclib/svn/__init__.py
(BlameSourceKludge): Remove.
  (SubversionRepository.annotate): Go back to using BlameSource --
    Russell fixed it in r1236.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1251 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-09 18:41:34 +00:00
cmpilato
fd1afe5fdb * viewvc/templates/diff.ezt
Avoid creating references to undefined "vc_idiff_" class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1250 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-06 18:36:46 +00:00
cmpilato
d28ec94d3c * viewvc/lib/idiff.py
(_item.__init__): Call update() with the proper argument.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1249 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-06 18:30:10 +00:00
rey4
40a2cdda10 Fix issue #205 "Illegal id tags in tempates" reported by
Andreas Amann (aamann) using patch he provided.

* templates/diff.ezt
* templates/annotate.ezt
    put a letter in front of id tags that begin with numbers


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1248 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 18:37:37 +00:00
rey4
a6391ce319 Fix HTML escaping in new unified diff view
* lib/idiff.py (_differ_split)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1247 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 18:26:46 +00:00
rey4
1700dcd3c8 Implement trac-style unified diffs (with line numbers along the side
and intraline changes highlighted). This feature requires Python 2.2
and is disabled by default.

* templates/diff.ezt
    add table for highlighted unified diffs

* lib/idiff.py
  (unified, _trim_context, _differ_split): new

* lib/viewcvs.py
  (view_diffs): set new "unified" template var on diff page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1246 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-05 17:32:44 +00:00
rey4
ffe781b297 Check in some files that were supposed to be included in r1244
* templates/docroot/styles.css
* templates/diff.ezt
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1245 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:51:55 +00:00
rey4
52b8b89883 Add rudimentary support for intraline diffs. Implementation is pretty
clean, but it doesn't provide all the bells and whistles of our normal
diff interface. It's disabled by default and requires python 2.4 to
run.

* templates/docroot/styles.css: 
    add new styles

* templates/diff.ezt:
    add table for intraline diffs

* lib/config.py:
* viewcvs.conf.dist
    add new "hr_intraline" option

* lib/vclib/svn/__init__.py
  (FileContentsPipe.readline): prevent from returning "" before eof and
    from stripping out newlines
  (FileContentsPipe.readlines): new
  
* lib/idiff.py
    new

* lib/viewcvs.py
  (view_diff): set new "sidebyside" template variable



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1244 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:48:00 +00:00
rey4
ddaebb0f26 Make EZT library support python iterators so you can pass in things like
like generator functions. This patch was attached to issue 201. I am the
author, but credit goes to Greg Stein for valuable feedback which allowed
me to simplify the initial implementation.

* lib/ezt.py
  (Template.generate, Template._cmd_if_index, Template._cmd_for,
   _get_value): replace ctx.for_index member with ctx.for_iterators
  (_Iterator, OldIterator, _iter): new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1243 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 22:21:47 +00:00
rey4
f24f6e5119 Fix issue 204, 'Invalid "Repository Listing" location' reported by
Erik C. Thauvin (ethauvin)

* lib/viewcvs.py
  (Request.get_link):
    return "/" instead of "" when generating top level links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1242 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-04 19:54:34 +00:00
rey4
c4edb250aa Rename ndiff.py and difflib.py modules, which are only provided for
python 1.5 compatibility.

* lib/difflib.py
* lib/ndiff.py
* lib/compat_ndiff.py
* lib/compat_difflib.py
    rename 

* viewcvs-install
    update ndiff invocation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1241 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-03 05:16:29 +00:00
rey4
0000ed88bb Rename the "Project Root" drop down box to "Repository" in the
default templates. We already say "CVS Repositories" and
"SVN Repositories" inside the drop down box, so we might as well
use same term outside. Also, "Root" has a specific meaning in CVS
(a top level directory containing a CVSROOT folder, a bunch of
modules, and no files) and CVS repositories in the drop down box
are not necessarily CVS roots.

* templates/include/header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1240 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-01 00:40:33 +00:00
rey4
68673daba3 Allow CVS roots to be specified as root_parent directories, that way
ViewVC can list CVS modules alongside Subversion repositories.

* lib/viewcvs.py
  (load_config): include modules in CVS root_parent directories (not just
    roots) in repository list


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1239 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-02-01 00:34:24 +00:00
rey4
8afaca5f75 Fix mismatch between config.py and config file
* lib/config.py
  (Config.set_defaults): set "php_exe_path" instead of "php_path"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1238 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-31 19:15:52 +00:00
cmpilato
ef93e8eed3 * viewvc.org/download.html,
* viewvc.org/contributing.html
  Update the downloading and Subversion checkout instructions.  Also, provide
  a link to the nightly builds.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1237 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-27 14:53:14 +00:00
rey4
42b55eb5f9 Improve error reporting when svn blame fails. Also fix some bugs in
BlameSource. Maybe now we don't need BlameSourceKludge anymore...

* lib/vclib/svn/__init__.py
  (BlameSource.__init__): add missing first_rev parameter
  (BlameSource.__getitem__): remove check for fp.eof() which may
    return true when the process has finished executing but data
    can still be read from the pipe
  (BlameSource.__getitem__, BlameSourceKludge.__getitem__):
    use regex to parse blame info so we can show a detailed error
    message instead of just an exception when split() or int() fail

* lib/popen.py
  (_pipe.eof): add note about implementation problem


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1236 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-22 17:01:02 +00:00
cmpilato
f88451caaa Finish issue #34 by making annotation lines bookmarkable, and linking
to them from the diff page.

* viewvc/templates/annotate.ezt
  Make each row bookmarkable.

* viewvc/templates/diff.ezt
  Make line numbers into links to the annotate page.

* viewvc/lib/viewcvs.py
  (view_diff): Add an annotate_href to the data dictionary.

* viewvc/viewvc.org/template-authoring-guide.html
  (variables-diff): Document new annotate_href and changes.line_number
    variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1235 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 13:08:54 +00:00
cmpilato
695dd93b47 Implement support for line numbers in the diff view.
* viewvc/lib/viewcvs.py
  (DiffSource.__init__): Initialize a new line_number member.
  (DiffSource._get_row, DiffSource._flush_row): Calculate line number
    information from the diff output.

* viewvc/templates/diff.ezt
  Show line numbers with the diff, and make those line numbers
  bookmarkable (for sub-page granularity).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1234 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 12:44:34 +00:00
cmpilato
d3358ad705 Really finish issue #177. Fix a little bug with the bugfix done in r1232.
* viewvc/lib/vclib/svn/__init__.py
  (SubversionRepository.annotate): Always cross copies when looking
    for the first and last revisions in the file's history.  Duh.  



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1233 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 09:26:19 +00:00
cmpilato
d1d1b73cde Finish issue #177.
Fix a bug with Subversion annotate views which allowed the first
revision of a file's life to be a link to a diff against a
non-existent path/rev location.

NOTE: This doesn't fix the problem for remote repositories (accessed
      via the svn_ra module).

* viewvc/lib/vclib/svn/__init__.py
  (_get_history):  Make 'options' optional.
  (BlameSource.__init__, BlameSourceKludge.__init__):  Accept new
    first_rev parameter which is the first revision in the history of
    the file.
  (BlameSource.__getitem__, BlameSourceKludge.__getitem__):  Don't
    store a 'prev' revision that's older than the first revision of
    the file.
  (SubversionRepository.annotate): Instead of using _get_last_history_rev(), 
    call_get_history() to find both the first and the last revision in
    the file's history.  Update call to BlameSourceKludge().



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1232 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-21 06:54:04 +00:00
cmpilato
e93648496d * www/index.html
Override a few more styles to hide the "Description" box.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1231 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-19 02:06:08 +00:00
cmpilato
4510863e42 Try a different hack (the same one I used on subversion.tigris.org) for
hiding the project info box on the webpage which doesn't also have the
unfortunate side effect of losing the links for project editing, 
requesting membership, and other such useful things.

* index.html
  Lose a JavaScript redirect hack for a style override hack.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1230 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-19 01:46:47 +00:00
rey4
11174518d5 Fix mod_python issue, #188 reported by Andreas Amann (aamann).
* lib/viewcvs.py
  (generate_page): pass file object associated with current request
   to EZT instead of sys.stdout, which under mod_python is a proxy
   that tries to figure out the current request based on the current
   thread id. It can't be used in worker threads spawned by
   popen.pipe_cmds


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1229 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-18 01:34:11 +00:00
cmpilato
1f40fe9094 * viewvc/viewcvs.conf.dist (enscript_path),
* viewvc/lib/config.py (Config.set_defaults)
  Set use_highlight to 0 by default, so that the default configuration
  has a mildly higher chance of not being broken out of the box.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1228 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-17 01:43:12 +00:00
cmpilato
95fd278332 Add a new --script-alias option to standalone.py, to allow folks to
dynamically fake a non-root location for a running ViewVC process.
Reasoning?  It offends me that "viewcvs" was hardcoded in ... just
seems wrong.

* bin/standalone.py
  (Options): Populate a new script_alias member.
  (StandaloneServer.do_POST, StandaloneServer.is_viewcvs,
   StandaloneServer.redirect, StandaloneServer.run_viewcvs): Use
    options.script_alias instead of a hardcoded "viewcvs".
  (cli): Parse new --script-alias/-s option for dynamically defining
    the ScriptAlias.  Rework the usage message for my own pleasure.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1227 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-05 19:24:13 +00:00
cmpilato
993b156089 Finish issue #189 -- stale URLs for enscript in INSTALL file and website.
* INSTALL
* viewvc.org/index.html
  Update URLs for enscript to http://www.codento.com/people/mtr/genscript,
  as suggested by Eric Garrido <eric@tigris.org>.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1226 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-01-04 20:25:38 +00:00
rey4
ed6a269934 Resolve issue 147 "patch for aix co." Patch by sourceforge user
coshx.

* lib/vclib/bincvs/__init__.py
  (_re_co_filename): broaden regex


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1225 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-30 07:30:45 +00:00
rey4
0a889562f3 Use built in enscript file detection. This is an updated implementation
of an patch from Andreas Amann (sf user ahndee) in issue 156.

* lib/viewcvs.py
  (MarkupShell.__call__): make input file pointer optional
  (MarkupEnscript.__init__, MarkupEnscript.__call__): write input to
    temporary file so enscript can decide what kind of highlighting to do
    based on the file name
  (enscript_extensions, enscript_filenames): removed
  (view_markup): update call to MarkupEnscript

* lib/compat.py
  (mkdtemp): new function

* lib/config.py
* viewcvs.conf.dist
* viewvc.org/upgrading.html
    remove "disable_enscript_lang" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1224 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-30 07:29:22 +00:00
rey4
4e4e961b2d * windows/README
minor updates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1223 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 17:13:41 +00:00
rey4
95d99a5826 Fix issue 187, "viewcvs.conf.dist contains outdated references." Patch
and bug report by Gerard Gerritsen (sigcafe).

* viewcvs.conf.dist
    fix typos and old reference to dir_alternate in comments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1222 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 15:17:31 +00:00
rey4
0467a8e1d1 Fix exception in tarball view for CVS repositories when
use_rcsparse is enabled.

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs): set DirEntry.path member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1221 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 15:08:27 +00:00
rey4
360c5d9e66 Make popen.pipe_cmds() accept an "out" argument that controls where
output from last command goes. For now only the unix implementation
respects it, windows implementation always writes to standard output
as before.

* lib/popen.py
  (pipe_cmds): add "out" argument

* lib/viewcvs.py
  (MarkupShell.__call__): update call to pipe_cmds()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1220 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-29 14:49:42 +00:00
rey4
03070a2320 Attempt to make directory log page a little less confusing.
* templates/include/file_header.ezt
    link to current directory listing instead of parent directory

* templates/include/log_header.ezt
    don't display "Links to HEAD:" stuff for directories. With
    change above it's redundant

* templates/log.ezt
* templates/log_table.ezt
    label directory links as "Directory Listing" instead of "(view)"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1219 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 16:03:14 +00:00
rey4
2d808ae415 Add limit_changes configuration option to limit the number of changed
paths shown in the subversion revision view and in query results.

* lib/config.py
* viewcvs.conf.dist
    add "limit_changes" option

* lib/cvsdb.py
  (LazyCommit): new class
  (CheckinDatabase.LazyCommit): return LazyCommit objects instead of
    fetching all properties of all commits

* lib/viewcvs.py
  (_sticky_vars, _legal_params): add "limit_changes" query parameter
  (view_revision): handle "limit_changes" and add links to manipulate it
  (view_queryform, build_commit, view_query): same

* templates/query_form.ezt
    add field to set "limit_changes"

* templates/query_results.ezt
    wherever changed files are being hidden, add link to show all files

* templates/revision.ezt
    same, and if that link is clicked, show another link to restore
    the default limit_changes so you can toggle back and forth

* viewvc.org/template-authoring-guide.html
* upgrading.html
    document new template variables and configuration option
  


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1218 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 13:24:26 +00:00
rey4
6ae579587e Line wrap windows README file. I had been using a little python script
to do this for windows releases, but it's better just to pre-wrap it
and keep the release process simple.

* windows/README


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1217 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-23 05:56:23 +00:00
rey4
7bb6cac37e Add precompiled aspfool.dll. It's needed to run ViewCVS under
ASP and it's not very big. File is from "ViewCVS for Windows"
page at http://russ.hn.org/viewcvs/ which I'm about to take
down.

* windows/aspfool/aspfool.dll
    new


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1216 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 19:50:11 +00:00
rey4
1c87fc7fa7 Fix issue 104 "ViewCVS Broken on WinNT" with patch provided by
sourceforge user "tomy"

* lib/win32popen.py
    don't import win32security, not needed and doesn't work on NT4


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1215 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 17:04:44 +00:00
rey4
5e595215ec Documentation updates & template cleanups for recent changes.
* lib/viewcvs.py
  (common_template_date):
    only set "rss_href" when it will be valid URL

  (build_commit):
    only set commits.rev for subversion queries

    rename some of the new RSS template variables
      commits.title -> commits.short_log
      commits.url -> commits.rss_url
      commits.date -> commits.rss_date
  
* templates/include/header.ezt
* templates/rss.ezt
    update for changed template variables

* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
* CHANGES
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1214 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 16:55:26 +00:00
rey4
70ffad13c1 Update URL to the highlight program. Inadvertently gave a URL to
GNU Highlight instead of the Highlight program we support. The two
programs have the same name, and do the same things, but are not at
all related. Patch by Wataru Hirayama <hirayama@rr.iij4u.or.jp>

* INSTALL


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1213 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 14:47:13 +00:00
rey4
dabb055603 Add RSS capability to ViewVC using patch from Paul Koning (pkoning)
in issue 179. (All changes are his except for a fix in standalone.py,
and a line initializing "commits.url" template variable to None
in build_commit).

* lib/config.py
* viewcvs.conf.dist
    add [cvsdb] rss_row_limit config option

* lib/cvsdb.py:
  (CheckinDatabase.CreateSQLQueryString): make "LIMIT" value customizable
  (CheckinDatabaseQuery.__init__): set new "limit" member
  (CheckinDatabaseQuery.SetLimit): new

* lib/viewcvs.py:
  (_legal_params): add "limit" parameter
  (common_template_data): add "rss_href" variable
  (make_rss_time_string): new
  (build_commit): add commits.title, commits.rev, commits.author,
    commits.date, commits.url template variables
  (view_query): handle "limit" parameter and new "rss" format

* templates/include/header.ezt
    use new rss_href variable

* templates/rss.ezt
    new

* bin/standalone.py
  (run_viewcvs): set HTTP_HOST environment variable
 


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1212 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 05:16:23 +00:00
rey4
9aef5f5ad6 Add "port" option to connect to specified mysql port.
Patch written by sunjammerx in issue 106.

* lib/config.py
  (Config.set_defaults):
    set default port

* lib/cvsdb.py
  (CheckinDatabase.__init__, ConnectDatabaseReadOnly, ConnectDatabase):
     handle port value

* lib/dbi.py
  (connect):
    same

* INSTALL
* viewcvs.conf.dist
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1211 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-22 03:07:31 +00:00
rey4
053658384c Make "Revision Log" links on markup, annotate and diff pages
jump to the current revision on the log page, like they used
to in 0.9.x. This patch by Jordan Russell <jr-list-2005@quo.to>
from issue 109.

* lib/viewcvs.py
  (common_template_data):
    set "log_rev_href" template variable

* templates/include/file_header.ezt
    use "log_rev_href" template variable

* viewvc.org/template-authoring-guide.html
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1210 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-21 20:45:11 +00:00
rey4
93c239a2af Fix issue 181, query results groups subversion commits from different
revision numbers. Patch by Paul Koning (pkoning)

* lib/viewcvs.py
  (view_query):
    when roottype != cvs, only group commits from same revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1209 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-21 15:18:45 +00:00
rey4
9b5c4db217 Add support for colorizing using highlight. This is a stripped down version
of a patch by Andreas Amann (aamann) from issue 126.

* lib/viewcvs.py
  (MarkupHighlight):
    new EZT callback for invoking highlight

  (view_markup):
    use MarkupHighlight class when "use_highlight" option enabled

* lib/config.py
* viewcvs.conf.dist
    add new configuration options for highlight

* templates/docroot/styles.css
    add ".line" style to make highlight line number stand out
    
* INSTALL
    mention highlight required version and home page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1208 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-20 18:42:32 +00:00
rey4
5c7258464e Simplify enscript and php colorizing using EZT callbacks
* lib/viewcvs.py
  (MarkupShell):
    base class for colorizing callbacks that use shell tools

  (MarkupEnscript, MarkupPHP):
    make these into callbacks instead of pseudo-file pointers, eliminate
    the need for temporary files since with callbacks these tools can
    run in the middle of template execution and send their output to 
    straight to stdout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1207 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-20 17:11:01 +00:00
rey4
08cc30e0cd Change required CvsGraph version from 1.4 to 1.5 to close out
issue 171 reported by Gerard Gerritsen (sigcafe)

* INSTALL


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1206 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 21:15:56 +00:00
cmpilato
f609e62ba2 * templates/include/header.ezt
Make the ViewVC logo a link to http://www.viewvc.org/.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1205 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 17:07:21 +00:00
cmpilato
eb9ee85f90 * templates/docroot/images/logo.png
Grumble.  Fix the background "color" of the transparent portions to
  be white for whack Internet Explorer's sake.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1204 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 17:04:56 +00:00
cmpilato
fbd59621cf * lib/viewcvs.py
(parse_date): Use compat.timegm() instead of time.mktime().  This closes
    issue #5, and comes with rey4's money back guarantee.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1203 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 16:14:34 +00:00
cmpilato
9fdeff7fd0 * templates/docroot/images/logo.png
Tweak the logo to reflect the new project name.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1202 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 16:04:29 +00:00
cmpilato
72146c0875 Revert the changes made in r1196. They were wrong. Actually, cmpilato
was wrong -- the changes merely followed his lead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1201 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-19 14:58:20 +00:00
rey4
b91146fee0 Work on issue 168, s/ViewCVS/ViewVC. This patch changes references to
ViewCVS in comments, strings, and documentation. References to ViewCVS
in filenames and urls still need to be fixed. Also, logo.png (the blimp)
needs to be updated or replaced.

This patch is by Gerard Gerritsen (sigcafe), the only change I've made is
to restore a reference to ViewCVS in a comment about backwards compatibility.

* windows/README
* viewcvs-install
* README
* templates/include/footer.ezt
* templates/include/header.ezt
* templates/error.ezt
* templates/query.ezt
* templates/docroot/help.css
* templates/docroot/help_query.html
* templates/docroot/help_dirview.html
* templates/docroot/help_rootview.html
* templates/docroot/styles.css
* templates/docroot/help_log.html
* templates/diff.ezt
* tools/make-release
* lib/sapi.py
* lib/dbi.py
* lib/accept.py
* lib/cvsdb.py
* lib/config.py
* lib/query.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/svn/__init__.py
* lib/vclib/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/blame.py
* lib/popen.py
* lib/compat.py
* lib/viewcvs.py
* lib/debug.py
* INSTALL
* bin/standalone.py
* bin/make-database
* bin/mod_python/query.py
* bin/mod_python/viewcvs.py
* bin/cgi/query.cgi
* bin/cgi/viewcvs.cgi
* bin/asp/query.asp
* bin/asp/viewcvs.asp
* bin/svndbadmin
* bin/loginfo-handler
* bin/cvsdbadmin
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1200 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 17:19:28 +00:00
rey4
4f0805fcc1 Fix issue 172, typo in query results table header reported by
Paul Koning (pkoning). This is also issue 175.

* templates/query_results.ezt
    fix html-o


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1199 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:42:01 +00:00
rey4
cd05e5c22b Fix issue 173, cvsdb references MySqlDb connection escape() method not
present in old versions of mysql-python.

escape() has been a method of the _mysql.Connection objects since the very
beginning, but didn't get exposed in the python objects until 0.9.2
when they made the python class inherit from the C one. Python connections
have had an equivalent literal() method since 0.9.0.

* lib/cvsdb.py
    call conn.literal() method instead of conn.escape()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1198 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:40:52 +00:00
rey4
752c3b05d4 Fix issue 166 "empty diff generates an exception" reported by
Yoshinori Okuji (yo). This is also issue 184 

* lib/viewcvs.py
  (rcsdiff_date_reformat):
    avoid an exception when date is None


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1197 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 15:37:22 +00:00
cmpilato
5cb9ec78ac Finish Issue #5.
* lib/viewcvs.py
  (parse_date): Use time.altzone when DST is in effect.  Fix suggested
    by SourceForge user "johmart".

NOTE:  This change was reverted in r2001.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1196 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-16 17:46:39 +00:00
cmpilato
75e08ad3bf * www/index.html
Ah, forget the custom style stuff right now.  The color clash with the
  Tigris.org branding is awful.

* www/images,
* www/styles.css
  Removed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1195 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:54:17 +00:00
cmpilato
5cd3a20158 * www/index.html
Minor tweaks to preformatted section.

* www/styles.css
  Gut out unused styles, and remove more font size dictation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1194 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:47:45 +00:00
cmpilato
0f1185f221 * www/index.html
Use CSS for preformatted text instead of <pre> tags.

* www/styles.css
  Stop shrinking the font size.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1193 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:40:11 +00:00
cmpilato
299afac8b7 Begin sorta kinda figuring out how to distribute data on the new
tigris.org project site.

* www/index.html
  Describe ViewVC (taken from viewvc.org/index.html).

* www/styles.css,
* www/images
  Copy from viewvc.org/images/.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1192 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 21:37:19 +00:00
cmpilato
285572e89c Fix email addresses on the website. Noticed by Richard Calmbach.
* viewvc.org/who.html
* viewvc.org/license-1.html
* viewvc.org/upgrading.html
* viewvc.org/download.html
* viewvc.org/contributing.html
* viewvc.org/index.html
* viewvc.org/contact.html
  s/@viewcvs.tigris.org/@viewvc.tigris.org/

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1191 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-15 15:36:43 +00:00
cmpilato
92b4270895 * www/index.html
Move some stuff from the project attributes into the index.html file.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1190 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-14 22:56:05 +00:00
cmpilato
cd9a2d3a44 Goofing off a little bit in the www/ area, preparing for some real
site content creation.

* www
  New tigris.org magic website directory.

* www/project_tools.html
* www/index.html
  New site files.



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1189 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-14 22:53:17 +00:00
cmpilato
a03977c386 Add *.pyc to the ignores list for the lib directory and its subdirs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1188 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 21:35:06 +00:00
cmpilato
08efb7ca46 Finish issue #165 - Can't get valid log display for directories (subversion)
* lib/viewcvs.py
  (view_log): Pass '1' for the 'svn_show_all_dir_logs' option in calls to
    repos.itemlog().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1187 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 20:21:10 +00:00
cmpilato
2a96f56114 Fix issue #176 - Subversion annotate doesn't honor rev number.
* lib/vclib/svn/__init__.py
  (BlameSource.__init__, BlameSourceKludge.__init__):  Use both the @-syntax
    and the -r parameter to 'svn' to get the right blame information.
    Patch by Paul Koning <pkoning@tigris.org>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1186 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 20:10:44 +00:00
rey4
27db52403e Fix exception caused by r1173 when kv files are used. This is issue 170
reported by cmpilato.

* lib/viewcvs.py:
  (Config.load_config):
    re-add line from before r1173 that assigns "base" member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1185 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-13 06:01:19 +00:00
rey4
ca8d7b89d4 Fix MySQL 4.1 incompatibility in make-database script. Patch provided by
sourceforge user "dchabal" in issue 131. The same bug was also reported
in issues 1, 17, 146.

* bin/make-database
    remove "DEFAULT '0'" clauses from auto_increment column declarations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1184 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-12 17:28:59 +00:00
rey4
d6f18dc5bf Don't forget to install mod_python handler. Fixes issue 163 reported
by Andreas Amann (aamann) caused by revision 1173

* viewcvs-install
  (FILE_INFO_LIST):
    add new handler.py file


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1183 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-11 14:51:45 +00:00
rey4
d742c7fe32 Fix invalid variable reference in log_table template reported by
Gerard Gerritsen (sigcafe) in issue 164

* templates/log_table.ezt
    s/stick/pathrev/



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1182 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-11 14:46:55 +00:00
rey4
3154c3a102 Simplify pathrev/lastrev code, removing cruft left over from
previous iterations. This change shouldn't affect any
user-visible ViewVC behavior.

* lib/viewcvs.py
  (_last_rev):
    removed

  (view_directory):
    update call to pathrev_form

  (pathrev_form):
    find lastrev inside here instead of taking lastrev parameter
    call svn.last_rev instead of _last_rev
    make some other simplifications

  (redirect_pathrev):
    call svn.last_rev instead of _last_rev


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1181 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 19:03:24 +00:00
rey4
311d9ec761 Fix HEAD links on log page broken in r1150
* lib/viewcvs.py
  (Request.get_link):
    don't hide view parameters when other parameters are None. This
    fixes the HEAD annotate link

  (get_file_view_info):
    add pathrev argument

  (view_log):
    pass None as pathrev argument to get_file_view_info, that way the links
    point to HEAD instead of the current sticky tag


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1180 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 19:01:59 +00:00
rey4
9cb702c219 Prevent exception when jumping to a pathrev earlier than the revision
where the current path was added. This was the behavior in r1146 which
was changed in r1159

* lib/vclib/svn/__init__.py
  (last_rev):
    use alternate implemention when peg_revision > limit_revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1179 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 18:59:38 +00:00
rey4
2a6beda68b Fix bincvs co bug.
* lib/vclib/bincvs/__init__.py:
  (_re_co_side_branches):
    handle "no side branches present" error which seems to occur sometimes
    when you check out a branch tag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1178 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-10 18:58:51 +00:00
rey4
f2d2d530f1 Revert portion of r1176 that stopped exposing the "prefer_markup" value
(formerly "viewable") to all templates. Even though the default templates
don't use these values, people might want to use them in custom templates.

* lib/viewcvs.py
  (get_file_view_info):
    add prefer_markup return value

  (nav_header_data):
    add "prefer_markup" template variable

  (view_directory):
     update call to get_file_view_info()

  (view_log):
     set "entry.prefer_markup" template variable
     set "prefer_markup" template variable
     set "tag_prefer_markup" template variable

* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
    update docs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1177 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-09 08:17:27 +00:00
rey4
754e9dbc30 Update template authoring guide and make template cleanups.
* lib/viewcvs.py
  (get_file_view_info):
    get rid of viewable return value

  (nav_header_data):
    get rid of "viewable" template variable

  (view_directory):
    rename "entries.viewable" variable to "entries.prefer_markup"
    rename "selection_form" variable to "search_re_form"
    rename "search_tag_action" variable to "search_action"
    rename "search_tag_hidden_values" variable to "search_re_hidden_values"

  (view_log):
    rename "entries.html_log" variable to "entries.log"
    restore value of "entries.next_main" variable to what it was in ViewCVS
      0.9.x
    get rid of "entries.viewable" template variable
    get rid of "viewable" template variable
    get rid of "tag_viewable" template variable

  (view_revision):
    rename "changes.filename" variable to "changes.path"
    rename "changes.base_path" variable to "changes.copy_path"
    rename "changes.base_rev" variable to "changes.copy_rev"

  (build_commit)
    rename "commits.desc" variable to "commits.log"
    get rid of "commits.rev_href" variable and replace with
      "commits.view_href", "commits.download_href", and
      "commits.prefer_markup"

* templates/include/dir_footer.ezt
* templates/include/file_header.ezt
* templates/dir_new.ezt
* templates/directory.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/query.ezt
* templates/query_results.ezt
* templates/revision.ezt
    update templates for changed variables

* CHANGES
    fix blurb about paging

* viewvc.org/upgrading.html
    update information about 0.9.x variables

* viewvc.org/template-authoring-guide.html
    fill it out


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1176 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-08 18:18:08 +00:00
cmpilato
e4f868ffdc * templates/include/diff_form.ezt
Restore the diff_select FORM's NAME attribute so the JavaScript
  stuffs work.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1175 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-07 19:07:01 +00:00
rey4
baafc550a9 Check in another directory listing template following discussion that
started at

  http://mailman.lyra.org/pipermail/viewcvs-dev/2005-November/002139.html

The major differences from directory.ezt are:

  - there is a new column of icons providing links to most other views

  - revision, date, author, and log message columns are merged into a
    single "Last Change" column which is more compact and easier to
    decipher when reading from left to right. The fact that you can't
    do things like sort by log message or read down the author column
    shouldn't be a problem because in the most cases, doing these things
    doesn't make any sense.

Ideally everybody will fall in love with this template, and we'll be able
to make it the default, release ViewVC 1.0, and put these old UI issues to
rest. Otherwise we can tweak and butcher this template until we agree that
its good enough to be the default, and move on from there.

* templates/dir_new.ezt
    new template file

* lib/viewcvs.py
   (sort_file_data):
     when sorting in reverse, leave directories at the top and files
     with no revision information at the bottom. Also make sorting by
     revision number the same as sorting by date in cvs.

   (view_directory):
     add "row.revision_href" links for directory entries

* templates/docroot/images/annotate.png
    new icon for annotate view. image is "stock_people.png" from gnome

* templates/docroot/images/download.png
    new icon for download view. image is
    http://www.gentoo-portage.com/img/download.png

* templates/docroot/images/list.png
    new icon for directory listings. image is "stock_view-details.png"
    from gnome

* templates/docroot/images/log.png
    new icon for log view. image is "stock_list_enum.png" from gnome

* templates/docroot/images/view.png
    new icon for markup view. image is "stock_show-all.png" from gnome

* templates/dir_alternate.ezt
    removed, nobody seems to like it


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1174 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-06 19:22:41 +00:00
rey4
72672b458c Tweak logic used to find installed paths ("lib" directory, configuration
file, templates, etc). Specifically, make the following changes:

- Get rid of hardcoded paths in module files ("lib" directory) and
  configuration files (viewcvs.conf and mod_python's .htaccess)

- Allow stub scripts (for asp, cgi, and mod_python) to specify
  configuration files so it's possible to have multiple configurations of
  viewcvs running off a single installation.

- Be more consistent about resolving paths when they aren't hardcoded
  (when ViewCVS is running from a source directory). In particular, try
  not to depend on the working directory. That way it's legal to run
  ./standalone.py instead of bin/standalone.py without getting an
  ImportError.

- Get rid of global cfg variables in viewcvs.py and cvsdb.py. They led to
  all sorts of hacks in other files to pilfer and reset them. They were
  also possible sources of races in multithreaded environments like
  mod_python and asp.

- Rewrite mod_python handler so library paths can be specified inside the
  stub files.

* lib/apache.py
    removed, contained old mod_python handler

* lib/config.py
  (Config.load_config):
    remove sys.argv voodoo, just load the configuration path specified in
    the pathname argument

  (Config.set_defaults):
    use relative path for cvsgraph_conf setting instead of hardcoded
    <VIEWCVS_INSTALL_DIRECTORY> literal

* lib/cvsdb.py
  (CONF_PATHNAME, config, cfg):
    removed, configuration stuff

  (CheckinDatabase.__init__, CheckinDatabase.CreateSQLQueryString):
    add "_row_limit" member instead of using cfg object

  (CreateCheckinDatabase):
    removed, a do-nothing function

  (ConnectDatabaseReadOnly, ConnectDatabase):
    add cfg arguments

  (GetUnrecordedCommitList):
    add db argument

* lib/query.py
  (CONF_PATHAME):
    removed

  (build_commit, run_query, main):
    add cfg arguments, use new viewcvs.get_template function

* lib/viewcvs.py
  (CONF_PATHNAME, cfg, g_install_dir):
    removed

  (Request.__init__):
    add cfg member

  (Request.run_viewcvs, Request.get_link, check_freshness,
   get_view_template, generate_page, default_view, get_file_view_info,
   format_log, common_template_data, MarkupEnscript.__init__,
   markup_stream_python, markup_stream_php, make_time_string, view_markup,
   sort_file_data, view_directory, paging, view_log, view_annotate,
   view_cvsgraph_image, view_cvsgraph, view_doc, rcsdiff_date_reformat,
   spaced_html_text, DiffSource.__init__, DiffSource._get_row, view_patch,
   view_diff, generate_tarball, download_tarball, view_revision,
   is_query_supported, english_query, build_commit, view_query,
   view_error, main):
    stop using global config, use cfg arguments or request member instead

  (_install_path):
    new, use __file__ to locate template and configuation paths

  (get_view_template):
    use _install_path and return compiled template instead of path

  (is_viewable, default_view):
    rename is_viewable to default_view and return view instead of boolean

  (handle_config, load_config):
    rename handle_config to load_config and return config object instead
    of setting cfg global

* bin/cgi/viewcvs.cgi
* bin/cgi/query.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/standalone.py
* bin/svndbadmin
    look for library relative to sys.argv[0] when no hardcoded library
    path is available. Also add configuration loading code.

* bin/asp/viewcvs.asp
* bin/asp/query.asp
    add configuration loading code

* bin/mod_python/.htaccess
    specify new mod_python handler, remove reference to
    <VIEWCVS_APACHE_LIBRARY_DIRECTORY>

* bin/mod_python/handler.py
    added, holds new mod_python handler

* bin/mod_python/viewcvs.py
* bin/mod_python/query.py
    rewrite for new handler, add hardcoded library and configuration paths

* viewcvs.conf.dist
    remove references to <VIEWCVS_INSTALL_DIRECTORY>

* viewcvs-install
  (FILE_INFO_LIST):
    stop hardcoding paths in config files

  (SetPythonPaths,):
    get rid of <VIEWCVS_INSTALL_DIRECTORY> and
    <VIEWCVS_APACHE_LIBRARY_DIRECTORY> substitutions

  (ApacheEscape, _re_apache):
    removed

  (InstallTree):
    stop hardcoding paths in lib directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1173 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-06 04:04:14 +00:00
cmpilato
80436a855c * lib/viewcvs.py
(_get_diff_paths_parts): Was _get_location.  This is a reversion of
    a changed accidentally committed in r1171.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1172 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-05 14:35:35 +00:00
cmpilato
74090cdc09 * viewvc/lib/viewcvs.py
(view_directory, redirect_pathrev, view_log): Only call _last_rev()
    when viewing a Subversion repository (per the assert in the
    function).
  (_get_location): Was _get_diff_paths_parts.  *** THIS CHANGE WAS A 
    MISTAKE, REVERTED IN r1172 ***

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1171 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-02 20:46:24 +00:00
cmpilato
3f03d0923e Some diff-related fixes.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rawdiff): Stop being so picky about the diff
    header sanity.  Start looser, and we'll tighten up as we need to.

* lib/vclib/__init__.py
  (_diff_fp.close): Add 'self' to the parameter list.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1170 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-22 16:32:59 +00:00
cmpilato
5f34e658fc * viewvc.org/index.html
Oops.  Missed a ViewCVS -> ViewVC in the title.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1169 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-17 15:00:15 +00:00
cmpilato
22a6e8b209 * templates/markup.ezt
Revert a change made in r1150, in which the markup template used the
  'viewable' data to avoid displaying binary files.  We'll let custom
  template writers do that if they wish, but will maintain our prior
  behavior.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1168 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 16:43:52 +00:00
cmpilato
4782355970 * viewcvs-install
Fix some code width and formatting issues throughout.
  (install_tree): Add '.svn' to the list of ignorable paths.

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1167 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 16:42:18 +00:00
cmpilato
5ca85cbf4d * viewcvs.sourceforge.net/contact.html
* viewcvs.sourceforge.net/contributing.html
* viewcvs.sourceforge.net/download.html
* viewcvs.sourceforge.net/images
* viewcvs.sourceforge.net/index.html
* viewcvs.sourceforge.net/license-1.html
* viewcvs.sourceforge.net/styles.css
* viewcvs.sourceforge.net/template-authoring-guide.html
* viewcvs.sourceforge.net/upgrading.html
* viewcvs.sourceforge.net/who.html
  Replace the whole of the SourceForge site...

* viewcvs.sourceforge.net/.htaccess
  ...with a simple redirect.  :-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1166 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:40:29 +00:00
cmpilato
c3614949e8 I like the Perl dig, but let's be kind enough to use it as a reminder
of what can go wrong, not a cheap claim of what we somehow did right.

* viewvc.org/index.html
  Move the Perl slam from here...

* viewvc.org/contributing.html
  ...to here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1165 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:21:47 +00:00
cmpilato
a192534c92 * viewvc.org/contact.html
* viewvc.org/contributing.html
* viewvc.org/download.html
* viewvc.org/index.html
* viewvc.org/license-1.html
* viewvc.org/upgrading.html
* viewvc.org/who.html
  Remove SourceForge logo and linkage.

* viewvc.org/styles.css
  Minor stylation tweaks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1164 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 06:14:05 +00:00
cmpilato
373041996d Copy the old SourceForge site so it can be cleaned up
for use at viewvc.[com|net|org].

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1163 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-15 04:56:12 +00:00
cmpilato
db63df565e * tools/make-release
Update the release tool to work with the Subversion repsitory.

* viewcvs.sourceforge.net/contributing.html
  Update whole sections of this page (including the part that tells
  how to make use of the release tool) with post-migration information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1162 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 07:06:54 +00:00
cmpilato
3c9b6d1869 Tigris.org likes to use '/trunk/www' for the project htdocs stuff.
This gives me a chance to finally rename the 'www' directory to
something more in line with other CGI programs I've seen.  And while
I'm here, and while we have Subversion, I might as well do many of the
reorgs I've been wanting to do for some time.

* www
  Renamed to...

* bin
  ...this.

* standalone.py,
* tools/make-database,
* tools/svndbadmin,
* tools/loginfo-handler,
* tools/cvsdbadmin
  Moved from here...

* bin/standalone.py,
* bin/make-database,
* bin/svndbadmin,
* bin/loginfo-handler,
* bin/cvsdbadmin
  ...to here.

* viewcvs-install
  Update locations of moved files.

* viewcvs.sourceforge.net/upgrading.html
  Tweak relevant documentation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1161 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 06:15:20 +00:00
cmpilato
fc5ec817e5 Website tweaks to track project rename and relocation.
* viewcvs.sourceforge.net
  Renamed from...

* website
  ...here.

* viewcvs.sourceforge.net/who.html
* viewcvs.sourceforge.net/license-1.html
* viewcvs.sourceforge.net/upgrading.html
* viewcvs.sourceforge.net/download.html
* viewcvs.sourceforge.net/contributing.html
* viewcvs.sourceforge.net/index.html
* viewcvs.sourceforge.net/contact.html
  Update text to indicate new project name and location.  Historical
  and legal references to ViewCVS were left untouched -- not sure what
  to do about the legal ones just yet.

* viewcvs.sourceforge.net/images/title.xcf
  New Gimp multi-layer file, created from...

* viewcvs.sourceforge.net/images/title.psd
  ...the old PhotoShop file.  I didn't know Gimp could do that!!
  
* viewcvs.sourceforge.net/images/title.jpg
  Re-rasterize the title graphic with new "ViewVC"-bearing text.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1160 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-12 05:15:30 +00:00
cmpilato
4896268450 Re-add Russ Yanofsky's "last_rev" support, fine-tuned for performance
by myself.

NOTE: There are still some pool usage fixes to be made here.  Boy am I
looking forward to Subversion 1.3.0's (almost-)pool-free bindings...

* viewcvs/website/template-authoring-guide.html
  Restore definition of lastrev template item.

* viewcvs/templates/include/pathrev_form.ezt
  Expose the lastrev dictionary item.

* viewcvs/lib/vclib/svn/__init__.py
  (last_rev): New.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (last_rev): New.

* viewcvs/lib/viewcvs.py
  (_last_rev): New wrapper around the svn provider's last_rev() functions.
  (pathrev_form, redirect_pathrev, view_log, view_directory): Use _last_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1159 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 22:08:48 +00:00
cmpilato
6d792a94a9 * viewcvs/lib/vclib/svn/__init__.py
(get_revision_info): Pull the revision props directly instead of using
    the (buggy) ChangeCollector.get_root_props() interface.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1158 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 16:01:15 +00:00
cmpilato
41975fa847 * viewcvs/templates/revision.ezt
Move the log message into the metadata table (this has been bugging
  me for some time), and don't force the table to 100% width.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1157 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-10 15:52:11 +00:00
rey4
af70f41740 * templates/docroot/help_rootview.html:
fix HTML error caught by Greg Stein


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1156 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 16:06:09 +00:00
rey4
8aa47a94e9 More documentation updates
* templates/docroot/help_rootview.html
* templates/docroot/help_dirview.html
* templates/docroot/help_log.html
    updated

* templates/docroot/help_logtable.html
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1155 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 15:34:25 +00:00
rey4
8bba165888 Get diffs to work in the ccvs module (used when use_rcsparse is enabled),
using the system "diff" command like the svn and svn_ra modules. Factor
the diff code out of the svn and svn_ra modules so they can share
functionality with each other and ccvs. Thanks to C. Mike for getting me
to work on this.

* lib/vclib/__init__.py:
  (_diff_fp):
    new class, based on svn_ra.FileDiff, used by ccvs, svn, and svn_ra
    modules

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.rawdiff):
    implement in terms of openfile, itemlog, and _diff_fp

* lib/vclib/svn_ra/__init__.py
  (FileDiff, do_diff, _escape_msvcrt_shell_command, _escape_msvcrt_shell_arg):
    removed

  (temp_checkout)
    new function

  (SubversionRepository.rawdiff):
    change implementation to use temp_checkout and _diff_fp

* lib/vclib/svn/__init__.py
  (do_diff):
    removed

  (temp_checkout):
    new function, based on code from subversion's fs.py

  (SubversionRepository.rawdiff
    change implementation to use temp_checkout and _diff_fp


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1154 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-09 15:29:56 +00:00
cmpilato
e5f784525f Built-in help touch-ups.
* viewcvs/templates/docroot/help.css
  Added (a file from a recent patch by Marten Thavenius <martent@gmail.com>
  which I inadvertently failed to version when applying the patch).

* viewcvs/templates/docroot/help_rootview.html
  Update names of Fogel's CVS book and my (et al) Subversion book.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1153 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-08 14:33:04 +00:00
rey4
78c66dff21 Documentation updates.
* CHANGES
    add changes since last time we were going to release 1.0

* templates/docroot/help_rootview.html
    add better overview of ViewCVS. a little dry but more useful than
    "Directory entries end in slashes" and other stuff that shouldn't have
    to be pointed out.

    also remove outdated information about ViewCVS Project and
    replace it with a link to viewcvs.sourceforge.net


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1152 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-08 12:21:15 +00:00
rey4
b0d6bf328e Restore the sometimes checkout, sometimes markup behavior for
file links in the directory listing templates. Also make other
minor cleanups.

* templates/directory.ezt
    restore the file links and make the alt attribute for the
    parent direcotry icon the same as for the other icons

* templates/dir_alt.ezt
    restore the file links and add title attributes to all links

* website/upgrading.html
    update documentation for 0.9's rows.rev_href variable

----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1151 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-07 08:51:48 +00:00
cmpilato
0eab479ca0 Make the various file-related views available from the directory and
log views on a per-entry/revision basis.  Template authors can choose
to ignore the 'viewable'-ness of an item if they choose.  In the
process, this makes the directory view always link to the markup view
for files (instead of sometimes doing markup, sometimes checkout).
Consistent, predictable UI, folks ...

* viewcvs/lib/viewcvs.py
  (get_file_view_info): New.
  (nav_header_data, view_directory, view_log): Use new get_file_view_info to
    populate file navigation links.

* viewcvs/templates/markup.ezt
  If a file isn't viewable, show a warning instead of the markup.

* viewcvs/website/upgrading.html
  Track changes in the data dictionary.

* viewcvs/website/template-authoring-guide.html
  Track changes in the data dictionary, and fill in a few blanks here
  and there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1150 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 19:20:55 +00:00
cmpilato
811b660e86 Restore performance by removing extremely expensive Subversion history
crawl.  Also, gracefully redirect old non-HEAD directory views.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Redirect old DIRECTORY?rev=REV URLs to
    DIRECTORY?pathrev=REV ones.
  (_last_rev): Removed.
  (pathrev_form, redirect_pathrev, view_log): Lose the "lastrev" stuff.

* viewcvs/templates/include/pathrev_form.ezt,
* viewcvs/website/template-authoring-guide.html
  Track the loss of "lastrev".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1149 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 13:16:24 +00:00
rey4
7080f2c083 Fix error in CVS log view when file has default branch set.
* lib/viewcvs.py
  (view_log):
    fix call to prep_tags


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1148 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-04 05:46:08 +00:00
rey4
92057a3380 Reorganize and update template information in upgrade guide.
* website/upgrading.html
    put all information about 0.9 template variables in a big
    table sorted alphabetically by variable name. Table was
    generated from a little script which parsed the 0.9
    templates and extracted the names of all variables that
    they referenced, so the list is complete and accurate.
    The color scheme was generated by me, so the table is
    garish and maybe even ugly. Feel free to modify.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1147 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:36:14 +00:00
rey4
c002889dad Take some rough edges off the new sticky revision interface. Instead of
showing 404 errors when users try to jump to revisions where the path
being viewed doesn't exist, just redirect to the closest revision where
the path does exist.

Also, italicize the links which change the current 'pathrev' value
to make them stand out from links that stay within the current revision.

* lib/viewcvs.py
  (redirect_pathrev):
    new view that validates input from the pathrev form and redirects to
    the right revision

  (pathrev_form):
    new function that generates fields for pathrev form

  (_last_rev):
    new function for tracking subversion revisions

  (Request.run_viewcvs, Request.get_link, _legal_params, _views):
    add handling for redirect_pathrev view

  (Request.get_form):
    new function that wraps around get_link

  (view_directory, view_log):
    make use of new pathform_form and get_form functions

  (common_template_data, view_revision, view_queryform):
    make use of get_form function

  (view_directory, view_log):
    make use of pathrev_form

* templates/include/pathrev_form.ezt
    only show the "Clear" button when clearing won't cause a 404

* templates/annotate.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
    italicize revision jumping links

* website/template-authoring-guide.html
    update


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1146 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:33:56 +00:00
rey4
01437d5937 New URL scheme for Subversion. The problem with the old scheme is it
doesn't have a concept of a "sticky" revision. So if you are looking
at version 10 of a directory, and click to view a file inside which
was last modified in version 6, the fact you were looking at version 10
of the parent directory is not recorded anywhere, and the "Parent Directory"
links on the markup page will take you to a version 6 directory listing
instead of the listing you came from. This problem exists all over
ViewCVS, not just in directory listings, and the result of it is that when
you browse a repository by following the provided links you get sent further
and further back into the history, all the while seeing incomplete log pages
and outdated directory listings which you never asked for.

The new URL scheme works by introducing a new 'pathrev' sticky variable and
is described in detail in a comment in the _orig_path function in
lib/viewcvs.py. The scheme is not backwards compatabile with all (or
maybe even most) old subversion URLs. Specifically, any old URL referring
to a path that no longer exists in the HEAD will not work. Other subversion
URLs will still work.

It is still possible to add backwards compatibility. We'd have to rename
the rev parameter to something else, so we could know that all URLs with
'rev' in them are old style URLs which need to be redirected. I don't know
if it's worth doing this though.

This is not an isolated change. I've tried to unite the Subversion "sticky
revision" with the present "only_with_tag" logic for CVS. And since I had
to go over viewcvs.py with a fine-toothed comb implementing these things,
there are also some miscellaneous cleanups there.

* lib/vclib/bincvs/__init__.py
  (_file_log):
    change filtering so when matching revisions to tag, includes all
    preceding revisions, not just tag revision itself

* lib/viewcvs.py
  (_sticky_vars):
    'only_with_tag' is gone, so change this back into a list with no
    span-roots values

  (request.run_viewcvs):
    read new 'pathrev' parameter and use it when calling repos.itemtype

  (request.get_link):
    add 'pathrev' parameter to urls, restore update _sticky_vars loop

  (_legal_params, prep_tags, build_commit):
    replace 'only_with_tag' with 'pathrev'

  (_orig_path):
    new function

  (nav_path, common_template_data):
    stop adding 'rev' parameters to links
    removed unused 'roots_href' template variable

  (nav_header_data):
    add new 'revision_href', 'orig_path', 'orig_href' template variables
    for use in markup and annotate views

  (view_markup, view_checkout, view_annotate, setup_diff, generate_tarball,
   download_tarball):
    use 'pathrev' when looking up file revision

  (view_directory):
    use 'pathrev' when looking up directory revisions instead of 'rev'.
    stop adding 'rev' to links.
    add template variables: pathrev, pathrev_action, pathrev_hidden_values.
    remove unused template variables: num_files, rev, view_tag, has_tags,
    main_href, jump_rev_action, jump_rev_hidden_values, row.show_log.

  (view_log):
    use 'pathrev' to retrieve log information instead of 'rev'.
    stop linking to original paths of copied files.
    add template variables: entry.orig_path, entry.orig_href, default_branch,
    pathrev, pathrev_action, pathrev_hidden_values, branch_tags, plain_tags.
    remove template variables: entry.filename, entry.prev_path,
    branch, path_selected, view_tag, branch_names, branch_select_action,
    branch_select_hidden_values.

  (view_cvsgraph):
    use common_template_data instead of nav_header_data, 'pathrev' instead
    of 'only_with tag'

  (view_diff):
    use common_template_data instead of nav_header_data
    add template variables: path_left, path_right

  (view_revision):
    use 'pathrev' instead of 'rev' in links

* templates/include/dir_header.ezt
    rearrange header and add sticky tag/revision row

* templates/include/dir_footer.ezt
    remove tag selector

* templates/include/pathrev_form.ezt
    new, sticky tag/revision selector form based on code from
    dir_footer.ezt

* templates/include/branch.ezt
* templates/include/branch_form.ezt
* templates/include/view_tag.ezt
    removed

* templates/include/log_header.ezt
    new, based on branch.ezt and view_tag.ezt

* templates/include/log_footer.ezt
    new

* templates/include/log.ezt
* templates/include/log_table.ezt
    include log_header.ezt and log_footer.ezt

* templates/include/annotate.ezt
* templates/include/diff.ezt
* templates/include/markup.ezt
    show original paths and add view_revision links

* cvsgraph.conf.dist
    replace only_with_tag parameter with pathrev

* website/template-authoring-guide.html
    update template variable information


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1145 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:31:02 +00:00
rey4
5204e26666 Change vclib interface to accept 'rev' parameters wherever it accepts
path parameters so it is possible to use a single Repository object
to request information about any path at any revision.

Note: I wasn't able to test the svn_ra.get_location function because
I only have subversion 1.2.3.

* lib/vclib/__init__.py
  (Repository.itemtype, Repository.openfile, Repository.listdir,
   Repository.dirlogs, Repository.itemlog, Repository.annotate):
    add rev arguments, update docstrings

* lib/vclib/bincvs/__init__.py
  (CVSRepository.itemtype, CVSRepository.listdir, BinCVSRepository.openfile,
   BinCVSRepository.dirlogs, BinCVSRepository.itemlog):
    same

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs, CCVSRepository.itemlog):
    same

* lib/vclib/svn/__init__.py
  (SubversionRepository.__init__):
    remove rev argument

  (get_location, created_rev, _get_history, get_revision_info, _fetch_log,
   _get_last_history_rev, get_logs, do_diff,
   SubversionRepository.itemtype, SubversionRepository.openfile,
   SubversionRepository.listdir, SubversionRepository.dirlogs,
   SubversionRepository.itemlog, SubversionRepository.annotate):
    add rev arguments, use new _getrev and _getroot functions to handle
    all revision string parsing and revision_root creation

  (SubversionRepository._getrev, SubversionRepository._getroot):
    new functions

* lib/vclib/svn_ra/__init__.py
  (_rev2optrev):
    accept integers instead of strings, and eliminate head/unspecified
    revision handling which is already taken care of by _getrev

  (SubversionRepository.__init__):
    remove rev argument

  (get_location, created_rev, get_revision_info, get_logs,
   SubversionRepository.itemtype, SubversionRepository.openfile,
   SubversionRepository.listdir, SubversionRepository.dirlogs,
   SubversionRepository.itemlog, SubversionRepository.annotate,
   SubversionRepository.rawdiff, SubversionRepository._get_dirents):
    add rev arguments, use new _getrev function to handle all revision
    string parsing

  (SubversionRepository._getrev):
    new function

* lib/blame.py
  (link_includes):
    update call to repos.itemtype

* tools/cvsdbadmin
  (RecurseUpdate):
    update call to repos.listdir

* lib/viewcvs.py
  (Request.run_viewcvs):
    update calls to SubversionRepository constructors and _strip_suffix

  (_strip_suffix):
    add rev parameter, remove redundant where parameter

  (_repos_pathtype, view_markup, search_files, _get_diff_path_parts,
   generate_tarball):
    update calls to vclib methods

  (nav_path, view_directory, view_log, setup_diff, download_tarball,
   view_revision):
    explicitly read 'rev' query param instead of relying on
    SubversionRepository.rev, and update vclib calls


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1144 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-03 13:23:42 +00:00
cmpilato
7787585540 * viewcvs/lib/viewcvs.py
(Request.get_link): Just some whitespace/formatting cleanups.  No
    logic changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1143 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-02 19:15:52 +00:00
cmpilato
9213450bc0 Some revision view cleanups.
* viewcvs/lib/viewcvs.py
  (view_revision): Fix the links generated for deleted items.

* viewcvs/lib/vclib/svn/__init__.py
  (_cleanup_path): New.
  (_trim_path): Remove.
  (_log_helper, NodeHistory.add_history): Use new _cleanup_path().
  (ChangedPathSet.add_change): Fix the detection of replaces-with-history.
    Also, use new _cleanup_path().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1142 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-11-02 19:13:07 +00:00
cmpilato
b6b1146a1c * viewcvs/lib/viewcvs.py
(view_directory): Oops!  Use make_time_string() to set entries.date
    to a string date representation, not "number of seconds since
    Epoch".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1141 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-28 13:53:36 +00:00
cmpilato
721b99609b More data dictionary consistency tweaks.
* viewcvs/lib/viewcvs.py
  (view_directory): Lose the initialization of the unused entries.href
    (accidentally overlooked a previous purge).  Rename entries.type
    to entries.pathtype.
  (view_revision): Recycle changes.pathtype (which just happens to
    work because the vclib file/dir constants are the same as those
    used for our EZT exposure) instead of setting a second
    changes.type variable.

* templates/directory.ezt,
* templates/dir_alternate.ezt,
* viewcvs/website/upgrading.html
  Track renamed and dropped variables.

* viewcvs/website/template-authoring-guide.html
  Fill in more of the directory view stuff, tracking the renamed and
  dropped variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1140 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-26 21:00:24 +00:00
cmpilato
203faae2d0 Consistify the datestamp variables to just 'date' (the timestamp) and
'ago' (the string describing how long ago that timestamp was from
"now").

* viewcvs/lib/viewcvs.py
  (view_directory): Expose entries.date variable, and rename
    entries.time to entries.ago.

* viewcvs/templates/dir_alternate.ezt,
* viewcvs/templates/directory.ezt
  Track renamed entries.time variable.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track changes to the data dictionary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1139 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-26 19:40:42 +00:00
cmpilato
d36d230e75 * website/download.html
Add link to nightly snapshots.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1138 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-21 12:23:57 +00:00
cmpilato
010b3be03c Fix Bug #1332969 - small fix of markup warning on Repository Listing page
* viewcvs/templates/include/header.ezt
  Fix a markup warning which occurs when there's no nav_path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1137 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-20 13:19:19 +00:00
cmpilato
a27d1016c9 Miscellaneous tweaks.
* viewcvs/lib/viewcvs.py
  (copy_stream): Add 'htmlize' option.
  (MarkupPipeWrapper.__call__): Use copy_stream() with htmlize=1
    instead of duplicating that loop logic.
  (view_log): Set 'rev_selected' and 'path_selected' based on
    previously acquired values.
  (_re_extract_rev): Tweak regexp so it can match context diff '***'
    headers, too.
  (view_patch): Move request.server.header() call to just before
    rendering.
  (view_diff): Escape the 'patch_href' item.  Move
    request.server.header() call to just before rendering.
  (view_error): Don't use the error template if we've already started
    sending output through the server.

* viewcvs/lib/sapi.py
  (ModPythonServer.__init__, ModPythonServer.header): Add and manage
    new headerSent variable (like the ones used by CGIServer and
    ASPServer).

* viewcvs/lib/query.py
  (main): Call server headers here instead of down in the exception printer.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1136 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-19 20:38:33 +00:00
cmpilato
8f79165d0c Move some logic that really UI-ish from the core code into the
templates.

* viewcvs/lib/viewcvs.py
  (view_log): Lose 'tr1' and 'tr2' dictionary items.

* viewcvs/templates/log.ezt,
* viewcvs/templates/log_table.ezt
  Calculate first and last revisions using EZT magic.

* viewcvs/templates/include/diff_form.ezt
  Choose default diff form values based on the 'rev_selected'
  dictionary item as well as the EZT-calculated first and last
  revisions.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track removed variables, and add some missing punctuation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1135 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-17 20:31:11 +00:00
cmpilato
2d37af8286 More template authoring guide; more dictionary tweaks as this exercise
points out more ugliness (which was its secondary goal, after all).

* viewcvs/lib/viewcvs.py
  (view_revision, view_markup, view_log): Use 'date' instead of
    'date_str' in data dictionary items.
  (view_directory): Use 'entries' instead of 'rows' in the data
    dictionary.  Remove redundant 'has_tags' dictionary init.

* viewcvs/templates/markup.ezt,
* viewcvs/templates/log.ezt,
* viewcvs/templates/revision.ezt,
* viewcvs/templates/log_table.ezt,
* templates/dir_alternate.ezt
* templates/directory.ezt
* viewcvs/website/upgrading.html
  Track variable renames.

* viewcvs/website/template-authoring-guide.html
  Track variable renames, and begin working on the directory view section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1134 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-17 19:50:20 +00:00
cmpilato
1a7a0c0a77 * viewcvs/lib/viewcvs.py
(view_patch): Fix a little logic bug in the patch diff_format
    selector.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1133 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:51:07 +00:00
cmpilato
99da769f25 Lose the poorly thunk 'makepatch' checkbox on the diff form. There
are probably whole volumes written about similar UI decisions and how
unintuitive they are.  Instead, abstract that work in a new patch
view.

NOTE:  While the new patch view supports the diff_format input
parameter, no template links or forms make use of it.  The code will
default to unified diff unless told to use context diff via the CGI
params or runtime config.

* viewcvs/lib/viewcvs.py
  (_legal_params): Lose 'makepatch'.  It was a good idea with a poor
    implementation choice.
  (_views): Add new 'patch' view, and tweak the alignment of this
    definition a bit.
  (get_link): Always copy the params dictionary instead of tainting
    the input dictionary.
  (view_patch): New.  Was the "if makepatch" section of view_diff().
  (view_diff): Abstract some setup stuff into setup_diff(), and the
    makepatch stuff into view_patch().

* viewcvs/templates/diff.ezt
* viewcvs/templates/include/diff_form.ezt
  Lose the 'makepatch' form checkbox.

* viewcvs/templates/include/file_header.ezt
  Add a patch view link.

* viewcvs/templates/docroot/images/diff.png
  New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1132 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:35:58 +00:00
cmpilato
46a3ee4888 * viewcvs/templates/templates/docroot/images/broken.png,
* viewcvs/templates/templates/docroot/images/text.png
  Fix some transparency-related oddities in these images.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1131 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 21:32:41 +00:00
cmpilato
043995ce16 Tweak the diff view data dictionary for consistency.
* viewcvs/lib/viewcvs.py
  (DiffSource._flush_row): Make the 'have_left' and 'have_right'
    members of the change object be EZT booleans.
  (DiffSource._get_row): Rename 'extra' member to 'line_info_extra'.
  (view_diff): Rename some data dictionary variables:
    'rev1' => 'rev_left'
    'rev2' => 'rev_right'
    'tag1' => 'tag_left'
    'tag2' => 'tag_right'
    'date1' => 'date_left'
    'date2' => 'date_right'

* viewcvs/templates/diff.ezt
  Track renamed variables.

* viewcvs/website/upgrading.html
  Note the slight tweak to the way 'have_left' and 'have_right' work,
  not that I expect anyone to have really been testing for "yes".
  Also, note the renamed variables.

* viewcvs/website/template-authoring-guide.html
  Populate the annotate, graph, and diff sections, tracking the
  tweaked variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1130 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 20:29:16 +00:00
cmpilato
2777f41d32 * website/template-authoring-guide.html
Add some left/right padding in table cells.  Also, populate the NAVDATA
  section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1129 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 16:13:51 +00:00
cmpilato
f5ddba9443 Lose the unnecessary 'jump_rev' data dictionary item. It was used in
two views (directory and revision).  In the directory case, it was
renamed to just 'rev'; in the revision case, it was dropped as
redundant with with existing 'rev' variable.  Also, don't assume that
"is not a directory" implies "is a file" when looking at the common
'pathtype' variable.

* viewcvs/lib/viewcvs.py
  (common_template_data): Allow 'pathtype' to be None instead of
    'file' when the pathtype is neither a file nor a directory.
  (view_revision): Lose 'jump_rev'.
  (view_directory): Rename 'jump_rev' to just 'rev'.

* viewcvs/templates/revision.ezt
  Use 'rev' instead of 'jump_rev' throughout.

* viewcvs/templates/include/dir_header.ezt
  Stop using 'jump_rev' -- make 'youngest_rev' the default jump-to
  location.

* viewcvs/website/upgrading.html,
* viewcvs/website/template-authoring-guide.html
  Track the demise of 'jump_rev'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1128 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 15:33:35 +00:00
cmpilato
9d39c14082 * website/template-authoring-guide.html
Populate the COMMON section.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1127 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-14 15:28:51 +00:00
cmpilato
1cf2b31004 * website/template-authoring-guide.html
Begin work on a template authoring guide.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1126 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-12 17:40:10 +00:00
cmpilato
df37902e41 * viewcvs/lib/vclib/svn/__init__.py
(get_revision_info): Wrap reads from the revision property hash with
    str() to ensure conversion from "buffer" type.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1125 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 16:59:34 +00:00
cmpilato
30f1537eb7 * viewcvs/templates/revision.ezt
Add a trailing slash to directory paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1124 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 16:58:11 +00:00
cmpilato
d9f6360681 Fix some bugs introduced yesterday that show up when using the
'svn_ra' module with the 'revision' view.

* viewcvs/lib/viewcvs.py
  (view_revision): Collapse some similar URL generation calls, but
    also trap the AssertionError thrown when using the 'svn_ra' backend
    (as it can't determine path types yet).

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LastHistoryCollector.add_history): It's a long way from correct,
    but at least pass along copyfrom information correctly from this
    log handler.

* viewcvs/templates/revision.ezt
  Make the file/dir icons part of the filename links, too.  But don't
  make links where no valid hrefs exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1123 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-11 14:35:21 +00:00
cmpilato
997d65e926 Make some tweaks to the 'revision' view to differentiate between
'added' and 'replaced' items, and to make the fact that something was
or wasn't copied from elsewhere a first-class piece of data.

* viewcvs/lib/vclib/svn/__init__.py
  (_compare_paths): Move from the svn_ra module.
  (ChangedPath.__init__): Add 'is_copy' param, and stow it away.
  (ChangedPathSet): New.
  (get_revision_info): Use newer svn.repos.ChangeCollector() interface
    so we can hook the notification callback (using the new
    ChangedPathSet class) and get replacement information.

* viewcvs/lib/viewcvs.py
  (view_revision): Boolean-ify the new is_copy ChangedPath member.
    Expose change.log_href links to log views.
  (common_template_data): Expose log_href for Subversion directories.

* viewcvs/templates/docroot/styles.css
  (td, th, tr): Set vertical-align to 'top'.

* viewcvs/templates/revision.ezt
  Re-work this template into a different layout (still not happy it,
  but...)

* viewcvs/lib/vclib/svn_ra/__init__.py
  Import _compare_paths from the 'svn' module.
  (LastHistoryCollector.add_history): Tweak to recognize replaced
    items, and to pass the new 'is_copy' param to ChangedPath().
  (_compare_paths): Move to the 'svn' module.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1122 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 20:22:59 +00:00
cmpilato
ef9e91dd20 * viewcvs/lib/viewcvs.py
(DiffSource._get_row): Rename 'line1' and 'line2' 'change' members to
    'line_info_left' and 'line_info_right', respectively.

* viewcvs/templates/diff.ezt
  Track renamed template variables.

* viewcvs/website/upgrading.html
  Document renamed variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1121 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 14:10:48 +00:00
cmpilato
0be0bf1e9d * viewcvs/lib/viewcvs.py
(view_revision_svn): Remove.
  (view_revision): Eat up view_revision_svn's little bit o' work.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1120 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-10 13:38:58 +00:00
cmpilato
2e9593eff0 * viewcvs/lib/vclib/bincvs/__init__.py
(BinCVSRepository.rawdiff): Ignore warnings from rcsdiff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1119 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-05 12:51:50 +00:00
cmpilato
2e13e6fd4c Expose regular-expression-based search to Subversion repositories, too.
* viewcvs/lib/viewcvs.py
  (view_directory): Set 'selection_form' and friends for 'svn'
    roottypes, too.

* viewcvs/lib/vclib/svn/__init__.py
  (FileContentsPipe.readline): Fix usage of core.svn_stream_readline().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1118 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-04 15:05:39 +00:00
cmpilato
8bdfd374a2 Sticky variables are cool and all (despite being less elegant than a
cookies-based implementation...), but there are some that simply
should stick when switching to a view of a different repository root
(such as only_with_tag).

* viewcvs/lib/viewcvs.py
  (_sticky_vars): Convert to a dictionary, and let the values
    associated with the sticky variables indicate whether that
    stickiness spans repository roots.
  (Request.get_link): Pay attention to the spanrootsedness of the
    sticky variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1117 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-04 15:01:08 +00:00
cmpilato
0506513760 Expose "tip o' the branch" links from the log view.
* viewcvs/lib/viewcvs.py
  (view_log): Add new template variables: 'tag_view_href',
    'tag_download_href', 'tag_download_text_href', 'tag_annotate_href',

* viewcvs/templates/include/view_tag.ezt
  Expose links to the tip of a currently selected branch.

* viewcvs/website/upgrading.html
  Document new variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1116 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 22:23:35 +00:00
cmpilato
54c1b4f760 Finish Bug #1309545 ("tip of the branch" URLs don't work with 'bincvs' module)
* viewcvs/lib/vclib/bincvs/__init__.py
  (COMalformedOutput, COMissingRevision): New exception classes.
  (BinCVSRepository._get_tip_revision): New helper.
  (BinCVSRepository.openfile): If a COMissingRevision exception is
    raised, use rlog to try to resolve to a real (existing) revision.
  (_parse_co_header): Stop writing HTML error messages, and use the
    new exceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1115 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 20:57:12 +00:00
cmpilato
0881ded7c0 * templates/directory.ezt,
* templates/dir_alternate.ezt
  Lose unnecessary P tags which tend to oversize errorful rows.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1114 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-10-03 15:31:27 +00:00
cmpilato
73b347ee5d Finish Bug #1097695 - Exception on CVS revisions with 2-digit year
* viewcvs/lib/vclib/bincvs/__init__.py
  (_parse_log_entry): Ensure that revision years > 1970, as rlog seems
    only to assume they are > 1900.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1113 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-30 15:10:49 +00:00
cmpilato
a16f40e0ac * viewcvs/templates/directory.ezt
Lose the alt-text on the row icons, and restore View/download distinction
  in title attributes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1112 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-29 13:42:32 +00:00
cmpilato
2a93244acb * viewcvs/lib/viewcvs.py
(view_query): Query on subdirectories of the request directories,
    too.  This is a followup to the changes made in revision 1.367.
    Thanks to Russell Yanofsky for noticing the mistake.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1111 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-29 13:28:38 +00:00
cmpilato
c85732a907 * viewcvs/lib/viewcvs.py
(nav_header_data, view_log): Expose annotation links for Subversion
    in a couple more places.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1110 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-28 19:27:55 +00:00
cmpilato
97a07dc88e This patch (mostly by Marten Thavenius) upgrades ViewCVS to XHTML 1.0
Strict.  Changes have been made in the EZT templates, the CSS files,
HTML code embedded in the Python files as well as in the help
files. The original code structure and design is the very same.  No
other improvements have been made to the browser code and it still
uses the old layout tables to create the page grid.

Apart from the XHTML/CSS code changes, the patch adds an argument (-x
x) for CVSGraph in viewcvs.py in the view_cvsgraph function to tell
CVSGraph to generate XHTML code. For Mozilla/Firefox to recognize the
id attribute in the image map generated, the content-type must be set
to application/xhtml+xml (see
https://bugzilla.mozilla.org/show_bug.cgi?id=109445).  This patch does
however not change the content-type, but uses an ugly hack to make the
CVSGraph output work in Mozilla with the current text/html
content-type: a name attribute is merged into the id attribute in the
map_name defined in the cvsgraph.conf.dist file.

The XHTML code does not contain the standard XML declaration, just the
XHTML 1.0 Strict Doctype. This is to keep ViewCVS as encoding agnostic
as before and let the browser decide which encoding to use. An XML
file without the encoding declared must be interpreted as UTF-8 (or
UTF-16 if the byte order mark is included).

* viewcvs/cvsgraph.conf.dist
  Add name="" hack to the 'map_name' variable so Mozilla/Firefox will work.

* viewcvs/lib/ezt.py
  XHTML-ize sample output.

* viewcvs/lib/viewcvs.py
  XHTML-ize hard-coded output.
  (view_cvsgraph): Pass "-x x" to cvsgraph to force XHTML production.

* viewcvs/lib/blame.py
* viewcvs/lib/debug.py
* viewcvs/lib/py2html.py
* viewcvs/lib/query.py
* viewcvs/lib/vclib/bincvs/__init__.py
* viewcvs/templates/annotate.ezt
* viewcvs/templates/diff.ezt
* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
* viewcvs/templates/error.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
* viewcvs/templates/query_form.ezt
* viewcvs/templates/query_results.ezt
* viewcvs/templates/revision.ezt
* viewcvs/templates/roots.ezt
* viewcvs/templates/docroot/help_dirview.html
* viewcvs/templates/docroot/help_log.html
* viewcvs/templates/docroot/help_logtable.html
* viewcvs/templates/docroot/help_query.html
* viewcvs/templates/docroot/help_rootview.html
* viewcvs/templates/docroot/styles.css
* viewcvs/templates/include/branch.ezt
* viewcvs/templates/include/branch_form.ezt
* viewcvs/templates/include/diff_form.ezt
* viewcvs/templates/include/dir_footer.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/file_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
* viewcvs/templates/include/paging.ezt
* viewcvs/templates/include/sort.ezt
* viewcvs/templates/include/view_tag.ezt
  XHTML-ize hard-coded output and templatized data.

* viewcvs/CHANGES
  Note this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1109 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-28 17:06:16 +00:00
cmpilato
b629620cf6 Lose 'row.href' and 'row.rev_href' for the more meaningful
'row.log_href' and 'row.view_href'.

* viewcvs/lib/viewcvs.py
  (view_directory): For files, rename 'row.href' to 'row.log_href',
    and 'row.rev_href' to 'row.view_href'.  For directories, do the
    renames, but swap the mappings.

* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
  Track the changes to these data dictionary items.

* viewcvs/website/upgrading.html
  Note the changed variables.  Also, add svn_path as a configuration
  parameter recently added.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1108 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-27 18:08:47 +00:00
cmpilato
4a24ab0c36 * viewcvs/lib/viewcvs.py
(common_template_data): Show a non-empty root listing when there is
    a non-empty list of roots, regardless of the size of that list.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1107 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 19:34:41 +00:00
cmpilato
701452a3fb Fix Bug #1177407: CVS tags with a slash cause an exception
* viewcvs/lib/viewcvs.py
  (_re_validate_number): Allow '/' in tag names.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1106 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 18:57:32 +00:00
cmpilato
577728db86 Fix Bug 1271136: Query results wrong for directories with similar
names

* viewcvs/lib/viewcvs.py
  (view_query): Use "exact" matches for the query directory, instead
    of "like" ones.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1105 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 17:14:42 +00:00
cmpilato
1b967b1a09 * viewcvs/lib/vclib/__init__.py (Repository.rawdiff),
* viewcvs/lib/vclib/svn/__init__.py (SubversionRepository.rawdiff),
* viewcvs/lib/vclib/svn_ra/__init__.py (SubversionRepository.rawdiff),
* viewcvs/lib/vclib/ccvs/__init__.py (CCVSRepository.rawdiff),
* viewcvs/lib/vclib/bincvs/__init__.py (BinCVSRepository.rawdiff):
  For clarity, replace uses of the term 'path' with 'path_parts' in the
  Repository.rawdiff() stub and implementations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1104 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 16:07:17 +00:00
cmpilato
d7429e31ae Add Subversion blame support to the 'svn_ra' module, and re-enable the
'svn' module's blame support with a non-streamy kludge.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.annotate): Implement (for real).
  (_item): New, copied from one of a thousand places...

* viewcvs/lib/vclib/svn/__init__.py
  (BlameSourceKludge): New, non-streamy form of the Subversion blame factory.
  (SubversionRepository.annotate): Use BlameSourceKludge here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1103 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-26 15:57:57 +00:00
cmpilato
30c3fbef04 * viewcvs/lib/vclib/svn/__init__.py
(BlameSource.__getitem__): Ensure initialization of prev_rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1102 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-24 20:05:30 +00:00
cmpilato
edd45cb153 * viewcvs/lib/vclib/svn/__init__.py
(SubversionRepository.annotate): Re-disable temporarily.  Something's
    wrong.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1101 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 21:08:56 +00:00
cmpilato
ac88e349ca Expose annotation support for local Subversion repositories. Patch
largely by Stefan Haller <haller@ableton.com>, at least in the
approach used.

* viewcvs/viewcvs.conf.dist
  (svn_path): New configuration variable.

* viewcvs/lib/config.py
  (Config.set_defaults): Populate a new svn_path config member.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Tweak the way Subversion's vclib.Repository
    objects are opened to have different codepaths for the 'svn' and
    'svn_ra' modules, and pass the new cfg.general.svn_path option to
    the 'svn' module's SubversionRepository.

* viewcvs/lib/vclib/svn/__init__.py
  (BlameSource, BlameSequencingError, _item): New.
  (SubversionRepository.__init__): Add 'svn_path' parameter.
    Calculate and store a path for the 'svn' command-line client binary.
  (SubversionRepository.annotate): Really implement annotation.

* viewcvs/templates/log.ezt,
* viewcvs/templates/log_table.ezt
  Enable annotate links for Subversion, too!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1100 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 20:15:08 +00:00
cmpilato
a5ad1e5f41 * viewcvs/lib/blame
(link_includes): Use the more generic itemtype() interface instead of
    the rcsfile() one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1099 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 19:40:29 +00:00
cmpilato
828ee07077 Abstract the annotate interface by moving core functionality down
into the vclib providers.

* viewcvs/lib/vclib/__init__.py
  (Repository.annotate): New interface.

* viewcvs/lib/vclib/ccvs/blame.py
  New file, with contents cored from viewcvs/lib/blame.py, and
  reworked a little bit to avoid data tainting, and to be independent
  of the vclib implementation.

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.annotate): Implement Repository.annotate() by returning
    a blame.BlameSource object.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.annotate) Implement by returning a
    vclib.ccvs.blame.BlameSource object.

* viewcvs/lib/vclib/svn/__init__.py
* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.annotate): New.  Return NotImplementedError.

* viewcvs/lib/viewcvs.py
  (view_annotate): Use new blame.blame() function.

* viewcvs/lib/blame.py
  Gut this sucker, moving most of the heavy lifting into the ccvs module.
  (HTMLBlameSource): New wrapper for BlameSource objects to handle
    HTML-izing and such.
  (blame): New function, thin wrapper around
  (make_html): Remove unused 'sticky' param.  Tweak to use new
    abstracted interface, but at the cost of diff_url support.  I'll
    probably come back to this (by adding a --diff-url option), but
    does anyone really care?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1098 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 18:51:35 +00:00
cmpilato
034a661704 * viewcvs/INSTALL
Rework the list the required software-n-stuff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1097 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 13:48:36 +00:00
cmpilato
dcf43ad7b8 Teach ViewCVS to obey the Subversion location tracing algorithm, which
identifies a line of history using a path and a "peg revision", and
then traces that line of history to figure out the object's current
path as of other revisions fed to the algorithm.

Previously, if I had a Subversion file that had been renamed a few
times (so, had multiple distinct paths over time), and I wanted to
diff between revisions at which the object's path was different, as
well as different from its path as of HEAD, the URL was this
monstrously long thing:

   http://.../viewcvs/path/to/file?p1=/old/path/of/file&r1=X&p2=/another/old/path/of/file&r2=Y

Now, it's simply:

   http://.../viewcvs/path/to/file?r1=X&r2=Y

Support for p1 and p2 are still present (so you can diff across
arbitrary paths in Subversion), but URLs generated by ViewCVS will no
longer use those query params.

* viewcvs/lib/viewcvs.py
  (view_log): Lose the use of p1 and p2 in diff URLs.
  (_get_diff_path_parts): New helper function.
  (view_diff): Teach ViewCVS to obey the Subversion location tracing
    algorithm by using the new _get_diff_path_parts() helper.

* viewcvs/lib/vclib/svn/__init__.py
  Require Subversion 1.1.0 or better.
  (_allow_all, get_location): New.

* viewcvs/lib/vclib/svn_ra/__init__.py
  Require Subversion 1.3.0 or better.
  (get_location): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1096 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 13:47:53 +00:00
cmpilato
70c4a29059 * viewcvs/lib/compat.py
Revert revision 1.18.  The Way of Russell is Enlightenment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1095 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-23 11:22:30 +00:00
cmpilato
88ac9dd646 * viewcvs/lib/vclib/__init__.py
(InvalidRevision.__init__): Make the revision argument optional, and
    fix the exception strings up a bit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1094 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-22 22:03:55 +00:00
cmpilato
0579698762 * viewcvs/lib/compat.py
(compare_versions): New.  (To be used in a future commit by
    Subversion vclib layers.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1093 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-22 20:37:23 +00:00
cmpilato
d19322a7c5 * viewcvs/lib/vclib/svn_ra/__init__.py
(LogCollector.add_log): Fix a bug in the rename tracing algorithm which
    was triggered whenever a path's parent was copied, and the path's
    copied location was edited, in the same revision.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1092 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-21 19:53:29 +00:00
cmpilato
1b2dc4efa3 Consistify the output of the vclib diff engines, sticking with GNU
diff format.  This also has the effect of simplifying the wrapping
code (which wasn't working anyway) a little bit.  Also, restore
functionality lost in the last re-org of the diff functionality
(svn_ra).  Finally, make the vclib.ccvs module's lack of diff
functionality a little more apparent to those who attempt to use it.

* viewcvs/lib/vclib/__init__.py
  (Repository.rawdiff): Specify that returned diffs are expected to be
    in GNU diff format.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rawdiff): Eat up the rcsdiff header lines, not
    exposing them to the caller.  The goal is to expose consistent
    diff output across vclib providers, so we'll shoot for GNU diff
    compliance.

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.rawdiff): Implement this interface, though only to
    raise an exception about how the functionality isn't implemented.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (do_diff): Sync with vclib.svn.do_diff().
  (SubversionRepository.rawdiff): Implement this interface.

* viewcvs/lib/viewcvs.py
  (diff_parse_headers): Lose the 'rootpath' argument.  We've tuned the
    vclib providers to stop exposing that stuff.
  (view_diff): Update calls to diff_parse_headers().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1091 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-20 15:06:52 +00:00
pefu
adbaa3d909 Fixed SF-Bug # 1192503: Updated broken link to competing project cvsweb
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1090 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-09-13 22:04:24 +00:00
rey4
42955196e8 Pass strings and callbacks to EZT instead of so many pseudo file objects.
* lib/viewcvs.py
  (MarkupBuffer):
    remove, not used anymore and StringIO is always there if we need it

  (MarkupPipeWrapper):
    make into a one-shot callback instead of going though contortions to
    support repeated read() calls

  (MarkupEnscript.__init__):
    add unrelated comment

  (markup_stream_python, view_markup):
    no need to wrap strings in MarkupBuffers, ezt supports strings too


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1089 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:22:59 +00:00
rey4
f236e63a43 Various improvements to EZT
- make substitution pattern implementation to use current format instead
    of writing directly to output

  - make it possible to pass python functions to ezt templates as simple
    callbacks

  - update documentation with information about callbacks, file pointers,
    and the [format] directive

* lib/ezt.py
  (__doc__):
    update documentation

  (_write_value):
    add code to implement callbacks and substitution patterns

  (Template._parse, Template._cmd_print, Templte._cmd_print_html):
    update to work with changed _write_value function

  (Template._cmd_subst):
    removed, functionality moved into _write_value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1088 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:10:45 +00:00
rey4
883e9a98bb Simplify diff code somewhat
* lib/viewcvs.py
  (diff_parse_headers, human_readable_diff, raw_diff):
    merge raw_diff and human_readable_diff into new
    diff_parse_headers function

  (view_diff):
    call diff_parse_headers


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1087 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-24 05:01:56 +00:00
rey4
7cdebbaf24 Move some diff functionality into vclib
* lib/vclib/__init__.py
  (Repository.rawdiff, UNIFIED, CONTEXT, SIDE_BY_SIDE, _diff_args):
    new

* lib/vclib/bincvs/__init__.py
  (Repository.rawdiff):
    new

* lib/vclib/svn/__init__.py
  (Repository.rawdiff):
    new

  (do_diff):
    move code that fixes diff headers here

* lib/viewcvs.py
  (_path_parts):
    new function to break a repository path into parts

  (Request.run_viewcvs):
    use _path_parts function

  (view_diff):
    use new Repository.rawdiff methods and _path_parts


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1086 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 20:07:02 +00:00
rey4
cbc95d7617 Fix check for forbidden paths on tarball download and simplify
generate_tarball function.

* lib/viewcvs.py
  (download_tarball):
    get rid of overly broad check for forbidden paths which would 404 on
    tarballs of all directories with forbidden names instead of just top
    level directories with forbidden names.

  (generate_tarball):
    get rid of tar_top and rep_top arguments

    get rid of default value for stack argument, which is likely to cause
    problems in multithreaded environments like mod_python

    reorganize and add comments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1085 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 19:33:18 +00:00
cmpilato
12d28a5509 Sooth pain felt by Daniel Berlin <dberlin@dberlin.org>, who complained
that navigation to a Subversion resource no longer in HEAD (or in a
directory no longer in HEAD) caused generated parent directory links
which 404'ed.

* viewcvs/lib/viewcvs.py
  (nav_path, common_template_data): When generating navigational links
    for Subversion repositories, if the current page was a request
    with an associated explicit revision number, use that revision
    number in references to parent directory views and "other" views
    of the file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1084 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:52:06 +00:00
rey4
c2c60e243d Fix exception when cvsdbadmin is passed only one argument
* tools/cvsdbadmin
  (global code)
    make sure script has 2 arguments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1083 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:51:54 +00:00
rey4
6c90233f4e Tighten up some logic in cvs revision number functions. I think the first
change might fix an rare exeception someplace, but these changes been sitting
in my working copy for a couple of months and I don't remember.

* lib/vclib/bincvs/__init__.py
  (_match_revs_tags):
    when iterating over trunk revisions, don't assume that a non-empty history
    array means there is a valid previous revision, always check the "prev"
    value explicity. It could be None now that _match_revs_tags accepts
    incomplete lists of revisions (as of rev 1.47)

  (_add_tag):
    remove redundant check for None revisions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1082 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:49:47 +00:00
rey4
5d0396e4c7 Restore viewcvs's ability to run under python 1.5
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.rcs_popen):
    convert tuples to lists before passing to list.extend

* lib/compat.py
  (formatdate):
    cut n' paste of rfc822.formatdate()

* lib/popen.py
  (popen):
    don't use string "find" method

* lib/viewcvs.py
  (Request.get_link):
    don't use dictionary "setdefault" method

  (check_freshness):
    don't use rfc822.formatdate()

* lib/win32popen.py
  (CommandLine, MakePrivateHandle, MakeInheritedHandle):
    don't use +=, |= operators

  (File2FileObject):
    don't use string "find" methods

  (SpoolWorker):
    don't use print >> syntax


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1081 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-22 18:41:59 +00:00
cmpilato
11769e1b29 Miscellaneous fixes around the forbiddenness support, mostly bugs
where too much data was being hidden that I think I caused myself, but
also a security fix where not enough data was being hidden.  At any
rate, this should bring us to consistent support for forbidden modules
(directories, not files) across the various views.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Move the forbidden check until later, after
    we know the path type, because forbiddenness only applies to
    top-level directories (modules), not files.
  (view_directory): Only do forbidden checks on directories, not files.
  (view_query): Strip forbidden/hidden paths from the query results.
    Noticed by Jon Stritar (jstritar) in Bug #1249974.

* viewcvs/lib/query.py
  (build_commit): Strip forbidden/hidden paths from query results.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1080 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:45:35 +00:00
cmpilato
26d6fdb439 * viewcvs/CHANGES
Forward port entries from the 0.9.x branch.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1079 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:20:51 +00:00
cmpilato
bf4e37d54e * viewcvs/website/download.html
Update links to downloadable versions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1078 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-17 21:17:14 +00:00
cmpilato
5df9a282b0 Make svndbadmin run to completion on the Subversion source code
repository, which it previously failed to do because of poor change
handling.  Also, stop it from Aborting at the end of every run due to
double-freeing of memory.

* viewcvs/tools/svndbadmin
  (SvnRepo.__init__): No longer keep self.pool around, and certainly
    don't close it on __del__() -- that's what the svn.core.run_app()
    wrapper framework is for.
  (_get_diff_counts): Just accept a diff file pointer object as input,
    and let the caller generate such a thing and pass it in.
  (SvnRev.__init__): Make use of the change item's base_path and
    base_rev to get accurate locations against which to diff.  Update
    calls to _get_diff_counts(), and make use of a new revision root
    cache.
  (SvnRev._get_root_for_rev): New revision root caching helper.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1074 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-08-09 03:22:50 +00:00
cmpilato
d1b71817d7 * viewcvs/lib/viewcvs.py
(generate_tarball, Request.run_viewcvs): Use '404 Not Found' instead
    of '403 Forbidden' for forbidden paths.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1073 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 16:08:34 +00:00
cmpilato
f1657e2c34 Fix copy-n-pasto in CHANGES file.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1071 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:58:52 +00:00
cmpilato
2c0181d625 Merge in CHANGES from 0.9.3 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1070 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:28:32 +00:00
cmpilato
2a75e75d23 Tweak website to point to new 0.9.3 release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1069 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 07:12:53 +00:00
cmpilato
27ad9a4f9d * lib/viewcvs.py
(download_tarball): Throw a 403 Forbidden area if a tarball request
    is for a forbidden module.  Patch by Olaf Hering <olh@suse.de>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1065 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-17 05:30:27 +00:00
cmpilato
6eeaf2be2b * lib/vclib/svn/__init__.py
(SubversionRepository.__init__): Catch (and ignore) a ValueError
    exception thrown by signal.signal.  It's probably the situation
    described in this email:
    http://mailman.lyra.org/pipermail/viewcvs/2005q1/003357.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1064 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-08 04:46:58 +00:00
dionisos
cefd17b78e Stricter input checking: throw an exception when not expecting EOF yet.
* tparse/tparse.h, tparse/tparse.cpp: Add 'allow_eof' parameter to
  TokenStream::get() and adjust callers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1063 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 16:05:26 +00:00
dionisos
c3a80705ba * tparse/tparse.cpp (parse_rcs_admin): Allow 'symbol<space>:<space>revnum'
as recently added to the python modules.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1062 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 15:00:26 +00:00
dionisos
a9f8e7a802 * tparse/tparse.h: Fix 2 warnings revealed by gcc -Wall.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1061 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 13:58:06 +00:00
dionisos
55889fd691 Exception usage cleanup. Use exceptions to terminate the parser in all cases.
Also protect pointers with auto_ptr to ensure cleanup.

Note: Before this change exceptions *could* occur, but all pointer-referenced
memory would be leaked.

* tparse/tparse.h: Change #include-s to C++ names.
  (RCSParseError):  Change to be a public descendant of exception. Use
  string datatype to ensure automatic cleanup. Implement a destructor
  as required by exception.
  (RCSExpected):  Use string datatype to ensure automatic cleanup. Add
  constructor for expected characters.
  (Branche): Removed.  Replaced with std::list<>.
  (Sink): Change method definition to reflect switch to exceptions.
  (TokenParser::match):  Add method for matching characters.
  (TokenParser::semicol, TokenParser::matchsemicol): Removed.
  Obsolete because we're now able to match single characters.
  (tparseParser):  Change method definition to reflect the switch
  to exceptions.
  (tparseParser::parse):  Adapt to changed method definitions.

* tparse/tparse.cpp: Change #include-s to C++ names.
  (TokenParser::get): Space changes and conversion to auto_ptr.
  (tparseParser::parse_rcs_admin,
   tparseParser::parse_rcs_description,
   tparseParser::parse_rcs_deltatext): Conversion to auto_ptr and exceptions.
  (tparseParser::parse_rcs_tree): Conversion to auto_ptr and exceptions. Also
  adjust for removal of Branche class.

* tparse/tparsemodule.h:  Include Python.h, since
  we,re actually using python types.

* tparse/tparsemodule.cpp (pyobject, pystring):
  New classes.  Used to anchor python objects ensuring their refcounts
  are decremented.
  (chkpy):  New.  Function to check python return value and act appropriately.
  (initparse):  Correctly anchor python strings.
  (rcstoken_to_pystring):  Removed.  Now integrated into the pystring class.
  (PythonSink):  Claim ownership for the duration of the instance lifetime.
  Also adjust all methods for the switch to exceptions.
  (tparse):  Adapt to the switch to exceptions.  Also prevent memory leakage
  when an exception occurs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1060 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-05-01 13:56:23 +00:00
dionisos
cab7c9ae04 Fix problems parsing files with 0 (nul) characters in them (typically
binary files).

At the same time reduce processing time by ~50% (in my measurements).


* tparse/tparse.h: Remove deprecated (and now unused) strstream header.
  (rcstoken): New class. Used to hold parser output.
  (Branche, Sink, TokenParser): Use rcstoken class whereever char* was
  used for holding parser output.

* tparse/tparse.cpp (rcstoken::init, rcstoken::append,
  rcstoken::grow,rcstoken::copy_begin_end, rcstoken::copy_begin_len): New.
  (TokenParser::get): Change return type to rcstoken and adapt accordingly.
  (TokenParser::unget): Change argument type.
  (tparseParser::parse_rcs_admin,tparseParser::parse_rcs_tree,
   tparseParser::parse_rcs_description,
   tparseParser::parse_rcs_deltatext): Adjust to use rcstoken class.

* tparse/tparsemodule.cpp (rcstoken_to_pystring): New. Helper function
  to do token to python string transformation.
  (PythonSink): Adjust all methods to use the rcstoken class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1059 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 19:09:19 +00:00
dionisos
700b9eb7ad Use 'const char *' type for exception arguments.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1058 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 13:23:42 +00:00
dionisos
4038b9fe96 Eliminate compile warning.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1057 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-30 12:06:31 +00:00
cmpilato
543de7e0f7 Fix Bug #1181208.
* lib/viewcvs.py
  (raw_diff): Rootpath only shows up in Subversion diffs, not CVS.  So
    look for headers in a slightly less demanding way, replacing the
    rootpath if it appears, but certainly not caching the whole diff
    in memory if it doesn't.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1056 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-18 23:35:37 +00:00
cmpilato
c6cef2c309 Remove this patch. mailer.py (in Subversion /trunk) can now do ViewCVS diff
URLs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1055 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-15 16:03:22 +00:00
cmpilato
7e563d0746 Minor code cleanups.
* lib/viewcvs.py
  (view_diff): Little comment fix.

* lib/vclib/svn_ra/__init__.py
  (ChangedPath): Remove; use the one from vclib.svn.

* lib/ezt.py
  Update to latest upstream version, but reapply "the LongType fix".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1054 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 17:00:56 +00:00
cmpilato
2ab8c50dd7 Lose some duplicated code.
* lib/vclib/svn_ra/__init__.py
  (_datestr_to_date): Remove, and pull in the one from vclib.svn instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1053 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 02:43:34 +00:00
cmpilato
949c6a196d Some fixes to the 'diff' view.
While this would appear to fix the problems Aaron Craven
<viewcvs@vickerscraven.net> has been seeing with respect to HTML
escaping levels of diff output, this is a fluke.  A real problem (not
addressed here) is that raw_diff() is that basically, any time
raw_diff() is called with 'parseheader' set, it is treating the whole
diff output as headers (the early outs aren't firing).  This is
broken, and rather defeats the point of attempting streamy diffs since
we're collecting the whole thing into an array in memory.

* lib/viewcvs.py
  (raw_diff): Don't forget to htmlize() headers if so requested.
  (view_diff): Use 'unidiff' as the diff format choice if asked to
    make a patch for 'side-by-side' mode.  'Unidiff' and 'context
    diff' are the only valid patch formats, as far as we are
    concerned.  Also, fix a little comment typo.  Finally, revert my
    previous change, where I added an extra MarkupPipeWrapper around
    the file object returned from raw_diff() -- this was bogus, as
    raw_diff() should have been htmlifying stuff anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1052 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-12 01:37:28 +00:00
cmpilato
5fb004046a Fix a bug which caused context and unidiff output to not be properly
htmlize()'d.  Reported (with patience, thankfully) by Aaron Craven
<viewcvs@vickerscraven.net>

* lib/viewcvs.py
  (view_diff): Wrap the raw diff FP object with an htmlize()ing class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1051 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-11 04:57:37 +00:00
cmpilato
4bfb7f1354 Rename Repository.filelog() to Repository.itemlog() (Subversion
supports logs on directories, too, ya know).  And make some other
little documentation changes.

* viewcvs/lib/vclib/__init__.py
  (Repository.itemlog): Was Repository.filelog().
  (Revision.__init__): Document the input parameters.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository.itemlog): Was BinCVSRepository.filelog().

* viewcvs/lib/vclib/ccvs/__init__.py
  (CCVSRepository.itemlog): Was CCVSRepository.filelog().

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.itemlog): Was SubversionRepository.filelog().

* viewcvs/lib/vclib/svn_ra/__init__.py
  (SubversionRepository.itemlog): Was SubversionRepository.filelog().

* viewcvs/lib/viewcvs.py
  (view_markup, view_log): Update calls to Repository.itemlog() (from
    Repository.filelog()).

* viewcvs/lib/cvsdb.py
  (GetCommitListFromRCSFile): Update calls to Repository.itemlog()
    (from Repository.filelog()).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1050 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-08 22:57:02 +00:00
cmpilato
0738697d61 Fix an annotate bug reported by Amy Langenhorst <Amy.Langenhorst@noaa.gov>.
* lib/blame.py
  (CVSParser.is_branch): Tighten up regular expression with '^'/'$'.
    Revisions like "11.0.2.2.0.1" were matching not with groups
    "11.0.2.2" and "1", but with "11" and "2.2.0.1".


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1049 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-08 22:55:58 +00:00
cmpilato
f7e15a4b8e * lib/viewcvs.py
(view_log): Fix a bug where use of the diff form via branch
    selection resulted in a log view instead of a diff view.  Reported
    by Amy Langenhorst <arl@noaa.gov>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1048 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-04-04 19:02:23 +00:00
cmpilato
874e0be23b Sorta kinda revert my changes from Feb. 1 2005, wherein I stopped
grouping directories in the directory view.  Now, make that behavior
optional (though, the default), but also fix it so that the directory
group itself is internally sorted by the current sort key.  This more
accurately mimics the likes of the Windows Explorer.

* viewcvs/viewcvs.conf.dist
  (sort_group_dirs): New option.

* viewcvs/lib/config.py
  (Config.set_defaults): Set default value for sort_group_dirs.

* viewcvs/lib/viewcvs.py
  (file_sort_cmp): If grouping directories, sorts dirs higher than
    files.  Otherwise, use normal sorting rules.

* viewcvs/website/upgrading.html
  Note the new option.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1047 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-03-07 15:13:23 +00:00
cmpilato
bbd4c762cb * templates/docroot/images/broken.png
* templates/docroot/images/cvsgraph_16x16.png
* templates/docroot/images/cvsgraph_32x32.png
  More PNG background fixes from Jordan Russell <jr-list-2005@quo.to>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1046 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-03-01 20:25:52 +00:00
cmpilato
b1d10a7f96 Jordan Russell <jr-list-2005@quo.to> was kind enough to rework some of
PNG files to have white backgrounds so that wussie browsers that don't
support PNG transparency (like Internet Explorer) can deal with them.

* templates/docroot/images/back_small.png
* templates/docroot/images/logo.png
* templates/docroot/images/text.png
  Tweaked.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1045 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-28 15:54:15 +00:00
cmpilato
6355639d08 Provide the Subversion youngest revision, and a link to it, to the
directory view.  This is pretty common request, the most recent by
Sergio Rua <srua@plus.net>.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (get_youngest_revision): New.

* viewcvs/lib/vclib/svn/__init__.py
  (get_youngest_revision): New.

* viewcvs/lib/viewcvs.py
  (view_directory): Re-organize some data dictionary stuffing (I
    really wish that *all* data dictionary parameters were initialized
    at the head of each view function so we can see a canonical list
    of those params, but maybe another day...).  Also, for 'svn'
    roottypes, populate a new 'youngest_rev' and 'youngest_rev_href'
    dictionary items.

* viewcvs/website/upgrading.html
  Document the new 'youngest_rev' and 'youngest_rev_href' template keys.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1044 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-28 15:40:08 +00:00
cmpilato
ad0bc5c421 * viewcvs/templates/markup.ezt
This template was on crack.  The absence of a revision log was
  enough to turn of the display of almost all of the other interesting
  data, and turn on the display of data that was in one half redundant,
  and in the other half non-existant.  Good Lord...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1043 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-25 15:59:20 +00:00
cmpilato
329a9edab4 * viewcvs/lib/viewcvs.py
(enscript_extensions): Add '.cs', '.bas', and '.cls' extensions,
    mapping to 'csharp', 'vba', and 'vba', respectivelyly, at the
    request of Bo Berglund <bo.berglund@telia.com> and Hern��n Mart��nez
    Foffani <hernan@orgmf.com.ar>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1042 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-22 15:09:09 +00:00
dionisos
81aaaab615 * tparse/tparse.cpp (parse_rcs_tree): Don't special case non-special case.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1041 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 13:15:25 +00:00
dionisos
ec41758e2e Stop passing ownership of parameters into the sink.
* tparse/tparsemodule.cpp: Stop freeing parameters passed into the sink.

* tparse/tparse.cpp: Dispose of allocated memory after use.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1040 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 13:03:02 +00:00
dionisos
0acab473b2 Add .cvsignore file to ignore 'build/' output directory.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1039 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-20 12:36:53 +00:00
cmpilato
f723597546 Now that Subversion's RA layer has a pleasant API (instead of a nasty
vtable structure), update the ViewCVS 'svn_ra' module to use it.  This
module now almost has total functional parity with the 'svn' module.

* viewcvs/lib/vclib/svn_ra/__init__.py
  Import the svn.ra module.
  (date_from_rev, created_rev): Actually flesh out these functions
    using the new RA capabilities.
  (LastHistoryCollector.add_history): Remove leading slashes from
    paths used to make ChangedPath items.
  (either_binary): Leave a TODO, with some optimization ideas.
  (SubversionRepository.__init__): Use the RA interface to fetch the
    youngest revision instead of a really kludgy (and more expensive)
    algorithm based on dirents.
  (FileDiff.get_files, SubversionRepository.openfile): Fixup the use
    of streams.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1038 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-17 19:01:46 +00:00
rey4
66cdbe31e7 Support relative images and links in checked out HTML pages when
checkout_magic is disabled by changing the default view for file URLs from
"log" to "checkout"

This causes some URL compatibility to be lost when checkout_magic is disabled.
Bookmarks which pointed to log pages but don't have explicit view=log
parameters will point to checkout pages instead.

* lib/viewcvs.py
  (Request.run_viewcvs):
    change default view for files from "log" to "checkout" when checkout_magic
    is disabled

  (Request.get_link):
    don't add explicit view=checkout parameters for checkout links when
    checkout_magic is disabled

    don't drop explicit view=log parameters for log links

* website/upgrading.html
    add note about URL compatibility

* INSTALL
    update section on access control

* viewcvs.conf.dist
    update documentation for "root_as_url_component" and "checkout_magic"

    move "checkout_magic" option directly underneath "root_as_url" component
    because the two options are related


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1037 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-13 16:48:12 +00:00
rey4
6b9207ab39 Add title attributes to directory links
* lib/viewcvs.py
  (view_directory):
    add new row.viewable attribute so it is possible to tell whether a file
    link goes to a checkout or markup page

* templates/directory.ezt:
    add title attributes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1036 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-13 16:46:56 +00:00
maxb
08cf03dbd3 tparse: A few of the smaller changes from Erik's patch, slightly extended by me.
* tparse/tparse.h (tparseParser::tparseParser, tparseParser::parse):
    Split the actual parsing out of the constructor, into a parse() function.
* tparse/tparsemodule.cpp (PythonException): Move earlier in the file.
  (tparse): Call tparseParser::parse(). Do not INCREF and then DECREF the
    parameters - our caller must by definition be holding a reference in order
    to pass the objects in, and we are finished with them before we return.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1035 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-12 13:13:25 +00:00
maxb
b7482f30f5 tparse: A few cleanups. Some whitespace adjustments extracted from Erik's
big std::string-izing patch, and also toss some code I noticed was unused.

* tparse/tparse.cpp
  (Whitespace, Token_term, TokenParser::unget, tparseParser::parse_rcs_tree):
    Whitespace adjustments.
* tparse/tparsemodule.cpp (tparse): Whitespace adjustments.

* tparse/tparse.h (RCSParseError.getvalue, RCSExpected.getvalue):
    Remove some unused code, which includes one use case of the deprecated
    ostrstream class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1034 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-12 01:50:11 +00:00
maxb
af6dbf5ecd tparse: Enable compilation on gcc 3.x, sacrificing compatibility with gcc 2.x.
* tparse/tparse.h: #include <strstream>, not <strstream.h>,
    and add "using namespace std;".

* tparse/tparsemodule.cpp: Do not #include <stdiostream.h>.
  If a version of GNU C++ with the stdio_filebuf extension to the STL is
  detected, then use it to allow the passing of a filehandle from Python
  to the parser. Otherwise, throw a NotImplementedError when a filehandle
  is passed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1033 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-11 23:53:52 +00:00
cmpilato
fd5acb4930 * viewcvs/lib/viewcvs.py
(enscript_extensions): Add '.f90' as an extension mapping to
    'fortran'.  Suggestion by Ed Zaron <ezaron@coas.oregonstate.edu>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1032 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-10 23:37:11 +00:00
cmpilato
5020756254 Add notation about the new 'template_dir' directive.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1031 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 16:58:47 +00:00
cmpilato
da38c84d9c Move the [options] section up to just below the [general] stuffs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1030 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 02:48:14 +00:00
cmpilato
50508ebcc7 In short, facilitate the creation, testing, installation, and sharing
of "template sets."

I'm introducing a new configuration variable ('template_dir') which is
the parent directory of all ViewCVS templates.  Those templates have
names which match the views they describe (directory.ezt,
revision.ezt, graph.ezt, etc.).  The 'docroot' variable will now
default to "<template_dir>/docroot".  Finally, the [templates] section
will continue to work as before, save that all configuration therein
(and templates not configured will fallback to
"<template_dir>/<view_name>.ezt").

The beauty of this is that folks can start whipping up (and
maintaining themselves) ViewCVS template sets which can be traded and
shared, like themes for Mozilla or Windows XP.  EZT is super-powerful,
and there are some really fun things you can do with it to serve up
interesting and unique ViewCVS views.  But while we want to encourage
creativity and innovation, we don't want the ViewCVS project itself
having to maintain everyone's fun little themes.  Anyway, so now
installing a new template set is just a matter of dropping that set
directory somewhere (anywhere, really) on your system and pointing
'template_dir' to that directory tree.  No (very annoying) template
modification conflicts to deal with every time you update ViewCVS on
your system.

And the best part is that existing ViewCVS configurations should all
continue to work compatibly.

* viewcvs/viewcvs.conf.dist
  Add a new option, "template_dir".  Tweak documentation on the
  "docroot" option.  And make the whole [templates] section work a
  little differently.

* viewcvs/lib/config.py
  (Config.set_defaults): Use 'None' as the default value for the
    self.templates.directory, self.templates.log,
    self.templates.query, self.templates.diff, self.templates.graph,
    self.templates.annotate, self.templates.markup,
    self.templates.error, self.templates.query_form,
    self.templates.query_results, and self.templates.roots options.
    Add a new default value for self.options.template_dir.

* viewcvs/lib/viewcvs.py
  (get_view_template): New.
  (generate_page): Instead of taking a template name, take a view
    name.  Also, call get_view_template() to generate the full
    template path.
  (view_markup, view_roots, view_directory, view_log, view_annotate,
    view_cvsgraph, view_diff, view_revision_svn, view_queryform,
    view_queryform, view_error): Update calls to generate_page().

* viewcvs/lib/query.py
  (main): Use viewcvs.get_view_template().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1029 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-08 02:46:20 +00:00
rey4
12d47495c3 Reorganize URL handling functions for clarity and to make it
easier to change the default view.

* lib/viewcvs.py
  (Request.run_viewcvs):
    move code that handles the magic markup mimetype.

    remove unneccessary special case code for log pages with revisions
    selected for diffs

  (Request.get_link):
    consolidate code that determines whether to skip sticky variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1028 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:55:49 +00:00
rey4
0b989145a7 Minor updates to documentation.
* INSTALL
    update cvsgraph revision number and cgi directory path

* CHANGES
    mention "root_as_url_component" and fix the way a date is formatted

* website/upgrading.html
    fix stutter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1027 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:53:17 +00:00
rey4
605109cbfd Fix page title for repository listing page
* templates/include/header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1026 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-06 19:49:30 +00:00
cmpilato
83af4b6b3d Move the magical 'Repository Listing' option to the top of the option set.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1025 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-05 16:52:12 +00:00
rey4
86a7feb403 Add unobtrusive link to repository listing view on the common page
headers.

* templates/include/header.ezt
    add "Repository Listing" option to the roots select box

* lib/viewcvs.py
  (Request.run_viewcvs):
    handle magic "roots" value submitted by the roots select box

  (common_template_data):
    add "view" template parameter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1024 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:33:20 +00:00
rey4
56e7993f12 Add repository listing view. This change doesn't any links to the new
view because I'm not really sure where they would fit best in the UI.
So for now, the view is only visible when viewcvs.cgi is loaded
with no trailing path in the URL and either root_as_url mode is
enabled or default_root is not set.

* lib/viewcvs.py
  (Request.run_viewcvs, Request.get_link, nav_path, common_template_data,
   _views):
    add support for new view

  (view_roots):
    new function

* lib/config.py
  (Config.set_defaults):
    set default templates.roots option

* templates/roots.ezt
    new template

* viewcvs.conf.dist
  (templates/roots):
    new option

  (general/default_root, options/root_as_url_component):
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1023 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:32:32 +00:00
rey4
5d572bef92 Remove duplicate code
* lib/viewcvs.py
  (nav_header_data):
    get rid of duplicate template assignments


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1022 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:29:09 +00:00
rey4
21f89e87d5 Get revision numbers to display on annotate pages when viewing HEAD.
* lib/blame.py
  (BlameSource.__init__):
    set "revision" member to revision being annotated

* lib/viewcvs.py
  (view_annotate):
    use "revision" member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1021 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:28:22 +00:00
rey4
37a8e3ee3c Document removed template variables
* website/upgrading.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1020 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-04 18:26:54 +00:00
rey4
d9fd8ee727 Replace dodgy os.dup calls with calls to os.dup2
* standalone.py
  (ViewCVS_Handler.run_viewcvs):
    don't duplicate file descriptors inside an assert, asserts shouldn't
    be used to handle runtime errors, only to detect logic errors, and
    anyway, the code needs to run with asserts disabled

    call dup2() instead of dup() to explicitly set the standard out,
    instead of just hoping that the standard out is the first available
    descriptor


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1019 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:08:59 +00:00
rey4
4504b5fc3d Make redirects work better with the standalone server
* lib/sapi.py
  (CgiServer.redirect):
    use addheader() method instead of printing headers literally


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1018 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:07:16 +00:00
rey4
72dbcf1fb7 Fix bug in copy_stream which broke docroot requests with the standalone
server on linux.

* lib/viewcvs.py
  (copy_stream):
    when copying to the sys.stdout, make sure to use the current
    sys.stdout file object instead of the file object cached by
    python as a default argument


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1017 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:05:40 +00:00
rey4
33e9c1db0c Make the blame module use get_url links
* lib/viewcvs.py
  (sticky_vars):
    removed

  (view_annotate):
    pass partial get_url links to blame module

* lib/blame.py
  (link_includes, BlameSource.__init__, BlameSource.__getitem__):
    use get_url links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1016 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:04:03 +00:00
rey4
d0029c46d3 Add revision links to annotate view
* lib/viewcvs.py
  (view_markup, nav_header_data)
    move "view_href," "download_href," "annotate_href" assignments
    into nav_header_data

* templates/annotate.ezt
    add revision links here


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1015 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:03:19 +00:00
rey4
dc76b574a9 Clean up path handling in viewcvs views, eliminate unused template variables.
* lib/viewcvs.py
  (_path_join):
    new function

  (Request.run_viewcvs, nav_path, common_template_data, view_markup,
   view_log, view_cvsgraph, generate_tarball, view_query):
    use _path_join

  (nav_header_data):
    remove unused variables

* templates/graph.ezt
    don't use "path" variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1014 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 12:58:14 +00:00
cmpilato
4d1a7b09b3 Fix tarball generation bug noticed by Nicolas Benoit <nbenoit@tuxfamily.org>.
* viewcvs/lib/viewcvs.py
  (generate_tarball): rep_top is a list, so stop testing it against strings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1013 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-02 15:07:29 +00:00
cmpilato
e58df06c55 * viewcvs/lib/vclib/svn/__init__.py
(_sigterm_handler): Make self available for compatibility with older
    Python versions.  (Thanks for catching this, Greg Stein.)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1012 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-02 15:02:55 +00:00
cmpilato
5ad97c13bb Ensure that Subversion repositories get a clean disconnect when
SIGTERM is sent to the process by registering a handler for that
signal which gracefully shuts down APR.

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.__init__): Register a handler for SIGTERM that
    cleanly closes up shop.
  (SubversionRepository._close): New (with code copied and modified
    from __del__).
  (SubversionRepository.__del__): Cored out (see _close).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1011 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-01 20:37:00 +00:00
cmpilato
b5cf642f0e * viewcvs/lib/viewcvs.py
(file_sort_cmp): Only treat directories as special when sorting by name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1010 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-01 16:40:15 +00:00
cmpilato
f85b7bb67e * viewcvs/lib/popen.py
(popen): Removed commented-out code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1009 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-31 21:14:04 +00:00
cmpilato
e8fa0f0186 * viewcvs/lib/debug.py
(PrintStackTrace): Remove unused function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1008 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-31 21:12:13 +00:00
cmpilato
27c4c62394 * viewcvs/lib/viewcvs.py
(_sticky_vars): Remove 'dir_pagestart' and 'log_pagestart' from the
    set of sticky parameters.  I simply can't see any utility in
    keeping those things around, as they muck up more URLs than they help.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1007 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-29 03:55:24 +00:00
rey4
ff5aa6d251 Fix handling of "tarball" parameter (for backwards compatibility
with ViewCVS 0.9.2

* lib/viewcvs.py
  (Request.run_viewcvs)
    look for tarball parameter on directory paths, not file paths
----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1006 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 19:35:14 +00:00
rey4
83d2817867 Fix subversion markup view
* lib/viewcvs.py
  (view_markup):
    set annotate_href value

----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1005 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 06:38:20 +00:00
rey4
c9ca3313c6 Remove "auto" view replacing auto links with direct checkout or
markup links.

* lib/viewcvs.py
  (is_viewable):
    new function

  (view_auto):
    removed

  (view_directory, view_cvsgraph, build_commit):
    change auto links into direct links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1004 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 06:08:08 +00:00
rey4
99818c7cf0 Add a bunch of links between different views. Some of these links
were present in ViewCVS 0.9.2, but seem to have been inadvertently
removed since then.

* lib/viewcvs.py
  (common_template_data):
    set "up_href, "log_href," and "graph_href" template variables
    for files

  (view_markup):
    set "annotate_href"

  (view_directory):
    stop setting "up_href" here

  (view_log):
    stop setting "graph_href" and "back_url" here
    set "annotate_href" here

  (view_queryform):
    set "dir_href" here

* templates/annotate.ezt
* templates/diff.ezt
* templates/graph.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
* templates/query_form.ezt
* templates/include/branch.ezt
    add links

* website/upgrading.html
    document changed variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1003 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 05:20:46 +00:00
cmpilato
ee9b309d4c Answer a FAQ about Subversion bindings.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1002 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 04:54:50 +00:00
rey4
0b8521ef61 Add viewcvs logo to the page across from the title.
* templates/include/header.ezt
    look at it go...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1001 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 03:47:20 +00:00
rey4
c0110cacae Simplify page titles. Someone was getting a little - too crazy - with -
the: punctuation ;)

* templates/annotate.ezt
* templates/diff.ezt
* templates/graph.ezt
* templates/log.ezt
* templates/log_table.ezt
* templates/markup.ezt
* templates/query.ezt
* templates/query_form.ezt
* templates/query_results.ezt
* templates/revision.ezt
* templates/include/dir_header.ezt
* templates/include/header.ezt
  change titles

* lib/config.py
  (Config.set_defaults):
    remove "main_title" option

* viewcvs.dist.conf
    remove "main_title" option

* website/upgrading.html
    document removal of "main_title" option


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1000 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-14 03:40:55 +00:00
rey4
cbac6b920c Fix infinite redirect problem for tarball download links, and remove
trailing slashes on revision view links.

* lib/viewcvs.py
  (Request.run_viewcvs):
    don't require trailing slashes on tarball download or revision
    view URLs

  (Request.get_link):
    remove trailing slashes on revision view links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@999 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 19:04:13 +00:00
rey4
aedd660e9a Fix infinite redirect problem for revision URLs.
C. Michael Pilato <cmpilato@collab.net> first reported this bug
on the dev list.

* lib/viewcvs.py
  (Request.get_link):
    add trailing slashes on revision view links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@998 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 18:31:10 +00:00
cmpilato
d34e4f0594 * viewcvs/lib/viewcvs.py
(nav_path): Escape the root name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@997 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 18:11:57 +00:00
cmpilato
9fdb38c5e5 * viewcvs/lib/viewcvs.py
(Request.run_viewcvs): If there is no rootname, set a default one so
    that further attempts to use it don't choke.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@996 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 17:37:59 +00:00
rey4
fdb5ced659 Templatize the clickable path in header.ezt.
* lib/viewcvs.py
  (clickable_path, _dir_url):
    removed

  (nav_path):
    new function, replaces clickable_path

  (common_template_data):
    set "nav_path" template variable with nav_path() instead of
    clickable_path()

  (view_directory, view_log, view_queryform, view_query):
    don't override 'nav_path' variable

* templates/include/header.ezt
    use changed 'nav_path' variable

* website/upgrading.html
    document changed 'nav_path' variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@995 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 17:30:45 +00:00
rey4
3d3554b07e Remove extra clickable paths from directory and markup pages.
* lib/viewcvs.py
  (view_markup):
    don't set 'nav_file' template variable

* templates/markup.ezt
    remove the clickable path right before the revision information

* templates/include/dir_header.ezt
    remove clickable path in "Current Directory" row of summary table

* website/upgrading.html
    add documentation on 'nav_file' template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@994 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:55:48 +00:00
rey4
df3d83f843 Fix bug that prevented magic checkout URLs from working.
* lib/viewcvs.py
  (Request.run_viewcvs):
    fix use of nonexistent variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@993 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:17:53 +00:00
rey4
35c9d578f7 Add a promiment link to the log page on the markup page. ViewCVS 0.9.2
had one, but it got lost in the sauce.

* templates/markup.ezt
    add (log) link right before (download) and (as text) links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@992 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 16:14:12 +00:00
rey4
8a6ffa0257 Fix a bug in redirection logic
* lib/viewcvs.py
  (Request.run_viewcvs):
    add trailing slash to all directory paths, not just paths
    for directory listing pages


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@991 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 07:20:33 +00:00
rey4
77e0fd633a Add "Parent Directory" link in directory listings
* templates/directory.ezt
* templates/dir_alternate.ezt
    add "Parent Directory" rows

* lib/viewcvs.py
  (view_directory):
    set "up_href" template value

* website/upgrading.html
    document "up_href" variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@990 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 05:57:01 +00:00
rey4
7e897b10df Fix UnmatchedEndError in dir_alternate template.
* templates/dir_alternate.ezt
    remove unmatched [end]


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@989 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 05:38:13 +00:00
rey4
5c42382511 Redirect on irregular URLs so it is easier to limit viewing parts of
the repository in apache based on the URL.

Thanks to Jonathan <voigtjr@gmail.com> for bringing this issue to my
attention on the users' list.

* lib/viewcvs.py
  (Request.run_viewcvs):
    add redirects for weird urls

  (view_directory):
    don't redirect here when there's no trailing slash; it's taken
    care of in run_viewcvs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@988 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 02:16:09 +00:00
rey4
0b7be07a67 Fix cvs log view
* lib/viewcvs.py
  (view_log):
    set default value for entry.copy_path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@987 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-13 01:34:20 +00:00
cmpilato
c15cc3bb33 * viewcvs/lib/debug.py
(PrintException): Escape the error message so it doesn't goof up
    HTML display.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs, _validate_param): Don't escape params in
    strings of raised exceptions, as that's the exception-handling
    code's job.
  (nav_header_data, common_template_data, clickable_path, view_log,
    view_directory): Escape template data that needs escapin'.
  (view_markup): Use un-escaped filename instead of the one in the
    data dictionary.
  (view_checkout): Re-org a little bit so that fp is always explicitly
    closed.
  (copy_stream): Instead of defaulting the output stream to None, and
    letting None mean "gimme sys.stdout", just make the default output
    sys.stdout.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@986 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:40:09 +00:00
cmpilato
167311b79b * viewcvs/lib/viewcvs.py
(view_doc): Refer to "static files" instead of "help files", and to
    try to get all the exceptionful states to occur before we fire up
    the output process.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@985 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:38:47 +00:00
cmpilato
39d2eedd10 Fix Bugs item #1090934, reported by ahndee.
* lib/viewcvs.py
  (view_revision_svn): Convert 'text_mods' and 'prop_mods' members of
    each changed path item into EZT booleans.

* templates/revision.ezt
  Use if-any tests, instead of comparisons with "1", to determine if
  each changed path item has text or property mods.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@984 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:27:27 +00:00
cmpilato
38dc2d2521 * viewcvs-install
Add support for DESTDIR installs, and support for --prefix and
  --destdir command-line arguments (which override the defaults and
  prevent prompts from appearing).  DESTDIR install stuff from a
  patch by Olaf Hering <olh@suse.de>, command-line arg stuff by me.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@983 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-01-06 20:10:47 +00:00
rey4
ce2a896be2 Fix loginfo crashes on "cvs import" and "cvs add <directory>". Thanks to John
Beranek <john@redux.org.uk> for reporting the bug on the users' list.

* tools/loginfo-handler
  (HeuristicArgParse, CvsNtArgParse):
    fix return values


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@982 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-10 02:43:07 +00:00
rey4
1c703900bb Generate CvsGraph image map links with get_url function just like other
links instead of cobbling them together in cvsgraph.conf. This way
cvsgraph.conf doesn't have to change if we add new url schemes and we can
handle sticky variables and root parameters without special case code.

* lib/viewcvs.py
  (Request.get_url):
    accept new "partial" argument to append trailing ? or & to generated
    url

  (view_cvsgraph):
    pass get_url generated links to cvsgraph instead of url fragments

* cvsgraph.conf.dist
    use the new links passed by ViewCVS


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@981 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-10 02:09:46 +00:00
rey4
b6a4e521be Remove apache logo from default templates
* templates/include/footer.ezt
    Powered by... nothing :'(


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@980 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-06 01:45:59 +00:00
rey4
518573a350 Minor cleanups.
* lib/vclib/bincvs/__init__.py
  (_log_path):
    remove initialization of unused variable

  (_check_path):
    distinguish error messages that come from os.stat()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@979 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-04 01:57:13 +00:00
rey4
2529196782 Improve error messages in directory view for inaccessible CVS files.
* lib/vclib/__init__.py
  (DirEntry.__init__):
    set "errors" member instead of "verboten"

* lib/vclib/bincvs/__init__.py
  (CVSRepository.listdir):
    don't skip "Attic" and "CVS" entries if we're not sure if they are
    directories

    don't skip entries in Attic/ when we can't tell if they are files or
    directories

  (CVSDirEntry.__init__):
    use "errors" argument instead of "verboten"

  (_get_logs):
    don't set "DirEntry.log_errors" member, use "errors"

  (_log_path):
    don't return file access errors here, they are returned by _check_path

  (_check_path):
    return error strings on file access errors instead of simple booleans

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs):
    don't set "DirEntry.log_errors" member, use "errors"

* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
  (get_logs):
    don't set "DirEntry.log_errors" member

* lib/viewcvs.py
  (view_directory):
    use "DirEntry.errors" member instead of "log_errors"

  (generate_tarball):
    use "DirEntry.errors" member instead of "verboten"

* tools/cvsdbadmin
  (RecurseUpdate):
    use "DirEntry.errors" member instead of "verboten"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@978 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-03 20:44:56 +00:00
rey4
dd140d8f59 Merge in changes from cvsgraph.conf in CvsGraph 1.5.1
* cvsgraph.conf.dist
    update

* lib/viewcvs.py
  (view_cvsgraph):
    pass query string as %8 custom parameter instead of %6


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@977 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-12-02 22:51:48 +00:00
cmpilato
356642e4b6 Error template fixes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@976 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-11-19 06:38:39 +00:00
cmpilato
cbf330498f Drop a TODO for later processing.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@975 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-11-19 06:37:39 +00:00
rey4
0986d26a6a Update enscript link
* website/index.html
    link to enscript home page instead of gnu.org entry


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@974 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 22:12:03 +00:00
rey4
496719d672 Tone down normalization of the script name. We just need to trim its
leading slashes, not put it through some hocus-pocus purification
ritual.

* lib/viewcvs.py
  (_normalize_path):
    just trim leading slashes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@973 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 22:12:01 +00:00
cmpilato
bb591ca897 Remove some italics.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@972 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 05:19:53 +00:00
cmpilato
8164d4fd3f Fix Bug #983511 by normalizing the SCRIPT_NAME.
* lib/viewcvs.py
  (_normalize_path): New.
  (Request.__init__): Run _normalize_path() on self.script_name.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@971 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 05:19:52 +00:00
cmpilato
3ee18bdb13 (_get_logs): Fix a bug in determining imperfect-but-wanted entries.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@970 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-30 04:45:36 +00:00
cmpilato
514f573a6a Space text chunks a little more naturally.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@969 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-28 15:27:53 +00:00
cmpilato
b404bc2719 Website content edits.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@968 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-28 03:34:37 +00:00
cmpilato
c7e1eeb97d * tools/make-release
Fix the CVS root used, and remove the website before tarrin' up.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@967 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:36:30 +00:00
cmpilato
aa7d64fb28 Add the PhotoShop file I used to create the title image. Note that the cloud
photo is a public domain image taken from:
  http://pdphoto.org/PictureDetail.php?mat=pdef&pg=5173


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@966 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:32:39 +00:00
cmpilato
98046b15f5 Hope I'm not stepping on any toes here, but I couldn't bear the site
of the ViewCVS web pages any longer.  This begins a journey of
organization and updating that has been long past due.  And hey, if
folks hate it -- it's under version control.

* website/contact.html
* website/download.html
* website/images/bg-grad.jpg
* website/images/title.jpg
* website/styles.css
  New files.

* website/contributing.html
* website/index.html
* website/license-1.html
* website/upgrading.html
* website/who.html
  Heavily modified files.

* website/images/chalk.jpg
* website/images/logo.png
  Removed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@965 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 06:22:13 +00:00
cmpilato
1a76505beb Minor docco fix. Patch by Juanma Barranquero <lektu@mi.madritel.es>.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@964 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-26 02:09:09 +00:00
cmpilato
e3abe288f6 Update mailing list information.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@963 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-25 17:46:27 +00:00
cmpilato
b26f6c0e09 * viewcvs/lib/viewcvs.py
(view_log): Only show download hrefs for files, and make view hrefs
    for directories show the directory view.

* viewcvs/templates/include/branch.ezt
  Only display the view_href if it exists.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@962 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-20 16:27:04 +00:00
cmpilato
0540dd9c0a * lib/viewcvs.py
(view_log): Always expose the view_href and download_href.

* templates/log.ezt
* templates/log_table.ezt
  Lose the "if CVS" condition I added for some includes a while ago.

* templates/include/branch.ezt
  Always show bookmarkable links to HEAD/download.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@961 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-19 14:46:35 +00:00
cmpilato
6fbdc57c44 Fix issue #1035766.
* lib/viewcvs.py
  (_re_rewrite_url): Look for the HTML-encoded version of ampersands
    in URLs ("&amp;").


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@960 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-18 16:39:26 +00:00
cmpilato
4884f8f5c6 Address issue #1049046.
* lib/viewcvs.py
  (_re_rewrite_email): Allow plus signs in email addresses.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@959 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-18 16:03:44 +00:00
rey4
68ebc10d44 Minor fix in svndbadmin
* tools/svndbadmin
  (usage):
    fix call to os.path.basename()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@958 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 03:08:04 +00:00
rey4
eaa2136cf6 Minor cleanups in loginfo script
* tools/loginfo-handler
  (HeuristicArgParse):
    fix spelling error in docstring

  (HeuristicArgParseDirectory, FindLongestDirectory)
    rename function

  (NextFile):
    fix return value

  (ProcessLoginfo):
    update inaccurate comment

  (module code):
    update inaccurate debug message


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@957 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 03:04:30 +00:00
rey4
325e79d4dc Minor cleanup in viewcvs module
* lib/viewcvs.py
  (view_query)
    shorten call to get_url


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@956 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:46:30 +00:00
rey4
5687f191f3 Minor cleanup in cvsdb module
* lib/cvsdb.py
  (Commit.SetBranch)
    shorten this code

  (CheckinDatabaseQuery.AddCommit, CheckinDatabaseQuery.SetCommitCB):
    remove unused callback functionality


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@955 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:40:10 +00:00
rey4
31410c3272 Minor cleanup in bincvs module
* lib/vclib/bincvs/__init__.py
  (_log_path)
    no need to deal with Attic paths here, they are filtered out in
    listdir


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@954 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:32:32 +00:00
rey4
173a8a7290 Get rid of rlog module, make CVSdb use bincvs instead.
* lib/rlog.py
    deleted

* lib/cvsdb.py
  (RLogDataToCommitList):
    removed

  (GetCommitListFromRCSFile):
    change to use vclib instead of rlog module

  (GetCommitListFromRCSFile, GetUnrecordedCommitList):
    update to accept vclib-style path_parts arguments

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.filelog):
    accept "cvs_pass_rev" option for passing -r arguments to rlog

  (_match_revs_tags):
    make this function work with an incomplete list of revisions
    instead of crashing. This is neccessary when an -r argument
    is passed to rlog.

  (_add_tag):
    make this function work when we need to create a tag with no
    revision object. We need this to create a HEAD tag when an -r
    argument is passed to rlog and we don't know what the HEAD
    revision is.

  (fetch_log):
    removed

* tools/cvsdbadmin
  (RebuildFile):
    removed, merged into UpdateFile

  (UpdateFile)
    accept new argument to reinsert all commits

  (RecurseRebuild):
    removed, merged into RecurseUpdate

  (RecurseUpdate):
    update to use vclib's listdir instead of os.listdir

  (CommandRebuild, CommandUpdate):
    removed, code moved into __main__ section

* tools/loginfo-handler
  (FileData, CommitFromFileData, GetUnrecordedCommitList):
    removed, these were just wrappers over the cvsdb interface

  (HeuristicArgParse, CvsNtArgParse)
    return tuples describing file data instead of file data objects

  (ProcessLoginfo):
    update to use cvsdb interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@953 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 02:23:23 +00:00
rey4
34b3f3e47a Fix file path issues in CVSdb on windows. Summary of changes:
- Stop converting directory and file paths to lower case with native
    slashes before storing them in the database. Instead store with
    preserved case and forward slashes.

  - Stop trying to clean up paths haphazardly all over the cvsdb module,
    instead expect paths to be normalized before they get passed to
    cvsdb.

* lib/cvsdb.py
  (Commit.SetRepository, Commit.SetDirectory, Commit.SetFile,
   CheckinDatabaseQuery.SetRepository,
   CheckinDatabaseQuery.SetDirectory):
    remove path cleanup code

  (RLogDataToCommitList)
    don't strip repository prefix because rlog module now does it

  (CleanRepository):
    new function

* lib/rlog.py
  (_get_co_file):
    change to return paths with forward slashes and without repository
    prefixes

  (GetRLogData):
    update call to _get_co_file

* tools/cvsdbadmin
  (UpdateFile, CommandUpdate, RebuildFile, CommandRebuild)
    remove calls to normcase here

  (module code):
    use CleanRepository function to clean up repository path

* tools/loginfo-handler
  (CleanDirectory):
    removed

  (HeuristicArgParse, CvsNtArgParse):
    don't call CleanDirectory or normcase here

  (HeuristicArgParseDirectory):
    remove stray print statement

  (module code):
    use cvsdb.CleanRepository function to clean up repository path

* tools/svndbadmin
  (module code):
    use cvsdb.CleanRepository function to clean up repository path

* lib/viewcvs.py
  (view_query):
    change to use forward slashes in directory names instead of native
    slashes

    use cvsdb.CleanRepository function to clean up repository paths

* lib/query.py
  (build_commit):
    change to handle forward slashes in directory paths instead of
    native slashes

  (run_query):
    use cvsdb.CleanRepository function to clean up repository path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@952 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-16 00:47:42 +00:00
rey4
0547748716 Remove site-specific kludge from cvsdb (originally added by Jay Painter for
RealNetworks repositories)

* lib/cvsdb.py
  (CheckinDatabase.CreateSQLQueryString):
    remove code that excludes ".ver" files from all queries


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@951 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 02:07:07 +00:00
rey4
1095284f7f Fix case-sensitive path comparison in bincvs that causes problems on
windows when lowercase drive letters are used in cvs paths in
viewcvs.conf.

* lib/vclib/bincvs/__init__.py
  (_paths_eq):
    new function for comparing paths that works on case-insensitive
    filesystems

  (BinCVSRepository.openfile, _get_logs):
    use new path comparison function

  (_parse_co_header, _parse_log_header):
    stop cleaning up returned filenames, it's no longer neccessary
    with new path comparison function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@950 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 02:00:34 +00:00
rey4
673b15f3aa Update windows README
* windows/README
  - add troubleshooting info for CreateProcess exception
  - consolidate information about old CVSNT bugs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@949 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 01:48:30 +00:00
rey4
fb0a3cb754 Remove workaround for really old CVSNT bug in loginfo-handler
* tools/loginfo-handler
  (BrokenCvsNtArgParse):
    remove

  (global scope)
    no longer accept "brokencvsnt" argument


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@948 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-14 01:44:53 +00:00
cmpilato
f570dd8bd6 Don't include the branch and view_tag templates for non-CVS log displays.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@947 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-13 18:19:14 +00:00
cmpilato
d417cc000b * viewcvs/lib/viewcvs.py
(view_log): Dictate the 'where' and 'pathtype' values to the
    URL-generating function when making download links.  Patch by
    Stefan Haller <haller@ableton.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@946 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-13 17:39:55 +00:00
rey4
fd665fd18e Swap sorting arrows in directory view following a discussion on the
dev list that ended at

http://mailman.lyra.org/pipermail/viewcvs-dev/2004-September/001769.html

* templates/docroot/images/ascending.png
* templates/docroot/images/descending.png
* templates/docroot/images/down.png
* templates/docroot/images/up.png
    rename ascending and descending images to down and up based on the
    direction of the arrows

* templates/directory.ezt
* templates/dir_alternate.ezt
    update to use new image names


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@945 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 02:59:27 +00:00
rey4
b0ebdbed63 Fix escaping of directory paths in query pages so searching within
directories works on windows.

* lib/cvsdb.py
  (EscapeLike):
    new function

* lib/viewcvs.py
  (view_query):
    escape directory paths before using them in LIKE comparisons


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@944 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 02:32:15 +00:00
rey4
32ad18a7ad Remove unused and undocumented 'filename' template variable from log
pages. It was was added in rev 1.158.

* lib/viewcvs.py
  (view_log):
    remove 'filename' template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@943 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 01:40:58 +00:00
rey4
155c926b23 Update upgrading.html with information about some recently changed
template variables, also fix some existing entries in the file.

* website/upgrading.html
  (sortdir_up_href, sortdir_down_href, roots):
    add new documentation about these variables

  (roottype, rootname, pathtype, raw_diff):
    fix these entries up


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@942 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-09 01:17:17 +00:00
rey4
267d335899 Combine "Dead Files" and "Files Shown" counts in directory listing
* templates/include/dir_header.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@941 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:51:55 +00:00
rey4
162f650a9b Update windows README
* windows/README
    update CVSNT url
    add warning about using old versions of CVSNT


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@940 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:30:41 +00:00
rey4
0366e98834 Remove unused loginfo module
* lib/vclib/ccvs/loginfo.py
    deleted


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@939 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 23:08:27 +00:00
rey4
e0a60537f7 Tweak handling of MIME types in ViewCVS pages
- Don't pass "text/plain" as a MIME type to templates when the real
  type is unknown, pass None instead

- Load MIME types file once after reading the ViewCVS configuration
  instead of reloading at each request.

* lib/viewcvs.py
  (Request.run_viewcvs):
    set Request.mime_type member here

  (Request.setup_mime_type_info):
    removed

  (guess_mime, is_plain_text):
    new

  (is_text, is_viewable_image, view_checkout):
    change to cope with None MIME types, treating them like text

  (view_markup):
    use new is_plain_text function

  (view_directory, search_files):
    use new guess_mime function

  (view_log):
    make use of Request.mime_type member and the new is_plain_text
    function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@938 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 22:35:43 +00:00
rey4
1f561d48eb Fix some silliness in link generating code
* lib/viewcvs.py
  (Request.get_link):
    where implies where != ''


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@937 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 21:02:26 +00:00
rey4
f8bf3f132f Fix time conversion bug that prevented queries from working on
Python 2.3 installations without mxDateTime.

Thanks to paul@times-interactive.com for bringing the bug and fix
to my attention on the users' list.

* lib/dbi.py
  (TicksFromDateTime):
    handle case where MySQLdb returns datetime objects


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@936 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 20:53:31 +00:00
rey4
55aa1e3d12 Update the documentation so it's no longer an impediment to a 1.0
release. There's still a lot of room for improvement, but there
should be no gaping holes or inaccuracies.

* INSTALL
    update old paths

    remove mention of svn_parent_path

    remove advice about trailing slashes in the Troubleshooting
    section. They're nice, but optional now that we don't use
    relative links.

* README
    add pointer to windows/README

* templates/docroot/help_logtable.html
    document the missing columns

* website/upgrading.html
    document the configuration options

    add a word of advice about upgrading with custom templates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@935 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 17:57:14 +00:00
rey4
38e39154ac Update the list of developers
* website/who.html
    add James Henstridge and Lucas Bruand and list the various
    peoples' contributions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@934 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 04:01:18 +00:00
rey4
ebba161285 Update the CHANGES file
* CHANGES
  (Version 1.0):
    add new features and bugfixes. I came up with the list by scanning
    the CVS logs since 0.9.2 for user-visible changes, so it should
    be pretty complete.

  (Version 0.9.2):
    correct release date


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@933 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-10-08 02:23:16 +00:00
rey4
50e1e87f71 Edit a comment in viewcvs.conf.dist
* viewcvs.conf.dist
  (docroot):
    edit comment


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@932 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-28 16:33:44 +00:00
rey4
f74b149949 Don't copy website on install
* viewcvs-install
  (TREE_LIST):
    remove website directory from list


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@931 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-28 16:30:22 +00:00
rey4
22965539ff Make the navigation bar easier to read
* templates/docroot/styles.css
  (.vc_navheader):
    switch to gray background because blue links on purple background
    are hard to read

* header.ezt
  (nav_path):
    make it bold


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@930 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-27 21:01:06 +00:00
rey4
b062a30d76 Simplify handling of roots in root_as_url mode.
* lib/viewcvs.py
  (Request.run_viewcvs):
    don't do blind redirects when we have a "root" parameter in
    root_as_url mode because it can lead to multiple redirects
    and redirects to invalid urls

    don't even try to interpret non-root_as_url url's in
    root_as_url mode when they don't specify an explicit
    root. It can't be done reliably and there's little
    value in it anyway


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@929 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 03:45:20 +00:00
rey4
38321990ae Get rid of unused "viewable" and "is_text" template variables on log
page. They weren't terribly useful or accurate.

* lib/viewcvs.py
  (Request.setup_mime_type_info):
    stop setting "default_viewable" member

  (view_auto):
    stop using request's "default_viewable" member, just compute value
    on the fly

  (view_log):
    stop setting "viewable" and "is_text" template variables

* website/upgrading.html
    update documentation


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@928 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 03:06:28 +00:00
rey4
c0300fcc2c Fix bug in clickable_path (from lib/viewcvs.py 1.167) that makes
navigation on markup, diff, and annotate pages a pain.

* lib/viewcvs.py
  (clickable_path):
    interpret leaf_is_link argument correctly


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@927 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 02:39:19 +00:00
rey4
7886133d91 Tweaks to code that generates links in ViewCVS pages. The only
externally visible difference is that in root_as_url mode,
links with "root" parameters no longer get a redundant path
component pointing at the current root.

* lib/viewcvs.py
  (_sticky_vars):
    don't make root a sticky var, it gets special treatment anyway
    and having it sticky just makes things more complicated

  (Request.get_link):
    remove redundant and never-used rootname argument

    make logic that suppresses sticky variables on checkout and
    tarball links more explicit

    change code for merging sticky variables to operate on the
    dictionary of parameters instead of building a new dictionary

    make code that handles the "root" parameter generate minimal
    URLs in all circumstances

  (Request.get_options):
    removed, logic moved into Request.get_link

  (Request.sticky_vars):
    new method that returns a dictionary of stick variables

  (view_annotate, view_cvsgraph):
    call Request.sticky_vars instead of Request.get_options


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@926 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 02:23:27 +00:00
rey4
24041aeb9a Use new-style viewcvs links in CvsGraph images
* cvsgraph.conf.dist
    update path strings


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@925 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:55:30 +00:00
rey4
502873ecc0 Bugfix in query page, stop using old "icons" config variable
* lib/query.py
  (main)
     stop trying to set "icons" template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@924 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:32:01 +00:00
rey4
e80dfb1aa9 Now that we're using our own icons instead of the icons provided by Apache,
we can get rid of the alternative icons we provided for the standalone web
server and IIS. We can also get rid of the "icons" configuration option.

* lib/apache_icons.py
* tools/bin2inline_py.py
    removed, icons for the standalone server

* windows/icons/apache_pb.gif
* windows/icons/small/back.gif
* windows/icons/small/dir.gif
* windows/icons/small/text.gif
    removed, icons for IIS

* templates/include/footer.ezt
    point "Powered by Apache" image at /icons/apache_pb.gif instead of
    [icons]/apache_pb.gif

* standalone.py
  (apache_icons, icons_last_modified):
     removed

  (ViewCVS_Handler.do_GET):
    remove handling of /icons/ paths

  (serve):
    stop setting options.icons config value

* viewcvs.conf.dist
  (icons):
    removed

* lib/config.py
  (Config.set_defaults):
    stop setting default options.icons config value

* lib/viewcvs.py
  (common_template_data):
    don't set "icons" template variable

* windows/README
  (ICONS FOR IIS):
    removed

  (DOCROOT OPTIMIZATION):
    new section about the docroot parameter

* website/upgrading.html
    remove documentation for "icons" template variable, update
    documentation for "docroot"


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@923 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-25 00:00:31 +00:00
jhenstridge
0e9248f2a7 Remove the moved files to finish off the reorganisation.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@922 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-22 06:40:53 +00:00
jhenstridge
d027efa883 Copy online documentation, stylesheet and required images to
templates/docroot/

* templates/docroot/help_*.html, templates/docroot/styles.css: copied
  from website/
* templates/docroot/images/*: copied from website/images/ or from Apache.
  fix up the transparency on some of the PNGs (just 1-bit transparency
  though, so they work with IE).
* lib/viewcvs.py (view_doc): update to the new location for documentation.
  We can use the same location in the "installed" and "uninstalled" modes.
* viewcvs.conf.dist: update the comment about the docroot config value.
* templates/*.ezt: update for new icon locations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@921 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-22 06:22:42 +00:00
cmpilato
3c236331e1 Some error-related cleanups.
* viewcvs/lib/viewcvs.py
  Update all uses of "ViewcvsException" to "ViewCVSException".
  (_RCSDIFF_IS_BINARY): Make this value match the one used in templates.
  (human_readable_diff): If rcsdiff comes back with the wrong version
    information, raise an exception that error.ezt can handle.  Also,
    simplify the handling of rcsdiff_eflag.
  (download_tarball, view_cvsgraph_image, view_cvsgraph_image): Raise
    403 Forbidden's for disable features.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@920 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 18:16:58 +00:00
jhenstridge
b68ec0fda5 Fix some validity errors on the query_form.ezt template.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@919 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 08:56:18 +00:00
jhenstridge
7cce726069 Fix up validity errors due to non-escaped ampersands in URLs.
* lib/viewcvs.py: add an optional escape parameter to the get_url()
   method, that will entity escape the URL.
   Pass escape=1 to each call to get_url() that is used to construct a
   URL for display in a template.
 * lib/blame.py: fix up a small entity escaping problem here too.
 * templates/revision.ezt: fix up a few HTML validity errors in this
   template that were a lot more obvious after clearing up the other
   errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@918 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-14 08:49:32 +00:00
cmpilato
2481c9a5c9 Normalize configured paths at a different time so that we don't
destroy URLs used by the svn_ra module.

* viewcvs/lib/config.py
  (_parse_roots): Don't normalize the paths for roots here -- it will
    destroy URLs.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Normalize them here, *after* we know what's a
    URL and what's a normal path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@917 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-09 22:10:57 +00:00
jhenstridge
302fa88601 * templates/include/dir_footer.ezt: get rid of validity error due to
misnesting of <form> and <table> tags.
* templates/include/diff_form.ezt: get rid of a similar problem in the
  diff form.
  Also simplify the form a bit for the case when there are no tags (ie.
  subversion).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@916 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-03 12:31:59 +00:00
jhenstridge
c969184313 * templates/directory.ezt, dir_alternate.ezt: make the sort order arrow
part of the header hyperlink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@915 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-09-03 11:48:38 +00:00
cmpilato
f857dad099 Learn these here RCS parsers about the fact that that "branch" keyword
over yonder is right optional.  Patch by Max Bowsher <maxb@ukf.net>.
Faux cowboy by cmpilato.

* lib/vclib/ccvs/rcsparse/common.py (_Parser.parse_rcs_admin)
* lib/vclib/ccvs/rcsparse/default.py (Parser.parse_rcs_admin)
* tparse/tparse.cpp (parse_rcs_admin)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@914 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-17 23:08:54 +00:00
cmpilato
e58b5f67aa * lib/viewcvs.py
(_re_validate_number): Allow brackets in tag names.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@913 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-17 19:17:55 +00:00
cmpilato
e376b03b6d * website/styles.css
Make the annotate data "smaller", and increase the padding between
  columns.

* viewcvs/templates/annotate.ezt
  Remove superfluous spaces in table cells.  Mozilla is rendering
  wrongly, presumably because the cells are using "nowrap" or "pre"
  whitespace handling.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@912 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-14 16:50:57 +00:00
cmpilato
2f0a5efaf1 Cleanup the new dead file handling code to be more template-friendly
(and honest).

* lib/viewcvs.py
  (view_directory): Always calculate the num_dead variable with
    truth.  Just because we aren't showing dead files doesn't mean they
    don't exist.

* templates/include/dir_header.ezt
  Provide a single place for reporting the number of, and toggling the
  display of, dead files.

* templates/directory.ezt
* templates/dir_alternate.ezt
  Stop handling dead file display toggling on what appears (and yet
  isn't) a per-item basis.  Also, use Apache's broken.gif as the icon
  for dead files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@911 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-11 14:35:44 +00:00
rey4
4f1e9a7ce7 Update alternate template.
* templates/dir_alternate.ezt
    fix handling of attic directories as in templates/directory.ezt, rev 1.47


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@910 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-01 14:41:39 +00:00
rey4
72f060b3ad Get the query view working on windows. The backslashes in repository paths
weren't being escaped before being embedded in sql strings.

Also do some cleanup in dbi.py

* lib/cvsdb.py
  (CheckinDatabase.SQLQueryListString):
    escape string values using Connection.escape() method

  (CheckinDatabase.CreateSQLQueryString):
    update calls to SQLQueryListString()

* lib/dbi.py
  (Cursor, Connection):
    remove these proxy objects, they don't do anything

  (connect):
    return MySQLdb.Connection object instead of proxy object


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@909 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-08-01 14:33:00 +00:00
rey4
f3ca45b9a0 Handle CVS Attic paths transparently in the bincvs module
instead of exposing them to users.

* templates/include/dir_footer.ezt
    add link to show dead files

* templates/directory.ezt
    remove code for detecting Attic entries,
    change (in the attic) caption to (dead)

* lib/viewcvs.py
  (Request.run_viewcvs):
    handle old Attic URL's by redirecting,
    remove unused request.full_name member

  (get_up_path, _re_up_attic_path, nav_header_data, generate_tarball,
   download_tarball):
    remove code for handling Attic directories

  (view_markup):
    remove unused "full_name" variable

  (view_directory):
    remove code for handling Attic directories,
    replace "no_match" template variable with "num_dead"

  (view_log):
    update call to get_up_path

  (view_annotate, view_cvsgraph_image, view_cvsgraph, view_diff):
    use CVSRepository.rcsfile to get path to rcs file

* lib/vclib/bincvs/__init__.py
  (CVSRepository.itemtype):
    look in Attic for repository files

  (CVSRepository.listdir):
    remove "cvs_list_attic" option, now always list attic files.
    leave "Attic" and "CVS" directories out of returned listing.

   (CVSRepository.rcsfile, CVSRepository._atticpath):
     new methods

   (BinCVSRepository.openfile, BinCVSRepository.filelog):
     use CVSRepository.rcsfile to get path to rcs file

   (_get_logs):
     don't mark directories as dead

* lib/vclib/ccvs/__init__.py
   (CCVSRepository.filelog, CCVSRepository.openfile):
     use CVSRepository.rcsfile to get path to rcs file

* website/upgrading.html
    document "no_match" and "num_dead" template variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@908 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-31 22:34:51 +00:00
rey4
98b799adbf Improve error handling in directory view.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile, BinCVSRepository.filelog, fetch_log):
    update calls to _parse_log_header

  (_re_log_error, _re_cvsnt_error, _re_lineno):
    update regular expressions for parsing rlog error messages

  (_parse_log_header):
    do a better job of parsing rlog error messages and return messages
    to callers

  (_get_logs):
    set new DirEntry.log_errors property and deal with multiple rlog error
    messages about the same file and cases where error messages precede
    file information

  (_log_path):
     return error info

* lib/vclib/ccvs/__init__.py
  (CCVSRepository.dirlogs):
    set new DirEntry.log_errors property

* lib/vclib/svn/__init__.py
  (get_logs):
    set new DirEntry.log_errors property

* lib/vclib/svn_ra/__init__.py
  (get_logs):
    set new DirEntry.log_errors property

* lib/vclib/__init__.py
  (Repository.dirlogs):
    document new DirEntry.log_errors property

* lib/viewcvs.py
  (view_directory):
    set new template variables

* website/upgrading.html
    document new template variables

* templates/include/dir_footer.ezt
    get rid of confusing "One or more files were unreadable" message.
    We display more specific error messages in the directory list.

    add links to set selection criteria at the bottom of "There are
    [num_files] files, but none match the current selection criteria"
    message

* templates/directory.ezt
* templates/dir_alternate.ezt
    simplify the way error messages are displayed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@907 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-31 14:38:03 +00:00
jhenstridge
73a344bb15 * lib/viewcvs.py (view_diff): also use entry.filename as the location for
the view_href in the case where the path type is a directory.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@906 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:37:47 +00:00
jhenstridge
32b741f259 * lib/viewcvs.py (view_log): when constructing the view and download URLs,
use entry.filename as the location.  This fixes the view/download links
  when the log crosses a copy boundary.  Fixes bug #999355.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@905 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:33:04 +00:00
jhenstridge
ea19338677 * lib/viewcvs.py (htmlify): when htmlifying email addresses, encode the
@ symbol as a character reference.  This can trip up some email address
  spiders, while being transparent to web browsers.
  The idea came from Bugzilla.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@904 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-29 02:04:16 +00:00
jhenstridge
7a0284214c * templates/include/header.ezt: remove stray </h1> tag.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@903 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-28 02:51:40 +00:00
jhenstridge
997d4f85d1 * lib/viewcvs.py (view_directory): If it is a subversion repository,
use the directory revision number as a weak etag.
 (view_revision_svn): use the revision number as a weak etag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@902 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 09:00:42 +00:00
jhenstridge
85d9d50631 * diff_form.ezt: wrap the text associated with the "makepatch" checkbox
in a <label> element, so that users can click on the text to toggle
  the value.
  Quote a few unquoted attribute values.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@901 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 08:17:15 +00:00
jhenstridge
d906319a8e * viewcvs-install (install_tree): don't install files ending in '~', since
this is the suffix many unix editors use for backups (and there aren't
  any files with that suffix in viewcvs).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@900 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-26 05:20:39 +00:00
jhenstridge
c3aff09497 * lib/viewcvs.py, templates/log.ezt, templates/log_table.ezt: revert
change that moved generation of human readable diff URLs from the
  templates to the Python code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@899 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-24 16:34:04 +00:00
rey4
db74810b91 Normalize user-specified paths in cvs_roots, svn_roots, and root_parents.
The bincvs module doesn't take kindly to paths with alternate directory
seperators or trailing slashes.

* lib/config.py
  (_parse_roots):
    call os.path.normpath for cvs_roots and svn_roots paths

* lib/viewcvs.py
  (handle_config):
    call os.path.normpath for root_parents paths


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@898 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 23:47:00 +00:00
jhenstridge
4e573ace1d Fix up the diff links when diff_format is set to a non-default value on
the log pages.

* templates/include/diff_form.ezt: if no tags exist for the file, don't
  show the drop down tag selection box.  This gets rid of some unneeded
  UI when browsing Subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@897 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 12:43:11 +00:00
jhenstridge
198923b18a * viewcvs.py: add code to calculate various diff URLs used in the log
view.  For Subversion repositories, these URLs are usually shorter
  (only include p1/p2 when paths differ) and handle a few corner
  cases w.r.t. moves that the old code didn't.

* log.ezt, log_table.ezt: use the diff URLs passed in from viewcvs.py
  rather than constructing them in the template.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@896 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 11:28:30 +00:00
jhenstridge
4f348926fe Add thead/tbody tags to log_table.ezt, query.ezt and revision.ezt
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@895 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 09:55:50 +00:00
jhenstridge
09165074cf set size of sort arrow images, so that they don't cause reflows while
loading.  Wrap the column headers in a <thead> tag, and the rest of
the elements in a <tbody> tag.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@894 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-23 08:43:04 +00:00
jhenstridge
0f89aa8265 Add vc_log CSS class to log message on revision.ezt template. Fix from
Simon Lieschke (patch #995667)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@893 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 10:08:29 +00:00
jhenstridge
768233a590 fix up typo in comment.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@892 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 08:58:18 +00:00
jhenstridge
80e621dc0d Sort the tags attached to a revision in the log view. Fix came from
bug #994522.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@891 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 02:19:07 +00:00
jhenstridge
247234ff03 Add support for generating backout scripts from query results like Bonsai
can.  Suggested in Bug #777122.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@890 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-22 02:10:51 +00:00
jhenstridge
af221adef2 Use a different parameter name for the query sort key so that it doesn't
get mixed up with the directory view sort (similar to how the log view
uses logsort as a parameter name).

Don't display the branch column in results for a subversion repo query.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@889 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 16:01:09 +00:00
jhenstridge
f2d02f282b Update get_link() to add a rev parameter for diff links on subversion
repositories (sets rev to the same value as r2).

Update run_viewcvs() so that if no view is selected, handle requests
that specify r1,r2,rev as diffs rather than checkouts, and requests
that specify r1,rev as logs.

Update log.ezt and log_table.ezt to set the rev parameter in the diff
links when browsing subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@888 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 15:46:47 +00:00
jhenstridge
69d586a5d8 Since you don't need to click on the sort arrow to change sort direction,
don't make the arrows look like buttons.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@887 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 15:11:48 +00:00
jhenstridge
cc970525ac Simplify column sort code, so that clicking the sort column header
reverses the sort order, while clicking on other headers sorts by
that column in ascending order.  This matches how most GUIs handle
sorting in columned lists.

Also port the sort handling from dir_alternate.ezt to directory.ezt
to reduce differences between the two templates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@886 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 14:58:30 +00:00
jhenstridge
57c58fde9b Fix up dir_alternate.ezt template to fix bug #995121 (switch the
pathname and revision links for directories).

Previously dir_alternate.ezt was broken for CVS repositories, resulting
in a traceback since it was trying to show the log href which doesn't
exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@885 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-21 12:17:50 +00:00
jhenstridge
55bdd8cb45 Convert double dashes in comment to single dashes, since the double dash
ends the comment.  Mentioned in a Debian bug report:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245550

Add a <meta name="generator"> tag to the top listing the version of
viewcvs used to generate the page.  This is less likely to be removed
from custom templates, and should be helpful when tracking bugs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@884 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-20 07:26:52 +00:00
jhenstridge
fcdcd96359 Remove the italics from the log message CSS rules, since regular type
was more common for rendering log messages.

Before, non-italic was used in the markup, log and query templates,
while italic was used in log_template and query_results (which I copied
off of log_template).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@883 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-20 07:16:50 +00:00
jhenstridge
31ac07eb78 render all revision log messages as <pre class="vc_log">...</pre>
Add CSS for vc_log to set it italic (as it was already shown in most places),
and set some proprietary properties to turn on word wrapping for Mozilla,
Opera and IE, and the equivalent standard CSS3 property (for when browsers
support it).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@882 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-19 08:49:39 +00:00
jhenstridge
8a3030d4cf use CSS classes for the different columns in annotate mode. In particular,
set "white-space: pre" for the text column, so that white space isn't
collapsed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@881 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 11:11:56 +00:00
jhenstridge
236668b628 Expose glob matching and notregex matching in query_form.ezt.
Loosen some of the parameter validation to _validate_regex for
branch, file and who query parameters.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@880 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 06:37:31 +00:00
jhenstridge
f3cbf1e629 Add two new match types: notregex and glob. The "glob" match type is
implemented using fnmatch to translate it into a regular expression.

Refactor CreateSQLQueryString a little bit to split out join conditions.
Previously if you wanted to query files names A or B, it would generate
SQL like this:
  ((checkins.fileid=files.id AND files.file='A') OR
   (checkins.fileid.files.id AND files.file='B'))
Now it generates the shorter (and hopefully easier to optimise):
  (checkins.fileid=files.id) AND (files.file='A' OR files.file='B')
I'd change it to do INNER JOIN's, but apparently MySQL 3.22 doesn't
support them fully.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@879 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-18 05:41:53 +00:00
jhenstridge
7ad43eaa74 Port the "diff link" support over to the query.cgi script.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@878 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 06:46:02 +00:00
jhenstridge
d8cc63ee4e Add simple querying support directly to the viewcvs script. This is
closer to the Bonsai query interface, and provides better integration
with the rest of viewcvs.

Fixed two bugs in cvsdb.py:
 - when loading up query results, set the checkin type on the Commit object
 - When sorting on file name or author, order by the name rather than ID.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@877 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 06:03:33 +00:00
jhenstridge
41c06a258e Fix file descriptor leak in standalone.py
Reported as http://sourceforge.net/tracker/?func=detail&aid=735455&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@876 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-17 01:50:20 +00:00
jhenstridge
a6ae62b59f 1) add a bit of documentation on using svndbadmin to load revision
information into the query database.
2) Update query.cgi to set [docroot] correctly.  This allows it to find
   the stylesheet, and corrects the help link in the footer.
3) Results could point at subversion repositories, so check if the
   repository is in svn_roots too.
4) Only display repository names rather than paths in the results.
   This matches what viewcvs.cgi shows the user.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@875 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:39:46 +00:00
cmpilato
4a479b303b Add copyright info to SVN mailer patch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@874 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:31:21 +00:00
cmpilato
39beba2aa9 New patch for integration with Subversion's mailer.py script.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@873 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 16:25:59 +00:00
jhenstridge
4d6369388e Remove the svn_parent_path config value, and replace it with a root_parents
config value, which can handle CVS repositories as well as Subversion ones.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@872 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 15:43:01 +00:00
cmpilato
648ac31eb3 * viewcvs/lib/viewcvs.py
(list_roots): Make the roots hash values into tuples, adding the roottype.
  (common_template_data): Make the 'roots' list items into hashes that
    carry the root names and types.

* viewcvs/templates/include/header.ezt
  Split the list of repositories up into CVS ones and Subversion ones
  using optgroups.  Note the super-cool single pass over the roots,
  appending options to variables created on-the-fly.  Have I mentioned
  how much I love James Henstridge today?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@871 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:11:55 +00:00
jhenstridge
59f7ac841a Fix the same issue in view_log(). Was mentioned in the same bug report
as the view_directory() one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@870 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:05:14 +00:00
jhenstridge
fc86389a25 s/query_dict/request.query_dict/ in view_directory() to fix traceback
when using pages.  Reported in the bug tracker as:
  http://sourceforge.net/tracker/index.php?func=detail&aid=953892&group_id=18760&atid=118760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@869 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 14:03:10 +00:00
jhenstridge
d428e9fa2e - Add svndbadmin script, which can be used to add Subversion revision
information to the Bonsai checkin database.
- Get viewcvs-install to install the new script.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@868 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-16 11:53:48 +00:00
rey4
19866deb18 Update windows README file
* windows/README
    add link for downloading subversion python bindings binaries

    remove mention of cvsnt bugs. they've all been either fixed or
    worked around, and the cvsnt bugzilla database is now deleted

    fix a spelling


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@867 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-01 23:51:45 +00:00
cmpilato
1b68297aff Makin' things purtier. Patch by James Henstridge <james@jamesh.id.au>.
* viewcvs/templates/log_table.ezt
  Set the HTML class attribute to vc_header_sort for the header of the
  sort column.  Change the tags around the log message from
  <i><pre>...</pre></i> to <pre><i>...</i></pre>.  Since <pre> is a
  block level element and <i> is an inline element, the old nesting
  results in an extra block after the message in the table cell.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@866 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-07-01 20:56:38 +00:00
cmpilato
289c3b25bc Make Etag support optional (in a first-class fashion).
* viewcvs/lib/viewcvs.py
  (check_freshness): Check the new configuration option for etag
    support.  Also, cfg.general.http_expiration_time is now
    cfg.options.http_expiration_time.

* viewcvs/lib/debug.py
  (DISABLE_ETAGS): Remove.

* viewcvs/lib/config.py
  (Config.set_defaults): Set new 'generate_etags' option default to 1,
    and move 'http_expiration_time' to the [options] section (from the
    [general] one).

* viewcvs/viewcvs.conf.dist
  (cfg.options.generate_etags): New.
  (cfg.options.http_expiration_time): Was cfg.general.http_expiration_time.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@865 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-23 20:57:16 +00:00
cmpilato
7b8eb7639e Instead of sending colored diffs to the diff.ezt template, and raw
diffs to their own text/plain output, templatize all diffs.  By
default now, all diffs will go through diff.ezt (which has been
updated to handle it).  Only if the new 'makepatch' boolean CGI flag
is set will diffs be sent directly as text/plain, non-templatized
output.

* viewcvs/lib/viewcvs.py
  (_legal_params): Add new 'makepatch' boolean parameter.
  (check_freshness): Fix a speeling eror.
  (MarkupPipeWrapper.__init__): Add 'htmlize' parameter, and use it.
  (human_readable_diff): Lose the 'request', 'sym1', and 'sym2'
    parameters.  Now return the parsed dates and DiffSource object
    instead of populating a data dictionary and completely generating
    the page.
  (spaced_html_text): Use an intermediate variable for readability.
  (raw_diff): New.
  (view_diff): Honor the new 'makepatch'.  Update calls to
    human_readable_diff(), and make use of raw_diff().  Do all page
    generation for diffs here now.  Adds a new 'raw_diff' data
    dictionary item, useful for testing raw vs. colored, as well as
    for positioning that raw diff output in the template.

* templates/diff.ezt
  Use the new 'raw_diff' data dictionary item to position raw diff
  output in the template.  Update the diff form to allow for the
  generation of traditional "patch-ish" raw diff output.

* templates/include/diff_form.ezt
  Allow for the generation of traditional "patch-ish" raw diff output.

* website/styles.css
  (vc_raw_diff): New style class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@864 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-22 14:37:11 +00:00
cmpilato
3e73713c17 Add a debug setting which promises to restore my sanity in the face of
Etags and browser caching.  And use it.

* lib/debug.py
  (DISABLE_ETAGS):  New.

* lib/viewcvs.py
  (check_freshness): If DISABLE_ETAGS is set, never report that the
    page is fresh.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@863 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-22 14:12:23 +00:00
cmpilato
e8dc91b483 Fix the description of http_expiration_time.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@862 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-21 19:34:38 +00:00
cmpilato
4d8b46e2c8 Bang out a 'revision' view for the svn_ra module. Soooo incomplete,
sooo hard a problem to solve efficiently.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_rev2optrev): Fix use of 'if foo' when I mean 'if foo is not None'.
  (ChangedPath): New class.
  (LastHistoryCollector.__init__): Remove uninteresting 'pass'.
  (LastHistoryCollector.add_history): Add 'paths' and 'pool'
    arguments, and now at least do some semblance of support for
    dealing with those paths.
  (LastHistoryCollector.get_history):
  (_get_rev_details): Was _get_revision_info().  Now uses the
    LastHistoryCollector.add_history callback directly.  Callers changed.
  (get_revision_info): New.
  (SubversionRepository.get_dirents): Fix a dirent caching bug.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@861 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-14 16:14:45 +00:00
cmpilato
ac8c9d303c Add cache expiry support to ViewCVS. Patch by James Henstridge
<james@daa.com.au>.

* standalone.py
  (StandaloneServer.header): Fix some status handling stuff.

* viewcvs.conf.dist
  Add default value for new http_expiration_time option.

* lib/config.py
  (Config.set_defaults): Set default value for new
  http_expiration_time

* lib/viewcvs.py
  (check_freshness): Add cache control headers using the configured
    expiration times.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@860 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-14 15:52:41 +00:00
rey4
8b85373685 Remove workaround for CVSNT bug 188, which was fixed in version 2.0.12
* lib/vclib/bincvs/__init__.py:
  (_get_logs):
    simplify filename checking

  (_path_ends_in):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@859 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-06 03:08:16 +00:00
rey4
ea73dfb7a3 Fix bugs #911437 and #922679 caused by newer versions of cvsnt using forward
slashes instead of backslashes in outputted paths.

(_parse_log_header, _parse_co_header):
  deal with forward slashes in paths outputted by cvsnt rcs utilities

(BinCVSRepository.openfile):
  fix uninitialized variable error in raise statement


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@858 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-06 02:46:49 +00:00
cmpilato
8f9c8de036 Make ViewCVS more cache-friendly. Patch by James Henstridge
<james@daa.com.au>.

* lib/viewcvs.py
  (check_freshness): New.
  (MarkupBuffer.close): New.
  (MarkupPipeWrapper.close): New.
  (MarkupPipeWrapper.__del__): Call own close() function now.
  (MarkupEnscript.close): New.
  (MarkupEnscript.__del__): Call own close() function now.
  (view_markup, view_log, view_diff): Call new check_freshness() function.
  (view_doc): Gut caching code and use check_freshness() instead.

* lib/sapi.py
  (CgiServer): Fix handling of 304's in IIS.

* standalone.py
  Now purge the environment of HTTP_* variables before setting our
  own.  Also, perhaps set the 'HTTP_IF_MODIFIED_SINCE' and
  'HTTP_IF_NONE_MATCH' variables.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@857 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-03 15:42:04 +00:00
cmpilato
f0b96a1617 Fix a bunch of pool usage problems with ViewCVS/Subversion.
* viewcvs/lib/vclib/svn/__init__.py
  (_fetch_log): Now accept a 'pool' parameter.
  (FileContentsPipe): Was StreamPipe().
  (FileContentsPipe.__init__): Instead of taking a stream, accept the
    root, path, and a pool.  Use a subpool of the pool for the stream
    creation.
  (FileContentsPipe.__del__): New.
  (SubversionRepository.__init__): Make a scratch subpool that
    operations can safely use and clear.
  (SubversionRepository._scratch_clear): New convenience function.
  (SubversionRepository.itemtype, SubversionRepository.listdir): Use
    and clear the scratch pool.
  (SubversionRepository.filelog): Update call to _fetch_logs().  Use
    and clear the scratch pool.
  (SubversionRepository.openfile): Update call to FileContentsPipe().
    Use and clear the scratch pool for the call to _get_last_history_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@856 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-06-01 19:43:51 +00:00
cmpilato
da2822ecf0 Sending caching headers back to the browser for static content to
reduce roundtrips.  Patch by James Henstridge <james@daa.com.au>.

* viewcvs/lib/viewcvs.py
  (copy_stream): Use a slightly different mechanism for falling back
    to sys.stdout (for standalone.py).
  (view_doc): Send Last-modified headers for static content.

* viewcvs/standalone.py
  Calculate the modification time of the Apache icons module.
  (StandaloneServer.do_GET): Send that modification time.
  (StandaloneServer.header): Send custom headers.

* viewcvs/lib/sapi.py
  (CgiServer.addheader, AspServer.addheader, ModPythonServer.addheader): New.
  (CgiServer.header): Fix the way statuses are returned.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@855 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-24 22:57:30 +00:00
cmpilato
0ccadb2681 Fix a typ-o in yon copyright block.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@854 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-18 20:15:30 +00:00
cmpilato
6e6c604a94 Update the upgrade docs.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@853 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-14 15:32:49 +00:00
cmpilato
6af773b46b * viewcvs/lib/viewcvs.py
(view_directory): Do mime_type detection of files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@852 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-14 15:21:10 +00:00
cmpilato
db610d9a21 * viewcvs/lib/viewcvs.py
(view_directory): Expose file sizes (when available) in the
    directory view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@851 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-13 04:29:08 +00:00
cmpilato
9d63323c24 Oops. Forgot to actually add the stylesheet.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@850 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-12 14:58:57 +00:00
cmpilato
71b16e1321 *** empty log message ***
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@849 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-12 01:46:43 +00:00
cmpilato
af1f78ba83 * viewcvs/templates/include/dir_footer.ezt
Use <optgroup> tags to group branches and tags.  Patch by James
  Henstridge <james@daa.com.au>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@848 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-11 06:53:52 +00:00
cmpilato
a0bc4d071b * viewcvs/lib/viewcvs.py
(common_template_data): Expose request.pathtype as a generally
    available template variable.  (Have I mentioned today how much I
    dislike per-template data dictionary items?)

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Use the pathtype variable to determine whether or not to show
  file-only stuff like diff and download options.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@847 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 15:37:11 +00:00
cmpilato
cfe3d1ea29 Fix a brain-O. "filter_path" is the *opposite* of "show_all_logs".
Duh.  Stop using filter_path and (failing at) translating between the
senses here.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.__init__): Drop the 'options', take explicit 'show_all_logs'.
  (LogCollector.add_log): Update for new variables.  Also, fix some
    logic so this works when we aren't showing all logs, too.
  (SubversionRepository.filelog): Parse the options here, and pass to
    the LogCollector().

* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.__init__, NodeHistory.add_history, _get_history): Stop
    using 'filter_path'; use 'show_all_logs' instead.

* viewcvs/lib/viewcvs.py
  (view_log): Make showing all directory logs default to 0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@846 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:56:09 +00:00
cmpilato
e075e20fa7 More directory log view fixes.
* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.add_history): Use subpools in this loop.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.add_log): Fix an off-by-one error.  The path for this
    revision is self.path *before* we find the previous path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@845 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:08:50 +00:00
cmpilato
bcd7a406aa * viewcvs/lib/vclib/svn/__init__.py
(NodeHistory.add_history): Fixes for support for directory log
    filtering.  Don't filter out copy revisions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@844 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-10 14:01:12 +00:00
cmpilato
d2a8e86357 Fix the root-change mechanism I broke recently.
* viewcvs/lib/viewcvs.py
  (Request.get_link): Allow where == '' as a way to indicate that you
    want to see the root directory (since None means "use self.where").
  (common_template_data): Generate the right URL for changing roots.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@843 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-07 15:40:22 +00:00
cmpilato
242b41d9c1 Fix Bug #949445 (premature <pre> tags in large files)
* viewcvs/lib/viewcvs.py
  (MarkupPipeWrapper): Rewrite this class so that it actually works.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@842 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-07 15:23:23 +00:00
cmpilato
459675943c Close Bug #847437.
* viewcvs/website/index.html
  Say that we require 1.5.2, not 1.5 (which eliminates the need to
  point out the MySQL dependency).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@841 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-06 21:38:35 +00:00
cmpilato
97d9b20adf Get support for the 'show_all_dir_logs' option (specifically, the
"don't show all dir logs") working the svn_ra layer.  In fact, this
sucker is now more accurate as far as revision choices go than the
'svn' module.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (LogCollector.__init__): Deal with None paths, and ensure leading slashes.
  (LogCollector.add_log): Uncomment and fix path filtering code.
  (_fetch_log): Remove.
  (SubversionRepository.filelog): Move contents of _fetch_log into
    here, and then do something that in unheard of -- CALL
    SVN_CLIENT_LOG WITH THE PARAMS IN THE RIGHT ORDER!


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@840 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-05-06 17:00:28 +00:00
cmpilato
c20560b1fc Add basic support for Subversion directory log viewing in ViewCVS.
NOTE: This work is not yet finished for the 'svn_ra' vclib module.

* viewcvs/lib/vclib/svn/__init__.py
  (NodeHistory.__init__): Add fs_ptr and filter_path arguments.
  (NodeHistory.add_history): If filtering, only add the history item
    if the path truly change in that revision.
  (_get_history): Add 'options' argument, and use it to decide if we
    need to filter out bubble-up-only directory logs, as well as
    whether or not to cross copies.
  (_fetch_log): Was fetch_log.  Add 'options' argument, passed to
    _get_history.
  (SubversionRepository.filelog): Update call to _fetch_log.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_compare_paths): New path comparison function (ported from
    Subversion's C-composed svn_path_compare_paths)
  (LogCollector): New class for doing what the old inline _log_cb
    function did.
  (_fetch_log): Was fetch_log.  Add 'options' argument.  Now use the
    new LogCollector class.
  (SubversionRepository.filelog): Update call to _fetch_log.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Don't set 'cross_copies' as an attribute of
    the repository any more.  We use the vclib interface options
    params.
  (view_log): Re-work this sucker to handle requests for directory
    logs in Subversion.  Also, pass the cross_copy option here.
  (view_directory): Set the rev_href for Subversion directories to the
    log view href.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@839 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 16:21:51 +00:00
cmpilato
d0a62c7520 Try to get the query.cgi script working again. Unfortunately, I'm not
setup to test it at all. :-(

* viewcvs/lib/query.py
  (main): Populate the 'docroot' data dictionary item.

* viewcvs/templates/query.ezt
  Stop trying (and failing) to use the common header include ... I
  don't have the energy to make this thing work with that right now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@838 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 15:53:39 +00:00
cmpilato
1d6743ab98 * viewcvs/templates/revision.ezt
Re-add the "previous" and "next" buttons on the revision view.
  Patch (mostly) by Guy Maor <guy@extreme-da.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@837 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-28 14:53:22 +00:00
cmpilato
5995f83c4c Some more ViewCVS fixes and tweaks.
* viewcvs/templates/diff.ezt
  Setup template defines before include header.ezt.

* viewcvs/lib/viewcvs.py
  (view_revision_svn): Add 'rev' to the diff_href.

* viewcvs/templates/dir_alternate.ezt
  Fix the filename links to go to the log view again (apparently I
  accidentally clobbered these recently, though I must say, the
  navigation seems entirely unintuitive to me this way...).

* viewcvs/templates/revision.ezt
  Tweak the display of the log message a little big.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@836 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-24 17:38:31 +00:00
cmpilato
da21434ef0 Some bug fixes as suggested (in great detail, just short of a patch)
by Dirk Lemstra <dirk.lemstra@atosorigin.com>.  Also, add some stuff
to the generally-available-to-all-templates dataset.  And finally,
re-work all the templates for consistent look and feel.

I can die now.

* viewcvs/lib/viewcvs.py
  (common_template_data): Expose the 'where', 'roottype', and
    'rootname' Request members, and the 'nav_path', to all views.
    Also, do the root selection stuffs ('roots', 'change_root_action',
    'change_root_hidden_values').
  (nav_header_data): No longer explicitly add 'nav_path' to the data
    dictionary.
  (_dir_url): For Subversion, supply the revision number to the
    generated links.
  (view_directory): Include the revision when generating log view
    URLs.  Also, expose a 'tree_rev_href' data item for linking to the
    revision view.  No longer explicitly add 'roottype', 'where', and
    'current_root' to the data dictionary.  No longer do the root
    selection stuff here, either.
  (view_log): No longer explicitly add 'roottype', 'where', and
    'current_root' to the data dictionary.
  (human_readable_diff): No longer explicitly add 'where' to the data
    dictionary.
  (view_markup, view_revision): No longer explicitly add 'roottype' to
    the data dictionary.

* viewcvs/website/upgrading.html
  Document the changes.

* viewcvs/website/help_rootview.html
  Add a missing "<br>".

* viewcvs/templates/annotate.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
* viewcvs/templates/revision.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
  Beat the heck outta these templates until they all reference
  header.ezt and footer.ezt (except for error.ezt), and they all
  present a basically consistent interface across all views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@835 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-22 15:40:01 +00:00
cmpilato
c94bb1347f * viewcvs/tparse/tparsemodule.cpp
Fix all instances of "if(!rv) { Py_DECREF(rv); }" mishap.  We should
  decrement the reference count for the value only if it is *not*
  NULL.  Erik Huelsmann oopsed.  I oopsed more for not reviewing the
  patch before application.  James Henstridge <james@daa.com.au> wins
  for paying attention.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@834 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 15:48:48 +00:00
cmpilato
0f09f6c241 Templatize the annotate view!
* viewcvs/lib/viewcvs.py
  (view_annotate): Now use blame.BlameSource() class for doing annotations.

* viewcvs/lib/blame.py
  (BlameSource, BlameSequencingError): New classes.
  (make_html): Re-work to use the use BlameSource code.

* viewcvs/lib/config.py
  (Config.set_defaults): No longer set self.templates.footer.

* viewcvs/viewcvs.conf.dist
  (templates.footer): Removed.

* viewcvs/templates/annotate.ezt
  Re-work this template to make use of the newly exposed blame data,
  and the fabulous new EZT assignment commands!

* viewcvs/website/upgrading.html
  Document this change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@833 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 05:08:12 +00:00
cmpilato
9c5c43b625 Implement an assignment mechanism in EZT, a new [define variable][end]
construct.  Patch by James Henstridge <james@daa.com.au>, tweaked to
conform with Greg Stein's review, and stripped of the template changes
that made use of the new functionality by C. Michael Pilato (that's me).

* viewcvs/lib/ezt.py
  import cStringIO, and failing that, import StringIO.
  (_block_cmd_specs): Add 'define' to the list of block specs.
  (Template.generate): Init defines member.
  (Template._parse): Don't prepare references for 'define' commands.
  (Template._cmd_define): New.
  (_get_value): Look for items in the defines dictionary before
    falling back to the data dictionary.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@832 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 03:41:34 +00:00
cmpilato
5bd3435a05 Fix the default value for the footer template location. Patch by James
Henstridge <james@daa.com.au>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@831 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-21 03:11:03 +00:00
cmpilato
a8c5db6248 Templatize the markup view.
* viewcvs/lib/viewcvs.py
  (html_footer): Remove.
  (view_annotate): Generate the footer data -- the only remaining
    place where template usage is impure...
  (retry_read): New.
  (copy_stream): Rename 'fp' to 'src', and add an optional 'dst'
    parameter.  Move reading code into retry_read().
  (markup_stream_default, markup_stream_enscript): Remove.
  (markup_stream_python): Return a MarkupBuffer instance.
  (markup_stream_python): Return a MarkupPHP instance.
  (MarkupBuffer, MarkupPipeWrapper, MarkupEnscript, MarkupPHP): New
    classes for implementing file-like markup objects.
  (view_markup): Use new Markup classes.
  (generate_tarball): Don't trap an unused status code.

* viewcvs/templates/markup.ezt
  Reference the new [markup] dictionary object, and include the footer.ezt.

* viewcvs/templates/include/header.ezt
  White background, please.

* viewcvs/website/upgrading.html
  Note the new [markup] variable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@830 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 16:40:12 +00:00
cmpilato
d103342f27 * viewcvs/viewcvs.conf.dist
(options.cross_copies): Make this default to 1 now.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@829 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:41:35 +00:00
cmpilato
fed9fcc893 Extend Sink and parsers to pass more of rcs admin data. Patch by
Erik Huelsmann <e.huelsmann@gmx.net>.

* viewcvs/lib/vclib/ccvs/rcsparse/common.py
  (Sink.set_expansion): New member function. Called to pass
   default expansion mode.
  (Sink.set_locking): New member function. Function is called
   to signal strict locking.
  (Sink.set_locker): New member function. Set locker for a given revision.
  (_Parser.parse_rcs_admin): parse 'access', 'expand', 'locks' and
   'strict' token values passing the result(s) into the sink.

* viewcvs/lib/vclib/ccvs/rcsparse/default.py
  (Parser.parse_rcs_admin): parse 'access', 'expand', 'locks' and
   'strict' token values passing the result(s) into the sink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@828 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:32:54 +00:00
cmpilato
a1aa2423d3 Stop potential memory leak by DECREF-ing the return value from
PyObject_CallMethod.  Patch by Erik Huelsmann <wiskid@gmx.net>.

* viewcvs/tparse/tparsemodule.cpp
  Catch return value from PyObject_CallMethod and DECREF when appropriate.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@827 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-20 14:28:15 +00:00
cmpilato
f2c4a87740 * viewcvs/viewcvs.conf.dist
(footer): Update the default location for footer.ezt (now in the
    include/ subdir).

* viewcvs/website/upgrading.html
  Add a note about rearranged template locations.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@826 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 21:23:02 +00:00
cmpilato
cf04879462 Oops! Missed an update of a relocated template.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@825 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 20:37:59 +00:00
cmpilato
ba43e61754 Re-arrange the templates directory a bit.
* viewcvs/templates/dir_footer.ezt
* viewcvs/templates/dir_header.ezt
* viewcvs/templates/footer.ezt
* viewcvs/templates/header.ezt
  Move all of these...

* viewcvs/templates/include/dir_footer.ezt
* viewcvs/templates/include/dir_header.ezt
* viewcvs/templates/include/footer.ezt
* viewcvs/templates/include/header.ezt
  ...to here.

* viewcvs/templates/annotate.ezt
* viewcvs/templates/diff.ezt
* viewcvs/templates/dir_alternate.ezt
* viewcvs/templates/directory.ezt
* viewcvs/templates/graph.ezt
* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
* viewcvs/templates/markup.ezt
* viewcvs/templates/query.ezt
  And then update the [include] items in these files to note the new
  locations of the aforementioned relocated templates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@824 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 05:57:57 +00:00
cmpilato
1b8e7c9aa5 Do some work to expose Subversion directory commit info (logs,
revision, authors), cleanup some unnecessary data dictionary cruft,
and rework the default directory templates a bit.

* viewcvs/lib/viewcvs.py
  (view_directory): Do the Right Thing for Subversion directory log
    messages.  Merge the 'cvs' and 'state' data fields for CVS.
    Populate rev_href for Subversion directories.

* viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Track data dictionary changes, and tweak the templates to always
  show name, rev, author, date -- now only log is conditional on
  show_logs (go figure).  Also, core the common header and footer
  parts of these files into...

* viewcvs/templates/dir_header.ezt
* viewcvs/templates/dir_footer.ezt
  ...these new include files.

* viewcvs/website/upgrading.html
  Update with notations about these changes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@823 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-15 05:27:55 +00:00
cmpilato
f9b6bd3f05 Some tarball-generation fixes. Thanks to Ulrich Goertz <debian@g0ertz.de>
for whipping me into action.

* viewcvs/lib/viewcvs.py
  (_strip_suffix): If the "suffix" is the whole last path component,
    remove that component altogether (rather than leaving an
    empty-string component after the strip)
  (generate_tarball): Include timestamps for directories now.  For
    CVS, directory timestamps will be the youngest of the dates for
    files in that directory.  For Subversion, same routine except that
    files and subdirs datestamps count.
  (download_tarball): Don't include in a tarball all the empty
    directories between the root of the repository at the directory
    being tarballed.  Just stick the tarballed directory into the top
    of the tarball, either by its own name (if we know it) or by the
    configured name of that repository root (if the top-most directory
    is the to-be-tarballed directory).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@822 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-13 21:59:52 +00:00
cmpilato
f0ae4c61f9 Fix some line-length > 80 columnsness.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@821 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-13 21:59:24 +00:00
cmpilato
04426fdf30 * viewcvs/tparse/tparse.cpp
* viewcvs/tparse/tparse.h
* viewcvs/tparse/tparsemodule.cpp
* viewcvs/tparse/tparsemodule.h
  Massive tparse reindenting, reformatting, and spacing /
  capitalization fixes in messages.  Patch by Max Bowsher
  <maxb@ukf.net> (tweaked a little by cmpilato to ensure lines < 80
  characters).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@820 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-04-06 02:52:08 +00:00
cmpilato
aa65061e43 * viewcvs/lib/viewcvs.py
(Request.run_viewcvs): Look in the Attic/ for files in CVS URLs, and
    redirect on a 'hit'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@819 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-31 21:56:22 +00:00
cmpilato
8b230d035a Patch by Max Bowsher <maxb@ukf.net> and Erik Huelsmann <e.huelsmann@gmx.net>.
* tparse/tparse.cpp
  (TokenParser::get): Write one less byte in case of
    @-sign-is-last-byte-in-buffer: the byte will be transferred to the
    start of the newly filled buffer.
  (tparseParser::parse_rcs_tree): Use correct pointer when
    constructing linked list.

* tparse/tparsemodule.cpp
  (PythonSink::define_revision): Don't leak PyString objects.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@818 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-30 14:21:25 +00:00
cmpilato
e2e32dcc0d Fix some memory leaks in the TParse code. Patch by Erik Huelsmann
<e.huelsmann@gmx.net>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@817 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-29 15:59:17 +00:00
cmpilato
a5cf1fe9c9 * viewcvs/lib/viewcvs.py
(view_revision_svn): Fix a missing assignment that rendered a call
    to html_time() rather pointless.  Noticed by Lele Gaifax.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@816 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-27 20:25:54 +00:00
cmpilato
f948f2db3f Get 'forbidden' module support mostly working for Subversion.
* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Move the forbidden path check until after a
    root-as-url-component redirect.
  (view_directory): Break out the forbidden path
    check so that Subversion and CVS paths get checked.
  (generate_tarball): Break out the forbidden path
    check so that Subversion and CVS paths get checked.  Also, fix
    usage of an uninstantiated variable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@815 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-26 14:59:32 +00:00
cmpilato
56a4d4652b * lib/vclib/ccvs/rcsparse/common.py
(_Parser.parse_rcs_tree): Add notation about spec violation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@814 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-18 20:45:33 +00:00
cmpilato
8a38080b25 * viewcvs/lib/vclib/svn/__init__.py
(_unparse_action): Remove this unused function.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@813 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-18 20:41:09 +00:00
cmpilato
1bfa20c8be * viewcvs/lib/vclib/ccvs/rcsparse/common.py
(_Parser.parse_rcs_tree): Support author which contain spaces.  It's
    a Windows CVS thing ... *shrug*.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@812 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-15 20:39:43 +00:00
cmpilato
8a8a587963 Subversion revisions might not have dates attached to them, and
ViewCVS assume otherwise.  Fix that (as best as can be expected).

Bug reported by Alejandro Ramirez <alejandro.ramirez@artmediacompany.com>.

* viewcvs/lib/vclib/svn/__init__.py
  (_datestr_to_date): Protect against None datestrings by return "now"
    when there's no valid to use.

* viewcvs/lib/vclib/svn_ra/__init__.py
  (_datestr_to_date): New (copied from the 'svn' module).
  (LastHistoryCollector._log_cb, get_logs): Use new _datestr_to_date()

* viewcvs/lib/viewcvs.py
  (view_markup, view_directory, view_log, view_revision_svn,
   view_diff, make_time_string): Watch out for missing dates.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@811 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-10 15:54:53 +00:00
cmpilato
b3e22e74e2 * viewcvs/lib/vclib/svn/__init__.py
(SubversionRepository.__init__): Carefully track how stuff is
    initialized so the __del__() method doesn't do bad stuff.
  (SubversionRepository.__del__): Only de-init stuff that got init-ed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@810 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-09 16:26:16 +00:00
cmpilato
0b91db3a1b * viewcvs/lib/viewcvs.py
(view_log): Initialize the entry.branch_point and entry.next_main
    values to None, common to all VC systems.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@809 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-09 16:25:54 +00:00
cmpilato
ea1274a8b8 Fix markup-view <img> source URLs to contain the revision of the
resource.  Reported by Roland Schwingel <Roland.Schwingel@onevision.de>.

* viewcvs/lib/viewcvs.py
  (view_markup): Add the revision to the URL for image-type markup views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@808 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-08 16:49:37 +00:00
cmpilato
fe97494fd0 Fix copyfrom links in the Subversion log view.
Patch mostly by Eike Bernhardt <eike-usenet@unorganized.net>.

* viewcvs/lib/viewcvs.py
  (Request.get_link): Don't lose the rev= parameter when building
    log-view URLs.
  (view_log): Include the copyfrom revision in the copyfrom URL.

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Don't tack on a revision bookmark to the copyfrom URL.  It's not
  likely to exist, and is now unnecessary anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@807 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-03-08 16:41:37 +00:00
cmpilato
d57c96259e * viewcvs/lib/ezt.py
Import LongType from types, too.
  (_get_value): Handle conversion of LongType as well.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@806 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-20 18:20:59 +00:00
cmpilato
68bd35d7e1 * viewcvs/lib/viewcvs.py
(view_log): Populate the 'copy_rev' member.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@805 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-17 15:58:16 +00:00
cmpilato
1fc3dcf7a4 * lib/viewcvs.py
(_re_validate_number): Add '~' as an acceptable character in a CVS
    symbol.  CVS, after all, does allow such things.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@804 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-02-06 19:17:04 +00:00
cmpilato
5f5d0140de * viewcvs/lib/vclib/bincvs/__init__.py
(_parse_co_header): Stop using variables that don't exist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@803 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-29 16:07:18 +00:00
rey4
3690e0b386 Fix problem with cvsdb and bincvs.fetch_log
* lib/vclib/bincvs/__init__.py
  (fetch_log):
    fix arg list

* lib/rlog.py
  (GetRLogData)
    take repository object as argument instead of cfg object

* lib/cvsdb.py
  (GetCommitListFromRCSFile):
    take repository object as argument instead of repository path

* tools/cvsdbadmin
  (CommandUpdate, CommandRebuild)
    create BinCVSRepository objects to pass to cvsdb functions

* tools/loginfo-handler
  (CommitFromFileData, GetUnrecordedCommitList)
    take repository object as arguments instead of repository path

  (ProcessLoginfo)
    create BinCVSRepository objects to pass to cvsdb functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@802 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-26 01:25:47 +00:00
rey4
f9cdf6b8ca Fix bug in svn_ra module
* lib/vclib/svn_ra/__init__.py
  (fetch_log):
    fix date conversion


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@801 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 23:09:59 +00:00
rey4
b5ffa5d06c Fix another bug in CVSNT workaround
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    fix _file_log call


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@800 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 22:58:41 +00:00
rey4
b01c037437 Get svn_ra module working again
* lib\vclib\svn_ra\__init__.py
  (created_rev):
    new function

  (LogEntry):
    removed

  (fetch_log):
    create Revision objects instead of LogEntries, and simplify return
    value

  (get_logs):
    set DirEntry.log_error property

  (SubversionRepository.listdir):
    add options argument to match rest of vclib library

  (SubversionRepository.dirlogs, filelog):
    add new vclib methods


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@799 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:29:00 +00:00
rey4
b826424b50 Get ccvs module in working state, and add "use_rcsparse" option to use
it instead of bincvs. It works for log pages, directory pages, markup
pages, checkouts, and tarball downloads, but not for diffs because vclib
doesn't currently have an interface for diffing.

* viewcvs.conf.dist
  (use_rcsparse):
    new option

* lib/config.py
  (Config.set_defaults):
    make use_rcsparse off by default

* lib/viewcvs.py
  (Request.run_viewcvs)
    import ccvs module instead of bincvs if use_rcsparse is enabled

  (markup_stream_enscript):
    check for eof() method on file objects before calling

* lib/vclib/bincvs/__init__.py
  (CVSRepository, BinCVSRepository):
    separate new base class CVSRepository out of BinCVSRepository.
    The new base class is shared with the ccvs module

  (BinCVSRepository.filelog, _file_log):
    move calls to rcs utilities out of _file_log() function and into the
    filelog() method. This way _file_log() can be shared with the ccvs
    module

  (Revision.__init__):
    add default argument values to simplify some calls in the ccvs module

  (_get_logs, _log_path):
    move some functionality out of _get_logs() into new _log_path()
    function, which is shared with ccvs

* lib/vclib/ccvs/__init__.py
  Lots of kludges added to this module to get it running again and taking
  advantage of functionality already implemented in bincvs. It's not
  pretty, but at least it works and is no longer out of date.

  (CCVSRepository, CVSRepository):
    delete old CVSRepository class, create new CCVSRepository class
    implementing the current vclib api

  (MatchingSink):
    new sink superclass

  (InfoSink):
    updated to work with tags and default branches instead of always
    finding latest trunk revisions. Also changed to work with DirEntry
    objects

  (TreeSink):
    updated to work with Revision objects

  (StreamText.next_revision, StreamText):
    remove "next_revision" debugging method and all references to it

  (COSink):
    reimplement with a simpler algorithm

* lib/vclib/ccvs/rcsparse/common.py
  (Sink.admin_completed):
    new callback

  (_Parser.parse):
    call new callback


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@798 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:25:30 +00:00
rey4
c78051dd63 Put underscores in names of internal bincvs functions
* lib/vclib/bincvs/__init__.py
  (lots of functions)
    rename


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@797 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:06:53 +00:00
rey4
0ed400de63 Tweak vclib DirEntry and Revision objects.
- Revision class is now defined in vclib
- DirEntry class has new log_error boolean member to replace use of
  bincvs._FILE_HAD_ERROR constant.
- In CVS, DirEntry.state string member is replaced by boolean DirEntry.dead

* lib/vclib/__init__.py
  (Repository.dirlogs):
    add documentation

  (Revision):
    new class

* lib/vclib/bincvs/__init__.py
  (Revision):
    inherit from new vclib.Revision class

  (get_logs, _FILE_HAD_ERROR):
    stop using _FILE_HAD_ERROR constant

  (parse_log_entry, get_logs):
    use "dead" properties instead of "state" properties on Revision and
    DirEntry objects

  (_newest_file):
    bugfix, call _check_path() to make sure returned file is accessible

* lib/rlog.py
  (GetRLogData):
    use Revision.dead member instead of Revision.state

* lib/vclib/svn/__init__.py
  (Revision, LogEntry):
    rename LogEntry class to Revision and inherit from vclib.Revision

  (NodeHistory.add_history):
    trim beginning slashes from subversion paths passed to this callback

  (_log_helper):
    call new Revision constructor

  (fetch_log):
    simplify return values

  (get_logs):
    set DirEntry.log_error member

  (SubversionRepository.filelog):
    update for changed fetch_log function, remove some kludges

* lib/viewcvs.py
  (Request.run_viewcvs, bincvs):
    import bincvs module as neccessary instead of importing globally

  (view_markup, sort_file_data, view_directory, view_log,
   generate_tarball):
    update to deal with changed DirEntry and Revision members


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@796 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 19:05:08 +00:00
rey4
3623c5476b Add new repository methods to vclib.
* lib/vclib/__init__.py
  (Repository):
    update docstrings

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    add options argument

  (BinCVSRepository.openfile):
    fix bug in cvsnt workaround

  (BinCVSRepository.dirlogs, BinCVSRepository.filelog):
    new methods

  (_sort_tags):
    removed

  (get_logs):
    simplify arguments and return value

* lib/vclib/svn/__init__.py
  (SubversionRepository.listdir):
    add options argument

  (SubversionRepository.dirlogs, SubversionRepository.filelog):
    new methods

* lib/viewcvs.py
  (view_markup, view_log):
    use new repos.filelog() method

  (icmp):
    new function

  (view_directory, generate_tarball):
    use new repos.dirlogs() method

  (read_log):
    removed

  (download_tarball):
    update call to generate_tarball


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@795 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-25 18:37:42 +00:00
rey4
b8f73030d6 Merge generate_tarball_cvs and generate_tarball_svn functions.
* lib/viewcvs.py
  (generate_tarball, generate_tarball_cvs, generate_tarball_svn):
    combine svn and cvs functions into a new function

  (download_tarball):
    call new generate_tarball function

* lib/vclib/svn/__init__.py
  (StreamPipe.read):
    support calls that don't specify length


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@794 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 04:53:09 +00:00
rey4
8b7b732983 Refactoring and rearranging in the bincvs module.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository, DirEntry):
    move these class definitions to top of file

  (rcs_popen, BinCVSRepository.rcs_popen):
    make standalone rcs_popen function into a repository method

  (BinCVSRepository._newest_file, _newest_file):
    make _newest_file method into standalone function

  (path_ends_in):
    move to bottom of file

  (BinCVSRepository.openfile, file_log, get_logs, fetch_log):
    update calls to rcs_popen, _newest_file

* lib/viewcvs.py
  (view_diff, generate_tarball_cvs(out):
    update calls to rcs_popen


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@793 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 03:46:30 +00:00
rey4
5154ff3d3e Some refactoring in BinCVS module.
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile, parse_co_header):
    move co parsing code out of openfile and into new parse_co_header
    function

  (BinCVSRepository._getrcsname, BinCVSRepository.itemtype):
    remove _getrcsname() method, replace call in itemtype()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@792 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 02:49:44 +00:00
rey4
9ec0064115 Simplify CVSNT workaround in BinCVSRepository.openfile using new file_log
function.

* lib/vclib/bincvs/__init__.py
  (Revision.__init__):
    add new "dead" boolean member. it would be nice to start using this in
    the other parts of the code instead of the "state" string member

  (match_revs_tags):
    set new "undead" properties pointing to previous non-dead revisions

  (file_log):
    bugfix, had been using invalid exception type

  (BinCVSRepository.openfile):
    reimplement CVSNT workaround in terms of file_log()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@791 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 02:20:24 +00:00
rey4
3fa077ff75 Move bulk of read_log function out of viewcvs.py and into the bincvs
module.

* lib/vclib/bincvs/__init__.py
  (file_log):
    new function mostly made up of code cut from read_log

* lib/viewcvs.py
  (read_log):
    call file_log function

  (view_markup, view_log):
    update calls to read_log


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@790 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-22 01:48:59 +00:00
rey4
ac551b0fa9 fix broken link on subversion log page
* lib/viewcvs.py
  (view_log):
    fix links to revision pages


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@789 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 22:56:09 +00:00
rey4
05888638d0 Make view/download links on log and markup pages simpler and more uniform.
I didn't like a number of things about previous interface, like how it:
 - inconsistently made some links pop up and others open in the same window
 - used inconsistent terminology, "view" links lead to markup pages in some
   cases and direct downloads in others
 - omitted useful links, there were no direct download links for images and
   no markup or "as text" links for "nonviewable" files (like text files
   that ending in .doc)
 - inserted extraneous punctuation, in lines like
   "Revision 1.1 - , (view/download)"

There's some more information about this change posted on the dev list:
http://mailman.lyra.org/pipermail/viewcvs-dev/2004-January/001337.html


* lib/viewcvs.py:
  (view_markup, view_log):
    set new template variables that have the same names and functions on
    all pages: "view_href", "download_href", and "download_text_href"

* templates/log.ezt
* templates/log_table.ezt
* templates/include/branch.ezt
* templates/markup.ezt
    use new template variables and get rid of pop-up links

* templates/dir_alternate.ezt
* templates/directory.ezt
    get rid of pop-up links

* website/upgrading.html
    describe changed variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@788 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 22:50:26 +00:00
rey4
3d9843aba9 Remove duplicate code from CVS and Subversion implementations of view_log
* lib/viewcvs.py
  (augment_entry, view_log_cvs, view_log_svn):
    removed

  (view_log)
    add functionality from removed functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@787 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 05:25:31 +00:00
rey4
e5588cbba1 Move all the code that manipulates CVS revision numbers out of viewcvs.py
and into the bincvs module, unfortunately rewriting most of it in the
process. I thought I finished this before, but some code in view_markup and
augment_entry slipped below my radar.

The main difference between the new code and the old code is that the old
code used string representations of revision numbers and manipulated them
with string operations and regular expressions while the new code converts
all revision numbers into tuples of integers and manipulates them in that
form.

This change also restores some minor ViewCVS 0.9.2 behaviors that I
inadvertently changed before:

- "Branch" fields on log pages list "MAIN" tags instead of skipping them
- The "Default branch" field on the top of log pages lists all names for a
  default branch instead of picking one randomly
- Viewing a directory with "only_with_tag=HEAD" shows default branch
  revisions, not just trunk revisions

* lib/vclib/bincvs/__init__.py
  (LogEntry, LogHeader, LogError, TagInfo):
    removed classes

  (Revision):
    new class, replaces LogEntry

  (Tag):
    new class, replaces TagInfo

  (match_rev_tags, add_tag, remove_tag):
    new functions for manipulating revisions and tags

  (_revision_tuple, _tag_tuple, _dict_list_add):
    new internal functions

  (parse_log_header):
    return multiple values directly instead of packing them into a
    LogHeader object

  (parse_log_entry, _sort_tags, BinCVSRepository.openfile):
    use Revision and Tag classes instead of LogEntry and TagInfo classes

  (get_logs):
    fix handling of HEAD tag

  (fetch_log):
    stop returning "head" field from rlog, it's not useful for anything

* lib/viewcvs.py
  (prep_tags, logsort_date_cmp, logsort_rev_cmp)
    tweaked to work with bincvs.Tag and bincvs.Revision objects

  (find_first_rev):
    removed

  (view_markup, augment_entry):
    change to deal with Revision and Tag objects, remove some revision
    number computation

  (read_log):
    don't do revision/tag matching here, instead call match_revs_tags
    update filtering code and some comments

  (view_log_cvs):
    fix default branch code to display all known branch names

* lib/rlog.py
  (GetRLogData):
    update for changed bincvs.fetch_log


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@786 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-21 00:50:17 +00:00
cmpilato
b69d1b42fe * lib/viewcvs.py
(view_directory): Check "file.log is not None" instead of just
    "file.log".  This is one aspect of Python I find a bit stupid.
    Also, don't build cvsgraph href's for Subversion views.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@785 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-20 19:34:36 +00:00
cmpilato
fdafc736d1 * lib/vclib/svn/__init__.py
(created_rev): New.

* lib/viewcvs.py
  (view_directory): Set 'tree_rev' to the results of created_rev()
    called on the current directory.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@784 8cb11bc2-c004-0410-86c3-e597b4017df7
2004-01-19 21:42:33 +00:00
cmpilato
403d5c8f73 * viewcvs/lib/viewcvs.py
(view_diff): Catch Subversion FS_NOT_FOUND errors from
    diffobj.get_pipe() so we can return a '400 Bad Request'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@783 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-12 10:39:10 +00:00
rey4
fd97298424 Fix bug #858414 "ValueError: unconverted data remains: 'UTC'" reported
by Jordan Russell

* lib/compat.py
  (cvs_strptime):
    stop trying to pass time zone information to strptime. Apparently
    the glibc implementation of this function doesn't support it.
    Instead just replace the returned is_dst value with 0.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@782 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-12 00:22:35 +00:00
rey4
c4d2c8e0a8 Minor fix in link constructing function. Doesn't have any effects
currently visible to users

* lib/viewcvs.py
  (Request.get_link):
    prevent tarball links from having their 'only_with_tag' parameters
    overwritten with the current sticky value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@781 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-11 00:38:39 +00:00
rey4
0d905fe2d0 Temporary workaround for another CVSNT bug. The problem was reported
in issue #829519 "Viewing removed file causes pyhton exception" by
Hartmut Honisch.

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    work around cvsnt's co not producing any output when we request
    a dead revision


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@780 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-11 00:18:20 +00:00
rey4
6fccdc0195 Fix bug #849834 "Download tarball doesn't respect tag selected"
reported by Aaron Linville.

* lib/viewcvs.py
  (Request.get_link):
    add "only_with_tag" parameters to tarball download links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@779 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 12:21:53 +00:00
rey4
22a713c5d6 Fix bug #845957 "exception when viewing a revision without log"
reported by Hernan Martinez Foffani.

* lib/viewcvs.py
  (view_markup):
    set default value for "tag" template variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@778 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 12:12:20 +00:00
rey4
d7d0a03ecc Fixed bug #844810 reported by Jordan Russell. It was caused by my recent
tinkering in the get_logs() function. I made the incorrect assumption
that rcs files used branch numbers with 0's in them (like 1.2.0.3) when
no changes had yet been made on the branch, and branch numbers without
0's like (1.2.3) for branches that did contain changes. But this appears
to have been based on an optional convention that not all cvs versions
follow. The assumption was only used to avoid some unneccessary iterations
of a while loop and the code is actually a little simpler without it.

* lib/vclib/bincvs/__init__.py

  (TagInfo.__init__):
    remove _zero_branch member

  (TagInfo.matches_rev):
    stop using _zero_branch value. the behavior of the this method
    is now different than before

  (get_logs):
    fix to work with new matches_rev definition

* lib/viewcvs.py
  (read_log):
    simplify an if statement using tag.holds_rev()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@777 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 11:50:44 +00:00
rey4
e891a6f0ca Remove workaround for Mod_Python bug fixed in new version 3.0.4
* lib/sapi.py:
  (ModPythonServer.getenv):
    Farewell SCRIPT_NAME bug, we hardly knew ye.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@776 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 07:53:42 +00:00
rey4
99a59b5032 Ahhh, the joys of using an interpreted language...
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    Fix errors in a raise statement


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@775 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 07:48:11 +00:00
rey4
4ddb87c838 Fix DST issue, bug #800741. Thanks to James Conley for the bug report and to
Anthon van der Neut for the patch.

* lib/compat.py
  (cvs_strptime):
    explicitly specify UTC time zone in the strptime function call
    that parses timestamps produced by RCS utilities. This causes
    the "isdst" field of the returned time tuple to be set to "0"
    instead of "-1", meaning "no" instead of "maybe."


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@774 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 06:07:36 +00:00
cmpilato
f95418732a * viewcvs/lib/vclib/svn/__init__.py
(LogEntry.__init__, get_logs): Use string representations of
    Subversion revisions here (for consistency with CVS).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@773 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-02 00:47:29 +00:00
rey4
ed885369ff update windows readme
* windows/README:
    add some subversion information and update known issues section


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@772 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-11-04 04:54:28 +00:00
rey4
3255fef447 Improve rlog error handling
* lib/vclib/bincvs/__init__.py:
  (parse_log_header):
    separate line numbers from file names in rlog error messages, also
    try to deal with missing "rlog: " prefixes in rlog error messages

  (get_logs):
    recover gracefully when rlog has a fatal parsing error and skips
    remaining files


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@771 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-11-04 04:52:08 +00:00
cmpilato
dbe55837bb * viewcvs/lib/ezt.py
Remove HTML-speak throughout.  This module is quite useful for much
  more than just HTML.  Also:
  (Template.__init__): Add 'compress_whitespace' parameter (defaulting
    to 1) to control whether or not runs of whitespace are compressed.
  (Template._parse): Only compress whitespace if the
    compress_whitespace variable is non-zero.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@770 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-29 02:01:37 +00:00
rey4
b63ed80ac7 * viewcvs.conf.dist
(php_exe_path):
    add another example path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@769 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-28 01:52:25 +00:00
rey4
755f7ac666 Update php colorizing code.
* viewcvs.conf.dist
  (use_php, php_exe_path):
    new options for php highlighting

* lib/config.py
  (Config.set_defaults):
    set defaults for new options

* lib/viewcvs.py
  (markup_stream_php):
    use new php option, and colorize using php's -s argument instead
    of invoking the php interpreter, building a big string and
    calling highlight_string()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@768 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-28 01:46:59 +00:00
rey4
c4f253f187 Check for execute permission on directories in _check_path. This is
another fix suggested by Anthon van der Neut in bug #817757

* lib/vclib/bincvs/__init__.py
  (_check_path):
    check for execute permission on directories when we fall back to
    os.access()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@767 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 19:46:31 +00:00
rey4
6f4440191e Fix bug #817757, "unaccessible directories displayed" submitted by
Anthon van der Neut using the fix that he suggested. This change
also seems to fix another bug, #509961

* lib/vclib/bincvs/__init__.py
  (_check_path):
    fix check of os.access() return value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@766 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 19:30:52 +00:00
rey4
7994db2d37 fix improperly escaped urls on query page, bug #529888 reported
by Franz H�pfinger.

* lib/query.py
  (build_commit)
    add call to urllib.quote


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@765 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:47:30 +00:00
rey4
055799e9f9 another change to make query page work from source directory
without installation

* lib/cvsdb.py
    fix path to viewcvs.conf


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@764 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:34:34 +00:00
rey4
e27958e70a make query page work straight from the source directory without
installation

* www/cgi/query.cgi
    fix path to lib directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@763 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 17:28:30 +00:00
gstein
4c82431592 Simplify some boolean ezt data values.
* lib/viewcvs.py:
  (view_markup): replace ezt.boolean(0) with None
  (view_directory): replace some Python ternary idioms (yuck) with a call
    to ezt.boolean() which does the nifty magic for us anyways.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@762 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 06:40:46 +00:00
rey4
c611d05862 * lib/viewcvs.py
(sort_file_data):
    fix sorting by name for files with no revision info


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@761 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-27 04:24:37 +00:00
rey4
e4d2fd765d * lib/viewcvs.py
(Request.get_link):
    remove trailing slashes from revision page links


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@760 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 23:48:19 +00:00
rey4
3f2d834184 add forward.gif and back.gif to apache_icons.py. these icons are used
by the new subversion revision page

* tools/bin2inline_py.py:
   added two new icons

* lib/apache_icons.py:
    regenerated


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@759 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 23:44:49 +00:00
rey4
52a55617da Rearrange view_directory function, moving logic to the top and template
filling code to the bottom. Add a few comments too.

* lib/viewcvs.py
  (view_directory):
    move some code around


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@758 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 22:57:30 +00:00
rey4
8f92ee55ab Merge view_directory_cvs and view_directory_svn functions. Had to add
a lot of kludgy request.roottype == 'cvs' checks, but at least this
way there's a lot less duplicate code.

* viewcvs.py
  (view_directory_cvs, view_directory_svn):
    removed, code moved into view_directory

  (view_directory):
    no longer calls view_directory_cvs and view_directory_svn


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@757 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 22:08:47 +00:00
rey4
f1057adb51 * website/upgrading.html
update for new template changes


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@756 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 04:40:43 +00:00
rey4
a478890739 Restore "this entry is unreadable" error messages that got mistakenly
suppressed in revision 1.205 of viewcvs.py.

* lib/viewcvs.py:
  (view_directory_cvs):
    stop skipping unreadable rows. also simplify row.name initialization
    by omitting trailing slashes for directory names

  (view_directory_svn):
    omit trailing slashes from directory names

* templates/directory.ezt
* templates/dir_alternate.ezt
    add trailing slashes to directory names


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@755 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 04:17:06 +00:00
rey4
a34029940f Move cvs tag sorting code out of view_directory_cvs and into vclib.
* lib/vclib/bincvs/__init__.py
  (_sort_tags):
    new function to alltags dictionary

  (get_logs):
    assign found tags to repos object instead of returning
    alltags dictionary

* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
  (get_logs):
    stop returning alltags dictionary

* lib/viewcvs.py
  (view_directory_cvs, view_directory_svn):
    updated to work with changed get_logs functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@754 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 03:33:47 +00:00
rey4
d11e6490ba Simplify some logic in view_directory_cvs. Except for the num_files
count (which was incorrect before), the new code should be equivalent
to the old code.

* lib/viewcvs.py
  (view_directory_cvs):
    simplify some parts, mainly by grouping together assignments of
    row properties


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@753 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-25 02:54:48 +00:00
cmpilato
551a38195c * viewcvs/lib/viewcvs.py
(view_revision_svn): Calculate links to the previous and next
    revisions, as well as a jump-box for whatever revision you so
    desire.

* viewcvs/templates/revision.ezt
  Add UI for navigating to previous and next revisions, for jumping to
  any particular revision you like.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev, fetch_log): Stop recalculating the youngest rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@752 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 19:27:02 +00:00
rey4
6aab83621c * lib/vclib/bincvs/__init__.py
(BinCVSRepository.openfile):
    fix NameError that occurs when raising an exception


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@751 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 19:06:00 +00:00
cmpilato
1f61819995 Committing some highly experimental code for allowing ViewCVS on one
machine to communicate with Subversion repositories via the Subversion
client bindings -- meaning your Subversion repository can live on an
entirely different computer.  Because of the experimental nature, I'm
leaving this feature undocumented (no remarks about using URLs in
viewcvs.conf.dist, basically).

* viewcvs/lib/vclib/svn_ra/__init__.py
  The new module.

* viewcvs/lib/viewcvs.py
  (_re_rewrite_url): Add a bunch of URL schemas that Subversion
    supports to this regexp.
  (Request.run_viewcvs): If a Subversion repository URL is given as
    the root, use the 'svn_ra' module instead of the direct-access
    'svn' one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@750 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 18:31:27 +00:00
cmpilato
d1f125f837 Rename some not-meant-for-public-consumption functions.
* viewcvs/lib/vclib/svn/__init__.py
  (_fs_path_join): Was fs_path_join.
  (_log_helper): Was log_helper.
  (_get_last_history_rev): Was get_last_history_rev.
  (_get_history): Was get_history.
  (fetch_log): Update calls to _log_helper and _get_history.
  (get_logs): Update calls to _fs_path_join and _get_last_history_rev.
  (SubversionRepository.openfile): Update call to _get_last_history_rev.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@749 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 09:48:32 +00:00
rey4
4b2021fa21 Add optional "list_attic" argument to the bincvs listdir function. Also
fix tarball generation (it was broken by the previous commit)

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    add ability include Attic in returned listing

  (CVSDirEntry):
    new DirEntry subclass with additional "in_attic" member

* lib/viewcvs.py
  (view_directory_cvs):
    update to take advantage of the new listdir functionality

  (generate_tarball_cvs, generate_tarball_svn):
    update for changed listdir() and get_logs() vclib functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@748 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 05:13:38 +00:00
rey4
6e00b5d388 Change get_logs functions to add their information directly to
DirEntry objects instead of returning dictionaries of LogEntry
objects. Also make some tweaks to the code that parses rlog output.

* lib/vclib/bincvs/__init__.py
  (parse_log_header):
    stop stripping ",v" suffixes off of filenames, fix error message
    parser to work with windows paths, assign more sensible default
    field values, and change a comment

  (path_ends_in):
    new function

  (get_logs):
    take list of DirEntries as argument and populate it with data
    instead of returning a separate dictionary, also add some
    extra error checking

* lib/vclib/svn/__init__.py
  (get_logs):
    take list of DirEntries as argument just like in bincvs. also
    remove another unneccessary svn_fs_is_file call

* lib/viewcvs.py:
  (sort_file_data):
    change to use the new DirEntry properties

  (view_directory_cvs, view_directory_svn):
    update to work with changed get_logs functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@747 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 02:52:05 +00:00
rey4
c575c4d821 Factor permissions-checking code out of BinCVSRepository.listdir and into
a new _check_path function. Also take the opportunity to write an alternate
implementation that works correctly on windows.

* lib/vclib/bincvs/__init__.py
  (_check_path):
    added

  (BinCVSRepository.listdir):
    shortened


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@746 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-24 00:03:48 +00:00
rey4
3fc688319f move get_last_modified() into vclib as BinCVSRepository._newest_file()
* lib/vclib/bincvs/__init__.py
  (BinCVSRepository._newest_file):
    new function, cut and paste of get_last_modified

* lib/viewcvs.py
  (get_last_modified):
    removed

  (view_directory_cvs):
    use repos._newest_file function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@745 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 20:36:40 +00:00
uid99421
c0a6d838c6 * templates/revision.ezt:
add the standard page header to the new revision page


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@744 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 19:23:26 +00:00
uid99421
2bd228c4ee Moved all string processing of CVS revision numbers into a new class
called TagInfo in an attempt to make tag-matching code more readable.

* lib/vclib/bincvs/__init__.py
  (TagInfo):
    new class

  (get_logs):
    change to use TagInfo

* lib/viewcvs.py
  (find_first_rev):
    new function

  (read_log, view_directory_cvs, view_log_cvs):
    change to use Taginfo and find_first_rev

  (CVSBranch):
    died and reincarnated as TagInfo


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@743 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-23 18:59:06 +00:00
cmpilato
e7be5b1f0a * lib/vclib/svn/__init__.py
(get_revision_info): Update call to RevisionChangeCollector().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@742 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 19:46:28 +00:00
cmpilato
a33f547c1e * viewcvs/lib/viewcvs.py
(view_revision_svn): Oops.  Fix the prev and diff_href calculations.

* viewcvs/templates/revision.ezt
  Fix some logic to always populate the right number of cells.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@741 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 18:35:56 +00:00
cmpilato
9d5d4170f9 More work on the cool new revision view.
* viewcvs/lib/vclib/svn/__init__.py
  (LogEntry.__init__): Remove 'other_paths' parameter and support.
  (ChangedPathEntry): Remove.
  (ChangedPath, get_revision_info): New.
  (log_helper): Don't do changed-path or action stuffs.  Update call
    to LogEntry().
  (get_logs): Update call to LogEntry().

* viewcvs/lib/viewcvs.py
  (view_log_svn): Remove support for 'other_paths' support.
  (view_revision): Move svn-specific stuff to new view_revision_svn()
  (view_revision_svn): New.

* viewcvs/templates/revision.ezt
  Make this template actually do something useful.

* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
  Remove display of "other_paths" from Subversion logs.  Make revision
  numbers into links to the revision view.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@740 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 18:23:01 +00:00
rey4
1e0d4e3cff combine get_logs() and process_rlog_output() functions, also trim
trailing whitespace

* lib/vclib/bincvs/__init__.py
  (process_rlog_output, get_logs):
    removed process_rlog_output, moved code into get_logs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@739 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-22 03:40:07 +00:00
rey4
069265c023 * lib/viewcvs.py
(view_directory, view_directory_cvs, view_directory_svn):
    move some common code in view_directory_cvs and
    view_directory_svn into view_directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@738 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 21:17:29 +00:00
cmpilato
45629a7dde Begin implementing the new 'revision' view.
* viewcvs/lib/viewcvs.py
  (Request.get_link): Add code to generate the new revision info links.
  (view_revision): New.
  (_views): Alphabetically sort the views here, and add the new 'rev' view.

* viewcvs/viewcvs.conf.dist
  (templates.revision): New.

* viewcvs/templates/revision.ezt
  New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@737 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 20:04:30 +00:00
rey4
c1785db585 Remove dead code from vclib.
* lib/vclib/__init__.py
  (Repository.getitem, Repository.getfiles, Repository.getsubdirs,
   Revision, Repository._getvf_files, Repository._getvf_subdirs,
   Versfile, Versdir, Versitem, Repository._getvf_info,
   Repository._getvf_tree, Repository._getvf_properties,
   Repository._getvf_cofile):
    removed

* lib/vclib/svn/__init__.py
  (SubversionRepository.getitem, SubversionRepository._getvf_files,
   SubversionRepository._getvf_subdirs,
   SubversionRepository._getvf_info,
   SubversionRepository._getvf_tree,
   SubversionRepository._getvf_properties,
   SubversionRepository._getvf_cofile):
    removed

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.getitem, BinCVSRepository._getvf_files,
   BinCVSRepository._getvf_subdirs,
   BinCVSRepository._getvf_info,
   BinCVSRepository._getvf_tree,
   BinCVSRepository._getvf_properties,
   BinCVSRepository._getvf_cofile):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@736 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 19:54:27 +00:00
cmpilato
e367c87dfe * viewcvs/lib/vclib/bincvs/__init__.py
(get_logs): Copy the input 'files' array so we aren't deleting data
    from the passed-in thing.  Caller might want to keep using that
    stuff, ya know?


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@735 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:58:32 +00:00
rey4
ff2cf94151 * lib/vclib/svn/__init__.py
(SubversionRepository.listdir)
    implement using fs library functions instead of the vclib
    getitem() interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@734 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:54:23 +00:00
rey4
111a9b823b * lib/viewcvs.py
(generate_tarball_svn):
    use repos.listdir() interface instead of repos.getitem() interface


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@733 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 18:28:55 +00:00
rey4
1dc358fc1d Move get_file_data and get_file_data_svn functions into vclib.
* lib/viewcvs.py
  (DirEntry, get_file_data_svn, get_file_data):
    removed

  (view_directory_cvs, view_directory_svn, generate_tarball_cvs):
    call repos.listdir instead of get_file_data

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.listdir):
    added, cut and paste of get_file_data

* lib/vclib/svn/__init__.py
  (SubversionRepository.listdir)
    added, cut and paste of get_file_data_svn

* lib/vclib/__init__.py
  (DirEntry)
    added, cut and paste

  (Repository.listdir)
    added abstract member function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@732 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 14:35:47 +00:00
rey4
f2cadab08a Store directory listing entries in objects instead of tuples
* lib/viewcvs.py
  (_UNREADABLE_MARKER):
    removed

  (DirEntry):
    new class to replace directory entry tuples

  (get_file_data_svn, get_file_data):
    take repository object and directory path as arguments instead of
    taking the entire Request object. And return DirEntry instances
    instead of tuples

  (get_file_tests):
    removed, code moved into get_file_data

  (get_last_modified, sort_file_data, view_directory_cvs,
   view_directory_svn, search_files, generate_tarball_cvs):
    work with DirEntry instances instead of tuples

  (search_files):
    change the way this is called and remove cvs-specific code so
    subversion listings could potentially have regular expression
    searching

  (download_tarball, generate_tarball_cvs, generate_tarball_svn):
    change the way two recursive parameters are used to make it
    easier to call vclib-style functions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@731 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-21 05:42:12 +00:00
rey4
cfbf622b27 Move the process_checkout function into vclib.
* lib/viewcvs.py
  (process_checkout):
    removed, functionality moved into vclib

  (view_markup, view_checkout, search_files):
    call vclib.Repository.openfile instead of process_checkout

  (Request.run_viewcvs):
    pass rcs path option values to CVS repository constructor

* lib/vclib/__init__.py
  (Repository.openfile):
    new abstract function

* lib/vclib/bincvs/__init__.py
  (BinCVSRepository.openfile):
    added

  (BinCVSRepository.__init__):
    added rcs_paths member to hold rcs config values

* lib/vclib/svn/__init__.py
  (SubversionRepository.openfile):
    added

  (get_file_contents):
    removed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@730 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-20 03:53:23 +00:00
rey4
131904872c Stop looking up "action" values for subversion log entries. C. Mike
pointed out that will ultimately allow us to get rid of an inefficient
call to svn_fs_paths_changed().

* lib/vclib/svn/__init__.py
  (LogEntry.__init__, log_helper, get_logs):
    no longer set LogEntry.action member

* templates/log.ezt
* templates/log_table.ezt
    stop trying to read LogEntry.action member


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@729 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-17 17:56:44 +00:00
cmpilato
4e5303978a Expose the actions for "other changed paths".
* viewcvs/lib/vclib/svn/__init__.py
  (ChangedPathEntry.__init__): Add 'action' parameter.
  (_unparse_action): New helper (with code previously in log_helper()).
  (log_helper): Now call _unparse_action() to get the action string
    for the path.  But now also call it for the other paths, passing
    the result to the updated ChangedPathEntry.__init__() function.

* viewcvs/templates/log.ezt
* viewcvs/templates/log_table.ezt
  Now show the type of change that happened for "the other paths", and
  don't make paths that were deleted into hyperlinks.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@728 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-16 14:41:10 +00:00
cmpilato
751b031192 Some pool usage fixes suggested by Greg Stein.
* viewcvs/lib/vclib/svn/__init__.py
  (get_last_history_rev): Add 'pool' argument; use it instead of the
    repository object's pool.
  (get_logs): Make this sucker us an iteration subpool.  Update call
    to get_last_history_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@727 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-16 06:34:52 +00:00
rey4
c7c9807517 Removed show_changed_paths option. It was originally added as a way to
to disable a buggy and inefficient subversion feature. But it's no
longer neccessary with C. Mike's recent improvements to the subversion
module.

* viewcvs.conf.dist
  (show_changed_paths):
    removed option

* lib/config.py
  (Config.set_defaults)
    removed default assignment

* lib/viewcvs.py
  (run_viewcvs):
    stop passing option value to repository object

* lib/vclib/svn/__init__.py
  (log_helper, fetch_log):
    stop passing option value to log_helper function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@726 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 20:33:04 +00:00
rey4
9970242b67 fix some links on log pages
* lib/vclib/svn/__init__.py
  (_trim_path):
    new function to take leading slashes off paths

  (log_helper):
    remove leading slashes from paths that get used by templates


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@725 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 20:12:29 +00:00
cmpilato
603181493b * viewcvs/lib/viewcvs.py
(view_markup): Ensure that the 'prev' data member always exists.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@724 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 19:29:40 +00:00
rey4
c1f7b71c81 get standalone server to work from development tree
* standalone.py
  (global code):
    remove os.chdir() call and set viewcvs.g_install_dir variable so
    the templates and configuration file can be found


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@723 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:39:43 +00:00
rey4
e159806814 * lib/viewcvs.py
(handle_config):
    when viewcvs is run without being installed first, look for a
    viewcvs.conf file in the root of tree instead of in the current
    directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@722 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:27:17 +00:00
cmpilato
c8bc2d4832 * viewcvs/lib/vclib/svn/__init__.py
(log_helper): Stop skipping over revisions in which the target path
    didn't actually change.  If we decide to re-add this feature, we
    need to do it in viewcvs.py itself (because other code, like
    view_markup(), is depending on getting real values for all
    relevant revisions.
  (get_last_history_rev): New.
  (get_logs): Move this function down in the file, and now call
    get_last_history_rev() instead of fs.node_created_rev().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@721 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 17:24:40 +00:00
cmpilato
9a8d5d115b Whip 'select for diffs', 'diff to previous', and 'diff to selected'
into shape for Subversion.

* viewcvs/lib/viewcvs.py
  (view_log): Grab the path of a version selected for diffs from the
    query data, and stash it in the data dictionary.

* viewcvs/templates/log_table.ezt
* viewcvs/templates/log.ezt
  Fix the 'diff to previous', 'diff to selected', and 'select for
  diff' links for Subversion.  Also, don't display the various "branch
  point" and "next main" diff links for Subversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@720 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-15 16:42:02 +00:00
cmpilato
1ab8cfbd92 Purge semi-colons from the ends of statements (in one case, moving it into a
string constant as an HTML entity terminator.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@719 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-14 15:53:42 +00:00
cmpilato
e83cf53244 * viewcvs/lib/viewcvs.py
(read_log): Word-capitalize the "Tag Not Found" status line.
  (view_diff): Add 400 status to the exceptions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@718 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-14 15:35:23 +00:00
cmpilato
078c625f09 * viewcvs/lib/viewcvs.py
(get_file_data_svn): Use request.full_name, not just full_name,
    since the latter doesn't exist in the scope.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@717 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-13 18:56:20 +00:00
cmpilato
ad3eade9ac * viewcvs/lib/viewcvs.py
(_validate_param): Return "400 Bad Request" when invalid parameters
    are passed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@716 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-13 18:18:01 +00:00
cmpilato
fec722653e * lib/vclib/svn/__init__.py
(NodeHistory): New collector class.
  (get_history): Use svn_repos_history() now instead of directly using
    the fs.history interface.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@715 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-04 22:13:10 +00:00
rey4
22aeba1b38 * templates/log_table.ezt: sync up with log.ezt 1.26
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@714 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-10-03 22:10:19 +00:00
cmpilato
4f46a705e2 Some fix-em-ups to the new history-using ViewCVS code. Thanks to Greg
Stein and Russell Yanofsky for review and suggestions.

* lib/vclib/svn/__init__.py
  (log_helper): Add 'pool' argument, and use it instead of
    svnrepos.pool for allocations.  Also, calculate the action and
    copy_rev/copy_path fields in the log entries.
  (fetch_log): Use an iteration subpool when looping over history items.

* templates/log.ezt
  Eliminate an unnecessary "if-any" check (since "is" does this work
  for us in this case).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@713 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-30 13:58:44 +00:00
cmpilato
f808704efe * viewcvs/lib/vclib/svn/__init__.py
(log_helper): Populate the 'action' attribute of the LogEntry.

* viewcvs/templates/log.ezt
  Expect human-readable strings for the action type (instead of the
    single-character abbreviations).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@712 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 14:29:07 +00:00
cmpilato
594baf20b8 Mm... Steinian code review is good for the soul. And the project,
too.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev): Remove a semicolon (it's a Python no-no).
  (get_history): Remove an errant space, and take advantage of
    Python's kewl tuple support to avoid a temp variable and simplify
    the read.
  (log_helper): Promote to a "real" function, adding some params and
    returning a real value.
  (fetch_log): Move the sub-function log_helper out.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@711 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 14:13:57 +00:00
cmpilato
7eae388966 Make "diff to previous" for across Subversion copies work.
* viewcvs/lib/viewcvs.py
  (_legal_params): Allow 'p1' and 'p2' query args.
  (view_log_svn): Populate prev_path entry members.
  (view_diff): Handle the 'p1' and 'p2' query string items.  Update
    call to vclib.svn.do_diff().

* viewcvs/templates/log.ezt
  Update "diff to previous" links to include prev_path.

* viewcvs/lib/vclib/svn/__init__.py
  (do_diff): Add (and use) 'path2' argument.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@710 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 02:58:59 +00:00
cmpilato
9632aa3bfc Teach ViewCVS how to follow copy history in Subversion repositories
(optionally, turned off by default).  No diffs across paths yet, but
that's coming soon(ish)!

* viewcvs/lib/vclib/svn/__init__.py
  (LogReceiver): Buh-bye.
  (get_history): New.
  (fetch_log): Use get_history() instead of the svn_repos_get_logs interface.

* viewcvs/lib/config.py
  (Config.set_defaults): Add default for 'cross_copies' option.

* viewcvs/lib/viewcvs.py
  (Request.run_viewcvs): Set the 'cross_copies' SubversionRepository
    attribute based on the config option of the same name.

* viewcvs/viewcvs.conf.dist
  (cross_copies): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@709 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-26 01:34:33 +00:00
gstein
60fbba9322 re-add CGI scripts with exec permission
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@708 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:18:28 +00:00
gstein
d340b5bfc5 remove these CGI scripts temporarily
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@707 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:17:50 +00:00
gstein
7183660985 Restore ViewCVS' ability to work straight from the development tree.
* lib/viewcvs.py:
  (g_install_dir): from the CGI, the conf is a couple levels up (now)
    rather than just one.
  (view_directory_cvs): row.name must be set for all row types since it
    will be displayed as part of the error lines. move the assignment
    further up in the file.

* www/cgi/viewcvs.cgi:
  (__main__): the lib is a couple levels up from the CGI (now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@706 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-09-18 22:16:04 +00:00
cmpilato
c77b65be9d * templates/dir_alternate.ezt
* templates/directory.ezt
* templates/markup.ezt
* templates/include/branch.ezt
  s/resizeable/resizable/.  This fixes Bug issue #756811.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@705 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-24 05:20:55 +00:00
cmpilato
5e834c47e7 Fix directory templates to properly handle missing graph_href's (like,
for example, which using Subversion).  This fixes #Bugs item #793866,
reported by Timothee Besset.

* templates/dir_alternate.ezt
* templates/directory.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@704 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-24 05:06:41 +00:00
rey4
f6b2ba3649 Fixed bug introduced in rcsdiff_date_reformat by previous commit which
was noticed by Greg Stein <gstein@lyra.org>.

* lib/viewcvs.py (rcs_date_reformat): restored call to make_time_string()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@703 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-22 21:56:31 +00:00
rey4
844a8c1269 fix ValueError exception on diff page
* lib/compat.py (cvs_strptime): make compatibility function throw a
    ValueError when time is not in expected format, so it is more
    like the native function

* lib/viewcvs.py (rcs_date_reformat): catch ValueError exception


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@702 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-22 17:55:39 +00:00
rey4
8e19ed6b2c fix exception when svn root not found
* lib/viewcvs.py: fix misspelled variable


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@701 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-21 01:45:50 +00:00
rey4
bdc40661f6 fixed mod_python bug reported by David Oxley
<David.Oxley@workplace-systems.plc.uk> on Subversion dev list

* lib/sapi.py (ModPythonServer.getenv): derive SCRIPT_NAME from apache
    request instead of using mod_python's value


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@700 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-18 15:01:36 +00:00
rey4
1ce3cc2174 Fixed bug in html form that was reported by John Hall
<john-news1@cambridgetechgroup.com>.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@699 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-10 01:25:44 +00:00
rey4
7296228e72 fixed template variable bug #781130 on query page. reported by Michael
Pechner (mpechner).

* lib/query.py (main): set 'icons' parameter in template data


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@698 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-05 01:02:23 +00:00
rey4
a06053167b fixes for python 1.5 compatibility
* lib/popen.py
    use string functions instead of methods

* lib/viewcvs.py
    use apply() function instead of **arg calling syntax


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@697 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-08-04 17:42:21 +00:00
rey4
1437a7e4fe prevent exception when use_localtime is set and rcsdiff produces wrongly
formatted dates. Bug reported by zindine <zindine at easynet.fr> who
encountered this using cvsnt's rcsdiff.

* lib/compat.py (cvs_strptime): changed to return None when the date
  doesn't match, instead of throwing an exception

* lib/viewcvs.py (rcsdiff_date_reformat, human_readable_diff): changed
  to display unaltered date string returned by rcsdiff when it can't
  be parsed.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@696 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 11:09:11 +00:00
rey4
59563e8dfe changed "Running Windows" logo to ViewCVS blimp as suggested by
Bo Berglund <bo.berglund@telia.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@695 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 02:59:32 +00:00
rey4
c9fbb0ec71 put cvs_roots and svn_roots on a single line as requested by
Bo Berglund <bo.berglund@telia.com> to help simplify his
windows installer


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@694 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-29 02:57:51 +00:00
rey4
79309e3025 fixed html error
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@693 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-28 23:47:04 +00:00
rey4
66bb812aeb * lib/viewcvs.py (common_template_data): new function to set a few variables
common to all templates

  (Request.__init__): moved icon and docroot initialization into
  common_template_data

  (html_footer, view_directory, view_log, view_markup, view_checkout,
   view_cvsgraph, human_readable_diff): changed to use common_template_data

* templates/dir_alternate.ezt:
  templates/directory.ezt:
  templates/graph.ezt:
  templates/header.ezt:
  templates/log.ezt:
  templates/log_table.ezt:
  templates/query.ezt: renamed docroot and icon variables

* website/upgrading.html: updated description of changed template variables


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@692 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-25 05:34:11 +00:00
rey4
25bb91db25 fix for bug #509705, Directory view of branch skips files
based on patch from Steve Lamm (slamm)

* lib/vclib/bincvs/__init__.py (parse_log_entry): fixed to work with
  versions of RCS that add extra dashed separator lines


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@691 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 21:53:20 +00:00
rey4
5d4c447dd4 added "icons" and "docroot" options to control the locations of
static files

* viewcvs.conf.dist, lib/config.py: added new options

* templates/dir_alternate.ezt:
* templates/directory.ezt:
* templates/header.ezt:
* templates/log.ezt:
* templates/log_table.ezt:
* templates/query.ezt:
* lib/viewcvs.py (Request.__init__):
  new "request.docroot" and "request.icons" template variables

* standalone.py (serve): standalone server must use default locations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@690 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 20:37:39 +00:00
rey4
5cf473d5a1 enscript "couldn't open input filter" issue happens on windows xp too
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@689 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 19:56:07 +00:00
rey4
cf9aa07cdb fixed docstring
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@688 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 19:53:59 +00:00
rey4
0999369756 changed to exit silently on "cvs import" instead of crashing
* tools/loginfo-handler (HeuristicArgParse, CvsNtArgParse): added tests
  to detect command line parameters ending in "- Imported sources'"

  (debug, warning, error): changed these functions to write to standard out
  instead of standard error


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@687 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 08:48:40 +00:00
rey4
c9dbb2c933 fixed bug #488302, missing tag information
* lib/viewcvs.py (read_log, view_log_cvs, class CVSBranch): rewrote code
  that correlates CVS tags with revisions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@686 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 08:03:25 +00:00
rey4
9009ce845a fixed bug #460835, "Too many connections in cvsdbadmin update"
* lib/cvsdb.py (ConnectDatabase): now returns an existing database
  connection instead of always creating a new one.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@685 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-24 00:26:33 +00:00
cmpilato
dc2b8063ee * viewcvs/lib/config.py
* viewcvs/viewcvs.conf.dist
  Make the 'show_changed_paths' option default to 0.  We should
  generally avoid a policy of checking in code that, by default,
  SEGFAULTs.  Further, showing changed paths in Subversion is a large
  deviation of the manner in which CVS behaves, and I'd like to keep
  the two displaying as similarly as possible in the default setup.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@684 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-22 14:17:38 +00:00
rey4
4c281fc21b Fixed log retrieving code to work correctly when get_changed_paths is
true and a directory containing the file being displayed has been copied

* vclib/svn/__init__.py (LogReceiver.__init__): added a new member
  called "node_id" and changed parameters passed to constructor

  (LogReceiver.receive): now compares each changed file in a revision
  with the file being displayed using file revision identifers rather
  than pathnames. Also removed some leftover debugging code

  (fetch_log): adjusted arguments passed to LogReceiver constructor


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@683 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-11 22:05:41 +00:00
rey4
456ece022a Documented template changes. Should be complete, but needs to be made
more readable.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@682 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-09 08:55:49 +00:00
cmpilato
69e5862d59 * viewcvs/lib/viewcvs.py
(markup_stream): Get log message and size display as part of the
    markup output working for Subversion.

* viewcvs/templates/markup.ezt
  Add display of file size for Subversion repositories, and make the
    'changes since' line CVS-only.

* viewcvs/lib/vclib/svn/__init__.py
  (StreamPipe.read, StreamPipe.readline): Don't try to read if EOF
    has been hit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@681 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-07 14:43:50 +00:00
rey4
6800f02ab0 various minor fixes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@680 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 17:13:21 +00:00
rey4
94102ae7ae updated alternate template files
* dir_alternate.ezt: updated with recent changes to directory.ezt

* log_table.ezt: updated with recent changes to log.ezt


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@679 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:52:31 +00:00
rey4
eb16ebf2ce removed empty column from directory information table and added missing
</tr> closing tag


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@678 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:51:08 +00:00
rey4
07a0d6e387 made standalone server work with cvsnt and rcs when it is run on windows
without a configuration file

* lib/config.py (Config.load_config): added conf_path member to hold the
  path to viewcvs.conf, or None if there is no configuration file

* standalone.py (serve): if there is no configuration file on windows, it
  will test for the presence of cvsnt and if the test fails, it will fall
  back to rcs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@677 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-05 16:44:25 +00:00
rey4
a071956110 Added some new fields to the Subversion log view and fixed the
download/view/markup links for old revisions of copied files.

The new fields are "Other changed files" which is a list of links to other
files changed in the same revision, "Copied from" which is displayed for
file revisions that are the result of a copy operations, and "Filename"
which is displayed for older file revisions which precede a copy operation.

* viewcvs.conf.dist
* lib/config.py (set_defaults): added "show_changed_paths" option to determine
  whether or not to retrieve and display the new information

* lib/viewcvs.py (run_viewcvs): now passes show_changed_paths option to
  newly created subversion repository objects

  (view_log_svn): changed the way download/view/markup links are generated
  and added code to generate links for new fields

* templates/log.ezt: template additions

* lib/vclib/svn/__init__.py (LogEntry.__init__): added extra arguments for new
  fields

  (ChangedPathEntry): new class to hold information about the changed paths
  associated with a revision

  (LogReceiver.__init__): added some new members to hold more state for the
  callback function

  (LogReceiver.receive): added some code to crawl through the "paths" hash
  and save useful information

  (get_logs): changed to work with new LogReciever constructor

  (fetch_log): changed call to repos.svn_repos_get_logs() to pass true for the
  "discover_changed_paths" argument. moved fs.file_length() call into
  LogReceiver.__init__


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@676 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-03 06:27:52 +00:00
rey4
c6ddff38ef Added some new fields to the Subversion log view and fixed the
download/view/markup links for old revisions of copied files.

The new fields are "Other changed files" which is a list of links to other
files changed in the same revision, "Copied from" which is displayed for
file revisions that are the result of a copy operations, and "Filename"
which is displayed for older file revisions which precede a copy operation.

* viewcvs.conf.dist
* lib/config.py (set_defaults): added "show_changed_paths" option to determine
  whether or not to retrieve and display the new information

* lib/viewcvs.py (run_viewcvs): now passes show_changed_paths option to
  newly created subversion repository objects

  (view_log_svn): changed the way download/view/markup links are generated
  and added code to generate links for new fields

* templates/log.ezt: template additions

* lib/vclib/svn/__init__.py (LogEntry.__init__): added extra arguments for new
  fields

  (ChangedPathEntry): new class to hold information about the changed paths
  associated with a revision

  (LogReceiver.__init__): added some new members to hold more state for the
  callback function

  (LogReceiver.receive): added some code to crawl through the "paths" hash
  and save useful information

  (get_logs): changed to work with new LogReciever constructor

  (fetch_log): changed call to repos.svn_repos_get_logs() to pass true for the
  "discover_changed_paths" argument. moved fs.file_length() call into
  LogReceiver.__init__


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@675 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-03 06:20:24 +00:00
rey4
8d21b07bc2 removed some false advertising
* viewcvs.conf.dist: removed comment about CVSNT handling UTF-16 text
  better than the RCS utilities. This is irrelevant since CVSNT
  converts text to UTF-8 before storing it in the repository file.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@674 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 06:49:59 +00:00
rey4
0df99f1010 updated documentation to say that CVSNT can be used instead of RCS
* windows/README
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@673 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:42:47 +00:00
rey4
d228ab0ce2 removed some lines of code that don't do anything...
* standalone.py (ViewCVS_Handler.run_viewcvs): ...from this function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@672 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:23:52 +00:00
rey4
2e3d56772a standalone server had been setting the SCRIPT_NAME in a nonstandard way
which was incompatible with the url escaping changes I made in viewcvs.py
a little earlier today. now it is set correctly.

* standalone.py (ViewCVS_Handler.run_viewcvs): changed the way SCRIPT_NAME
  value is determined


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@671 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 05:16:06 +00:00
rey4
fe67803feb fixed some variable misspellings
* lib/viewcvs.py (Request.run_viewcvs): errors were in this function


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@670 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 04:56:48 +00:00
rey4
df7db58a04 changes to allow viewcvs to use CVSNT instead of the RCS utilities to
get information from CVS repositories

* viewcvs.conf.dist
* lib/config.py (Config.set_defaults): new "cvsnt_exe_path" option
  that can be set to the path of the cvsnt executable. If it is
  set, cvsnt gets invoked instead of the rcs utilities

* lib/vclib/bincvs/__init__.py (rcs_popen): new wrapper for popen that decides
  what program to execute based on the "rcs_paths" and "cvsnt_exe_path"
  options.

  (get_logs, fetch_logs): changed to use rcs_popen function instead of
  popen.popen

* lib/viewcvs.py (process_checkout, view_diff, generate_tarball_cvs): changed
  to use bincvs.rcs_popen instead of popen.popen

  (view_directory_cvs, generate_tarball_cvs): updated call to bincvs.get_logs

  (read_log): updated call to bincvs.fetch_log

* lib/rlog.py (GetRLogData): updated call to bincvs.fetch_log


general.cvsnt_exe_path


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@669 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 04:49:16 +00:00
rey4
8675e8cad0 some minor fixes
* lib/viewcvs.py (_URL_SAFE_CHARS, Request.get_url, prep_tags,
  view_directory, view_log, human_readable_diff): added
  URL escaping

* (Request.run_viewcvs, _strip_suffix): changed fake-suffix code to actually
  interpret the fake suffixes instead of just stripping them off


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@668 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-02 01:28:09 +00:00
rey4
61406314a9 Changes intended to simplify handling URLs in ViewCVS. Nearly all
links between ViewCVS pages are now constructed by a new Request
method called "get_link," and all URL parsing happens in another new
Request method called "run_viewcvs."

I also added support for a new optional parameter called "view." It
provides a more uniform way of linking to ViewCVS pages, so you can
say

  /viewcvs/dir/file.txt?view=log
  /viewcvs/dir/file.txt?view=co
  /viewcvs/dir/file.txt?view=annotate
  /viewcvs/dir/file.txt?view=markup

instead of

  /viewcvs/dir/file.txt
  /viewcvs/*checkout*/dir/file.txt
  /viewcvs/dir/file.txt?annotate=head
  /viewcvs/dir/file.txt?rev=HEAD&content-type=text/vnd.viewcvs-markup

Changes which are not backwards compatible had to be made to some
template files. Old templates will not work with the new code.


* templates/include/branch_form.ezt:
* templates/include/diff_form.ezt:
* templates/include/paging.ezt:
* templates/include/sort.ezt:
* templates/diff.ezt:
  changed to use form action and hidden fields provided by the script

* templates/directory.ezt: got rid of relative urls, changed to use
  form action and hidden fields provided by the script

* templates/graph.ezt: changed to take image path from the script

* templates/header.ezt: got rid of "qquery" variable

* templates/log.ezt: changed the way diff and annotate links get
  constructed

* lib/viewcvs.py (Request.__init__): moved out url parsing stuff into
  new "run_viewcvs" method.

  (Request.run_viewcvs): new Request method to hold all url parsing
  code and replace the global function with the same name.

  (Request.get_url, Request.get_link): new methods to construct urls
  for ViewCVS pages. Most of the hyperlinks that appear in generated
  pages are now made by these functions.

  (get_up_path): turned off special handling of attic directory for
  subversion, switched names of regular expressions

  (_legal_params, _validate_param, _validate_root): added new 'view'
  parameter, turned off separate validation for root parameter

  (_re_validate_revnum): allow empty string to be specified as a
  revision number. needed to prevent validation error when doing a
  regular expression search on the cvs trunk (which sets
  only_with_tag to "")

  (_strip_suffix, _repos_pathtype): added some new helper functions

  (sticky_query, toggle_query, download_url): removed these functions,
  Request.get_url() is now used instead.

  (clickable_path, prep_tags, augment_entry): changed signatures and
  implementations to use Request.get_url

  (is_viewable, is_viewable_image): changed is_viewable() to
  is_viewable_image() to avoid overlap in functionality with is_text()

  (nav_header_data): got rid of 'qquery' template parameter, changed
  'file_url' to use an absolute pathname instead of a relative one

  (view_auto): new function that marks up the current file if it is
  viewable, otherwise downloads it. called when a user clicks on the
  revision numbers in directory listings.

  (view_markup, markup_stream): renamed markup_stream to view_markup
  and changed signature

  (get_file_data_svn): no longer tries to generate physical pathnames
  for subversion files since the values it did generate were
  meaningless and were ignored anyway.

  (get_file_data): changed docstring

  (prepare_hidden_values): changed signature

  (view_directory, view_directory_cvs, view_directory_svn): factored
  out some of the common parts of view_directory_cvs and
  view_directory_svn functions into a new function called
  view_directory. implementations were also changed to use new get_url
  and get_link functions

  (view_log, view_log_cvs, view_log_svn): ditto

  (process_checkout): changed signature and moved in support for
  subversion

  (view_checkout, search_files): changed implementations to deal with
  new url handling, and the changes to process_checkout.

  (view_annotate, human_readable_diff, download_tarball): changed to
  use new url methods

  (view_cvsgraph): changed signature to be consistent with
  view_checkout, view_annotate, view_markup, etc. Added new template
  parameter 'imagesrc' so the graph url doesn't have to
  be hardcoded in the template.

  (cvsgraph_image, view_cvsgraph_image): renamed cvsgraph_image to
  view_cvsgraph_image and changed its signature (also for consistency
  with the other view_* functions).

  (_views, _view_codes): new dictionary objects mapping "view"
  parameter values to functions that produce various viewcvs pages.

  (handle_config): got rid of global "default_settings" dictionary

  (run_viewcvs): replaced by Request.run_viewcvs

  (main): now calls Request.run_viewcvs()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@667 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-07-01 08:35:28 +00:00
rey4
4a3ac177ee just changed tabs to spaces.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@666 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-27 22:45:03 +00:00
cmpilato
0a88d6f1a6 * viewcvs/lib/vclib/svn/__init__.py
(get_logs, fetch_log): Add file sizes to file LogEntry() items.

* viewcvs/templates/log.ezt
  Add file size display for Subversion repositories.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@665 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 19:54:13 +00:00
cmpilato
dd34c9fd4c Implement templatized error messages. Thanks to Russell Yanofsky
<rey4@columbia.edu> for bringing sanity to my morning with his fix of
the "isinstance()" usage.

* viewcvs/lib/config.py
  (set_defaults): Add new default value for self.templates.error.

* viewcvs/viewcvs.conf.dist
  (error): New configuration variable for specifying the error template.

* viewcvs/templates/error.ezt
  New default error template.

* viewcvs/lib/debug.py
  (ViewCVSException.__init__): Lose the 'description' member.
  (PrintException): Now prints exception data passed in (doesn't do
    the sys.exc_info() call itself any more).
  (GetExceptionData): New generic exception data harvester for use
    with templatized output.

* viewcvs/lib/viewcvs.py
  (view_error): New error printer that tries to use the error template
    before falling back to direct output.

* viewcvs/lib/query.py
  Update calls to debug.PrintException() to get the exception data
  from debug.GetExceptionData()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@664 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 18:18:41 +00:00
rey4
d30f21f382 bugfix in PrintException. code was checking to see the exception type
was an instance of ViewCVSException instead of the exception object.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@663 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-26 17:07:10 +00:00
cmpilato
f6a150d62b Fix a template bug reported by Branden Robinson <branden@deadbeast.net>.
* templates/include/branch_form.ezt
* templates/include/diff_form.ezt
* templates/include/sort.ezt
  Use an action="" value in these forms that can deal with both states
    of the root_as_url_component option.

* lib/viewcvs.py
  (view_log_cvs, view_log_svn): Add 'current_root' to the data
    dictionary.  This is "just because", not really related to the bugfix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@662 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-25 20:32:03 +00:00
cmpilato
fc69db201e * viewcvs-install
Fix the final instructions to point to the updated location of
    viewcvs.cgi (now in www/cgi/ instead of just cgi/)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@661 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-25 20:29:03 +00:00
cmpilato
1f7b439cb0 Fix the example used to demonstrate working Subversion bindings.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@660 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-16 18:19:04 +00:00
rey4
3b02f55c88 Changed windows implementation of popen() to call CreateProcess with a "nul"
file handle instead of no handle at all when discarding the child process's
standard error output. Without this change, some versions of RCS crash when
they try to print warning messages.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@659 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-09 23:20:00 +00:00
rey4
0626128b12 - changed recommended python distribution and rcs binaries
- got rid of references to binaries folder
- changed spacing in a few places


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@658 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-08 19:46:30 +00:00
rey4
b762466add * www/cgi/viewcvs.cgi, www/cgi/query.cgi, www/viewcvs-strace.sh,
cgi/viewcvs.cgi, cgi/query.cgi, cgi/viewcvs-strace.sh
  - moved stub scripts from cgi/ to www/cgi/

* cgi/granny.cgi
  - deleted since annotate functionality is already intergrated into
    viewcvs

* cvsgraph.conf.dist, viewcvs.conf.dist,
  cgi/cvsgraph.conf.dist, cgi/viewcvs.conf.dist
  - moved configuration files from cgi/ to project root

* www/mod_python/.htaccess, www/mod_python/query.py, www/mod_python/viewcvs.py,
  windows/htaccess.mod_python, windows/query.py windows/viewcvs.py
  - moved mod_python files from windows/ to www/mod_python/

* www/asp/query.asp, www/asp/viewcvs.asp,
  windows/query.asp, windows/viewcvs.asp
  - moved asp files from windows/ to www/asp/

* viewcvs-install
  - updated installer to deal with all the moved files

* INSTALL windows/README website/upgrading.html
  - updated documentation with new file locations and mod_python information


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@657 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-03 06:24:59 +00:00
rey4
b0178f0511 bugfix in PrintException()
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@656 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 18:53:12 +00:00
rey4
76657fb8ad - fixed incorrect path in ASP installation instructions
- updated mod_python installation instructions (the new version has a
  windows installer)
- added a link for help troubleshooting mod_python
- deleted information about old enscript bugs, and added information about
  a new enscript problem.
- added URL for CvsGraph building instructions


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@655 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 05:14:50 +00:00
rey4
d35d170619 explicitly set mod_python's default content-type to text/html to prevent
it from automatically deducing different values


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@654 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:42:30 +00:00
rey4
f62fc9bd69 * lib/win32popen.py:
- removed nonblocking implementation of win32popen.MakeSpyPipe(). It added
    unnecessary complexity and had a flaw which made it inefficient to boot.

* lib/popen.py:
  - changes to work with new win32popen.CreatePipe() signature


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@653 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:40:44 +00:00
rey4
9c77b6eb7d fixed pipe_cmds() to work with mod_python on unix
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@652 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:05:00 +00:00
rey4
da232542ef Updated instructions for new versions of enscript and rcs tools. Also fixed
some typos and grammatical errors.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@651 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-27 02:47:33 +00:00
rey4
870580afb4 cvs ci standalone.py lib/sapi.py
* lib/sapi.py standalone.py
  changed sapi implementations of header() methods to accept status arguments
  set to None


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@650 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-27 02:46:53 +00:00
cmpilato
946a206b08 Add tarball support for Subversion repositories. Patch by Ben Collins
<bcollins@debian.org>, modified a little bit by cmpilato.

* lib/viewcvs.py
  (generate_tarball_cvs): Was generate_tarball().
  (view_directory_svn): Add linkage for tarball download().
  (generate_tarball_svn): New.
  (download_tarball): Now call either generate_tarball_svn and
    generate_tarball_cvs, depending on the root type.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@649 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-25 18:10:18 +00:00
cmpilato
d6806afe25 Track rename of Subversion binding module util->core.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@648 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-05-22 16:14:53 +00:00
cmpilato
38a02d75ea (view_log_svn): Protect against NULL log messages in Subversion
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@647 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-29 20:38:35 +00:00
cmpilato
5473b5d8d4 No longer display "Changes since" for non-CVS repositories
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@646 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-29 20:32:51 +00:00
cmpilato
aa32130d2e * lib/vclib/__init__.py
(InvalidRevision): New exception.

* lib/vclib/svn/__init__.py
  (date_from_rev, fetch_log, SubversionRepository.__init__): Raise new
    InvalidRevision exception where applicable.

* lib/viewcvs.py
  (Request.__init__, view_diff): Catch the new InvalidRevision
    exception from the vclib for Subversion actions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@645 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-04-16 16:00:30 +00:00
cmpilato
1fbc1eeb13 Add myself and Russell to the Who list (with gstein's blessing).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@644 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-20 17:23:03 +00:00
cmpilato
00de9ce28f Let the Subversion integration breathe the fresh air.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@643 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-20 16:29:38 +00:00
rey4
459ed3fea3 * lib/sapi.py
- Filled in ModPythonServer and AspServer header() methods to make use of
      the new http 'status' parameter. Also, changed CgiServer's header()
      method to ignore the status parameter under IIS to prevent the server
      from discarding the ViewCVS output and instead sending a static error
      page.
    - ModPythonFile and AspFile classes have been eliminated and replaced
      with a more generic File class. All server classes have new write()
      and flush() methods.
    - Common code from AspServer and ModPythonServer has been moved into
      a base class called ThreadedServer. AspProxy is renamed to
      ThreadedServerProxy.
    - All server classes now inherit from a new base class called Server
      which contains the small amount of code common to all of them.
    - added fix_iis_path_info() function, renamed IIS_FixURL() to
      fix_iis_url()
    - renamed getFile() methods to file()

* lib/viewcvs.py
    - Eliminated global server variable. Changed some scattered
      server.escape() calls into cgi.escape() calls. Got around other uses
      of the variable by adding a server member to the Request class.
    - Deleted gstein's strongly worded comment about the quality of the sapi
      hack :)
    - Page-global 'g_name_printed' is now passed as a normal parameter
      called 'name_printed' to the augment_entry() function
    - Got rid of some confusing string manipulation in human_readable_diff()
    - added 'server' parameter to viewcvs.main() to avoid relying on the
      sapi.server global variable

* cgi/viewcvs.cgi, windows/viewcvs.py, windows/viewcvs.asp
    - Added 'server' parameter to viewcvs.main() calls

* standalone.py:
    - Changed StandaloneServer.header() method to accept http status code
    - Added 'server' parameter to viewcvs.main() call

* lib/query.py
    - added 'server' parameter to query.main() to avoid relying on the
      sapi.server global variable
    - got rid of global 'server' variable and page-global 'viewcvs_link'
      variable, instead those values are passed as function parameters

* cgi/query.cgi, windows/query.py, windows/query.asp
    - Added 'server' parameter to query.main() calls

* lib/debug.py
    - Changed PrintStackTrace(), PrintException(), and DumpChildren() not to
      rely on global sapi.server variable and to use new server.write()
      method

* lib/popen.py
    - changed server.getFile() calls to server.file()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@642 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-12 23:08:09 +00:00
cmpilato
c74fa8eb35 * lib/vclib/svn/__init__.py
(itemtype): Make this more efficient (and more correct).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@641 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:42:03 +00:00
cmpilato
69383e0c33 Protect against silly user-entered data in the diff forms.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@640 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:38:01 +00:00
gstein
f30b808cc7 Restore the ability for errors to generate non-200 responses. This was
broken when sapi was introduced.

* lib/debug.py:
  - import 'sys' at the global level since it is fast enough, and we
    also want to be able to grab the exc_info() without any imports
  (ViewCVSException.__init__): rename var to 'status' as it represents
    the HTTP Response Status rather than an "http code"
  (ViewCVSException.__str__): revamp the output a bit for cleaner
    display within a traceback.
  (PrintException): grab the exception early, so that other code can't
    overwrite it. if necessary, pass an HTTP response to
    server.header(). tweak a bit of the exc_info() result handling.
    tweak the generated output.

* lib/sapi.py:
  (CgiServer.header): take and output an HTTP response status.
  (AspServer.header): take an HTTP response status. don't worry about
    returning 0/1 from the call (the result is unused)
  (ModPythonServer.header): take an HTTP response status. drop the
    return value.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@639 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 23:11:57 +00:00
gstein
d51c87a71a Various fixes and improvements.
* lib/config.py:
  (_parse_roots): get rid of a string method usage.

* lib/popen.py:
  (pipe_cmds): stop using the += syntax (not compatible with 1.5.2)

* lib/sapi.py:
  (CgiServer.__init__): use os.environ, not os.getenv()
  (IIS_FixURL): stop using the += syntax

* lib/viewcvs.py:
  - note: these changes look big, but are small. use 'cvs diff -b' to
    see the real change without the reindentation.
  (markup_stream_python): record a note about some future work
  (run_viewcvs): new function which holds the guts of ViewCVS. this
    used to be main() a long while back before that got monkeyed. this
    is really just a reindent.
  (main): hold the exception handling logic. tweak then the t_start
    and t_end calls are made, relative to the try/finally.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@638 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 20:43:06 +00:00
gstein
14c0409e77 handy script for tracing ViewCVS's syscalls
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@637 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-11 20:35:23 +00:00
rey4
690e7b6e8f installation now prompts to delete .py or .pyc files that don't belong
in install folders


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@636 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-03-03 09:57:06 +00:00
rey4
418e33776e Restored the line that deletes the return of exc_info() in PrintException(). Also added a try/finally block to make the exception-printer exception-safe.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@635 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-28 01:08:10 +00:00
cmpilato
b62f0bf4c5 Expose the filename to the log templates.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@634 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 23:03:21 +00:00
cmpilato
0c0999a9c7 Fix a little CVS/Subversion discrepency (and in the process, fix the
nav_path so that the Attic is optionally displayed based on the
hideattic CGI param).

* viewcvs/lib/viewcvs.py
  (_re_up_attic_path, get_up_path): New.  Change all other users of
    _re_up_path to call this function instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@633 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 22:44:47 +00:00
gstein
6227db7a91 Various small changes:
- fix syntax to be Python 1.5.2 compatible
  - no += operator
  - no "value in dict" operations
- remove a,b=c,d types of assignments; there is no reason to do tuple
  packing/unpacking; just use two assignments
- rename ViewcvsException to ViewCVSException; leave in a grandfather
- couple style nits


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@632 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 21:34:57 +00:00
cmpilato
fa4ad62287 Just some 80-column formatting changes.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@631 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-27 21:26:11 +00:00
gstein
9c346b051f Ensure that we open ,v files in binary mode.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@630 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-26 02:31:31 +00:00
rey4
4e9a300681 fixed interpretation of win32file.ReadFile() return value
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@629 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-26 01:39:51 +00:00
timcera
e0f09153bb Changed the length of dir and file VARCHAR fields from 128 to 255. I felt
this was the best (and easiest) change compared to changing the type
because of the possible introduction of subtle differences in the treatment
of VARCHAR and TEXT.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@628 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-22 03:52:14 +00:00
rey4
c8d318c670 replaced += operation with call to list extend method for pre-2.0 python compatibility
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@627 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:43:11 +00:00
rey4
b85fb5485e fix enscript documentation
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@626 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:22:03 +00:00
rey4
a79f56d178 bugfix: enabled display of pipe_cmds error streams in debug mode
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@625 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-20 10:21:08 +00:00
rey4
4e2aa11281 changed installer to not install windows-only files on unix!
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@624 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 23:24:29 +00:00
rey4
74b01543ae Updated with new locations of asp and mod_python files
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@623 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 22:51:27 +00:00
rey4
82729d4181 simplified apache handler using execfile()
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@622 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 06:23:32 +00:00
rey4
e586a6785b Now adds "_page" suffix to module_name once instead of twice
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@621 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:39:00 +00:00
rey4
90c060be4c - moved global g_name_printed variable into server.pageGlobals
- fixed scoping problem in Request.__init__()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@620 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:35:41 +00:00
rey4
358a5c2aa5 got rid of unneccessary imports
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@619 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:33:07 +00:00
rey4
c95a191275 replaced prints with writes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@618 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:31:35 +00:00
rey4
72c395bc35 moved ASP and mod_python folders out of "cgi" directory
and into the "windows" area. Updated windows readme with
the new locations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@617 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:29:21 +00:00
rey4
69b548a1b3 important bugfix for loginfo handler, didn't handle multidigit version numbers
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@616 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:56:35 +00:00
rey4
2cb8aa851b added environment variable dump
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@615 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:56:12 +00:00
rey4
e6d529b874 renamed variable
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@614 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:42 +00:00
rey4
5786f0958c commited Ivo Roessling's bugfix
http://mailman.lyra.org/pipermail/viewcvs/2003q1/001622.html


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@613 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:26 +00:00
rey4
27be5778fc fix for mod_python
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@612 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:55:04 +00:00
rey4
5a7ae45fa1 minor changes to sapi interface for mod_python support
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@611 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:54:41 +00:00
rey4
1d1816cc8c added the new mod_python files
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@610 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:54:21 +00:00
rey4
c23a80b4fe removed bit about mxDateTime and updated information about loginfo handler
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@609 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:53:44 +00:00
rey4
6037eefa8c added a new 0.9 section with blurb about UTC times in database
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@608 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:53:00 +00:00
rey4
6ab242782a removed bit about mxDateTime
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@607 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:52:26 +00:00
rey4
c878d98e57 readme from third release
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@606 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:49:24 +00:00
rey4
3127bf9af6 readme from second release
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@605 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:48:11 +00:00
rey4
db8777345b There are a few significant changes to the loginfo handler script.
1) There's a new way to pass it parameters. You can write:

  ALL <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv}

instead of:

  ALL (echo %{sVv}; cat) | <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler

although for backwards compatibility, the old invokation still works. The
reason for the change is to make life easier for windows users who do not
typically have cat and a unix-style echo command installed on their machines.

2) It now sort of supports spaces in file names. Current versions of CVS pass
loginfo parameters in a space-separated string without bothering to escape the
spaces that can occur in filenames within the string. This can make it
impossible to unambiguously parse, so a heuristic is used to guess which spaces
are meant to be separators and which are part of file names. (See the
documentation string for the HeuristicArgParse() function for a description of
how it works). The heuristic should be pretty reliable when spaces are used in
filenames AND directory names, extremely reliable when spaces are allowed in
EITHER filenames OR directory names, and completely reliable in the
unambiguous case when there are no spaces in path names.

There is a completely different situation with CVSNT. CVSNT does escape spaces
and special characters with backslashes so no heuristic is needed. A separate
parsing routine is used for this case.

3) By default the loginfo handler will run the CVSNT parsing routine on windows
and the heuristic parsing routine on all other platforms. But since CVSNT has
been backported to Unix, there may be some people who need to override the
default. This can be done by tacking on a second parameter:

  ALL <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler %{sVv} <arg2>

where <arg2> is either "cvs", "cvsnt", or "brokencvsnt". "brokencvsnt" is for
some semi-recent versions of CVSNT which mistakenly escaped filenames twice.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@604 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 03:09:17 +00:00
rey4
dea026e417 - changed some popen calls to discard warnings from RCS utilities that occur
when reading CVSNT RCS files with nonstandard fields


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@603 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:59:58 +00:00
rey4
2f8d06bd7c - added C++ formatting for .hpp extension
- changed some popen calls to discard warnings from RCS utilities that occur
  when reading CVSNT RCS files with nonstandard fields
- caused exit after tarball generation to prevent html from being appended
  to the end of the tarball


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@602 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:59:25 +00:00
rey4
d8b66eebde - fixed debug.PrintStackTrace() function
- updated child process tracker to use the sapi.server.pageGlobals dictionary


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@601 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:58:04 +00:00
rey4
8ad4c2657e - now converts path names to a canonical format with the os.path.normcase()
function before sending them to the database to avoid the problems with
  multiple path spellings on windows


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@600 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:57:21 +00:00
rey4
6659847cb7 - removed unneccesary cvsroot path manipulation
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@599 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:56:33 +00:00
rey4
b7877e0d0c - removed hardcoded links in query page
- replaced cvsroot_name_from_path() function with a lookup table


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@598 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:56:11 +00:00
rey4
561a2074d3 - removed hardcoded links in query page
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@597 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:55:40 +00:00
rey4
0ecbd1d45d - added sapi.server.pageGlobals dictionary to hold values and objects that
need to be kept for the duration of a page load


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@596 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:54:53 +00:00
rey4
6b47a6c80f - explicitly set text and binary modes on calls to popen
- replaced some convoluted time converting code with a call to compat.timegm()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@595 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:10:43 +00:00
rey4
bed66c3ea8 now replaces forward slashes in windows paths with backslashes before
passing them to the database. also changed loginfo-handler to print
errors to the standard error stream instead of the standard out so
messages can get forwarded to the CVS client.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@594 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:05:00 +00:00
rey4
458cfb4785 removed this unused copy of popen.py (more recent version is lib/popen.py)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@593 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 10:00:13 +00:00
rey4
f6f2654281 - modified popen module to work on windows
- added debugging mode for popen which can display the input and
  output from child processes (only works on windows for now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@592 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:57:46 +00:00
rey4
99b5381080 - updated to use new sapi module
- added support for php colorizing (using the colorizing capabilities of the
  php interpreter)
- replaced error() function with a ViewCVS exception class
- added explicit text 't' and binary 'b' mode flags to popen calls


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@591 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:50:44 +00:00
rey4
e808ff8ce9 - updated to use new sapi module
- now can display local times if the use_localtime configuration option
  is set


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@590 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:49:00 +00:00
rey4
e7cb800f6d added new sapi module which abstracts away differences between the different
server environments that ViewCVS runs on (CGI, ASP, standalone)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@589 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:48:05 +00:00
rey4
007ea0d99d - got rid of mxDateTime dependency
- made database store times in UTC by default instead of using
  the local timezone of the machine running ViewCVS. For backwards
  compatibility a global variable dbi.dbi_utc_time can be set to
  zero to use old behavior
- fixed use of some nonexistent constants in cvsdb.py
- allow forward slashes in directory and repository conditions
  of database searches regardless of the default path separator
  used by the underlying os


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@588 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:33:12 +00:00
rey4
2b2f676ee3 worked around lack of working popen2.Popen3 class on windows
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@587 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:21:08 +00:00
rey4
2a8a87b1a6 updated to cope with colons and backslashes in windows paths
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@586 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:17:55 +00:00
rey4
c10162e3da updated installer for windows compatibility
- escaped backslashes in regular expressions
- added viewcvs.asp and query.asp to FILE_INFO_LIST
- set default install path to "Program Files" directory


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@585 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:16:09 +00:00
rey4
ac310d82cb fixed line endings
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@584 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-08 01:15:07 +00:00
timcera
595556b544 Need to set CVSROOT in order for spawned RCS utilities to correctly
expand $CVSHeader$.  See patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=636331&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@583 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-01 05:42:29 +00:00
timcera
bd78d04280 Bolding revision number. See patch
http://sourceforge.net/tracker/index.php?func=detail&aid=621979&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@582 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-01 05:02:09 +00:00
timcera
59c63fab78 Added some filetypes to enscript's colorization list. Filetypes and enscript
settings used from
http://sourceforge.net/tracker/index.php?func=detail&aid=571973&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@581 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-31 03:00:59 +00:00
cmpilato
a25b7cc8ba (view_directory_svn): pass diffoptions as a list instead of a string
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@580 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-27 17:36:29 +00:00
cmpilato
fa05f953c2 (view_directory_svn): allow empty log messages
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@579 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-27 16:36:00 +00:00
cmpilato
5eca0694fb Track changes in the Subversion bindings; use top-level svn modules
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@578 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-01-21 21:30:17 +00:00
pefu
8730954b1e Clarified usage text and removed one trailing blank
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@577 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-28 10:14:30 +00:00
cmpilato
932aa382f0 * viewcvs/lib/vclib/svn/__init__.py
(date_from_rev): New.

* viewcvs/lib/viewcvs.py
  (_re_extract_rev): Fix this regexp to allow Subversion-style
    revision numbers, too.
  (view_diff): Fix Subversion diff labels to have datestamps and revisions.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@576 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-13 19:01:02 +00:00
cmpilato
5a5450e4c9 Implement alternative URL scheme, and make Subversion a little more
public.  Miscellaneous Subversion bug fixes, too.

* viewcvs/lib/config.py
  (Config.set_defaults): Add default state for 'root_as_url_component'
    option.  Remove "CVS" from the 'general/address' and
    'general/main_title' default values.

* viewcvs/cgi/viewcvs.conf.dist
  Lots of documentation changes in here.
  (root_as_url_component, svn_roots, svn_parent_path): New options.
  (address, main_title): Lose the "CVS" in the value.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Handle the new 'root_as_url_component' option.
  (list_roots): New.
  (clickable_path, download_url): Take any embedded roots into account
    during href generation.
  (view_diff): Fix the revision parsing here.  I dunno why I ever made
    this code CVS-specific in the first place...
  (view_log_svn): Populate 'roottype' data member.
  (view_log_cvs): Was view_log().  Populate 'roottype' data member.
  (view_directory_cvs, view_directory_svn): Use new list_roots()
    helper.  Also, calculate 'nav_path' unconditionally (it may be
    None, but it will at least be defined so templates can use it).
  (main): Update call to view_log_cvs().

* templates/directory.ezt
* templates/dir_alternate.ezt
  Take 'embedded_root' into account for href generation.

* templates/log.ezt
  Do some "CVS" vs. "Subversion" string changing.  Disable "annotate"
  link for Subversion.

* templates/log_table.ezt
  Disable "annotate" link for Subversion.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@575 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-12 02:02:52 +00:00
cmpilato
1e1b541063 track API rename
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@574 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-12-10 19:34:25 +00:00
cmpilato
794354e63a * viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Make the [hide] link conditional on the presence of the
    'attic_showing' data member. Also, treat the directory named 'Attic'
    special only for cvs roottypes.

* viewcvs/lib/viewcvs.py
  (view_directory_cvs): Setup the new 'attic_showing' data member.
  (view_directory_svn): Don't bother with the 'hide_attic_href' and
    'show_attic_href' data members.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@573 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-11-15 00:11:57 +00:00
timcera
6f118cda72 Code block removed that was supposed to handle some redirection issues
but failed under certain conditions (SERVER_URL not defined) and the
redirection problems are handles elsewhere in the code.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@572 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-22 03:01:53 +00:00
cmpilato
dabbdbd23c * lib/vclib/bincvs/__init__.py
Make BinCVSRepository a subclass of vclib.Repository.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@571 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-14 23:58:41 +00:00
gstein
f3ca7b9118 entity-escape some ampersand that go into the URLs on the page
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@570 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 23:14:23 +00:00
gstein
43c6a836e4 Fix the URL construction to use entities for the ampersands.
Submitted by: Ville Skytt� <scop@users.sourceforge.net>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@569 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 23:08:52 +00:00
gstein
53913a48d1 Fixes bug #536141 and #536144, submitted by Franz H�pfinger.
Escape the paths generated by clickable_path() and download_url()


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@568 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 22:10:01 +00:00
gstein
42f004c911 Minor cleanups.
- remove the revision_symbolic_name since it was bogus and unused
- quote the outer table attributes for xhtml compat
- remove the unused usedlog
- change the line number formatting to simplify the width usage
  (through the '*' format character) and to make the name= anchor
  surround the actual number rather than empty space.
- use '*' for author formatting, too
- remove the '.diff' from the URLs


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@567 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:53:14 +00:00
gstein
8ec28642ba * lib/viewcvs.py (prepare_hidden_values): tweak the <input> tag to
make it xhtml compatible.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@566 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:18:39 +00:00
gstein
08a5af8aef Recognize cvsweb's custom MIME type. This allows people to upgrade
their cvsweb installation to ViewCVS and still have old URLs do the
right thing.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@565 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-10 00:14:57 +00:00
gstein
c82276049a Various changes:
- remove diff_font_face/size options and move the font stuff from code
  to the diff.ezt template
- move error() back to viewcvs.py and have config.py raise an
  exception (so config doesn't have to know about CGI stuff)
- revamp SVN parent path stuff to avoid catch-all try/except

* cgi/viewcvs.conf.dist: remove the diff_font_face and diff_font_size
    options. These are now part of the diff.ezt template.
    COMPAT BUSTER

* templates/diff.ezt: need to apply font changes since the EZT
    references no longer include them.

* lib/viewcvs.py:
  (error): moved (back) here from config.py
  (DiffSource._get_row): stop inserting HTML into the values; leave
    that for the template to do however it wants
  (handle_config): catching all exceptions is very, very dangerous.
    rework this code to avoid exceptions thru the use of
    os.path.exists() and wrap an OSError exception catcher around the
    small little bit that might throw it.

* lib/config.py:
  (error): shifted back to viewcvs.py
  (_parse_roots): shifted below the "important" part of this file,
    which is the config stuff. changed the error handling to throw an
    exception rather than call error()
  (MalformedRoot): new exception. note that ViewCVS includes code for
    catching exceptions and pretty-printing them to an HTML page, so
    we don't need a specific catch of this exception.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@564 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 04:04:03 +00:00
gstein
ddd22c15b5 A new utility module to compute sets of changed files inside a loginfo
handler. It properly deals with spaces in the paths and the filenames.
See the internal doc for more information.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@563 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 01:47:43 +00:00
gstein
37e1e3aa93 Fix up some of the imports. Some were not needed. Also avoided the
importing of bare names, so that references are vclib.FOO (more
obvious where FOO came from). Also fixed references to the
RCSStopParser name, which were unqualified (and would have failed).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@562 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-09 01:46:56 +00:00
cmpilato
97b7b4863b * viewcvs/lib/viewcvs.py
(handle_config): Oops.  Little fix for skipping non-repos dirs in
    the parent path.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@561 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-04 22:17:36 +00:00
cmpilato
b6e6db84c8 Implement a new svn_parent_path configuration variable.
* viewcvs/lib/config.py
  (Config.set_defaults): Add default value for 'svn_parent_path'.

* viewcvs/lib/viewcvs.py
  (handle_config): So special handling for 'svn_parent_path'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@560 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-04 20:52:11 +00:00
cmpilato
341f1e8fe4 Hehheh...do some cleaning up, properly shutting down the repository
and terminating the APR stuffs.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Update call to SubversionRepository.__init__().

* viewcvs/lib/vclib/svn/__init__.py
  (SubversionRepository.__init__): No longer take pool argument; do
    all the APR init stuffs inside this constructor.
  (SubversionRepository.__del__): New.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@559 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-03 15:06:35 +00:00
cmpilato
8fdacfb716 Finish getting that enscript stuff working for Subversion, and
implement rudimentary directory version jumping.

* viewcvs/lib/vclib/svn/__init__.py
  (date_from_rev): New.
  (StreamPipe): new class.
  (get_file_contents): now returns StreamPipe object.

* viewcvs/templates/directory.ezt
  Get some subversion directory-revision-jumping UI action on.

* viewcvs/lib/viewcvs.py
  (Request.__init__): Allow 'HEAD' as incoming 'rev' option.
  (view_checkout): Use new get_file_contents() return.
  (view_directory_svn): Populate new 'roottype', 'tree_rev' and
    'jump_rev' data members.
  (view_directory_cvs): Populate new 'roottype' data member.

* viewcvs/lib/config.py
  (set_defaults): Stop using real default values for cvs_roots and
    default_root.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@558 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-02 20:00:27 +00:00
cmpilato
749762bb37 * viewcvs/lib/viewcvs.py
(markup_stream): Only do log-reading for CVS right now.
  (view_log_svn): Fix the view link, and fix the selected rev comparison.
  (view_checkout): Try to get some enscript-y action going on here.
  (view_diff): Clarify a comment just a bit.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@557 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-02 17:32:38 +00:00
gstein
94ce93766d comment nit
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@556 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 21:14:57 +00:00
cmpilato
1c6914a304 * viewcvs/lib/viewcvs.py
(view_log_svn): Get "select for diffs" working.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@555 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 20:00:18 +00:00
cmpilato
0b682e93b2 Get some basic diff functionality working for Subversion.
* viewcvs/lib/vclib/svn/__init__.py
  (do_diff): New.

* viewcvs/lib/viewcvs.py
  (view_checkout): Be a little smarter with mime types.
  (view_diff_svn): Can this function (buh-bye).
  (view_diff): Get initial Subversion diff support in here.  Also,
    remove the cvs_filename parameter -- this path can be retrieved
    from the request object.
  (main): Update call to view_diff_svn and view_diff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@554 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-10-01 19:20:37 +00:00
cmpilato
6760cc1c62 Address Issue #584803.
* viewcvs/lib/viewcvs.py
  (search_files): Skip unversioned files.  Thanks to David Resnick and
    Steve Frampton for noticing the problem.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@553 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-27 15:25:55 +00:00
cmpilato
b5d5e9d245 * viewcvs/lib/viewcvs.py
(handle_config): Use '' instead of None for the default value of
    "search".  A bug in urlencode() requires it.
  (view_diff_svn): New placeholder function.
  (Request.__init__, human_readable_diff): No longer chop the '.diff'
    off of the path.
  (main): Reorg the code here a bit.  I'm pretty sure I didn't
    actually change the logic outside of adding: redirect on file
    paths that have the extra '.diff' tacked on, and call the
    view_diff_svn stub at the right time.

* templates/log.ezt
* templates/log_table.ezt
* templates/include/diff_form.ezt
  Stop tacking that confounded ".diff" onto the diff queries.  The
  presence of r1 and r2 are enough to do the job.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@552 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-27 14:53:31 +00:00
cmpilato
d4271f954c * lib/viewcvs.py
(view_log_svn): New hacked-up half-hearted attempted at getting
    Subversion file revision history output.  Boy, if only those
    who've gone before me had documented the cryptic template data
    items, this kind of guesswork and weak deduction would be
    unnecessary... :-)
  (main): Do different stuff if 'rev' or checkout magic exists on a
    Subversion root request.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@551 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-23 17:01:23 +00:00
cmpilato
fefafefa2f * viewcvs/lib/vclib/svn/__init__.py
(LogReceiver.receiver): Add 'paths' argument (unused).
  (fetch_logs): _repos.get_logs is now _repos.svn_repos_get_logs.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@550 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-20 20:53:51 +00:00
cmpilato
c73e1cd5a4 * viewcvs/lib/vclib/svn/__init__.py
(_datestr_to_date, _fs_rev_props): New helpers.
  (LogEntry): Edit some comments.
  (LogReceiver): New.
  (get_logs): Use new helpers.
  (fetch_log, get_file_contents): New.
  (SubversionRepository.__init__): Store the repos item as a member.

* viewcvs/lib/viewcvs.py
  (main, view_checkout): Add crap-O Subversion file dump support (this
    is rather temporary, methinks).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@549 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-19 19:28:22 +00:00
cmpilato
87285b75f1 Fix datestamps and sorting for Subversion items.
* viewcvs/lib/vclib/svn/__init__.py
  (get_logs): Use the correct datestamp for Subversion tree items.

* viewcvs/lib/viewcvs.py
  (sort_file_data): Rename internal routine file_sort_cmp() to
    file_sort_cmp_cvs(), and add new file_sort_cmp_svn().  Add
    'roottype' argument to trigger which of those sort routines gets
     used.
  (view_directory_cvs): Update call to sort_file_data().
  (view_directory_svn): Update call to sort_file_data(), and populate
    the row data a little differently.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@548 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-10 17:15:08 +00:00
cmpilato
ab3b8795e3 Continue Subversion integration. Can now view trees (at any revision,
with minor browser Location bar hackery).

* viewcvs/lib/viewcvs.py
  (Request.__init__): Recognize 'rev' CGI field for Subversion roots.
  (sort_file_data): New, with file_sort_cmp() broken out from view_directory.
  (get_file_data_svn, view_directory_svn): New Subversions-specific functions
  (view_directory_cvs): Was view_directory.  Now uses sort_file_data() helper.
  (main): Use the appropriate view_directory_* function per roottype.

* viewcvs/lib/vclib/svn/__init__.py
  (LogEntry): New class (stolen with mods from bincvs)
  (get_logs): New.
  (SubversionRepository): Declare as a subclass of vclib.Repository.
  (SubversionRepository.__init__): Add optional 'rev' argument.  Also,
    make 'basepath' before trying to use it.
  (SubversionRepository._getvf_files, _getvf_subdirs): Fix references
    to 'pool', 'i' and 'thispath'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@547 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-10 14:02:27 +00:00
cmpilato
5b6234678b Begin adding Subversion config and query support. First step was to
rename the 'cvsroot' URL query item to 'root' (while still supporting
'cvsroot' as a valid token that just gets mapped to 'root' under the
hood) and to add support for an svn_roots configuration value (not
added to the default config file as part of this commit, though).

* viewcvs/lib/config.py
  (_parse_roots): New helper.
  (Config._force_multi_value): Add 'svn_roots'.
  (Config._process_section): Use new helper function to parse
    'cvs_roots' and 'svn_roots' configuration items.
  (Config.set_defaults): Initialize default svn_roots config item.

* viewcvs/lib/viewcvs.py
  (_sticky_vars, _legal_params): Rename 'cvs_root' to 'root'.
  (_validate_root): Was _validate_cvsroot.
  (Request.__init__): Patch 'cvsroot' query items to be 'root' items.
    Examine both CVS and Subversion root configurations and choose the
    appropriate repository.
  (view_directory): Show both Subversion and CVS roots in the templates.

* viewcvs/lib/query.py
  (build_commit): Use 'root' in the URL query portion instead of
  'cvsroot'.

* viewcvs/templates/directory.ezt
* viewcvs/templates/dir_alternate.ezt
  Replaces references to 'cvsroot' with 'root'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@546 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-06 20:36:58 +00:00
cmpilato
f8f6b1a69b Itty-bitty docstring fixes.
* viewcvs/lib/vclib/__init__.py
  (Repository._getvf_info): Fix typ-o.

* viewcvs/lib/vclib/bincvs/__init__.py
  (BinCVSRepository._getvf_info): Fix typ-o.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@545 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 20:14:32 +00:00
cmpilato
e7c52618b4 Initial implementation of Subversion vclib module.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@544 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 15:24:25 +00:00
gstein
79728fb463 Update copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@543 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:34:45 +00:00
gstein
4b21d7cb88 Rip out the rlog parser that was in this file. Leverage the parser
from vclib.bincvs instead, and apply a small compatibility layer over
the top of it. tests/testparse.py was used to verify that the new
parser/wrapper is equivalent.

[ things can be simplified further by changing the callers to not
  require the compat wrapper ]


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@542 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:18:30 +00:00
gstein
974eb42d02 This module is no longer needed. Use the vclib.ccvs.rcsparse module
instead.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@541 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:12:30 +00:00
gstein
44b8e40d50 Switch over to the vclib.ccvs.rcsparse package.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@540 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:11:42 +00:00
gstein
fd4f86f49d Fix up the time processing, based on time processing fixes from
elsewhere (stupid replicated code; will need to fix in future).

Note that we need the 'compat' module here. Also another fix for
later.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@539 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:11:09 +00:00
gstein
7472b19243 Another module that I used for testing a conversion of rlog.py. Just
checking in the code in case something similar may be useful in the
future.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@538 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 07:00:39 +00:00
gstein
5c4edd8cef Switch to the vclib.ccvs version of rcsparse. Some other assorted
testing tidbits.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@537 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-05 06:57:49 +00:00
pefu
11ca5c1a37 Bugfix: wrong exception in except clause. Thanks to C. Michael (Mike) Pilato.
He wrote:
> Quick introduction: Hi, I'm C. Michael (Mike) Pilato, a Subversion
> developer (and CollabNet-employed subordinate of Greg Stein) who's
> trying to add Subversion repository support to ViewCVS.  I'm also
> trying to learn Python as I go, so I'm begging for patch review.
>
> Anyways, I figured I'd start off with a little patch that fixes a bug
> I noticed when I (intentionally, I swear) misconfigured ViewCVS.
>
> * lib/viewcvs.py
>   (Request.__init__): bincvs's BinCVSRepository.__init__ actually
>       throws a vclib.ReposNotFound exception.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@536 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-09-01 11:34:02 +00:00
gstein
dca08bb674 Rename to "path_parts" to clarify that we're referring to a list of
path segments rather than a pathname string.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@535 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-07-18 02:27:21 +00:00
pefu
90db34f205 Inspired by Lucas Bruand email describing the CVSGrab project I
added a new subsection to the home page containing a compiled list of
Links.  This is somewhat redundant with the information contained
in the ViewCVS INSTALL file.  But on the other hand people might
not view the INSTALL file using a web browser, so this list of
links might become handy for all people who want to install
ViewCVS on an operating system which was not delivered with all
those tools preinstalled and who have to grab all those software
from the Net piece by piece.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@534 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-15 10:06:12 +00:00
pefu
d7e6668ef3 Bugfix: Apply SF patch #569246: standalone+enscript = zombies
Holger Hoffst�tte (h2o) wrote:
> When run in standalone mode, using enscript will leave
> zombie processes hanging around. These will not exit
> until the standalone.py process is restarted. The
> attached patch solves this by properly wait()ing for
> the child process. CGI mode is not affected by this,
> since the viewcvs process exits after every request
> anyway.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@533 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-15 09:56:03 +00:00
pefu
854656ea8b Added a link to the EMail explaining the disadvantages of CVS keywords.
...and argghhh... Protect the CVS keyword only used as an example herein.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@532 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-13 06:04:32 +00:00
pefu
bcf951e1b5 Document current policy for the use of CVS $-keyword macros within
the stayle guide paragraph.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@531 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-12 16:54:15 +00:00
pefu
7f580e36dd Fix Python 1.5.2 compatibility problem pointed out in
http://mailman.lyra.org/pipermail/viewcvs-dev/2002-June/000722.html
Unfortunately even the current Python documentation misses to point out,
that the function timegm() was added to the calendar module at a later
release. :-(  I will submit a patch to the Python documentation.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@530 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-12 06:38:49 +00:00
lbruand
e944408e70 Small coding style fixes
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@529 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 21:27:06 +00:00
gstein
4a3bc3f33a Implement some fixes for recent changes.
* viewcvs.py (Request.__init__): when we switched to use vclib.bincvs,
    the path_parts erroneously contained a '.diff' extension. make
    sure to strip that (found by Peter Funk).

* vclib/__init__.py (class ReposNotFound): don't override the __init__
    the method. the base Exception class will handle the argument as a
    string, and print it out appropriately.
  (class ItemNotFound): clarify that this takes path_parts, then join
    them for the superclass.

* vclib/ccvs/__init__.py (CVSRepository.__init__): don't provide the
    path for the CVS repository (info leakage); just use the name.
  (CVSRepository._getpath): parts are passed, not a pathname; adjust
    variables to clarify this.
  (CVSRepository.getitem, CVSRepository.getitemtype): the ItemNotFound
    exception is defined to take path_parts, not a pathname.

* vclib/bincvs/__init__.py (BinCVSRepository.__init__): pass the name
    of the repository to the ReposNotFound exception.
  (BinCVSRepository.getitem, BinCVSRepository.getitemtype): the
    ItemNotFound exception is defined to take path_parts, not a
    pathname.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@528 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 19:32:03 +00:00
pefu
01d04c0397 This might be a clueless fix for the problem outlined in
http://mailman.lyra.org/pipermail/viewcvs-dev/2002-June/000725.html
But it works for me.  Diff display now works again.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@527 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-11 17:42:58 +00:00
lbruand
d857b82cac Modified ccvs so that it conforms to the new API by Greg.
Modified a bit the API also:
 * Added a Versitem class from which both Versfile and Versitem inherite.
 * Added a show_CVSROOT constructor parameter in the CVSRepository.

Now that I am looking over to this code after some time, There are number
of concerns/interrogation that are coming to my mind:
 - Why not go into some more abstraction/polymorphism with the items  ( e.g.
Versfiles and Versdirs):
	shouldn't Versitems  have only one common getitemlist methods ?
	that would return Versitems
( and not two "getsubdirs" and "getfiles" methods...)

 - Quite obviously there are cyclic references in this library.
     This will flaw garbage collection.
    e.g. Versfile points to Repository. and so on...
  According to me deleting a Repository should in turn, result in the destruction of
 its subitems.
 - Another point of concern, we will have to deal with is
multithreading...  One of the current problem of viewcvs is that it does not
have multithreading. ( being a cgi it's kind of normal)  Now, having
multithreading capabilities in vclib would definitely leverage the
difficulty of porting  viewcvs to a servlet-like behaviour. A servlet-like
behaviour would be a big win for speed, according to me.

 - A very important ( if not vital) feature is lacking:
    You cannot select a tag to view in the repository ...
 - There is a problem with subversion ( named svn, from now on...):
svn, as you probably know, represent the evolution of a file hierarchy over time and not the
 evolution of files in hierarchy ( as in CVS). This API does not work with this kind of behaviour.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@526 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-09 22:20:23 +00:00
pefu
7e2052b962 Apply SF patch #565579 by Bill Newcomb (nuke999):
Correct handling of daylight saving

Bill wrote:
> While installing ViewCVS to be used with our (large,
> old, many-branched) repository, we encountered problems
> while trying to build the checkin database.  We
> eventually traced the problems to a file that had a
> checkin on the first sunday of april, when daylight
> saving time begins in the us.  The time of the checkin
> was 02:24 UTC, which is a perfectly reasonable time
> (it's actually still saturday  PST), but feeding that
> time to timelocal will generate an uncaught exception
> in rlog.py.  timegm() has been part of calendar.py
> since at least python 1.5.2, so it seems like an easy
> choice to fix this so it's more robust.  The following
> patch allowed us to get everything converted and
> running, and we really like all the extra stuff that
> ViewCVS has vs. cvsweb.

> rcsparse.py has a similar problem that is apparently
> not exercised by ViewCVS but did trip me up when I
> tried to use it with Subversion's repository converter.
>  There don't appear to my (admittedly Python-naive)
> eyes to be any other places in ViewCVS that use
> timelocal, so I think this should do it.

This patch looks reasonable to me and didn't break anything here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@525 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-07 06:07:30 +00:00
pefu
d92ff2f95e People hacking on templates have difficulties to track down errors.
This is a minor improvement on ezt template syntax error reporting.
Added two examples of bad template syntax to doctest section of the
module docstring.  Added doc string to the exception classes.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@524 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 13:05:57 +00:00
pefu
5a4a1b7216 Improved error reporting for a certain case of a malformed viewcvs.conf
configuration file.  That happened recently to some new user of ViewCVS.
Users unfamilar with Python have difficulties to interpret a Traceback
printout.

In order to implement this I decided to move the utility function
error() from module lib/viewcvs.py into the module lib/config.py and
import error() in viewcvs from module config.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@523 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 07:32:18 +00:00
pefu
2ed28fbc92 More detailed instructions how to implement access restrictions using Apache.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@522 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-06 06:22:00 +00:00
gstein
6925412e53 This commit contains three changes, which I couldn't split back apart
very easily (sorry):

1) use LogEntry for the fileinfo stuff
2) use bincvs.Repository for some basic functionality
3) update bincvs.__init__.py to the API that was checked in last week

* viewcvs.py

  (class Request): remember the split path parts. refine some of the
    error logic and messages. replace .cvsrep and .cvsroot with a
    Repository instance (and use .name and .rootpath instead).
  (_validate_cvsroot): refine the error message
  (clickable_path): use request.repos
  (view_directory, generate_tarball): use request.repos. use LogEntry
    for fileinfo.
  (file_sort_cmp): update for LogEntry
  (view_annotate, cvsgraph_image, viewcvs_graph, search_files,
      view_diff): use repos.rootpath rather than .cvsroot
  (main): tweak the ordering of some checks and dispatching. use the
    repos.itemtype() functionality to test for "is a directory".
    remove test for whether the CVS root exists -- it was done during
    the Request initialization.

* vclib/bincvs/__init__.py

  (_FILE_HAD_ERROR): copied over from viewcvs.py
  (class LogError): new class (unused so far) to represent an error.
  (process_rlog_output): use LogEntry for fileinfo rather than a tuple
  (class BinCVSRepository):
    - change the init to verify the root is a directory, and store the
      name and rootpath (rootpath used to be called basepath).
    - add new .getitem() and .itemtype() methods for retrieving and
      querying about items, respectively.
    - tweak _getpath() joining of paths so we don't have to worry
      about adding a separator onto .rootpath.
    - remove .getfile() (now part of getitem).
    - replace .getsubdirs() with ._getvf_subdirs().
    - replace .getfiles() with ._getvf_files().


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@521 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-06-03 18:35:06 +00:00
gstein
2eb0e6d7b5 Update the API a bit.
* remove .getfile(), .getfiles(), .getsubdirs() from the Repository
  object. add .getitem() as a replacment for fetching items. add
  .itemtype() for determining the type of an item before retrieval.

* add the Versdir class for representing a directory within a
  versioning repository. it implements .getfiles() and .getsubdirs()
  methods for retriving information from within the directory.

* add ._getvf_files() and ._getvf_subdirs() to the Repository for use
  by the Versdir class instances.

* add FILE and DIR symbols for denoting the type of an object in the
  repository. set them as class attributes in Versdir or Versfile.

* add some exception classes for use by concrete vclib implementations


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@520 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-30 22:21:54 +00:00
gstein
3c5cb27b94 Upgrade our parameter checking (to resolve CSS attacks) to a much
stricter validation suite.

The 'search' parameter is still not validated, but it is not enabled
by default, and it shouldn't be enabled except in very secure
situations.
(it should still be cgi-escaped at some point for proper display on
 the HTML page, but we don't need to worry about CSS attacks from that
 angle right now)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@519 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-24 07:08:34 +00:00
gstein
0ab5f2107e Problem found by Daniel Rall <dlr@collab.net>:
Netscape 4.x and early Mozillas would not send qvalues with their
    language tags. Even for a simple case (browser sends "en, ja" and
    we have en and ja available), we could produce unexpected (read:
    erroneous) results.

Thus, we now select from multiple matches based on the ordering of the
items in the Accept-Language: header.

I've also added more comments to this code since some of it is rather
opaque.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@518 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-23 19:13:40 +00:00
gstein
4ea09932a2 Only attempt to set paths in the Python source code. We don't want to
accidentally do this in a jpeg or whatever. (yah, unlikely, but it is
easy to say "just python source" since we already have the flag)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@517 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 09:01:14 +00:00
gstein
cf4f673448 Remove items that have been shifted over to vclib.bincvs
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@516 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 01:17:42 +00:00
gstein
e3a4336d40 Enable installation of entire trees so that we don't have to name all
the files individually.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@515 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-22 01:16:07 +00:00
gstein
f7fc5bb6f7 Various fixes to realign the functions from viewcvs back to their
original form, to tweak the imports, and to get the functions working
within their new context.

* realign parse_log_header() with the original from viewcvs.py. rather
  than updating a target object, the caller just grabs the relevant
  data from the returned LogHeader object.

* bring over various global constants for the parsing (e.g. _EOF_*)

* pass 'rcs_path' since cfg.general.rcs_path is not available

* add fetch_log() from viewcvs.py. only change is to pass rcs_path.

* change imports:
  - import 'vclib' rather than symbols from 'vclib'
  - import 'time' and 'compat' for some functions
  - don't import 'exceptions' since those are builtin anyways


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@514 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-21 22:47:16 +00:00
timcera
99ab86e91c Added redirection for bare script name that is missing the trailing '/'.
* Request class now tests for 'PATH_INFO', if None, then redirects URL.
  Required 'SERVER_URL' in order to not have the server remove the '/'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@513 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-17 17:42:12 +00:00
pefu
a9a59a9961 Tim Cera wrote:
>   Added UTC/localtime feature based on patch supplied by Guy Davis in
>   '[ 548889 ] Local time display option'.
[...]
I got CET displayed even for times in July, where it should read CEST
since we are 2 hours earlier here in summer instead of the usual 1 hour in
winter due to daylight saving time.  Hopefully I fixed this correctly.

Unfortunately nobody committed something into my CVS repository in those
nights where transitions from normal to daylight saving time and vice versa
happened.  So I didn't tested those particular nesty cases of time display.

BTW: I believe the whole idea of daylight savings time sucks...  but since
we have this everywhere here in the EU this is not going to change soon. :-(


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@512 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 06:43:39 +00:00
pefu
cb5c3b30d3 Added a new toggle to the Tkinter GUI to be able to test the
the new 'use_localtime' configuration option added by Tim Cera
yesterday (based on SF patch #548889 by Guy Davis).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@511 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 06:17:46 +00:00
timcera
ce16ab01b0 Added UTC/localtime feature based on patch supplied by Guy Davis in
'[ 548889 ] Local time display option'.
* Made a 'make_time_string' function that returns formatted date
  string in localtime or UTC, based on configuration choices.
* Added 'use_localtime' option in 'cgi/viewcvs.conf.dist' and
  'lib/config.py'.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@510 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-06 02:05:25 +00:00
timcera
1b9de04258 * Added 'GNUmakefile' to enscript_filename so that enscript will color
GNUmakefiles.  See 'Feature Request' - '[ 551690 ] colorize GNUmakefile
  like makefile'.
* Moved '.for: fortran' in enscript_extensions to maintain sort order.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@509 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-05-05 12:03:55 +00:00
timcera
c01aa7d4fe For some reason, Python 1.5.2 would not accept a compiled pattern. Moved the
pattern text directly into the re.search.  This search is for nefarious
characters :-) that could be used in a CSS attack.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@508 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-30 19:39:51 +00:00
timcera
837c82f2f1 Changes to the onClick handlers. Patch from Ville Skytt� (scop).
Basically include a 'return false;' and replace 'about:blank's.
See [ 541050 ] Bad onclick handler implementation at
http://sourceforge.net/tracker/index.php?func=detail&aid=541050&group_id=18760&atid=318760


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@507 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-27 20:24:12 +00:00
gstein
217169c9f8 Fix the style in these two files. Lots of white space was needed.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@506 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:51:05 +00:00
gstein
18b0f10c6e switch to a single, top-level makefile
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@505 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:01:41 +00:00
gstein
70d991b700 Big changes to the basic elem extraction tools.
* elx-common.c: new file for common file handling and token / symbol
    output.

* elx.h: expanded for new functions in elx-common.

* elx-java.c: switch to using a context for the files, and rely on the
    common functions to open/close and output stuff.

* elx-python.c: switch to using a context for the files, and rely on
    the common functions to open/close and output stuff. the
    identifier that we fetch is now null-term'd, so don't bother with
    a bunch of stuff to null-term it.

* scanner.c: null-term the identifier.

* elx_html.py: generate a full page, not just a body. use buffers to
    reference slices, rather than constructing slices. (and some test
    code to try binary files)

* add a couple .cvsignore files


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@504 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-26 08:00:53 +00:00
timcera
10ed9dbf05 Sorting not working right, but for different reasons.
* Did something about the 'None' values from fileinfo.  Now 'None' values
  are changed to _FILE_HAD_ERROR.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@503 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-18 02:54:21 +00:00
timcera
96300b1257 Sorting in the directory view under some situations would fail.
* Included patch from "[ 523275 ] Sorting bug fix (0.9.2)" from Jordan Russell
* Removed the substitution of "None" for "_FILE_HAD_ERROR" and changed
  tests appropriately.
* Moved section of code that sorts the filenames and changed logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@502 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-15 03:01:48 +00:00
lbruand
b7ced98ac2 debugged a checkout bug when a revision had a two-digit last number in a branch.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@501 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-14 21:31:41 +00:00
lbruand
25b5885a6b A working version of vclib.ccvs. Need a lot of debugging. Writing a driver
(called bincvs) for vclib that uses rlog and co binary rcs commands.
Added a few tests scripts.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@500 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-13 09:43:22 +00:00
timcera
6777801f27 A very low tech approach at validating URL input. Greg wants
restriction of each variable to it's allowed set of values, but I
couldn't do that quickly.  This works and I think a little easier
to maintain.  If it is found lacking I can improve later.  If a re
search of value finds '\'|"|<|>' the (name, value) pair is not put
into query_dict.  I can't think of a ViewCVS created URL, except
for search, that would have any of those characters.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@499 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-04-01 01:32:16 +00:00
gstein
cdaba43ea1 I've been screwing around for *days* trying to tweak this darned Java
grammar. Forget it for now, and checkpoint what I've done.

The elx-python and elx-java programs produce "element" text files
which can then be consumed by elx_html.py to produce syntax-colored
HTML output. elx_page.sh is a little wrapper around that to produce a
full page.

The Python stuff seems quite fine, and is blazing fast (the scanner
runs over 100k lines/second). The Java grammar is horked, so it does
work (the Java scanner seems fine; just the grammar).

Lots more to do on this, but I'm out for the weekend, so this it's
time to check point this. Maybe someone will have better ideas on how
to fix the Java parser. Note that this stuff requires the 'msta' and
'shilka' programs from the 'cocom' toolkit.

I still need to package this up nicely (some copyright/license
notices, better makefiles, some minimal doc, etc). I also want to mess
around with profiling the syntax coloring. It appears to be a bit
slower than enscript right now, but it shouldn't be since we've
already parsed the file by that point (gonna try binary element files,
and some perf improvements to elx_html.py).

General theory: write elx-* for any language needing cross-referencing
capabilities (things that only need hiliting can continue to use
enscript). The elx-* programs can be implemented in any fashion, as
long as it produces the element description file. Python, Perl, pure
C, automated scanner/parser, whatever.

Future steps include using the element description file to get
function names, to index them, and to feed that into the HTML
generation. It would also be quite possible to feed the element
descriptions right into a database and query from there.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@498 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-15 01:54:28 +00:00
pefu
c4942bf983 Russell Yanofsky (rey4@sourceforge.net) obviuosly spend a lot of time
porting ViewCVS to windows and added ASP support.  His patch #526282
is quite huge and this first step only commits the newfiles.tgz to CVS,
because this shouldn't break anything.  I will not commit the actual
patches contained in diff.txt until I've spend some time testing it here
with Linux because Russell wrote he didn't has the possibility to test
with Unix.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@497 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-06 09:53:08 +00:00
pefu
fb897f7db8 As pointed out on the mailing list, the TCPServer class from the
Python standard library is missing a close_request method.  See
Lucas Bruands followup message in SF patch #522034 and Greg Steins
mail:
   http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000562.html
Furthermore I added a try except IOError-clause to catch those
Broken Python exceptions, if someone hits the Stop-button of his
browser while retrieving a huge page.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@496 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-03-01 07:32:07 +00:00
pefu
2fbce441df Started spring cleanup... ;-) A lot more is missing here.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@495 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-28 17:59:12 +00:00
pefu
a80d3e8cb8 apply a slightly modified version of Lucas Brand patch #522034
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@494 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-28 17:53:00 +00:00
gstein
e47409ce23 Minor tweaks to get this stuff working.
* ccvs/__init__.py: the package is 'vclib' rather than 'versionlib'

* rcsparse/texttools.py: the string module is needed


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@493 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-23 00:16:18 +00:00
akr
b80e352f5e Don't contain a forbidden module in a tarball.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@492 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-22 09:20:46 +00:00
pefu
10cf1131c5 Esben Haabendal Soerensen suggested on viewcvs-dev:
> Ville Skytt <ville.skytta@xemacs.org> writes:

> > I noticed some problems with the sunsite.dk ViewCVS setup
> > (cvs.xemacs.org in particular) that look like virtual host configuration
> > problems.
> >
> > I'm CC'ing viewcvs-dev in case someone there wants to look at the python
> > traceback.
> >
> > If the Host: header sent by a browser contains the port number (eg.
> > Host: cvs.xemacs.org:80), ViewCVS fails. If the :80 part is not in the
> > header, everything works fine. It looks like a problem specific to
> > sunsite.dk (for example http://cvs.open-bio.org/ doesn't have the same
> > problem and is running ViewCVS 0.9.2 too). To reproduce:

> I have fixed this problem.  It is necessary to add the special case
> with :80 appended.  So I now have:

> [vhosts]
> main = cvs.sunsite.dk, cvs.sunsite.dk:80
> xemacs = cvs.xemacs.org, cvs.xemacs.org:80

> In our viewcvs.conf.  My guess is that Sunsite.dk is not the first and
> will not be the last site to not think of this.  Perhaps future
> versions of ViewCVS could ignore port numbers if only one vhost
> matches the domain...

In fact I now simply ignore the port number in vhost lookup.
Please tell me if this is to harsh.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@491 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-20 07:11:48 +00:00
pefu
caed1bbc6f Improve misleading docstring (Thanks to Lucas Bruand for pointing this out).
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@490 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-20 07:02:08 +00:00
lbruand
fca8276255 Memory leaks bugfix, by D. Berlin
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@489 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 20:22:11 +00:00
pefu
09aee9f2a8 I've tried to optimize Tims new prepare_hidden_values() function and
added a doc string.
I'm not really sure, whether the well known Python idiom to perform
string concatenation through list.append() will really pay off
here, since the list of hidden values is really short most of the time.
But I couldn't resist.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@488 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:55:57 +00:00
pefu
1d1b308d87 During testing with standalone.py I got a lot of
annoying 301 redirection "errors".  I tracked them
down to missing trailing slashes.  This change adds
these slashes to the directory URLs.  I'm not sure
whether this is right cure for the problem.  Please
review and comment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@487 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:51:06 +00:00
pefu
f583f7fc50 Sync with Tims changes to directory.ezt
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@486 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:26:10 +00:00
pefu
53b39b5950 Modified the '-r' option to aid testing of ViewCVS with more than one
repository withut actually having to install ViewCVS.  I now usually
use ./standalone.py -g -r /cvs1 -r /cvs2 to test my uncommited hacks to
the ViewCVS sources.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@485 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 15:02:11 +00:00
timcera
10a05b47f1 I think this fixes the cvsroot= not being propogated correctly in
the URLs.  It also fixes a problem with directory.ezt not having
closed </form> tags under certain conditions.
  *) Abstracted out a prepare_hidden_values function to create the
     appropriate hidden values for a particular form.  Should have
     everything in _sticky_vars in the request object as a hidden
     value EXCEPT the value(s) set by the form.
  *) Edited directory.ezt to use the new system.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@484 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-19 10:52:23 +00:00
lbruand
ed3bf198b7 remove tparse/sink.py & testtp.py, now redundant
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@483 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 18:24:55 +00:00
lbruand
718b506a9f * Removed debugging statments from the (C++) Sink class.
* Changed INSTALL to reflect the move of rcsparse to lib/vclib/ccvs/rcsparse.
  * Now when tparse cannot import common.py, it fails.
  * Added check for sink being of common.Sink class.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@482 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 18:19:12 +00:00
gstein
2acf85261a Some whitspace, spelling, and minor formatting tweaks. No functoinal
change.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@481 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 13:37:46 +00:00
gstein
ff8d47b670 Shift around some more code. Remove duplicate Parser classes.
* __init__.py: revise the import tests to just end up with an exported
  function named "parse" to parse an RCS file. move the test/debug
  functions to the new debug.py module.

* common.py: add mising imports. move DebugSink and DumpSink classes
  to the new debug.py module. tweak the RCSExpected class a bit to
  call the init method for its parent. move the Parser class here,
  expecting subclasses to set the .stream_class attribute.

* default.py: toss the 'time' import and import 'common' as a module,
  rather than getting all symbols from it. clarify where the
  CHUNK_SIZE value comes from. use common._Parser, but leave the
  parse_rcs_admin() method until we fix the token parsing for proper
  ":" handling.

* texttools.py: use 'common' as a module, rather than grabbing
  symbols. clarify CHUNK_SIZE. use common._Parser

* debug.py: shift DebugSink, DumpSink, and some utility funcs here.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@480 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 12:17:38 +00:00
gstein
455641bf37 Renamed these two files for clarity. No changes (those will come in a
separate commit, where we can actually see/record diffs more easily).

* pythparse.py was renamed to default.py: "pyth" is a funny
  abbreviation, "parse" is redundant with the "rcsparse" package name.
  this is intended as the default/fallback parser, so "default" is good.

* textparse.py was renamed to texttools.py: "text" is too generic.
  "texttools" describes the basis of the module better.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@479 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 10:53:38 +00:00
gstein
a86ad034e2 These files somehow got ^M characters into them, but were not being
subjected to proper newline translation. Removing the ^M characters so
that we can get some good diffs occurring, and to (hopefully) fix the
translation stuff.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@478 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-13 08:31:36 +00:00
lbruand
928ffd54d6 Import of vclib
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@477 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-11 21:03:31 +00:00
lbruand
87f43f02d5 Support for parser exceptions RCS*
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@476 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-11 20:13:50 +00:00
lbruand
8eec37e768 Daniel Berlin's patch
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@475 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 17:32:27 +00:00
pefu
9843b1b890 Improved diagnostics, if modules are not availabe on a certain Python
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@474 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 08:26:54 +00:00
pefu
6c216e387e Fixed sequence in content listing. Added a note about
standalone -g requiring thread support and Tkinter


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@473 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 07:39:10 +00:00
pefu
44918c941c Added a new section about Apache configuration
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@472 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-08 07:13:44 +00:00
timcera
314efa19da Added down.png and up.png for sorting on dir pages.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@471 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 13:21:21 +00:00
pefu
67de5edd63 Correct hasty checkin (URL path to icons went wrong)
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@470 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 10:03:29 +00:00
pefu
1d120d8991 Inspired by Tim Ceras EMail this morning
( http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000485.html )
I added sort direction toggles to the directory view.  It works.
But unfortunately the table header code in the template becomes very
bloated.  So I decided to put this only into dir_alternate.ezt for the
time being.  Please play around with it and review.  Putting
directory.ezt back into sync can be done later.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@469 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-07 09:08:50 +00:00
timcera
8b95292331 Hopefully adapts to enscript version 1.6.3 and later.
Shifted to the long options for enscript.  The short options are
either no longer tolerant of a missing ',' or they have changed.

Tested with enscript 1.6.2, so nothing has broken, but still need
verification that ViewCVS works with 1.6.3.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@468 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 22:55:03 +00:00
pefu
0988e943f6 see http://mailman.lyra.org/pipermail/viewcvs-dev/2002-February/000475.html
That's why I tried to improve diagnostics here


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@467 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 08:16:19 +00:00
pefu
30b78cf376 Added the recently added 'use_pagesize' option to the GUI
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@466 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-05 07:24:37 +00:00
pefu
2c9ccd262e Trying to keep this in sync with directory.ezt. :-(
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@465 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 07:40:21 +00:00
timcera
44651e5b2e * Fixed bug where a directory of only directories still had the search
files option.
  * Rearranged table to make 'Show all files' button lined up with the 'Show'
    button.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@464 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 04:08:51 +00:00
timcera
794a72f201 Added a page number to the page pick list.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@463 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 04:05:46 +00:00
timcera
705a54514e Corrected small errors noticed by pychecker.
* Multiple imports of the same module.
  * Module imported but never used.
  * Variables only used once.
  * Corrected deprecated modules.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@462 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:43:56 +00:00
timcera
8004d3ed59 Made common elements of the log templates into include files. Makes the
templates much easier to read and allows easier movement of the
elements around on the page.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@461 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:29:25 +00:00
timcera
d72922d81b This changes the behavoir of the View and Download links on log and log_table.
* For text files:
  'Download' opens download to file dialog box
  'View as Text' displays revision in new window
  'View as markup' displays enscript colored view with header information
  'View annotated' displays blame

* For gif, jpeg, and png:
  'View' displays graphic with header information similar to text markup

* For other binaries:
  'View/Download' will either view or download depending on browser's
   mime type / application settings.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@460 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-02-01 03:02:17 +00:00
lbruand
6afc2fb4f1 return wrong value in tparse.cpp
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@459 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-30 18:27:34 +00:00
lbruand
05e605e3da Few modification and debugging...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@458 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-30 18:24:17 +00:00
gstein
3d6755bcde Fix construction of state token: it was always appending a space, when
it should do that only when multiple states are found.

Fix parsing of dates. Some CVS files have a two-digit year (e.g. 99).
So we try parsing a 2-digit year first; if that fails, then we try a
four digit year.

timelog.compare_fetch() now shows tparse generating the same output to
the sink.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@457 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-29 11:30:10 +00:00
gstein
b37103c4d7 Check in the mxTextTools-based parser that I implemented back in
November. The timelog.fetch_log2() timing dropped from .53 seconds for
my test input to .34 seconds. Overall stream speed dropped from .25
seconds to .10 seconds.

This also introduces an mget() method on the token stream so that the
parser can get multiple tokens in one shot, rather than needing to
call many times.

In timelog, I've added a new compare_many() for big verifications,
time_stream to time individual token streams, profile_stream for
profiling streams, and revised the time_fetch function to do multiple
fetches and to trim the exceptional cases off the ends before
reporting.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@456 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-29 10:08:46 +00:00
lbruand
2c245d2bdb CHANGES update
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@455 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-27 14:01:53 +00:00
lbruand
fdb39468d3 added INSTALL file and various small modif.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@454 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-27 13:57:29 +00:00
lbruand
a163e8b5b8 Initial revision of the C++ RCS parser.
VS: ----------------------------------------------------------------------


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@453 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-25 17:36:15 +00:00
timcera
a25b2de3f9 This corrects some problems with rcsdiff header processing.
* Symbolic constants for tests.
* Moved text to diff.ezt template.
* Used elif to clean up logic.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@452 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-24 02:17:53 +00:00
timcera
ed9d473ff1 * Added template components to templates/include.
* Added description of remaining install step at end of install.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@451 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 05:24:31 +00:00
timcera
d24e850723 Added complete processing of rcsdiff header.
* Binary files are treated appropriately, detecting if there are differences
  or not.  Should fix part of feature request '[ #497044 ] Hide Diffs for
  Binaries'.
* Detects whether diff is accessible to rcsdiff and whether diff is GNU diff.
  Might move a diff test to viewcvs-install.  Advantage to it being here is
  that it responds to the CGI environment.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@450 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 05:05:18 +00:00
timcera
a30ae3877a Created template components and put in templates/include directory.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@449 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-23 04:18:26 +00:00
pefu
d54413e580 Don't complain about the release files kept in
/home/groups/v/vi/viewcvs/htdocs @ sf.net when doing a cvs update there


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@448 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:51:06 +00:00
pefu
8145be1151 Added a comment pointing out, that the -C option of enscript doesn'nt work
with HTML output.  TODO:  Invent a way to generate line numbers.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@447 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:42:23 +00:00
pefu
40e4f03f27 Added a paragraph clarifying howto upgrade to the latest version with
skipping one or more releases inbetween.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@446 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-22 08:38:21 +00:00
timcera
477599ee40 * Used pychecker to identify unused variables.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@445 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-17 04:01:08 +00:00
timcera
1f72a98e9e * Fixed bug in search_files where every file was identified as 'text/plain'. This was from not removing the ',v' from the file name before it was tested by mimetypes.
* Made the test for text files much clearer to read.
* Added/changed comments in search_files.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@444 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-17 03:52:20 +00:00
gstein
cd5fedd3dd update for 0.9.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@441 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-15 09:55:01 +00:00
gstein
dff5d57e76 describe the changes in 0.9.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@438 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-15 09:10:43 +00:00
gstein
c832f96e5b Fix a problem with diffs between revisions that have no changes. The
state was never getting set to "done" (== was used rather than =).
This also uncovered a problem where left_col and right_col were not
initialized before use, so get them set to empty values.

Reported by: Sam Mason <smason@mtc.ricardo.com>


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@437 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-10 01:26:36 +00:00
akr
385c97ba04 redirect to Attic for diffs didn't work.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@436 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-05 05:40:09 +00:00
pefu
4fcf12e391 Richard Offer posted Patch [ #498165 ] listen on non loopback interfaces:
> The attached patch adds the ability for the standalone
> server to listen on interfaces other than the loopback
> (localhost).
>
>  usage:
>
>  ./standalone -h `hostname`
>
>  Will allow anyone not on the localmachine to still view
> the cvs repo, without requiring a full-blown web server
> be set up first.
>
>
>  Patch is against release 0.9.1

I must admit, that I personally don't fully understand, why this
should be required.  But after adding some additional lines to the
gui() function and to the option initialization I applied this patch.
I tested it here with the name of my notebook and didn't see any
difference.  So at least it didn't hurt. ;-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@435 8cb11bc2-c004-0410-86c3-e597b4017df7
2002-01-02 18:50:57 +00:00
timcera
16bcb9e218 Added paging capability.
* Added use_pagesize to viewcvs.conf.dist and config.py
  * Modified directory and log templates to have a <select>
    pulldown menu based on files for directory views and revs
    for file logs.  Also setup to make the current page the
    'selected' item in the pulldown.
  * Added paging function to viewcvs.py.  Called from
    view_directory and view_log.
  * Added two variables to the _sticky_vars, dir_pagestart and
    log_pagestart.  Couldn't use a single pagestart var because
    it stuck around between the directory and log pages.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@434 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-31 04:39:34 +00:00
gstein
f75d262553 I disagree that 0.10 is confusing, but I guess we *do* have to call
this thing 1.0 at some point :-)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@433 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 08:17:53 +00:00
gstein
49b970079c More info on making a release.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@432 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 08:17:07 +00:00
gstein
b815e6ece7 update for 0.9.1
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@430 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:18:35 +00:00
gstein
c35dabcaeb Rolling 0.9.1
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@429 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:17:51 +00:00
gstein
f45b5f8d7f bleck... a debug statement was left in the code. all those people with
0.9 are going to see a really large /tmp/log file...


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@428 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-27 05:15:47 +00:00
pefu
44528c0b7e quick backport to Python 1.5.2
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@427 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-24 11:38:30 +00:00
pefu
11f594b7ed Using 0.10 as a version number AFTER 0.9 is a really bad idea and
will cause a lot of confusion, because many people will think 0.10 < 0.9!

Since the main functionality of ViewCVS is mature, there is no need to
avoid bumping up the version up to 1.0-dev.  I do that right now.

Merry Xmas to all.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@426 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-23 15:54:18 +00:00
gstein
8a9719a5f8 we're developing 0.10 now...
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@425 8cb11bc2-c004-0410-86c3-e597b4017df7
2001-12-23 12:04:32 +00:00
412 changed files with 47453 additions and 11482 deletions

462
CHANGES
View File

@@ -1,3 +1,464 @@
4Intra.net/CUSTIS improvements
* Support for full-text search over file contents, including binary
documents like *.doc and so on using Sphinx Search and Apache Tika
server. Patched Tika with fixes for #TIKA709 and #TIKA964 is highly
recommended:
http://wiki.4intra.net/public/tika-app-1.2-fix-TIKA709-TIKA964.jar
(SHA1 efef722a5e2322f7c2616d096552a48134dc5faa)
* Access right checks in query results.
* Access right checks for repository root directories.
* New query parameters: repository, repo type, revision number.
* Authorizer for CVSnt ACLs.
* InnoDB, additional database indexes and some search query
optimisations.
* Support for specifying path to MySQL UNIX socket.
* Asynchronous hook examples for updating SVN and CVS repos.
* Slightly more correct charset guessing, especially for Russian.
* Support for diffing added/removed files.
* File lists in RSS feeds for 'classic' template.
* Path configuration via a single 'viewvcinstallpath.py' file,
not via editing multiple bin/* files.
* Link to repository list instead of viewvc.org from the logo
* "rcsfile service" support used to workaround command execution
problems (forks) from Apache mod_python.
Version 1.2.0 (released ??-???-????)
* bumped minimum support Python version to 2.4
* implemented support for property diffs (issue #383)
* allow user-configurable cvsgraph display (issue #336)
* allow rNNNN syntax for Subversion revision numbers (issue #441)
Version 1.1.20 (released 24-Apr-2013)
* fix tab-to-space handling regression in markup view
* fix regression in root lookup handling (issue #526)
Version 1.1.19 (released 22-Apr-2013)
* improve root lookup performance (issue #523)
* new 'max_filesize_kbytes' config option and handling (issue #524)
* tarball generation improvements:
- preserve Subversion symlinks in generated tarballs (issue #487)
- reduce memory usage of tarball generation logic
- fix double compression of generated tarballs (issue #525)
* file content handling improvements:
- expanded support for encoding detection and transcoding (issue #11)
- fix tab-to-space conversion bugs in markup, annotate, and diff views
- fix handling of trailing whitespace in diff view
* add support for timestamp display in ISO8601 format (issue #46)
Version 1.1.18 (released 28-Feb-2013)
* fix exception raised by BDB-backed SVN repositories (issue #519)
* hide revision-less files when rcsparse is in use
* include branchpoints in branch views using rcsparse (issue #347)
* miscellaneous cvsdb improvements:
- add --port option to make-database (issue #521)
- explicitly name columns in queries (issue #522)
- update MySQL syntax to avoid discontinued "TYPE=" terms
Version 1.1.17 (released 25-Oct-2012)
* fix exception caused by uninitialized variable usage (issue #516)
Version 1.1.16 (released 24-Oct-2012)
* security fix: escape "extra" diff info to avoid XSS attack (issue #515)
* add 'binary_mime_types' configuration option and handling (issue #510)
* fix 'select for diffs' persistence across log pages (issue #512)
* remove lock status and filesize check on directories in remote SVN views
* fix bogus 'Annotation of' page title for non-annotated view (issue #514)
Version 1.1.15 (released 22-Jun-2012)
* security fix: complete authz support for remote SVN views (issue #353)
* security fix: log msg leak in SVN revision view with unreadable copy source
* fix several instances of incorrect information in remote SVN views
* increase performance of some revision metadata lookups in remote SVN views
* fix RSS feed regression introduced in 1.1.14
Version 1.1.14 (released 12-Jun-2012)
* fix annotation of svn files with non-URI-safe paths (issue #504)
* handle file:/// Subversion rootpaths as local roots (issue #446)
* fix bug caused by trying to case-normalize anon usernames (issue #505)
* speed up log handling by reusing tokenization results (issue #506)
* add support for custom revision log markup rules (issue #246)
Version 1.1.13 (released 23-Jan-2012)
* fix svndbadmin failure on deleted paths under Subversion 1.7 (issue #499)
* fix annotation of files in svn roots with non-URI-safe paths
* fix stray annotation warning in markup display of images
* more gracefully handle attempts to display binary content (issue #501)
Version 1.1.12 (released 03-Nov-2011)
* fix path display in patch and certain diff views (issue #485)
* fix broken cvsdb glob searching (issue 486)
* allow svn revision specifiers to have leading r's (issue #441, #448)
* allow environmental override of configuration location (issue #494)
* fix exception HTML-escaping non-string data under WSGI (issue #454)
* add links to root logs from roots view (issue #470)
* use Pygments lexer-guessing functionality (issue #495)
Version 1.1.11 (released 17-May-2011)
* security fix: remove user-reachable override of cvsdb row limit
* fix broken standalone.py -c and -d options handling
* add --help option to standalone.py
* fix stack trace when asked to checkout a directory (issue #478)
* improve memory usage and speed of revision log markup (issue #477)
* fix broken annotation view in CVS keyword-bearing files (issue #479)
* warn users when query results are incomplete (issue #433)
* avoid parsing errors on RCS newphrases in the admin section (issue #483)
* make rlog parsing code more robust in certain error cases (issue #444)
Version 1.1.10 (released 15-Mar-2011)
* fix stack trace in Subversion revision info logic (issue #475, issue #476)
Version 1.1.9 (released 18-Feb-2011)
* vcauth universal access determinations (issue #425)
* rework svn revision info cache for performance
* make revision log "extra pages" count configurable
* fix Subversion 1.4.x revision log compatibility code regression
* display sanitized error when authzfile is malformed
* restore markup of URLs in file contents (issue #455)
* optionally display last-committed metadata in roots view (issue #457)
Version 1.1.8 (released 02-Dec-2010)
* fix slowness triggered by allow_compress=1 configuration (issue #467)
* allow use of 'fcrypt' for Windows standalone.py authn support (issue #471)
* yield more useful error on directory markup/annotate request (issue #472)
Version 1.1.7 (released 09-Sep-2010)
* display Subversion revision properties in the revision view (issue #453)
* fix exception in 'standalone.py -r REPOS' when run without a config file
* fix standalone.py server root deployments (--script-alias='')
* add rudimentary Basic authentication support to standalone.py (issue #49)
* fix obscure "unexpected NULL parent pool" Subversion bindings error
* enable path info / link display in remote Subversion root revision view
* fix vhost name case handling inconsistency (issue #466)
* use svn:mime-type property charset param as encoding hint
* markup Subversion revision references in log messages (issue #313)
* add rudimentary support for FastCGI-based deployments (issue #464)
* fix query script WSGI deployment
* add configuration to fix query script cross-linking to ViewVC
Version 1.1.6 (released 02-Jun-2010)
* add rudimentary support for WSGI-based deployments (issue #397)
* fix exception caused by trying to HTML-escape non-string data (issue #454)
* fix incorrect RSS feed Content-Type header (issue #449)
* fix RSS <title> encoding problem (issue #451)
* allow 'svndbadmin purge' to work on missing repositories (issue #452)
Version 1.1.5 (released 29-Mar-2010)
* security fix: escape user-provided search_re input to avoid XSS attack
Version 1.1.4 (released 10-Mar-2010)
* security fix: escape user-provided query form input to avoid XSS attack
* fix standalone.py failure (when per-root options aren't used) (issue #445)
* fix annotate failure caused by ignored svn_config_dir (issue #447)
Version 1.1.3 (released 22-Dec-2009)
* security fix: add root listing support of per-root authz config
* security fix: query.py requires 'forbidden' authorizer (or none) in config
* fix URL-ification of truncated log messages (issue #3)
* fix regexp input validation (issue #426, #427, #440)
* add support for configurable tab-to-spaces conversion
* fix not-a-sequence error in diff view
* allow viewvc-install to work when templates-contrib is absent
* minor template improvements/corrections
* expose revision metadata in diff view (issue #431)
* markup file/directory item property URLs and email addresses (issue #434)
* make ViewVC cross copies in Subversion history by default
* fix bug that caused standalone.py failure under Python 1.5.2 (issue #442)
* fix support for per-vhost overrides of authorizer parameters (issue #411)
* fix root name identification in query.py interface
Version 1.1.2 (released 11-Aug-2009)
* security fix: validate the 'view' parameter to avoid XSS attack
* security fix: avoid printing illegal parameter names and values
* add optional support for character encoding detection (issue #400)
* fix username case handling in svnauthz module (issue #419)
* fix cvsdbadmin/svnadmin rebuild error on missing repos (issue #420)
* don't drop leading blank lines from colorized file contents (issue #422)
* add file.ezt template logic for optionally hiding binary file contents
Version 1.1.1 (released 03-Jun-2009)
* fix broken query form (missing required template variables) (issue #416)
* fix bug in cvsdb which caused rebuild operations to lose data (issue #417)
* fix cvsdb purge/rebuild repos lookup to error on missing repos
* fix misleading file contents view page title
Version 1.1.0 (released 13-May-2009)
* add support for full content diffs (issue #153)
* make many more data dictionary items available to all views
* various rcsparse and tparse module fixes
* add daemon mode to standalone.py (issue #235)
* rework helper application configuration options (issues #229, #62)
* teach standalone.py to recognize Subversion repositories via -r option
* now interpret relative paths in "viewvc.conf" as relative to that file
* add 'purge' subcommand to cvsdbadmin and svndbadmin (issue #271)
* fix orphaned data bug in cvsdbadmin/svndbadmin rebuild (issue #271)
* add support for query by log message (issues #22, #121)
* fix bug parsing 'svn blame' output with too-long author names (issue #221)
* fix default standalone.py port to be within private IANA range (issue #234)
* add unified configury of allowed views; checkout view disabled by default
* add support for ranges of revisions to svndbadmin (issue #224)
* make the query handling more forgiving of malformatted subdirs (issue #244)
* add support for per-root configuration overrides (issue #371)
* add support for optional email address mangling (issue #290)
* extensible path-based authorization subsystem (issue #268), supporting:
- Subversion authz files (new)
- regexp-based path hiding (for compat with 1.0.x)
- file glob top-level directory hiding (for compat with 1.0.x)
* allow default file view to be "markup" (issue #305)
* add support for displaying file/directory properties (issue #39)
* pagination improvements
* add gzip output encoding support for template-driven pages
* fix cache control bugs (issue #259)
* add RSS feed URL generation for file history
* add support for remote creation of ViewVC checkins database
* add integration with Pygments for syntax highlighting
* preserve executability of Subversion files in tarballs (issue #233)
* add ability to set Subversion runtime config dir (issue #351, issue #339)
* show RSS/query links only for roots found in commits database (issue #357)
* recognize Subversion svn:mime-type property values (issue #364)
* hide CVS files when viewing tags/branches on which they don't exist
* allow hiding of errorful entries from the directory view (issue #105)
* fix directory view sorting UI
* tolerate malformed Accept-Language headers (issue #396)
* allow MIME type mapping overrides in ViewVC configuration (issue #401)
* fix exception in rev-sorted remote Subversion directory views (issue #409)
* allow setting of page sizes for log and dir views individually (issue #402)
Version 1.0.13 (released 24-Oct-2012)
* security fix: escape "extra" diff info to avoid XSS attack (issue #515)
* security fix: remove user-reachable override of cvsdb row limit
* fix obscure "unexpected NULL parent pool" Subversion bindings error
* fix svndbadmin failure on deleted paths under Subversion 1.7 (issue #499)
Version 1.0.12 (released 02-Jun-2010)
* fix exception caused by trying to HTML-escape non-string data (issue #454)
Version 1.0.11 (released 29-Mar-2010)
* security fix: escape user-provided search_re input to avoid XSS attack
Version 1.0.10 (released 10-Mar-2010)
* security fix: escape user-provided query form input to avoid XSS attack
* fix errors viewing remote Subversion paths with URI-unsafe characters
* fix regexp input validation (issue #426, #427, #440)
Version 1.0.9 (released 11-Aug-2009)
* security fix: validate the 'view' parameter to avoid XSS attack
* security fix: avoid printing illegal parameter names and values
Version 1.0.8 (released 05-May-2009)
* fix directory view sorting UI
* tolerate malformed Accept-Language headers (issue #396)
* fix directory log views in revision-less Subversion repositories
* fix exception in rev-sorted remote Subversion directory views (issue #409)
Version 1.0.7 (released 14-Oct-2008)
* fix regression in the 'as text' download view (issue #373)
Version 1.0.6 (released 16-Sep-2008)
* security fix: ignore arbitrary user-provided MIME types (issue #354)
* fix bug in regexp search filter when used with sticky tag (issue #346)
* fix bug in handling of certain 'co' output (issue #348)
* fix regexp search filter template bug
* fix annotate code syntax error
* fix mod_python import cycle (issue #369)
Version 1.0.5 (released 28-Feb-2008)
* security fix: omit commits of all-forbidden files from query results
* security fix: disallow direct URL navigation to hidden CVSROOT folder
* security fix: strip forbidden paths from revision view
* security fix: don't traverse log history thru forbidden locations
* security fix: honor forbiddenness via diff view path parameters
* new 'forbiddenre' regexp-based path authorization feature
* fix root name conflict resolution inconsistencies (issue #287)
* fix an oversight in the CVS 1.12.9 loginfo-handler support
* fix RSS feed content type to be more specific (issue #306)
* fix entity escaping problems in RSS feed data (issue #238)
* fix bug in tarball generation for remote Subversion repositories
* fix query interface file-count-limiting logic
* fix query results plus/minus count to ignore forbidden files
* fix blame error caused by 'svn' unable to create runtime config dir
Version 1.0.4 (released 10-Apr-2007)
* fix some markup bugs in query views (issue #266)
* fix loginfo-handler's support for CVS 1.12.9 (issues #151, #257)
* make viewvc-install able to run from an arbitrary location
* update viewvc-install's output for readability
* fix bug writing commits to non-MyISAM databases (issue #262)
* allow long paths in generated tarballs (issue #12)
* fix bug interpreting EZT substitute patterns
* fix broken markup view disablement
* fix broken directory view link generation in directory log view
* fix Windows-specific viewvc-install bugs
* fix broke query result links for Subversion deleted items (issue #296)
* fix some output XHTML validation buglets
* fix database query cache staleness problems (issue #180)
Version 1.0.3 (released 13-Oct-2006)
* fix bug in path shown for Subversion deleted-under-copy items (issue #265)
* security fix: declare charset for views to avoid IE UTF7 XSS attack
Version 1.0.2 (released 29-Sep-2006)
* minor documentation fixes
* fix Subversion annotate functionality on Windows (issue #18)
* fix annotate assertions on uncanonicalized #include paths (issue #208)
* make RSS URL method match the method used to generate it (issue #245)
* fix Subversion annotation to run non-interactively, preventing hangs
* fix bug in custom syntax highlighter fallback logic
* fix bug in PHP CGI hack to avoid force-cgi-redirect errors
Version 1.0.1 (released 20-Jul-2006)
* fix exception on log page when use_pagesize is enabled
* fix an XHTML validation bug in the footer template (issue #239)
* fix handling of single-component CVS revision numbers (issue #237)
* fix bug in download-as-text URL link generation (issue #241)
* fix query.cgi bug, missing 'rss_href' template data item (issue #249)
* no longer omit empty Subversion directories from tarballs (issue #250)
* use actual modification time for Subversion directories in tarballs
Version 1.0 (released 01-May-2006)
* add support for viewing Subversion repositories
* add support for running on MS Windows
* generate strict XHTML output
* add support for caching by sending "Last-Modified", "Expires",
"ETag", and "Cache-Control" headers
* add support for Mod_Python on Apache 2.x and ASP on IIS
* Several changes to standalone.py:
- -h commandline option to specify hostname for non local use.
- -r commandline option may be repeated to use more than repository
before actually installing ViewCVS.
- New GUI field to test paging.
* add new, better-integrated query interface
* add integrated RSS feeds
* add new "root_as_url_component" option to embed root names as
path components in ViewCVS URLs for a more natural URL scheme
in ViewCVS configurations with multiple repositories.
* add new "use_localtime" option to display local times instead of UTC times
* add new "root_parents" option to make it possible to add and
remove repositories without modifying the ViewCVS configuration
* add new "template_dir" option to facilitate switching between sets of
templates
* add new "sort_group_dirs" option to disable grouping of
directories in directory listings
* add new "port" option to connect to a MySQL database on a nonstandard port
* make "default_root" option optional. When no root is specified,
show a page listing all available repositories
* add "default_file_view" option to make it possible for relative
links and image paths in checked out HTML files to work without
the need for special /*checkout*/ prefixes in URLs. Deprecate
"checkout_magic" option and disable by default
* add "limit_changes" option to limit number of changed files shown per
commit by default in query results and in the Subversion revision view
* hide CVS "Attic" directories and add simple toggle for showing
dead files in directory listings
* show Unified, Context and Side-by-side diffs in HTML instead of
in bare text pages
* make View/Download links work the same for all file types
* add links to tip of selected branch on log page
* allow use of "Highlight" program for colorizing
* enable enscript colorizing for more file types
* add sorting arrows for directory views
* get rid of popup windows for checkout links
* obfuscate email addresses in html output by encoding @ symbol
with an HTML character reference
* add paging capability
* Improvements to templates
- add new template authoring guide
- increase coverage, use templates to produce HTML for diff pages,
markup pages, annotate pages, and error pages
- move more common page elements into includes
- add new template variables providing ViewCVS URLs for more
links between related pages and less URL generation inside
templates
* add new [define] EZT directive for assigning variables within templates
* add command line argument parsing to install script to allow
non-interactive installs
* add stricter parameter validation to lower likelihood of cross-site
scripting vulnerabilities
* add support for cvsweb's "mime_type=text/x-cvsweb-markup" URLs
* fix incompatibility with enscript 1.6.3
* fix bug in parsing FreeBSD rlog output
* work around rlog assumption all two digit years in RCS files are
relative to the year 1900.
* change loginfo-handler to cope with spaces in filenames and
support a simpler command line invocation from CVS
* make cvsdbadmin work properly when invoked on CVS subdirectory
paths instead of top-level CVS root paths
* show diff error when comparing two binary files
* make regular expression search skip binary files
* make regular expression search skip nonversioned files in CVS
directories instead of choking on them
* fix tarball generator so it doesn't include forbidden modules
* output "404 Not Found" errors instead of "403 Forbidden" errors
to not reveal whether forbidden paths exist
* fix sorting bug in directory view
* reset log and directory page numbers when leaving those pages
* reset sort direction in directory listing when clicking new columns
* fix "Accept-Language" handling for Netscape 4.x browsers
* fix file descriptor leak in standalone server
* clean up zombie processes from running enscript
* fix mysql "Too many connections" error in cvsdbadmin
* get rid of mxDateTime dependency for query database
* store query database times in UTC instead of local time
* fix daylight saving time bugs in various parts of the code
Version 0.9.4 (released 17-Aug-2005)
* security fix: omit forbidden/hidden modules from query results.
Version 0.9.3 (released 17-May-2005)
* security fix: disallow bad "content-type" input [CAN-2004-1062]
* security fix: disallow bad "sortby" and "cvsroot" input [CAN-2002-0771]
* security fix: omit forbidden/hidden modules from tarballs [CAN-2004-0915]
Version 0.9.2 (released 15-Jan-2002)
* fix redirects to Attic for diffs
* fix diffs that have no changes (causing an infinite loop)
Version 0.9.1 (released 26-Dec-2001)
* fix a problem with some syntax in ndiff.py which isn't compatible
with Python 1.5.2 (causing problems at install time)
* remove a debug statement left in the code which continues to
append lines to /tmp/log
Version 0.9 (released 23-Dec-2001)
* create templates for the rest of the pages: markup pages, graphs,
@@ -21,7 +482,6 @@ Version 0.9 (released 23-Dec-2001)
* create dir_alternate.ezt for the flipped rev/name links
* various UI tweaks for the directory pages
Version 0.8 (released 10-Dec-2001)
* add EZT templating mechanism for generating output pages

28
COMMITTERS Normal file
View File

@@ -0,0 +1,28 @@
The following people have commit access to the ViewVC sources.
Note that this is not a full list of ViewVC's authors, however --
for that, you'd need to look over the log messages to see all the
patch contributors.
If you have a question or comment, it's probably best to mail
dev@viewvc.tigris.org, rather than mailing any of these people
directly.
gstein Greg Stein <gstein@lyra.org>
jpaint Jay Painter <???>
akr Tanaka Akira <???>
timcera Tim Cera <???>
pefu Peter Funk <???>
lbruand Lucas Bruand <???>
cmpilato C. Michael Pilato <cmpilato@collab.net>
rey4 Russell Yanofsky <rey4@columbia.edu>
mharig Mark Harig <???>
northeye Takuo Kitame <???>
jamesh James Henstridge <???>
maxb Max Bowsher <maxb1@ukf.net>
eh Erik Hülsmann <e.huelsmann@gmx.net>
mhagger Michael Haggerty <mhagger@alum.mit.edu>
## Local Variables:
## coding:utf-8
## End:
## vim:encoding=utf8

743
INSTALL
View File

@@ -1,10 +1,12 @@
CONTENTS
--------
TO THE IMPATIENT
INSTALLING VIEWCVS
UPGRADING VIEWCVS
SECURITY INFORMATION
INSTALLING VIEWVC
APACHE CONFIGURATION
UPGRADING VIEWVC
SQL CHECKIN DATABASE
ENSCRIPT CONFIGURATION
ENABLING SYNTAX COLORATION
CVSGRAPH CONFIGURATION
IF YOU HAVE PROBLEMS...
@@ -13,227 +15,508 @@ TO THE IMPATIENT
----------------
Congratulations on getting this far. :-)
Prerequisites: Python 1.5 or later
(http://www.python.org/)
RCS, Revision Control System
(http://www.cs.purdue.edu/homes/trinkle/RCS/)
read-only, physical access to a CVS repository
(See http://www.cvshome.org/ for more information)
Required Software And Configuration Needed To Run ViewVC:
Optional: a web server capable of running CGI programs
(for example, Apache at http://httpd.apache.org/)
GNU-diff to replace broken diff implementations
(http://www.gnu.org/software/diffutils/diffutils.html)
MySQL to create and query a commit database
(http://www.mysql.com/)
(http://sourceforge.net/projects/mysql-python)
(and Python 1.5.2 or later)
Enscript to colorize code displayed from the CVS repository
(http://people.ssh.com/mtr/genscript/)
CvsGraph for a graphical representation of the CVS revisions
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
In General:
GUI Operation:
* Python 2, version 2.4 or later (sorry, no 3.x support yet)
(http://www.python.org/)
If you just want to see what your CVS repository looks like with
ViewCVS, type "./standalone.py -g -r /PATH/TO/CVS/ROOT". This
will start a tiny webserver serving at http://localhost:7467/.
For CVS Support:
* RCS, Revision Control System
(http://www.cs.purdue.edu/homes/trinkle/RCS/)
* GNU-diff to replace diff implementations without the -u option
(http://www.gnu.org/software/diffutils/diffutils.html)
* read-only, physical access to a CVS repository
(See http://www.cvshome.org/ for more information)
For Subversion Support:
* Subversion, Version Control System, 1.3.1 or later
(binary installation and Python bindings)
(http://subversion.apache.org/)
Optional:
* a web server capable of running CGI programs
(for example, Apache at http://httpd.apache.org/)
* MySQL 3.22 and MySQLdb 0.9.0 or later to create a commit database
(http://www.mysql.com/)
(http://sourceforge.net/projects/mysql-python)
* Pygments 0.9 or later, syntax highlighting engine
(http://pygments.org)
* CvsGraph 1.5.0 or later, graphical CVS revision tree generator
(http://www.akhphd.au.dk/~bertho/cvsgraph/)
Quick sanity check:
If you just want to see what your repository looks like when seen
through ViewVC, type:
$ bin/standalone.py -r /PATH/TO/REPOSITORY
This will start a tiny ViewVC server at http://localhost:49152/viewvc/,
to which you can connect with your browser.
Standard operation:
To start installing right away (on UNIX): type "./viewcvs-install"
To start installing right away (on UNIX): type "./viewvc-install"
in the current directory and answer the prompts. When it
finishes, edit the file viewcvs.conf in the installation directory
to tell viewcvs the paths to your CVS repositories. Next,
configure your web server to run <INSTALL>/cgi/viewcvs.cgi, as
appropriate for your web server. The section `INSTALLING VIEWCVS'
below is still recommended reading.
finishes, edit the file viewvc.conf in the installation directory
to tell ViewVC the paths to your CVS and Subversion repositories.
Next, configure your web server (in the way appropriate to that browser)
to run <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi. The section
`INSTALLING VIEWVC' below is still recommended reading.
INSTALLING VIEWCVS
SECURITY INFORMATION
--------------------
ViewVC provides a feature which allows version controlled content to
be served to web browsers just like static web server content. So, if
you have a directory full of interrelated HTML files that is housed in
your version control repository, ViewVC can serve those files as HTML.
You'll see in your web browser what you'd see if the files were part
of your website, with working references to stylesheets and images and
links to other pages.
It is important to realize, however, that as useful as that feature
is, there is some risk security-wise in its use. Essentially, anyone
with commit access to the CVS or Subversion repositories served by
ViewVC has the ability to affect site content. If a discontented or
ignorant user commits malicious HTML to a version controlled file
(perhaps just by way of documenting examples of such), that malicious
HTML is effectively published and live on your ViewVC instance.
Visitors viewing those versioned controlled documents get the
malicious code, too, which might not be what the original author
intended.
For this reason, ViewVC's "checkout" view is disabled by default. If
you wish to enable it, simply add "co" to the list of views enabled in
the allowed_views configuration option.
INSTALLING VIEWVC
------------------
1) To get viewcvs.cgi to work, make sure that you have Python 1.5 or
greater installed and a webserver which is capable of executing
CGI scripts (either based on the .cgi extension, or by placing the
script within a specific directory).
NOTE: Windows users can refer to windows/README for Windows-specific
installation instructions.
You need to have RCS installed. Specifically, "rlog", "rcsdiff",
and "co". This script was tested against RedHat's rcs-5.7-10.rpm
1) To get viewvc.cgi to work, make sure that you have Python installed
and a webserver which is capable of executing CGI scripts (either
based on the .cgi extension, or by placing the script within a specific
directory).
Note, that the viewcvs.cgi script needs to have READ-ONLY, physical
access to the CVS repository (or a copy of it). Therefore, rsh/ssh or
pserver access to the repository will not work.
Note that to browse CVS repositories, the viewvc.cgi script needs to
have READ-ONLY, physical access to the repository (or a copy of it).
Therefore, rsh/ssh or pserver access to the repository will not work.
And you need to have the RCS utilities installed, specifically "rlog",
"rcsdiff", and "co".
For the more human readable diff formats you need a modern diff utility.
If you are using Linux, this is no problem. But on commercial unices
you might want to install GNU-diff to be able to use unified or
side-by-side diffs.
If you want to use cvsgraph, you have to obtain and install this
separately. See below. This was tested with cvsgraph-1.1.2.
For the checkin database to work, you will need MySQL >= 3.22,
and the Python DBAPI 2.0 module, MySQLdb. This was tested with
MySQLdb 0.9.1.
2) Installation is handled by the ./viewcvs-install script. Run this
2) Installation is handled by the ./viewvc-install script. Run this
script and you will be prompted for a installation root path.
The default is /usr/local/viewcvs-VERSION, where VERSION is
the version of this ViewCVS release. The installer sets the install
path in some of the files, and ViewCVS cannot be moved to a
The default is /usr/local/viewvc-VERSION, where VERSION is
the version of this ViewVC release. The installer sets the install
path in some of the files, and ViewVC cannot be moved to a
different path after the install.
Note: while 'root' is usually required to create /usr/local/viewcvs,
ViewCVS does not have to be installed as root, nor does it run as root.
It is just as valid to place ViewCVS in a home directory, too.
Note: while 'root' is usually required to create /usr/local/viewvc,
ViewVC does not have to be installed as root, nor does it run as root.
It is just as valid to place ViewVC in a home directory, too.
Note: viewcvs-install will create directories if needed. It will
Note: viewvc-install will create directories if needed. It will
prompt before overwriting files that may have been modified (such
as viewcvs.conf), thus making it safe to install over the top of
as viewvc.conf), thus making it safe to install over the top of
a previous installation. It will always overwrite program files,
however.
3) Edit <VIEWCVS_INSTALLATION_DIRECTORY>/viewcvs.conf for your specific
3) Edit <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf for your specific
configuration. In particular, examine the following configuration options:
cvs_roots
cvs_roots (for CVS)
svn_roots (for Subversion)
root_parents (for CVS or Subversion)
default_root
rcs_path
mime_types_file
root_as_url_component
rcs_dir
mime_types_files
There are some other options that are usually nice to change. See
viewcvs.conf for more information. ViewCVS provides a working,
default look. However, if you want to customize the look of ViewCVS
then edit the files in <VIEWCVS_INSTALLATION_DIRECTORY>/templates.
viewvc.conf for more information. ViewVC provides a working,
default look. However, if you want to customize the look of ViewVC
then edit the files in <VIEWVC_INSTALLATION_DIRECTORY>/templates.
You need knowledge about HTML to edit the templates.
4) The CGI programs are in <VIEWCVS_INSTALLATION_DIRECTORY>/cgi/. You can
4) The CGI programs are in <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/. You can
symlink to this directory from somewhere in your published HTTP server
path if your webserver is configured to follow symbolic links. You can
also copy the installed <VIEWCVS_INSTALLATION_DIRECTORY>/cgi/*.cgi scripts
after the install (unlike the other files in ViewCVS, the CGI scripts can
be moved).
also copy the installed <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
scripts after the install (unlike the other files in ViewVC, the scripts
under bin/ can be moved).
If you are using Apache, then the ScriptAlias directive is very
useful for pointing directly to the viwecvs.cgi script.
If you are using Apache, then see below at the section titled
APACHE CONFIGURATION.
NOTE: for security reasons, it is not advisable to install ViewCVS
NOTE: for security reasons, it is not advisable to install ViewVC
directly into your published HTTP directory tree (due to the MySQL
passwords in viewcvs.conf).
passwords in viewvc.conf).
5) That's it for repository browsing. Instructions for getting the
SQL checkin database working are below.
That's it for repository browsing. Instructions for getting the SQL
checkin database working are below.
WARNING: ViewCVS has not been tested on web servers operating on the
Win32 platform.
APACHE CONFIGURATION
--------------------
1) Locate your Apache configuration file(s).
Typical locations are /etc/httpd/httpd.conf,
/etc/httpd/conf/httpd.conf, and /etc/apache/httpd.conf. Depending
on how Apache was installed, you may also look under /usr/local/etc
or /etc/local. Use the vendor documentation or the find utility if
in doubt.
2) Depending on how your Apache configuration is setup by default, you
might need to explicitly allow high-level access to the ViewVC
install location.
<Directory <VIEWVC_INSTALLATION_DIRECTORY>>
Order allow,deny
Allow from all
</Directory>
For example, if ViewVC is installed in /usr/local/viewvc-1.0 on
your system:
<Directory /usr/local/viewvc-1.0>
Order allow,deny
Allow from all
</Directory>
3) Configure Apache to expose ViewVC to users at the URL of your choice.
ViewVC provides several different ways to do this. Choose one of
the following methods:
-----------------------------------
METHOD A: CGI mode via ScriptAlias
-----------------------------------
The ScriptAlias directive is very useful for pointing
directly to the viewvc.cgi script. Simply insert a line containing
ScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/viewvc.cgi
into your httpd.conf file. Choose the location in httpd.conf where
also the other ScriptAlias lines reside. Some examples:
ScriptAlias /viewvc /usr/local/viewvc-1.0/bin/cgi/viewvc.cgi
ScriptAlias /query /usr/local/viewvc-1.0/bin/cgi/query.cgi
----------------------------------------
METHOD B: CGI mode in cgi-bin directory
----------------------------------------
Copy the CGI scripts from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
to the /cgi-bin/ directory configured in your httpd.conf file.
You can override configuration file location using:
SetEnv VIEWVC_CONF_PATHNAME /etc/viewvc.conf
------------------------------------------
METHOD C: CGI mode in ExecCGI'd directory
------------------------------------------
Copy the CGI scripts from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/cgi/*.cgi
to the directory of your choosing in the Document Root adding the following
Apache directives for the directory in httpd.conf or an .htaccess file:
Options +ExecCGI
AddHandler cgi-script .cgi
Note: For this to work mod_cgi has to be loaded. And for the .htaccess file
to be effective, "AllowOverride All" or "AllowOverride Options FileInfo"
needs to have been specified for the directory.
------------------------------------------
METHOD D: Using mod_python (if installed)
------------------------------------------
Copy the Python scripts and .htaccess file from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/mod_python/
to a directory being served by Apache.
In httpd.conf, make sure that "AllowOverride All" or at least
"AllowOverride FileInfo Options" are enabled for the directory
you copied the files to.
You can override configuration file location using:
SetEnv VIEWVC_CONF_PATHNAME /etc/viewvc.conf
Note: If you are using Mod_Python under Apache 1.3 the tarball generation
feature may not work because it uses multithreading. This works fine
under Apache 2.
----------------------------------------
METHOD E: Using mod_wsgi (if installed)
----------------------------------------
Copy the Python scripts file from
<VIEWVC_INSTALLATION_DIRECTORY>/bin/wsgi/
to the directory of your choosing. Modify httpd.conf with the
following directives:
WSGIScriptAlias /viewvc <VIEWVC_INSTALLATION_DIRECTORY>/bin/wsgi/viewvc.wsgi
WSGIScriptAlias /query <VIEWVC_INSTALLATION_DIRECTORY>/bin/wsgi/query.wsgi
You'll probably also need the following directive because of the
not-quite-sanctioned way that ViewVC manipulates Python objects.
WSGIApplicationGroup %{GLOBAL}
Note: WSGI support in ViewVC is at this time quite rudimentary,
bordering on downright experimental. Your mileage may vary.
-----------------------------------------
METHOD F: Using mod_fcgid (if installed)
-----------------------------------------
This uses ViewVC's WSGI support (from above), but supports using FastCGI,
and is a somewhat hybrid approach of several of the above methods.
Especially if fcgi is already being used for other purposes, e.g. PHP,
also using fcgi can prevent the need for including additional modules
(e.g. mod_python or mod_wsgi) within Apache, which may help lessen Apache's
memory usage and/or help improve performance.
This depends on mod_fcgid:
http://httpd.apache.org/mod_fcgid/
as well as the fcgi server from Python's flup package:
http://pypi.python.org/pypi/flup
http://trac.saddi.com/flup
The following are some example httpd.conf fragments you can use to
support this configuration:
ScriptAlias /viewvc /usr/local/viewvc/bin/wsgi/viewvc.fcgi
ScriptAlias /query /usr/local/viewvc/bin/wsgi/query.fcgi
4) [Optional] Provide direct access to icons, stylesheets, etc.
ViewVC's HTML templates reference various stylesheets and icons
provided by ViewVC itself. By default, ViewVC generates URLs to
those artifacts which point back into ViewVC (using a magic
syntax); ViewVC in turn handles such magic URL requests by
streaming back the contents of the requested icon or stylesheet
file. While this simplifies the configuration and initial
deployment of ViewVC, it's not the most efficient approach to
deliver what is essentially static content.
To improve performance, consider carving out a URL space in your
webserver's configuration solely for this static content and
instruct ViewVC to use that space when generating URLs for that
content. For example, you might add an Alias such as the following
to your httpd.conf:
Alias /viewvc-docroot /usr/local/viewvc/templates/default/docroot
And then, in viewvc.conf, set the 'docroot' option to the same
location:
docroot = /viewvc-docroot
WARNING: As always when using Alias directives, be careful that you
have them in the correct order. For example, if you use an
ordering such as the following, Apache will hand requests for your
static documents off to ViewVC as if they were versioned resources:
ScriptAlias /viewvc /usr/local/viewvc/bin/wsgi/viewvc.fcgi
Alias /viewvc/static /usr/local/viewvc/templates/default/docroot
The correct order would be:
Alias /viewvc/static /usr/local/viewvc/templates/default/docroot
ScriptAlias /viewvc /usr/local/viewvc/bin/wsgi/viewvc.fcgi
(That said, it's best to avoid such namespace nesting altogether if
you can.)
5) [Optional] Add access control.
In your httpd.conf you can control access to certain modules by
adding directives like this:
<Location "<url to viewvc.cgi>/<modname_you_wish_to_access_ctl>">
AllowOverride None
AuthUserFile /path/to/passwd/file
AuthName "Client Access"
AuthType Basic
require valid-user
</Location>
WARNING: If you enable the "checkout_magic" or "allow_tar" options, you
will need to add additional location directives to prevent people
from sneaking in with URLs like:
http://<server_name>/viewvc/*checkout*/<module_name>
http://<server_name>/viewvc/~checkout~/<module_name>
http://<server_name>/viewvc/<module_name>.tar.gz?view=tar
6) Restart Apache.
The commands to do this vary. "httpd -k restart" and "apache -k
restart" are two common variants. On RedHat Linux it is done using
the command "/sbin/service httpd restart" and on SuSE Linux it is
done with "rcapache restart". Other systems use "apachectl restart".
7) [Optional] Protect your ViewVC instance from server-whacking webcrawlers.
As ViewVC is a web-based application which each page containing various
links to other pages and views, you can expect your server's performance
to suffer if a webcrawler finds your ViewVC instance and begins
traversing those links. We highly recommend that you add your ViewVC
location to a site-wide robots.txt file. Visit the Wikipedia page
for Robots.txt (http://en.wikipedia.org/wiki/Robots.txt) for more
information.
UPGRADING VIEWCVS
UPGRADING VIEWVC
-----------------
Please read the file upgrading.html in the website subdirectory or
at <http://viewcvs.sourceforge.net/upgrading.html>.
Please read the file upgrading-howto.html in the docs/ subdirectory.
SQL CHECKIN DATABASE
--------------------
This feature is a clone of the Mozilla Project's Bonsai database. It
catalogs every commit in the CVS repository into a SQL database. In fact,
the databases are 100% compatible.
catalogs every commit in the CVS or Subversion repository into a SQL
database. In fact, the databases are 100% compatible.
Various queries can be performed on the database. After installing ViewCVS,
Various queries can be performed on the database. After installing ViewVC,
there are some additional steps required to get the database working.
1) You need MySQL >= 3.22, and the Python module MySQLdb 0.9.0 installed.
Python 1.5.2 is REQUIRED by MySQLdb, therefore to use this part of
ViewCVS you must be using Python 1.5.2. Additionally you will need the
mxDateTime extension. I've tested with version 1.3.0
1) You need MySQL and MySQLdb (a Python DBAPI 2.0 module) installed.
2) You need to create a MySQL user who has permission to create databases.
Optionally, you can create a second user with read-only access to the
database.
3) Run the <VIEWCVS_INSTALLATION_DIRECTORY>/make-database script. It will
3) Run the <VIEWVC_INSTALLATION_DIRECTORY>/bin/make-database script. It will
prompt you for your MySQL user, password, and the name of database you
want to create. The database name defaults to "ViewCVS". This script
want to create. The database name defaults to "ViewVC". This script
creates the database and sets up the empty tables. If you run this on a
existing ViewCVS database, you will lose all your data!
existing ViewVC database, you will lose all your data!
4) Edit your <VIEWCVS_INSTALLATION_DIRECTORY>/viewcvs.conf file.
4) Edit your <VIEWVC_INSTALLATION_DIRECTORY>/viewvc.conf file.
There is a [cvsdb] section. You will need to set:
enabled = 1 # Whether to enable query support in viewvc.cgi
host = # MySQL database server host
database_name = # the name of the database you created with
# make-database
user = # the read/write database user
port = # MySQL database server port (default is 3306)
database_name = # name of database you created with make-database
user = # read/write database user
passwd = # password for read/write database user
readonly_user = # the readonly database user -- it's pretty
# safe to use the read/write user here
readonly_passwd = # password for the readonly user
readonly_user = # read-only database user
readonly_passwd = # password for the read-only user
5) Two programs are provided for updating the checkin database,
cvsdbadmin and loginfo-handler. They serve two different purposes.
The cvsdbadmin program walks through your CVS repository and adds
every commit in every file. This is commonly used for initializing
the database from a repository which has been in use. The
loginfo-handler script is executed by the CVS server's CVSROOT/loginfo
system upon each commit. It makes real-time updates to the checkin
database as commits are made to the repository.
Note that it's pretty safe in this instance for your read-only user
and your read-write user to be the same.
To build a database of all the commits in the CVS repository /home/cvs,
invoke: "./cvsdbadmin rebuild /home/cvs". If you want to update
the checkin database, invoke: "./cvsdbadmin update /home/cvs". The
update mode checks to see if a commit is already in the database,
and only adds it if it is absent.
5) At this point, you need to tell your version control system(s) to
publish their commit information to the database. This is done
using utilities that ViewVC provides.
To get real-time updates, you'll want to checkout the CVSROOT module
from your CVS repository and edit CVSROOT/loginfo. Add the line:
To publish CVS commits into the database:
ALL (echo %{sVv}; cat) | <VIEWCVS_INSTALLATION_DIRECTORY>/loginfo-handler
Two programs are provided for updating the checkin database from
a CVS repository, cvsdbadmin and loginfo-handler. They serve
two different purposes. The cvsdbadmin program walks through
your CVS repository and adds every commit in every file. This
is commonly used for initializing the database from a repository
which has been in use. The loginfo-handler script is executed
by the CVS server's CVSROOT/loginfo system upon each commit. It
makes real-time updates to the checkin database as commits are
made to the repository.
If you have other scripts invoked by CVSROOT/loginfo, you will want
to make sure to change any running under the "DEFAULT" keyword to
"ALL" like the loginfo handler, and probably carefully read the
execution rules for CVSROOT/loginfo from the CVS manual.
To build a database of all the commits in the CVS repository
/home/cvs, invoke: "./cvsdbadmin rebuild /home/cvs". If you
want to update the checkin database, invoke: "./cvsdbadmin
update /home/cvs". The update mode checks to see if a commit is
already in the database, and only adds it if it is absent.
6) You may want to modify the HTML template file:
To get real-time updates, you'll want to checkout the CVSROOT
module from your CVS repository and edit CVSROOT/loginfo. For
folks running CVS 1.12 or better, add this line:
<VIEWCVS_INSTALLATION_DIRECTORY>/templates/query.ezt
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %p %{sVv}
This is used by the query.cgi script to generate part of its HTML output.
At some point the currently hardcoded table output will also vanish.
If you are running CVS 1.11 or earlier, you'll want a slightly
different command line in CVSROOT/loginfo:
7) You should be ready to go. Load up the query.cgi script and give
it a try.
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv}
If you have other scripts invoked by CVSROOT/loginfo, you will
want to make sure to change any running under the "DEFAULT"
keyword to "ALL" like the loginfo handler, and probably
carefully read the execution rules for CVSROOT/loginfo from the
CVS manual.
If you are running the Unix port of CVS-NT, the handler script
need to know about it. CVS-NT delivers commit information to
loginfo scripts differently than the way mainstream CVS does.
Your command line should look like this:
ALL <VIEWVC_INSTALLATION_DIRECTORY>/bin/loginfo-handler %{sVv} cvsnt
To publish Subversion commits into the database:
To build a database of all the commits in the Subversion
repository /home/svn, invoke: "./svndbadmin rebuild /home/svn".
If you want to update the checkin database, invoke:
"./svndbadmin update /home/svn".
To get real time updates, you will need to add a post-commit
hook (for the repository example above, the script should go in
/home/svn/hooks/post-commit). The script should look something
like this:
#!/bin/sh
REPOS="$1"
REV="$2"
<VIEWVC_INSTALLATION_DIRECTORY>/bin/svndbadmin update \
"$REPOS" "$REV"
If you allow revision property changes in your repository,
create a post-revprop-change hook script which uses the same
'svndbadmin update' command as the post-commit script, except
with the addition of the --force option:
#!/bin/sh
REPOS="$1"
REV="$2"
<VIEWVC_INSTALLATION_DIRECTORY>/bin/svndbadmin update --force \
"$REPOS" "$REV"
This will make sure that the checkin database stays consistent
when you change the svn:log, svn:author or svn:date revision
properties.
You should be ready to go. Click one of the "Query revision history"
links in ViewVC directory listings and give it a try.
ENSCRIPT CONFIGURATION
----------------------
ENABLING SYNTAX COLORATION
--------------------------
Enscript is program that can colorize sourcecode of a lot of languages.
Linux distributions like for example SuSE Linux from at least 7.0
up to the recently released 7.3 already contain a precompiled and
configured enscript 1.6.2 package.
1) Download genscript from http://people.ssh.com/mtr/genscript/
2) Configure and compile per instructions with enscript.
(I 've not done this, since I'm using the precompiled package
delivered with SuSE Linux)
3) Set the 'use_enscript' option in viewcvs.conf to 1.
4) That's it!
5) If you want to colorize exotic languages, you might have to
patch 'lib/viewcvs.py' and add a new highlighting file to enscript.
I've done this for Modula-2 and submitted the file to the
enscript maintainer long ago. If interested in this patch for
enscript mailto:pefu@sourceforge.net
ViewVC uses Pygments (http://pygments.org) for syntax coloration. You
need only install a suitable version of that module, and if ViewVC
finds it in your Python module path, it will use it (unless you
specifically disable the feature by setting use_pygments = 0 in your
viewvc.conf file).
CVSGRAPH CONFIGURATION
@@ -243,88 +526,116 @@ CvsGraph is a program that can display a clickable, graphical tree
of files in a CVS repository.
WARNING: Under certain circumstances (many revisions of a file
or many branches or both) cvsgraph can generate very huge images.
or many branches or both) CvsGraph can generate very huge images.
Especially on thin clients these images may crash the Web-Browser.
Currently there is no known way to avoid this behavior of cvsgraph.
Currently there is no known way to avoid this behavior of CvsGraph.
So you have been warned!
Nevertheless cvsgraph can be quite helpful on repositories with
Nevertheless, CvsGraph can be quite helpful on repositories with
a reasonable number of revisions and branches.
1) Install viewcvs according to instructions in 'INSTALLING
VIEWCVS' section above. The installation directory is where
the 'viewcvs-install' script copied and configured the viewcvs
programs.
1) Install CvsGraph using your system's package manager or downloading
from the project home page.
2) Download CvsGraph from http://www.akhphd.au.dk/~bertho/cvsgraph/
2) Set the 'use_cvsgraph' options in viewvc.conf to 1.
3) Configure and compile per instructions with CvsGraph. I had
problems with 'configure' finding the gd library. Had to create
a link from libgd.so to libgd.do.4.0.0. On Solaris you might
want to edit the link command line and add the option -R if
you have you libraries at non-standard location.
3) You may also need to set the 'cvsgraph_path' option if the
CvsGraph executable is not located on the system PATH.
4) Place the 'cvsgraph' executable into a directory readable by the
userid running the web server. (default is '/usr/local/bin' if
you simply type 'make install' in the cvsgraph directory).
5) Check the setting of the 'cvsgraph_path' option in viewcvs.conf:
/usr/local/bin/ is most often NOT contained in $PATH of the
webserver process (e.g. Apache), so you will have to edit this.
Set the 'use_cvsgraph' option in viewcvs.conf to 1.
6) That's it!
7) There is a file <VIEWCVS_INSTALLATION_DIRECTORY>/cvsgraph.conf that
4) There is a file <VIEWVC_INSTALLATION_DIRECTORY>/cvsgraph.conf that
you may want to edit if desired to set color and font characteristics.
See the cvsgraph.conf documentation. No edits are required in
cvsgraph.conf for operation with viewcvs.
cvsgraph.conf for operation with ViewVC.
SUBVERSION INTEGRATION
----------------------
Unlike the CVS integration, which simply wraps the RCS and CVS utility
programs, the Subversion integration requires additional Python
libraries. To use ViewVC with Subversion, make sure you have both
Subversion itself and the Subversion Python bindings installed. These
can be obtained through typical package distribution mechanisms, or
may be build from source. (See the files 'INSTALL' and
'subversion/bindings/swig/INSTALL' in the Subversion source tree for
more details on how to build and install Subversion and its Python
bindings.)
Generally speaking, you'll know when your installation of Subversion's
bindings has been successful if you can import the 'svn.core' module
from within your Python interpreter. Here's an example of doing so
which doubles as a quick way to check what version of the Subversion
Python binding you have:
% python
Python 2.2.2 (#1, Oct 29 2002, 02:47:30)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from svn.core import *
>>> "%s.%s.%s" % (SVN_VER_MAJOR, SVN_VER_MINOR, SVN_VER_PATCH)
'1.3.1'
>>>
Note that by default, Subversion installs its bindings in a location
that is not in Python's default module search path (for example, on
Linux systems the default is usually /usr/local/lib/svn-python). You
need to remedy this, either by adding this path to Python's module
search path, or by relocating the bindings to some place in that
search path.
For example, you might want to create .pth file in your Python
installation directory's site-packages area which tells Python where
to find additional modules (in this case, you Subversion Python
bindings). You would do this as follows (and as root):
$ echo "/path/to/svn/bindings" > /path/to/python/site-packages/svn.pth
(Though, obviously, with the correct paths specified.)
Configuration of the Subversion repositories happens in much the same
way as with CVS repositories, only with the 'svn_roots' configuration
variable instead of the 'cvs_roots' one.
IF YOU HAVE PROBLEMS ...
------------------------
If you've trouble to make viewcvs.cgi work:
If nothing seems to work:
=== If nothing seems to work:
* Check if you can execute CGI-scripts (Apache needs to have an
ScriptAlias /cgi-bin or cgi-script Handler defined). Try to
execute a simple CGI-script that often comes with the distribution
of the webserver; locate the logfiles and try to find hints which
explain the malfunction
o check if you can execute CGI-scripts (Apache needs to have an
ScriptAlias /cgi-bin or cgi-script Handler defined). Try to
execute a simple CGI-script that often comes with the distribution
of the webserver; locate the logfiles and try to find hints
which explain the malfunction
o view the entries in the webserver's error.log
* View the entries in the webserver's error.log
o make sure there is a trailing slash on the URL. for example:
If ViewVC seems to work but doesn't show the expected result (Typical
error: you can't see any files)
* Check whether the CGI-script has read-permissions to your
CVS-Repository. The CGI-script generally runs as the same user
that the web server does, often user 'nobody' or 'httpd'.
* Does ViewVC find your RCS utilities? (edit rcs_dir)
If something else happens or you can't get it to work:
* Check the ViewVC home page:
http://viewvc.org/
* Review the ViewVC mailing list archive to see if somebody else had
the same problem, and it was solved:
http://viewvc.tigris.org/servlets/SummarizeList?listName=users
* Check the ViewVC issue database to see if the problem you are
seeing is the result of a known bug:
http://viewvc.tigris.org/issues/query.cgi
http://www.example.com/cgi-bin/viewcvs.cgi/
(ViewCVS should perform a redirection to ensure this, but a report
has indicated that it doesn't always do this... please send more
of these bug reports if you run into this)
=== If viewcvs seems to work but doesn't show the expected result
(Typical error: you can't see any files)
o check whether the CGI-script has read-permissions to your
CVS-Repository. The CGI-script often runs as the user 'nobody'
or 'httpd' ..
o does viewcvs find your RCS utilities? (edit rcs_path)
=== If something else happens or you can't get it to work:
o check the ViewCVS home page:
http://viewcvs.sourceforge.net/
o review the ViewCVS mailing list archive to see if somebody else had
the same problem, and it was solved:
http://mailman.lyra.org/pipermail/viewcvs/
o send mail to the ViewCVS mailing list: viewcvs@lyra.org
NOTE: make sure you provide an accurate description of the problem
and any relevant tracebacks or error logs.
* Send mail to the ViewVC mailing list, users@viewvc.tigris.org.
NOTE: make sure you provide an accurate description of the problem
-- including the version of ViewVC you are using -- and any
relevant tracebacks or error logs.

70
LICENSE.html Normal file
View File

@@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>ViewVC: License v1</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<p>The following text constitutes the license agreement for the <a
href="http://www.viewvc.org/">ViewVC</a> software (formerly known
as ViewCVS). It is an agreement between <a
href="http://www.viewvc.org/who.html#sec-viewcvs-group">The ViewCVS
Group</a> and the users of ViewVC.</p>
<blockquote>
<p><strong>Copyright &copy; 1999-2013 The ViewCVS Group. All rights
reserved.</strong></p>
<p>By using ViewVC, you agree to the terms and conditions set forth
below:</p>
<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:</p>
<ol>
<li>Redistributions of source code must retain the above copyright
notice, this list of conditions and the following
disclaimer.</li>
<li>Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.</li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.</p>
</blockquote>
<hr />
<p>The following changes have occured to this license over time:</p>
<ul>
<li>May 12, 2001 &mdash; copyright years updated</li>
<li>September 5, 2002 &mdash; copyright years updated</li>
<li>March 17, 2006 &mdash; software renamed from "ViewCVS"</li>
<li>April 10, 2007 &mdash; copyright years updated</li>
<li>February 22, 2008 &mdash; copyright years updated</li>
<li>March 18, 2009 &mdash; copyright years updated</li>
<li>March 29, 2010 &mdash; copyright years updated</li>
<li>February 18, 2011 &mdash; copyright years updated</li>
<li>January 23, 2012 &mdash; copyright years updated</li>
<li>January 04, 2013 &mdash; copyright years updated</li>
</ul>
</body>
</html>

8
README
View File

@@ -1,3 +1,9 @@
ViewCVS -- Viewing the content of CVS repositories with a Webbrowser.
ViewVC -- Viewing the content of CVS/SVN repositories with a Webbrowser.
This is the 4Intra.net patched version with some extra features.
Please read the file INSTALL for more information.
And see windows/README for more information on running ViewVC on
Microsoft Windows.

64
bin/asp/query.asp Normal file
View File

@@ -0,0 +1,64 @@
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# query.asp: View CVS/SVN commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) query.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
#########################################################################
import sapi
import viewvc
import query
server = sapi.AspServer(Server, Request, Response, Application)
try:
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc_base_url = cfg.query.viewvc_base_url
if viewvc_base_url is None:
viewvc_base_url = "viewvc.asp"
query.main(server, cfg, viewvc_base_url)
finally:
s.close()
%>

45
cgi/viewcvs.cgi → bin/asp/viewvc.asp Executable file → Normal file
View File

@@ -1,37 +1,38 @@
#!/usr/bin/python
<%@ LANGUAGE = Python %>
<%
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewcvs: View CVS repositories via a web browser
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
# development, there will be no 'viewvcinstallpath.py'
#
LIBRARY_DIR = None
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
@@ -41,9 +42,8 @@ LIBRARY_DIR = None
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
if not LIBRARY_DIR in sys.path:
sys.path.insert(0, LIBRARY_DIR)
#########################################################################
@@ -52,5 +52,14 @@ else:
#########################################################################
# go do the work
import viewcvs
viewcvs.run_cgi()
import sapi
import viewvc
server = sapi.AspServer(Server, Request, Response, Application)
try:
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)
finally:
s.close()
%>

74
bin/cgi/query.cgi Normal file
View File

@@ -0,0 +1,74 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# query.cgi: View CVS/SVN commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
# Adjust sys.path to include our library directory.
#
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
#########################################################################
#
# If admins want nicer processes, here's the place to get them.
#
#try:
# os.nice(20) # bump the nice level of this process
#except:
# pass
#########################################################################
#
# Go do the work.
#
import sapi
import viewvc
import query
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc_base_url = cfg.query.viewvc_base_url
if viewvc_base_url is None:
viewvc_base_url = "viewvc.cgi"
query.main(server, cfg, viewvc_base_url)

8
bin/cgi/viewvc-strace.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# Set this script up with something like:
#
# ScriptAlias /viewvc-strace /home/gstein/src/viewvc/cgi/viewvc-strace.sh
#
thisdir="`dirname $0`"
exec strace -q -r -o /tmp/v-strace.log "${thisdir}/viewvc.cgi"

70
bin/cgi/viewvc.cgi Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
# Adjust sys.path to include our library directory.
#
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
#########################################################################
#
# If admins want nicer processes, here's the place to get them.
#
#try:
# os.nice(20) # bump the nice level of this process
#except:
# pass
#########################################################################
#
# Go do the work.
#
import sapi
import viewvc
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)

216
bin/custis-install Executable file
View File

@@ -0,0 +1,216 @@
#!/bin/sh
# ViewVC installation script for CustIS
if [ -f custis-install-config ]; then
. custis-install-config
else
cat >custis-install-config <<EOF
CVS_ASYNC=
SVN_ASYNC=
CVS_USER=www-data
CVS_GROUP=cvs.users
CVSROOTS=
SVNROOT=
SVN_FORBIDDENRE=
DB_HOST=
DB_PORT=
DB_SOCKET=/var/run/mysqld/mysqld.sock
DB=
DB_USER=
DB_PASSWD=
VIEWVC_DIR=
VIEWVC_URI=/
VIEWVC_URI_SLASH=/
VIEWVC_STATIC_URI=/static
http_proxy=
no_proxy=
EOF
echo Empty 'custis-install-config' initialized, please edit it before installation.
exit
fi
if [ ! "$DB" -o ! "$VIEWVC_DIR" ]; then
echo Please set up 'custis-install-config' before installation.
exit
fi
################################################################################
export http_proxy
export no_proxy
DEPS="python libapache2-mod-python rcs diff cvsnt subversion subversion-tools python-setuptools python-subversion python-mysqldb cvsgraph"
echo "*** Installing dependency packages: $DEPS"
apt-get install $DEPS
echo "*** Installing Pygments for Python"
wget http://pypi.python.org/packages/source/P/Pygments/Pygments-0.11.1.tar.gz
tar -zxf Pygments-0.11.1.tar.gz
cd Pygments-0.11.1
python setup.py install
cd ..
echo "*** Installing ViewVC into $VIEWVC_DIR"
if [ ! -e $VIEWVC_DIR/viewvc.conf ]; then
../viewvc-install <<EOF
$VIEWVC_DIR
EOF
fi
echo "*** Writing ViewVC configuration into $VIEWVC_DIR/viewvc.conf"
for CVSROOT in $CVSROOTS; do
if [ "$vccvsroots" ]; then
vccvsroots="$vccvsroots, "
fi
vcrootname=`basename $CVSROOT`
vccvsroots="$vccvsroots$vcrootname: $CVSROOT"
done;
cat >"$VIEWVC_DIR/viewvc.conf" <<EOF
[general]
cvs_roots = $vccvsroots
root_parents = $SVNROOT : svn
cvsnt_exe_path = /usr/bin/cvsnt
mime_types_file = /etc/mime.types
address = Admin address: stas [gav-gav] custis [ru]
kv_files =
languages = en-us, ru-ru
[utilities]
rcs_dir = /usr/bin
cvsnt = /usr/bin/cvsnt
svn = /usr/bin/svn
diff = /usr/bin/diff
cvsgraph = /usr/bin/cvsgraph
[options]
allowed_views = markup, annotate, roots
authorizer = forbiddenre
checkout_magic = 0
cross_copies = 1
cvsgraph_conf = $VIEWVC_DIR/cvsgraph.conf
default_file_view = log
diff_format = h
docroot = $VIEWVC_STATIC_URI
enable_syntax_coloration = 1
generate_etags = 1
hide_attic = 1
hide_cvsroot = 1
hide_errorful_entries = 0
hr_breakable = 1
hr_funout = 0
hr_ignore_keyword_subst = 1
hr_ignore_white = 1
hr_intraline = 0
http_expiration_time = 600
limit_changes = 100
log_sort = date
mangle_email_addresses = 1
root_as_url_component = 1
short_log_len = 80
show_log_in_markup = 1
show_logs = 1
show_subdir_lastmod = 0
sort_by = file
sort_group_dirs = 1
svn_config_dir =
template_dir = templates
use_cvsgraph = 1
use_localtime = 1
use_pagesize = 0
use_rcsparse = 0
use_re_search = 0
[templates]
[cvsdb]
enabled = 1
host = $DB_HOST
socket = $DB_SOCKET
database_name = $DB
user = $DB_USER
passwd = $DB_PASSWD
readonly_user = $DB_USER
readonly_passwd = $DB_PASSWD
[vhosts]
[authz-forbidden]
forbidden =
[authz-forbiddenre]
forbiddenre = $SVN_FORBIDDENRE
[authz-svnauthz]
authzfile =
EOF
echo "*** Initializing database: $DB using $DB_USER@$DB_HOST"
$VIEWVC_DIR/bin/make-database <<EOF
$DB_HOST
$DB_USER
$DB_PASSWD
$DB
EOF
echo "*** Configuring Apache"
cat >/etc/apache2/sites-available/viewvc <<EOF
<VirtualHost *:80>
ServerName viewvc.office.custis.ru
ServerAlias viewvc
ServerAdmin sysadmins@custis.ru
ServerSignature Off
ErrorLog /var/log/apache2/viewvc-error.log
TransferLog /var/log/apache2/viewvc-access.log
LogLevel warn
# ViewVC at $VIEWVC_URI installed at $VIEWVC_DIR
DocumentRoot $VIEWVC_DIR/bin/mod_python
Alias $VIEWVC_STATIC_URI $VIEWVC_DIR/templates/docroot
Alias $VIEWVC_URI $VIEWVC_DIR/bin/mod_python/
<Location ~ ^${VIEWVC_URI_SLASH}*(\?.*)?$>
Options -Indexes
RewriteEngine On
RewriteRule .* ${VIEWVC_URI_SLASH}viewvc.py%{REQUEST_URI} [R,L]
</Location>
<Directory $VIEWVC_DIR/bin/mod_python>
Options +ExecCGI
AddHandler python-program .py
PythonHandler handler
PythonDebug Off
</Directory>
</VirtualHost>
EOF
a2enmod python
a2enmod mod_python
a2enmod rewrite
a2ensite viewvc
echo "*** Restarting Apache"
apache2ctl stop
sleep 1
apache2ctl start
echo "*** Building commit database for CVS"
for CVSROOT in $CVSROOTS; do
$VIEWVC_DIR/bin/cvsdbadmin rebuild $CVSROOT
done;
echo "*** Building commit database for Subversion repositories"
for i in `ls $SVNROOT`; do
if [ -d "$SVNROOT/$i" ]; then
$VIEWVC_DIR/bin/svndbadmin -v rebuild "$SVNROOT/$i"
fi
done;
# setup hooks for CVS
./setup-cvs-hooks "$CVSROOTS" "$VIEWVC_DIR" "$CVS_USER" "$CVS_GROUP" "$CVS_ASYNC"
# setup hooks for Subversion
./setup-svn-hooks "$SVNROOT" "$VIEWVC_DIR" "$SVN_ASYNC"

211
bin/cvsdbadmin Executable file
View File

@@ -0,0 +1,211 @@
#!/usr/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# administrative program for CVSdb; this is primarily
# used to add/rebuild CVS repositories to the database
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import cvsdb
import viewvc
import vclib.ccvs
from stat import *
def UpdateFile(db, repository, path, update, latest_checkin, quiet_level, encoding = None):
try:
if update:
mtime = os.stat(repository.rcsfile(path, 1))[ST_MTIME]
if mtime < latest_checkin:
return
commit_list = cvsdb.GetUnrecordedCommitList(repository, path, db)
else:
commit_list = cvsdb.GetCommitListFromRCSFile(repository, path)
except cvsdb.error, e:
print '[ERROR] %s' % (e)
return
except vclib.ItemNotFound, e:
return
file = '/'.join(path)
printing = 0
if update:
if quiet_level < 1 or (quiet_level < 2 and len(commit_list)):
printing = 1
print '[%s [%d new commits]]' % (file, len(commit_list)),
else:
if quiet_level < 2:
printing = 1
print '[%s [%d commits]]' % (file, len(commit_list)),
## add the commits into the database
for commit in commit_list:
if encoding:
commit.SetFile(commit.GetFile().decode(encoding).encode('utf-8'))
db.AddCommit(commit)
if printing:
sys.stdout.write('.')
sys.stdout.flush()
if printing:
print
def RecurseUpdate(db, repository, directory, update, latest_checkin,
quiet_level, encoding = None):
for entry in repository.listdir(directory, None, {}):
path = directory + [entry.name]
if entry.errors:
continue
if entry.kind is vclib.DIR:
RecurseUpdate(db, repository, path, update, latest_checkin,
quiet_level, encoding)
continue
if entry.kind is vclib.FILE:
UpdateFile(db, repository, path, update, latest_checkin,
quiet_level, encoding)
def RootPath(path, quiet_level):
"""Break os path into cvs root path and other parts"""
root = os.path.abspath(path)
path_parts = []
p = root
while 1:
if os.path.exists(os.path.join(p, 'CVSROOT')):
root = p
if quiet_level < 2:
print "Using repository root `%s'" % root
break
p, pdir = os.path.split(p)
if not pdir:
del path_parts[:]
if quiet_level < 1:
print "Using repository root `%s'" % root
print "Warning: CVSROOT directory not found."
break
path_parts.append(pdir)
root = cvsdb.CleanRepository(root)
path_parts.reverse()
return root, path_parts
def usage():
cmd = os.path.basename(sys.argv[0])
sys.stderr.write(
"""Administer the ViewVC checkins database data for the CVS repository
located at REPOS-PATH.
Usage: 1. %s [[-q] -q] rebuild REPOS-PATH
2. %s [[-q] -q] update REPOS-PATH
3. %s [[-q] -q] purge REPOS-PATH
1. Rebuild the commit database information for the repository located
at REPOS-PATH, after first purging information specific to that
repository (if any).
2. Update the commit database information for all unrecorded commits
in the repository located at REPOS-PATH.
3. Purge information specific to the repository located at REPOS-PATH
from the database.
Use the -q flag to cause this script to be less verbose; use it twice to
invoke a peaceful state of noiselessness.
""" % (cmd, cmd, cmd))
sys.exit(1)
## main
if __name__ == '__main__':
args = sys.argv
# check the quietness level (0 = verbose, 1 = new commits, 2 = silent)
quiet_level = 0
while 1:
try:
index = args.index('-q')
quiet_level = quiet_level + 1
del args[index]
except ValueError:
break
# validate the command
if len(args) <= 2:
usage()
command = args[1].lower()
if command not in ('rebuild', 'update', 'purge'):
sys.stderr.write('ERROR: unknown command %s\n' % command)
usage()
# get repository and path, and do the work
root, path_parts = RootPath(args[2], quiet_level)
rootpath = vclib.ccvs.canonicalize_rootpath(root)
try:
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
if command in ('rebuild', 'purge'):
if quiet_level < 2:
print "Purging existing data for repository root `%s'" % root
try:
db.PurgeRepository(root, len(path_parts) and '/'.join(path_parts) or '')
except cvsdb.UnknownRepositoryError, e:
if command == 'purge':
sys.stderr.write("ERROR: " + str(e) + "\n")
sys.exit(1)
if command in ('rebuild', 'update'):
repository = vclib.ccvs.CVSRepository(None, rootpath, None,
cfg.utilities, 0, cfg.guesser())
latest_checkin = db.GetLatestCheckinTime(repository)
if latest_checkin is None:
command = 'rebuild'
RecurseUpdate(db, repository, path_parts,
command == 'update', latest_checkin, quiet_level,
cfg.options.cvs_ondisk_charset)
except KeyboardInterrupt:
print
print '** break **'
sys.exit(0)

57
bin/cvsnt-import-cvsacl Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/perl
use strict;
my ($type, $path, $branch, $user, $perm);
my $R = ''; # -R for recursive
my $lvl = {
r => 1,
t => 2,
w => 3,
c => 4,
a => 4,
p => 5,
};
while(<>)
{
chomp;
next if /^\s*#/so;
($type, $path, $branch, $user, $perm) = split /:/, $_;
($user, $perm) = split /!/, $user;
next unless $perm;
$perm = [ sort { $lvl->{$b} cmp $lvl->{$a} } split //, $perm ];
$perm = $perm->[0];
if ($perm eq 't')
{
$perm = 'read,tag,nowrite,nocreate,nocontrol';
}
elsif ($perm eq 'r')
{
$perm = 'read,notag,nowrite,nocreate,nocontrol';
}
elsif ($perm eq 'w')
{
$perm = 'read,tag,write,nocreate,nocontrol';
}
elsif ($perm eq 'c' || $perm eq 'a')
{
$perm = 'read,tag,write,create,nocontrol';
}
elsif ($perm eq 'p')
{
$perm = 'read,tag,write,create,control';
}
print "cvs rchacl$R -a $perm";
print " -u '$user'" if $user ne 'ALL';
print " -r '$branch'" if $branch ne 'ALL';
if ($path ne 'ALL')
{
print " '$path'";
}
else
{
print ' `ls $CVSROOT | grep -v '."'#cvs'`";
}
print "\n";
}

21
bin/cvsnt-rcsfile-inetd.pl Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/perl
# Very simple inetd/xinetd "cvsnt rcsfile" service
# Useful for ViewVC as there is an unpleasant non-stable bug, probably somewhere
# inside mod_python or Apache, which SOMETIMES causes cvsnt subprocesses forked
# from mod_python to die. This gives empty diff outputs or different errors like
# "Error: Rlog output ended early. Expected RCS file ..."
# This script removes forking from mod_python code and solves the issue.
# Additional profit of this script is that you can probably browse REMOTE cvs
# repositories, if you expose this service to ViewVC, although it is not tested.
# USAGE: (local) create an inetd service with this script as server listening
# on some port of 127.0.0.1 and put "rcsfile_socket = 127.0.0.1:port"
# into "utilities" section of viewvc.conf
$args = <STDIN>;
$args =~ s/\s+$//so;
@args = $args =~ /\'([^\']+)\'/giso;
# We don't execute shell, so this is mostly safe, not a backdoor :)
exec('/usr/bin/cvsnt', 'rcsfile', @args);

317
bin/loginfo-handler Executable file
View File

@@ -0,0 +1,317 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# updates SQL database with new commit records
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import getopt
import re
import cvsdb
import viewvc
import vclib.ccvs
DEBUG_FLAG = 0
## output functions
def debug(text):
if DEBUG_FLAG:
if type(text) != (type([])):
text = [text]
for line in text:
line = line.rstrip('\n\r')
print 'DEBUG(viewvc-loginfo):', line
def warning(text):
print 'WARNING(viewvc-loginfo):', text
def error(text):
print 'ERROR(viewvc-loginfo):', text
sys.exit(1)
_re_revisions = re.compile(
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
r"(?:$| )" # space or end of string
)
def Cvs1Dot12ArgParse(args):
"""CVS 1.12 introduced a new loginfo format while provides the various
pieces of interesting version information to the handler script as
individual arguments instead of as a single string."""
if args[1] == '- New directory':
return None, None
elif args[1] == '- Imported sources':
return None, None
else:
directory = args.pop(0)
files = []
while len(args) >= 3:
files.append(args[0:3])
args = args[3:]
return directory, files
def HeuristicArgParse(s, repository):
"""Older versions of CVS (except for CVSNT) do not escape spaces in file
and directory names that are passed to the loginfo handler. Since the input
to loginfo is a space separated string, this can lead to ambiguities. This
function attempts to guess intelligently which spaces are separators and
which are part of file or directory names. It disambiguates spaces in
filenames from the separator spaces between files by assuming that every
space which is preceded by two well-formed revision numbers is in fact a
separator. It disambiguates the first separator space from spaces in the
directory name by choosing the longest possible directory name that
actually exists in the repository"""
if (s[-16:] == ' - New directory'
or s[:26] == ' - New directory,NONE,NONE'):
return None, None
if (s[-19:] == ' - Imported sources'
or s[-29:] == ' - Imported sources,NONE,NONE'):
return None, None
file_data_list = []
start = 0
while 1:
m = _re_revisions.search(s, start)
if start == 0:
if m is None:
error('Argument "%s" does not contain any revision numbers' \
% s)
directory, filename = FindLongestDirectory(s[:m.start()],
repository)
if directory is None:
error('Argument "%s" does not start with a valid directory' \
% s)
debug('Directory name is "%s"' % directory)
else:
if m is None:
warning('Failed to interpret past position %i in the loginfo '
'argument, leftover string is "%s"' \
% start, pos[start:])
filename = s[start:m.start()]
old_version, new_version = m.group('old', 'new')
file_data_list.append((filename, old_version, new_version))
debug('File "%s", old revision %s, new revision %s'
% (filename, old_version, new_version))
start = m.end()
if start == len(s): break
return directory, file_data_list
def FindLongestDirectory(s, repository):
"""Splits the first part of the argument string into a directory name
and a file name, either of which may contain spaces. Returns the longest
possible directory name that actually exists"""
parts = s.split()
for i in range(len(parts)-1, 0, -1):
directory = ' '.join(parts[:i])
filename = ' '.join(parts[i:])
if os.path.isdir(os.path.join(repository, directory)):
return directory, filename
return None, None
_re_cvsnt_revisions = re.compile(
r"(?P<filename>.*)" # comma and first revision
r",(?P<old>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and first revision
r",(?P<new>(?:\d+\.\d+)(?:\.\d+\.\d+)*|NONE)" # comma and second revision
r"$" # end of string
)
def CvsNtArgParse(s, repository):
"""CVSNT escapes all spaces in filenames and directory names with
backslashes"""
if s[-18:] == r' -\ New\ directory':
return None, None
if s[-21:] == r' -\ Imported\ sources':
return None, None
file_data_list = []
directory, pos = NextFile(s)
debug('Directory name is "%s"' % directory)
while 1:
fileinfo, pos = NextFile(s, pos)
if fileinfo is None:
break
m = _re_cvsnt_revisions.match(fileinfo)
if m is None:
warning('Can\'t parse file information in "%s"' % fileinfo)
continue
file_data = m.group('filename', 'old', 'new')
file_data_list.append(file_data)
debug('File "%s", old revision %s, new revision %s' % file_data)
return directory, file_data_list
def NextFile(s, pos = 0):
escaped = 0
ret = ''
i = pos
while i < len(s):
c = s[i]
if escaped:
ret += c
escaped = 0
elif c == '\\':
escaped = 1
elif c == ' ':
return ret, i + 1
else:
ret += c
i += 1
return ret or None, i
def ProcessLoginfo(rootpath, directory, files):
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
repository = vclib.ccvs.CVSRepository(None, rootpath, None,
cfg.utilities, 0)
# split up the directory components
dirpath = filter(None, os.path.normpath(directory).split(os.sep))
## build a list of Commit objects
commit_list = []
for filename, old_version, new_version in files:
filepath = dirpath + [filename]
## XXX: this is nasty: in the case of a removed file, we are not
## given enough information to find it in the rlog output!
## So instead, we rlog everything in the removed file, and
## add any commits not already in the database
if new_version == 'NONE':
commits = cvsdb.GetUnrecordedCommitList(repository, filepath, db)
else:
commits = cvsdb.GetCommitListFromRCSFile(repository, filepath,
new_version)
commit_list.extend(commits)
## add to the database
db.AddCommitList(commit_list)
## MAIN
if __name__ == '__main__':
## get the repository from the environment
try:
repository = os.environ['CVSROOT']
except KeyError:
error('CVSROOT not in environment')
debug('Repository name is "%s"' % repository)
## parse arguments
argc = len(sys.argv)
debug('Got %d arguments:' % (argc))
debug(map(lambda x: ' ' + x, sys.argv))
# if we have more than 3 arguments, we are likely using the
# newer loginfo format introduced in CVS 1.12:
#
# ALL <path>/bin/loginfo-handler %p %{sVv}
if argc > 3:
directory, files = Cvs1Dot12ArgParse(sys.argv[1:])
else:
if len(sys.argv) > 1:
# the first argument should contain file version information
arg = sys.argv[1]
else:
# if there are no arguments, read version information from
# first line of input like old versions of ViewCVS did
arg = sys.stdin.readline().rstrip()
if len(sys.argv) > 2:
# if there is a second argument it indicates which parser
# should be used to interpret the version information
if sys.argv[2] == 'cvs':
fun = HeuristicArgParse
elif sys.argv[2] == 'cvsnt':
fun = CvsNtArgParse
else:
error('Bad arguments')
else:
# if there is no second argument, guess which parser to use based
# on the operating system. Since CVSNT now runs on Windows and
# Linux, the guess isn't necessarily correct
if sys.platform == "win32":
fun = CvsNtArgParse
else:
fun = HeuristicArgParse
directory, files = fun(arg, repository)
debug('Discarded from stdin:')
debug(map(lambda x: ' ' + x, sys.stdin.readlines())) # consume stdin
repository = cvsdb.CleanRepository(repository)
debug('Repository: %s' % (repository))
debug('Directory: %s' % (directory))
debug('Files: %s' % (str(files)))
if files is None:
debug('Not a checkin, nothing to do')
else:
ProcessLoginfo(repository, directory, files)
sys.exit(0)

363
bin/make-database Executable file
View File

@@ -0,0 +1,363 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2009 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# administrative program for CVSdb; creates a clean database in
# MySQL 3.22 or later
#
# -----------------------------------------------------------------------
import os, sys, string
import popen2
import getopt
## ------------------------------------------------------------------------
## Stuff common to all schemas
##
DATABASE_SCRIPT_COMMON="""\
DROP DATABASE IF EXISTS <dbname>;
CREATE DATABASE <dbname>;
USE <dbname>;
"""
## ------------------------------------------------------------------------
## Version 0: The original, Bonsai-compatible schema.
##
DATABASE_SCRIPT_VERSION_0="""\
DROP TABLE IF EXISTS branches;
CREATE TABLE branches (
id mediumint(9) NOT NULL auto_increment,
branch varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE branch (branch)
) TYPE=InnoDB;
DROP TABLE IF EXISTS checkins;
CREATE TABLE checkins (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
type enum('Change','Add','Remove'),
ci_when datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
whoid mediumint(9) DEFAULT '0' NOT NULL,
repositoryid mediumint(9) DEFAULT '0' NOT NULL,
dirid mediumint(9) DEFAULT '0' NOT NULL,
fileid mediumint(9) DEFAULT '0' NOT NULL,
revision varchar(32) binary DEFAULT '' NOT NULL,
stickytag varchar(255) binary DEFAULT '' NOT NULL,
branchid mediumint(9) DEFAULT '0' NOT NULL,
addedlines int(11) DEFAULT '0' NOT NULL,
removedlines int(11) DEFAULT '0' NOT NULL,
descid mediumint(9),
UNIQUE repositoryid (repositoryid,dirid,fileid,revision),
KEY repositoryid_when (repositoryid,ci_when),
KEY ci_when (ci_when),
KEY whoid (whoid,ci_when),
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid),
KEY descid (descid)
) TYPE=InnoDB;
DROP TABLE IF EXISTS descs;
CREATE TABLE descs (
id mediumint(9) NOT NULL auto_increment,
description text,
hash bigint(20) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY hash (hash),
FULLTEXT KEY description (description)
) TYPE=MyISAM;
DROP TABLE IF EXISTS dirs;
CREATE TABLE dirs (
id mediumint(9) NOT NULL auto_increment,
dir varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE dir (dir)
) TYPE=InnoDB;
DROP TABLE IF EXISTS files;
CREATE TABLE files (
id mediumint(9) NOT NULL auto_increment,
file varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE file (file)
) TYPE=InnoDB;
DROP TABLE IF EXISTS people;
CREATE TABLE people (
id mediumint(9) NOT NULL auto_increment,
who varchar(128) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE who (who)
) TYPE=InnoDB;
DROP TABLE IF EXISTS repositories;
CREATE TABLE repositories (
id mediumint(9) NOT NULL auto_increment,
repository varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE repository (repository)
) TYPE=InnoDB;
DROP TABLE IF EXISTS tags;
CREATE TABLE tags (
repositoryid mediumint(9) DEFAULT '0' NOT NULL,
branchid mediumint(9) DEFAULT '0' NOT NULL,
dirid mediumint(9) DEFAULT '0' NOT NULL,
fileid mediumint(9) DEFAULT '0' NOT NULL,
revision varchar(32) binary DEFAULT '' NOT NULL,
UNIQUE repositoryid (repositoryid,dirid,fileid,branchid,revision),
KEY repositoryid_2 (repositoryid),
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid)
) TYPE=InnoDB;
DROP TABLE IF EXISTS contents;
CREATE TABLE contents (
id int NOT NULL PRIMARY KEY,
content MEDIUMTEXT NOT NULL DEFAULT ''
) TYPE=MyISAM;
"""
## ------------------------------------------------------------------------
## Version 1: Adds the 'metadata' table. Adds 'descid' index to
## 'checkins' table, and renames that table to 'commits'.
##
DATABASE_SCRIPT_VERSION_1="""\
DROP TABLE IF EXISTS branches;
CREATE TABLE branches (
id mediumint(9) NOT NULL auto_increment,
branch varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE branch (branch)
) TYPE=InnoDB;
DROP TABLE IF EXISTS commits;
CREATE TABLE commits (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
type enum('Change','Add','Remove'),
ci_when datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
whoid mediumint(9) DEFAULT '0' NOT NULL,
repositoryid mediumint(9) DEFAULT '0' NOT NULL,
dirid mediumint(9) DEFAULT '0' NOT NULL,
fileid mediumint(9) DEFAULT '0' NOT NULL,
revision varchar(32) binary DEFAULT '' NOT NULL,
stickytag varchar(255) binary DEFAULT '' NOT NULL,
branchid mediumint(9) DEFAULT '0' NOT NULL,
addedlines int(11) DEFAULT '0' NOT NULL,
removedlines int(11) DEFAULT '0' NOT NULL,
descid mediumint(9),
UNIQUE repositoryid (repositoryid,dirid,fileid,revision),
KEY repositoryid_when (repositoryid,ci_when),
KEY ci_when (ci_when),
KEY whoid (whoid,ci_when),
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid),
KEY descid (descid)
) TYPE=InnoDB;
DROP TABLE IF EXISTS descs;
CREATE TABLE descs (
id mediumint(9) NOT NULL auto_increment,
description text,
hash bigint(20) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
KEY hash (hash),
FULLTEXT KEY description (description)
) TYPE=MyISAM;
DROP TABLE IF EXISTS dirs;
CREATE TABLE dirs (
id mediumint(9) NOT NULL auto_increment,
dir varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE dir (dir)
) TYPE=InnoDB;
DROP TABLE IF EXISTS files;
CREATE TABLE files (
id mediumint(9) NOT NULL auto_increment,
file varchar(255) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE file (file)
) TYPE=InnoDB;
DROP TABLE IF EXISTS people;
CREATE TABLE people (
id mediumint(9) NOT NULL auto_increment,
who varchar(128) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE who (who)
) TYPE=InnoDB;
DROP TABLE IF EXISTS repositories;
CREATE TABLE repositories (
id mediumint(9) NOT NULL auto_increment,
repository varchar(64) binary DEFAULT '' NOT NULL,
PRIMARY KEY (id),
UNIQUE repository (repository)
) TYPE=InnoDB;
DROP TABLE IF EXISTS tags;
CREATE TABLE tags (
repositoryid mediumint(9) DEFAULT '0' NOT NULL,
branchid mediumint(9) DEFAULT '0' NOT NULL,
dirid mediumint(9) DEFAULT '0' NOT NULL,
fileid mediumint(9) DEFAULT '0' NOT NULL,
revision varchar(32) binary DEFAULT '' NOT NULL,
UNIQUE repositoryid (repositoryid,dirid,fileid,branchid,revision),
KEY repositoryid_2 (repositoryid),
KEY dirid (dirid),
KEY fileid (fileid),
KEY branchid (branchid)
) TYPE=InnoDB;
DROP TABLE IF EXISTS metadata;
CREATE TABLE metadata (
name varchar(255) binary DEFAULT '' NOT NULL,
value text,
PRIMARY KEY (name),
UNIQUE name (name)
) TYPE=InnoDB;
INSERT INTO metadata (name, value) VALUES ('version', '1');
DROP TABLE IF EXISTS contents;
CREATE TABLE contents (
id int NOT NULL PRIMARY KEY,
content MEDIUMTEXT NOT NULL DEFAULT ''
) TYPE=MyISAM;
"""
BONSAI_COMPAT="""
WARNING: Creating Bonsai-compatible legacy database version. Some ViewVC
features may not be available, or may not perform especially well.
"""
## ------------------------------------------------------------------------
def usage_and_exit(errmsg=None):
stream = errmsg is None and sys.stdout or sys.stderr
stream.write("""\
Usage: %s [OPTIONS]
This script creates the database and tables in MySQL used by the
ViewVC checkin database. In order to operate correctly, it needs to
know the following: your database server hostname, database user,
database user password, and database name. (You will be prompted for
any of this information that you do not provide via command-line
options.) This script will use the 'mysql' program to create the
database for you. You will then need to set the appropriate
parameters in the [cvsdb] section of your viewvc.conf file.
Options:
--dbname=ARG Use ARG as the ViewVC database name to create.
[Default: ViewVC]
--help Show this usage message.
--hostname=ARG Use ARG as the hostname for the MySQL connection.
[Default: localhost]
--password=ARG Use ARG as the password for the MySQL connection.
--username=ARG Use ARG as the username for the MySQL connection.
--version=ARG Create the database using the schema employed by
version ARG of ViewVC. Valid values are:
[ "1.0" ]
""" % (os.path.basename(sys.argv[0])))
if errmsg is not None:
stream.write("[ERROR] %s.\n" % (errmsg))
sys.exit(1)
sys.exit(0)
if __name__ == "__main__":
try:
# Parse the command-line options, if any.
dbname = version = hostname = username = password = None
opts, args = getopt.getopt(sys.argv[1:], '', [ 'dbname=',
'help',
'hostname=',
'password=',
'username=',
'version=',
])
if len(args) > 0:
usage_and_exit("Unexpected command-line parameters")
for name, value in opts:
if name == '--help':
usage_and_exit(0)
elif name == '--dbname':
dbname = value
elif name == '--hostname':
hostname = value
elif name == '--username':
username = value
elif name == '--password':
password = value
elif name == '--version':
if value in ["1.0"]:
version = value
else:
usage_and_exit("Invalid version specified")
# Prompt for information not provided via command-line options.
if hostname is None:
hostname = raw_input("MySQL Hostname [default: localhost]: ") or ""
if username is None:
username = raw_input("MySQL User: ")
if password is None:
password = raw_input("MySQL Password: ")
if dbname is None:
dbname = raw_input("ViewVC Database Name [default: ViewVC]: ") or "ViewVC"
# Create the database
dscript = string.replace(DATABASE_SCRIPT_COMMON, "<dbname>", dbname)
if version == "1.0":
print BONSAI_COMPAT
dscript = dscript + DATABASE_SCRIPT_VERSION_0
else:
dscript = dscript + DATABASE_SCRIPT_VERSION_1
host_option = hostname and "--host=%s" % (hostname) or ""
if sys.platform == "win32":
cmd = "mysql --user=%s --password=%s %s "\
% (username, password, host_option)
mysql = os.popen(cmd, "w") # popen2.Popen3 is not provided on windows
mysql.write(dscript)
status = mysql.close()
else:
cmd = "{ mysql --user=%s --password=%s %s ; } 2>&1" \
% (username, password, host_option)
pipes = popen2.Popen3(cmd)
pipes.tochild.write(dscript)
pipes.tochild.close()
print pipes.fromchild.read()
status = pipes.wait()
if status:
print "[ERROR] The database did not create sucessfully."
sys.exit(1)
print "Database created successfully. Don't forget to configure the "
print "[cvsdb] section of your viewvc.conf file."
except KeyboardInterrupt:
pass
sys.exit(0)

3
bin/mod_python/.htaccess Normal file
View File

@@ -0,0 +1,3 @@
AddHandler python-program .py
PythonHandler handler
PythonDebug Off

29
bin/mod_python/handler.py Executable file
View File

@@ -0,0 +1,29 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Mod_Python handler based on mod_python.publisher
#
# -----------------------------------------------------------------------
from mod_python import apache
import os.path
def handler(req):
path, module_name = os.path.split(req.filename)
module_name, module_ext = os.path.splitext(module_name)
# Let it be 500 Internal Server Error in case of import error
module = apache.import_module(module_name, path=[path])
req.add_common_vars()
module.index(req)
return apache.OK

75
bin/mod_python/query.py Executable file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# ViewVC: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
import sapi
import imp
# Import real ViewVC module
fp, pathname, description = imp.find_module('viewvc', [LIBRARY_DIR])
try:
viewvc = imp.load_module('viewvc', fp, pathname, description)
finally:
if fp:
fp.close()
# Import real ViewVC Query modules
fp, pathname, description = imp.find_module('query', [LIBRARY_DIR])
try:
query = imp.load_module('query', fp, pathname, description)
finally:
if fp:
fp.close()
cfg = viewvc.load_config(CONF_PATHNAME)
def index(req):
server = sapi.ModPythonServer(req)
try:
viewvc_base_url = cfg.query.viewvc_base_url
if viewvc_base_url is None:
viewvc_base_url = "viewvc.py"
query.main(server, cfg, viewvc_base_url)
finally:
server.close()

69
bin/mod_python/viewvc.py Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewVC app. It checks the load
# average, then loads the (precompiled) viewvc.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
import sapi
import imp
import signal
# Totally ignore SIGPIPE - needed for overcoming popen() errors
def sigpipe(signum, frame):
pass
signal.signal(signal.SIGPIPE, sigpipe)
# Import real ViewVC module
fp, pathname, description = imp.find_module('viewvc', [LIBRARY_DIR])
try:
viewvc = imp.load_module('viewvc', fp, pathname, description)
finally:
if fp:
fp.close()
def index(req):
server = sapi.ModPythonServer(req)
cfg = viewvc.load_config(CONF_PATHNAME, server)
try:
viewvc.main(server, cfg)
finally:
server.close()

57
bin/setup-cvs-hooks Executable file
View File

@@ -0,0 +1,57 @@
#!/bin/sh
CVSROOTS=$1
VIEWVC_DIR=$2
CVS_USER=$3
CVS_GROUP=$4
CVS_ASYNC=$5
if [ ! "$CVSROOTS" -o ! "$VIEWVC_DIR" -o ! "$CVS_USER" -o ! "$CVS_GROUP" ]; then
echo "USAGE: $0 <CVS_ROOTS> <VIEWVC_DIR> <CVS_USER> <CVS_GROUP> [CVS_ASYNC]"
exit
fi
echo "*** Setting up commit hooks for CVS repositories (job=$CVS_ASYNC)"
chgrp $CVS_GROUP $VIEWVC_DIR
chmod 775 $VIEWVC_DIR
chmod 1777 .
for CVSROOT in $CVSROOTS; do
vcrootname=`basename $CVSROOT`
if [ "$CVS_ASYNC" ]; then
VHOOK="touch $VIEWVC_DIR/.cvs-updated-$vcrootname"
else
VHOOK="$VIEWVC_DIR/bin/cvsdbadmin update $CVSROOT >/dev/null"
fi;
su $CVS_USER -s /bin/sh <<EOSH
CVSROOT=$CVSROOT cvs co CVSROOT
if [ $? -eq 0 ]; then
cd CVSROOT
mv loginfo loginfo.bak
grep -v '/.cvs-updated' <loginfo.bak | grep -v '/bin/cvsdbadmin update' >loginfo
cat >>loginfo <<EOF
ALL $VHOOK
EOF
cvs ci -m 'CVS commit hook for ViewVC' loginfo
cd ..
rm -Rf CVSROOT
fi
EOSH
if [ "$CVS_ASYNC" ]; then
cat >$VIEWVC_DIR/cvshook-$vcrootname <<EOF
#!/bin/sh
if [ -e "$VIEWVC_DIR/.cvs-updated-$vcrootname" ]; then
rm "$VIEWVC_DIR/.cvs-updated-$vcrootname"
$VIEWVC_DIR/bin/cvsdbadmin update $CVSROOT >/dev/null
fi
EOF
chmod 755 $VIEWVC_DIR/cvshook-$vcrootname
cat >/etc/cron.d/viewvc-cvs-$vcrootname <<EOF
*/5 * * * * root $VIEWVC_DIR/cvshook-$vcrootname
EOF
fi
done;
if [ "$CVS_ASYNC" ]; then
echo "*** Reloading cron daemon"
/etc/init.d/cron reload
fi

36
bin/setup-svn-hooks Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/sh
SVNROOT=$1
VIEWVC_DIR=$2
SVN_ASYNC=$3
if [ ! "$SVNROOT" -o ! "$VIEWVC_DIR" ]; then
echo "USAGE: $0 <SVNROOT> <VIEWVC_DIR>"
exit
fi
echo "*** Setting up commit hooks for Subversion"
for i in `ls $SVNROOT`; do
if [ -d "$SVNROOT/$i" ]; then
if [ "$SVN_ASYNC" ]; then
cat >"$SVNROOT/$i/hooks/post-commit.tmp" <<EOF
#!/bin/sh
echo "\$1 \$2" >> $VIEWVC_DIR/.svn-updated
EOF
else
cat >"$SVNROOT/$i/hooks/post-commit.tmp" <<EOF
#!/bin/sh
$VIEWVC_DIR/bin/svndbadmin update \$1 \$2
EOF
fi
chmod 755 "$SVNROOT/$i/hooks/post-commit.tmp"
mv "$SVNROOT/$i/hooks/post-commit.tmp" "$SVNROOT/$i/hooks/post-commit"
fi
done;
if [ "$SVN_ASYNC" ]; then
cat >/etc/cron.d/viewvc-svn <<EOF
*/10 * * * * root $VIEWVC_DIR/bin/svnupdate-async.sh "$VIEWVC_DIR"
EOF
/etc/init.d/cron reload
fi

588
bin/standalone.py Executable file
View File

@@ -0,0 +1,588 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# This program originally written by Peter Funk <pf@artcom-gmbh.de>, with
# contributions by Ka-Ping Yee.
#
# -----------------------------------------------------------------------
"""Run "standalone.py -p <port>" to start an HTTP server on a given port
on the local machine to generate ViewVC web pages.
"""
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
import sys
import os
import os.path
import stat
import string
import urllib
import rfc822
import socket
import select
import base64
import BaseHTTPServer
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
import sapi
import viewvc
# The 'crypt' module is only available on Unix platforms. We'll try
# to use 'fcrypt' if it's available (for more information, see
# http://carey.geek.nz/code/python-fcrypt/).
has_crypt = False
try:
import crypt
has_crypt = True
def _check_passwd(user_passwd, real_passwd):
return real_passwd == crypt.crypt(user_passwd, real_passwd[:2])
except ImportError:
try:
import fcrypt
has_crypt = True
def _check_passwd(user_passwd, real_passwd):
return real_passwd == fcrypt.crypt(user_passwd, real_passwd[:2])
except ImportError:
def _check_passwd(user_passwd, real_passwd):
return False
class Options:
port = 49152 # default TCP/IP port used for the server
repositories = {} # use default repositories specified in config
host = sys.platform == 'mac' and '127.0.0.1' or 'localhost'
script_alias = 'viewvc'
config_file = None
htpasswd_file = None
class StandaloneServer(sapi.CgiServer):
"""Custom sapi interface that uses a BaseHTTPRequestHandler HANDLER
to generate output."""
def __init__(self, handler):
sapi.CgiServer.__init__(self, inheritableOut = sys.platform != "win32")
self.handler = handler
def header(self, content_type='text/html', status=None):
if not self.headerSent:
self.headerSent = 1
if status is None:
statusCode = 200
statusText = 'OK'
else:
p = status.find(' ')
if p < 0:
statusCode = int(status)
statusText = ''
else:
statusCode = int(status[:p])
statusText = status[p+1:]
self.handler.send_response(statusCode, statusText)
self.handler.send_header("Content-type", content_type)
for (name, value) in self.headers:
self.handler.send_header(name, value)
self.handler.end_headers()
class NotViewVCLocationException(Exception):
"""The request location was not aimed at ViewVC."""
pass
class AuthenticationException(Exception):
"""Authentication requirements have not been met."""
pass
class ViewVCHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Custom HTTP request handler for ViewVC."""
def do_GET(self):
"""Serve a GET request."""
self.handle_request('GET')
def do_POST(self):
"""Serve a POST request."""
self.handle_request('POST')
def handle_request(self, method):
"""Handle a request of type METHOD."""
try:
self.run_viewvc()
except NotViewVCLocationException:
# If the request was aimed at the server root, but there's a
# non-empty script_alias, automatically redirect to the
# script_alias. Otherwise, just return a 404 and shrug.
if (not self.path or self.path == "/") and options.script_alias:
new_url = self.server.url + options.script_alias + '/'
self.send_response(301, "Moved Permanently")
self.send_header("Content-type", "text/html")
self.send_header("Location", new_url)
self.end_headers()
self.wfile.write("""<html>
<head>
<meta http-equiv="refresh" content="10; url=%s" />
<title>Moved Temporarily</title>
</head>
<body>
<h1>Redirecting to ViewVC</h1>
<p>You will be automatically redirected to <a href="%s">ViewVC</a>.
If this doesn't work, please click on the link above.</p>
</body>
</html>
""" % (new_url, new_url))
else:
self.send_error(404)
except IOError: # ignore IOError: [Errno 32] Broken pipe
pass
except AuthenticationException:
self.send_response(401, "Unauthorized")
self.send_header("WWW-Authenticate", 'Basic realm="ViewVC"')
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write("""<html>
<head>
<title>Authentication failed</title>
</head>
<body>
<h1>Authentication failed</h1>
<p>Authentication has failed. Please retry with the correct username
and password.</p>
</body>
</html>""")
def is_viewvc(self):
"""Check whether self.path is, or is a child of, the ScriptAlias"""
if not options.script_alias:
return 1
if self.path == '/' + options.script_alias:
return 1
alias_len = len(options.script_alias)
if self.path[:alias_len+2] == '/' + options.script_alias + '/':
return 1
if self.path[:alias_len+2] == '/' + options.script_alias + '?':
return 1
return 0
def validate_password(self, htpasswd_file, username, password):
"""Compare USERNAME and PASSWORD against HTPASSWD_FILE."""
try:
lines = open(htpasswd_file, 'r').readlines()
for line in lines:
file_user, file_pass = line.rstrip().split(':', 1)
if username == file_user:
return _check_passwd(password, file_pass)
except:
pass
return False
def run_viewvc(self):
"""Run ViewVC to field a single request."""
### Much of this is adapter from Python's standard library
### module CGIHTTPServer.
# Is this request even aimed at ViewVC? If not, complain.
if not self.is_viewvc():
raise NotViewVCLocationException()
# If htpasswd authentication is enabled, try to authenticate the user.
self.username = None
if options.htpasswd_file:
authn = self.headers.get('authorization')
if not authn:
raise AuthenticationException()
try:
kind, data = authn.split(' ', 1)
if kind == 'Basic':
data = base64.b64decode(data)
username, password = data.split(':', 1)
except:
raise AuthenticationException()
if not self.validate_password(options.htpasswd_file, username, password):
raise AuthenticationException()
self.username = username
# Setup the environment in preparation of executing ViewVC's core code.
env = os.environ
scriptname = options.script_alias and '/' + options.script_alias or ''
viewvc_url = self.server.url[:-1] + scriptname
rest = self.path[len(scriptname):]
i = rest.rfind('?')
if i >= 0:
rest, query = rest[:i], rest[i+1:]
else:
query = ''
# Since we're going to modify the env in the parent, provide empty
# values to override previously set values
for k in env.keys():
if k[:5] == 'HTTP_':
del env[k]
for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH',
'HTTP_USER_AGENT', 'HTTP_COOKIE'):
if env.has_key(k):
env[k] = ""
# XXX Much of the following could be prepared ahead of time!
env['SERVER_SOFTWARE'] = self.version_string()
env['SERVER_NAME'] = self.server.server_name
env['GATEWAY_INTERFACE'] = 'CGI/1.1'
env['SERVER_PROTOCOL'] = self.protocol_version
env['SERVER_PORT'] = str(self.server.server_port)
env['REQUEST_METHOD'] = self.command
uqrest = urllib.unquote(rest)
env['PATH_INFO'] = uqrest
env['SCRIPT_NAME'] = scriptname
if query:
env['QUERY_STRING'] = query
env['HTTP_HOST'] = self.server.address[0]
host = self.address_string()
if host != self.client_address[0]:
env['REMOTE_HOST'] = host
env['REMOTE_ADDR'] = self.client_address[0]
if self.username:
env['REMOTE_USER'] = self.username
if self.headers.typeheader is None:
env['CONTENT_TYPE'] = self.headers.type
else:
env['CONTENT_TYPE'] = self.headers.typeheader
length = self.headers.getheader('content-length')
if length:
env['CONTENT_LENGTH'] = length
accept = []
for line in self.headers.getallmatchingheaders('accept'):
if line[:1] in string.whitespace:
accept.append(line.strip())
else:
accept = accept + line[7:].split(',')
env['HTTP_ACCEPT'] = ','.join(accept)
ua = self.headers.getheader('user-agent')
if ua:
env['HTTP_USER_AGENT'] = ua
modified = self.headers.getheader('if-modified-since')
if modified:
env['HTTP_IF_MODIFIED_SINCE'] = modified
etag = self.headers.getheader('if-none-match')
if etag:
env['HTTP_IF_NONE_MATCH'] = etag
# AUTH_TYPE
# REMOTE_IDENT
# XXX Other HTTP_* headers
# Preserve state, because we execute script in current process:
save_argv = sys.argv
save_stdin = sys.stdin
save_stdout = sys.stdout
save_stderr = sys.stderr
# For external tools like enscript we also need to redirect
# the real stdout file descriptor.
#
# FIXME: This code used to carry the following comment:
#
# (On windows, reassigning the sys.stdout variable is sufficient
# because pipe_cmds makes it the standard output for child
# processes.)
#
# But we no longer use pipe_cmds. So at the very least, the
# comment is stale. Is the code okay, though?
if sys.platform != "win32":
save_realstdout = os.dup(1)
try:
try:
sys.stdout = self.wfile
if sys.platform != "win32":
os.dup2(self.wfile.fileno(), 1)
sys.stdin = self.rfile
viewvc.main(StandaloneServer(self), cfg)
finally:
sys.argv = save_argv
sys.stdin = save_stdin
sys.stdout.flush()
if sys.platform != "win32":
os.dup2(save_realstdout, 1)
os.close(save_realstdout)
sys.stdout = save_stdout
sys.stderr = save_stderr
except SystemExit, status:
self.log_error("ViewVC exit status %s", str(status))
else:
self.log_error("ViewVC exited ok")
class ViewVCHTTPServer(BaseHTTPServer.HTTPServer):
"""Customized HTTP server for ViewVC."""
def __init__(self, host, port, callback):
self.address = (host, port)
self.url = 'http://%s:%d/' % (host, port)
self.callback = callback
BaseHTTPServer.HTTPServer.__init__(self, self.address, self.handler)
def serve_until_quit(self):
self.quit = 0
while not self.quit:
rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
if rd:
self.handle_request()
def server_activate(self):
BaseHTTPServer.HTTPServer.server_activate(self)
if self.callback:
self.callback(self)
def server_bind(self):
# set SO_REUSEADDR (if available on this platform)
if hasattr(socket, 'SOL_SOCKET') and hasattr(socket, 'SO_REUSEADDR'):
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
BaseHTTPServer.HTTPServer.server_bind(self)
def serve(host, port, callback=None):
"""Start an HTTP server for HOST on PORT. Call CALLBACK function
when the server is ready to serve."""
ViewVCHTTPServer.handler = ViewVCHTTPRequestHandler
try:
# XXX Move this code out of this function.
# Early loading of configuration here. Used to allow tinkering
# with some configuration settings:
handle_config(options.config_file)
if options.repositories:
cfg.general.default_root = "Development"
for repo_name in options.repositories.keys():
repo_path = os.path.normpath(options.repositories[repo_name])
if os.path.exists(os.path.join(repo_path, "CVSROOT", "config")):
cfg.general.cvs_roots[repo_name] = repo_path
elif os.path.exists(os.path.join(repo_path, "format")):
cfg.general.svn_roots[repo_name] = repo_path
elif cfg.general.cvs_roots.has_key("Development") and \
not os.path.isdir(cfg.general.cvs_roots["Development"]):
sys.stderr.write("*** No repository found. Please use the -r option.\n")
sys.stderr.write(" Use --help for more info.\n")
raise KeyboardInterrupt # Hack!
os.close(0) # To avoid problems with shell job control
# always use default docroot location
cfg.options.docroot = None
# if cvsnt isn't found, fall back to rcs
if (cfg.conf_path is None and cfg.utilities.cvsnt):
import popen
cvsnt_works = 0
try:
fp = popen.popen(cfg.utilities.cvsnt, ['--version'], 'rt')
try:
while 1:
line = fp.readline()
if not line:
break
if line.find("Concurrent Versions System (CVSNT)") >= 0:
cvsnt_works = 1
while fp.read(4096):
pass
break
finally:
fp.close()
except:
pass
if not cvsnt_works:
cfg.utilities.cvsnt = None
ViewVCHTTPServer(host, port, callback).serve_until_quit()
except (KeyboardInterrupt, select.error):
pass
print 'server stopped'
def handle_config(config_file):
global cfg
cfg = viewvc.load_config(config_file or CONF_PATHNAME)
def usage():
clean_options = Options()
cmd = os.path.basename(sys.argv[0])
port = clean_options.port
host = clean_options.host
script_alias = clean_options.script_alias
sys.stderr.write("""Usage: %(cmd)s [OPTIONS]
Run a simple, standalone HTTP server configured to serve up ViewVC requests.
Options:
--config-file=FILE (-c) Read configuration options from FILE. If not
specified, ViewVC will look for a configuration
file in its installation tree, falling back to
built-in default values.
--daemon (-d) Background the server process.
--help Show this usage message and exit.
--host=HOSTNAME (-h) Listen on HOSTNAME. Required for access from a
remote machine. [default: %(host)s]
--htpasswd-file=FILE Authenticate incoming requests, validating against
against FILE, which is an Apache HTTP Server
htpasswd file. (CRYPT only; no DIGEST support.)
--port=PORT (-p) Listen on PORT. [default: %(port)d]
--repository=PATH (-r) Serve the Subversion or CVS repository located
at PATH. This option may be used more than once.
--script-alias=PATH (-s) Use PATH as the virtual script location (similar
to Apache HTTP Server's ScriptAlias directive).
For example, "--script-alias=repo/view" will serve
ViewVC at "http://HOSTNAME:PORT/repo/view".
[default: %(script_alias)s]
""" % locals())
sys.exit(0)
def badusage(errstr):
cmd = os.path.basename(sys.argv[0])
sys.stderr.write("ERROR: %s\n\n"
"Try '%s --help' for detailed usage information.\n"
% (errstr, cmd))
sys.exit(1)
def main(argv):
"""Command-line interface (looks at argv to decide what to do)."""
import getopt
short_opts = ''.join(['c:',
'd',
'h:',
'p:',
'r:',
's:',
])
long_opts = ['daemon',
'config-file=',
'help',
'host=',
'htpasswd-file=',
'port=',
'repository=',
'script-alias=',
]
opt_daemon = False
opt_host = None
opt_port = None
opt_htpasswd_file = None
opt_config_file = None
opt_script_alias = None
opt_repositories = []
# Parse command-line options.
try:
opts, args = getopt.getopt(argv[1:], short_opts, long_opts)
for opt, val in opts:
if opt in ['--help']:
usage()
elif opt in ['-r', '--repository']: # may be used more than once
opt_repositories.append(val)
elif opt in ['-d', '--daemon']:
opt_daemon = 1
elif opt in ['-p', '--port']:
opt_port = val
elif opt in ['-h', '--host']:
opt_host = val
elif opt in ['-s', '--script-alias']:
opt_script_alias = val
elif opt in ['-c', '--config-file']:
opt_config_file = val
elif opt in ['--htpasswd-file']:
opt_htpasswd_file = val
except getopt.error, err:
badusage(str(err))
# Validate options that need validating.
class BadUsage(Exception): pass
try:
if opt_port is not None:
try:
options.port = int(opt_port)
except ValueError:
raise BadUsage("Port '%s' is not a valid port number" % (opt_port))
if not options.port:
raise BadUsage("You must supply a valid port.")
if opt_htpasswd_file is not None:
if not os.path.isfile(opt_htpasswd_file):
raise BadUsage("'%s' does not appear to be a valid htpasswd file."
% (opt_htpasswd_file))
if not has_crypt:
raise BadUsage("Unable to locate suitable `crypt' module for use "
"with --htpasswd-file option. If your Python "
"distribution does not include this module (as is "
"the case on many non-Unix platforms), consider "
"installing the `fcrypt' module instead (see "
"http://carey.geek.nz/code/python-fcrypt/).")
options.htpasswd_file = opt_htpasswd_file
if opt_config_file is not None:
if not os.path.isfile(opt_config_file):
raise BadUsage("'%s' does not appear to be a valid configuration file."
% (opt_config_file))
options.config_file = opt_config_file
if opt_host is not None:
options.host = opt_host
if opt_script_alias is not None:
options.script_alias = '/'.join(filter(None, opt_script_alias.split('/')))
for repository in opt_repositories:
if not options.repositories.has_key('Development'):
rootname = 'Development'
else:
rootname = 'Repository%d' % (len(options.repositories.keys()) + 1)
options.repositories[rootname] = repository
except BadUsage, err:
badusage(str(err))
# Fork if we're in daemon mode.
if opt_daemon:
pid = os.fork()
if pid != 0:
sys.exit()
# Finaly, start the server.
def ready(server):
print 'server ready at %s%s' % (server.url, options.script_alias)
serve(options.host, options.port, ready)
if __name__ == '__main__':
options = Options()
main(sys.argv)

545
bin/svndbadmin Executable file
View File

@@ -0,0 +1,545 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2004-2013 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 2004-2007 James Henstridge
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# administrative program for loading Subversion revision information
# into the checkin database. It can be used to add a single revision
# to the database, or rebuild/update all revisions.
#
# To add all the checkins from a Subversion repository to the checkin
# database, run the following:
# /path/to/svndbadmin rebuild /path/to/repo
#
# This script can also be called from the Subversion post-commit hook,
# something like this:
# REPOS="$1"
# REV="$2"
# /path/to/svndbadmin update "$REPOS" "$REV"
#
# If you allow changes to revision properties in your repository, you
# might also want to set up something similar in the
# post-revprop-change hook using "update" with the --force option to
# keep the checkin database consistent with the repository.
#
# -----------------------------------------------------------------------
#
#########################################################################
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, there will be no 'viewvcinstallpath.py'
#
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
# Adjust sys.path to include our library directory
import sys
import os
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0], "../../lib")))
#########################################################################
import os
import string
import socket
import select
import re
import mimetypes
import time
import svn.core
import svn.repos
import svn.fs
import svn.delta
import cvsdb
import viewvc
import vclib
from viewvcmagic import ContentMagic
class SvnRepo:
"""Class used to manage a connection to a SVN repository."""
def __init__(self, path, index_content = None, tika_client = None, guesser = None,
svn_ignore_mimetype = False, verbose = False):
self.path = path
self.repo = svn.repos.svn_repos_open(path)
self.fs = svn.repos.svn_repos_fs(self.repo)
self.rev_max = svn.fs.youngest_rev(self.fs)
self.index_content = index_content
self.tika_client = tika_client
self.guesser = guesser
self.verbose = verbose
self.svn_ignore_mimetype = svn_ignore_mimetype
def __getitem__(self, rev):
if rev is None:
rev = self.rev_max
elif rev < 0:
rev = rev + self.rev_max + 1
assert 0 <= rev <= self.rev_max
rev = SvnRev(self, rev)
return rev
_re_diff_change_command = re.compile('^(\d+)(?:,(\d+))?([acd])(\d+)(?:,(\d+))?')
class StupidBufferedReader:
def __init__(self, fp, buffer = 262144):
self.fp = fp
self.bufsize = buffer
self.buffer = ''
self.eof = False
def __iter__(self):
return self
def next(self):
if self.eof:
raise StopIteration
return self.readline()
def readline(self):
if self.eof:
return ''
p = self.buffer.find('\n')
while p < 0:
b = self.fp.read(self.bufsize)
if not len(b):
r = self.buffer
self.buffer = ''
self.eof = True
return r
self.buffer = self.buffer + b
p = self.buffer.find('\n')
r = self.buffer[0:p+1]
self.buffer = self.buffer[p+1:]
return r
def _get_diff_counts(diff_fp):
"""Calculate the plus/minus counts by parsing the output of a
normal diff. The reasons for choosing Normal diff format are:
- the output is short, so should be quicker to parse.
- only the change commands need be parsed to calculate the counts.
- All file data is prefixed, so won't be mistaken for a change
command.
This code is based on the description of the format found in the
GNU diff manual."""
plus, minus = 0, 0
for line in diff_fp:
match = re.match(_re_diff_change_command, line)
if match:
# size of first range
if match.group(2):
count1 = int(match.group(2)) - int(match.group(1)) + 1
else:
count1 = 1
cmd = match.group(3)
# size of second range
if match.group(5):
count2 = int(match.group(5)) - int(match.group(4)) + 1
else:
count2 = 1
if cmd == 'a':
# LaR - insert after line L of file1 range R of file2
plus = plus + count2
elif cmd == 'c':
# FcT - replace range F of file1 with range T of file2
minus = minus + count1
plus = plus + count2
elif cmd == 'd':
# RdL - remove range R of file1, which would have been
# at line L of file2
minus = minus + count1
return plus, minus
class TikaClient:
# Create tika client
def __init__(self, tika_server, mime_types, verbose):
self.tika_server = tika_server
self.mime_types = mime_types
self.verbose = verbose
self.addr = tika_server.split(':')
# Split address
if len(self.addr) != 2:
raise Exception('tika_server value is incorrect: \''+tika_server+'\', please use \'host:port\' format')
self.addr = (self.addr[0], int(self.addr[1]))
# Build regexp for MIME types
m = re.split('\s+', mime_types.strip())
self.mime_regexp = re.compile('|'.join('^'+re.escape(i).replace('\\*', '.*')+'$' for i in m))
# Extract text content from file using Tika which runs in server mode
def get_text(self, filename, mime_type, log_filename):
if not self.mime_regexp.match(mime_type):
# Tika can't handle this mime type, return nothing
return ''
fd = None
s = None
text = ''
fsize = 0
try:
# Read original file
fd = open(filename, 'rb')
data = fd.read()
fsize = len(data)
if not fsize:
return ''
# Connect to Tika
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(self.addr)
s.setblocking(0)
sockfd = s.fileno()
# Tika is somewhat delicate about network IO, so:
# Read and write using poll(2) system call
p = select.poll()
p.register(sockfd)
while 1:
fds = p.poll()
if not fds:
break
(pollfd, event) = fds[0]
if event & select.POLLIN:
# Exception or empty data means EOF...
try: part = os.read(sockfd, 65536)
except: break
if not part: break
text += part
if event & select.POLLOUT:
if not len(data):
# Shutdown output and forget about POLLOUT
s.shutdown(socket.SHUT_WR)
p.modify(sockfd, select.POLLIN)
else:
# Write and consume some data
l = os.write(sockfd, data)
data = data[l:]
if len(text) == 0:
raise Exception('Empty response from Tika server')
if self.verbose:
print "Extracted %d bytes from %s (%s) of size %d" % (len(text), log_filename, mime_type, fsize)
except Exception, e:
if self.verbose:
print "Error extracting text from %s (%s) of size %d: %s" % (log_filename, mime_type, fsize, str(e))
finally:
if fd: fd.close()
if s: s.close()
return text
class SvnRev:
"""Class used to hold information about a particular revision of
the repository."""
def __init__(self, repo, rev):
self.repo = repo
self.rev = rev
self.rev_roots = {} # cache of revision roots
# revision properties ...
revprops = svn.fs.revision_proplist(repo.fs, rev)
self.author = str(revprops.get(svn.core.SVN_PROP_REVISION_AUTHOR,''))
self.date = str(revprops.get(svn.core.SVN_PROP_REVISION_DATE, ''))
self.log = str(revprops.get(svn.core.SVN_PROP_REVISION_LOG, ''))
# convert the date string to seconds since epoch ...
try:
self.date = svn.core.svn_time_from_cstring(self.date) / 1000000
except:
self.date = None
# get a root for the current revisions
fsroot = self._get_root_for_rev(rev)
# find changes in the revision
editor = svn.repos.ChangeCollector(repo.fs, fsroot)
e_ptr, e_baton = svn.delta.make_editor(editor)
svn.repos.svn_repos_replay(fsroot, e_ptr, e_baton)
self.changes = []
changes_hash = {}
for path, change in editor.changes.items():
# skip non-file changes
if change.item_kind != svn.core.svn_node_file:
continue
# deal with the change types we handle
action = None
base_root = None
base_path = change.base_path
if change.base_path:
base_root = self._get_root_for_rev(change.base_rev)
# figure out what kind of change this is, and get a diff
# object for it. note that prior to 1.4 Subversion's
# bindings didn't give us change.action, but that's okay
# because back then deleted paths always had a change.path
# of None.
if hasattr(change, 'action') \
and change.action == svn.repos.CHANGE_ACTION_DELETE:
action = 'remove'
elif not change.path:
action = 'remove'
elif change.added:
action = 'add'
else:
action = 'change'
if action == 'remove':
diffobj = svn.fs.FileDiff(base_root, change.base_path, None, None, None, ['-b', '-B'])
else:
diffobj = svn.fs.FileDiff(base_root, change.base_path, fsroot, change.path, None, ['-b', '-B'])
diff_fp = diffobj.get_pipe()
diff_fp = StupidBufferedReader(diff_fp)
plus, minus = _get_diff_counts(diff_fp)
# CustIS Bug 50473: a workaround for svnlib behaviour in file movements (FILE1 -> FILE2 + FILE1 -> null)
if change.base_path:
if not change.path and change.base_path in changes_hash:
minus = 0
elif change.path:
changes_hash[change.base_path] = change.path
content = ''
mime = ''
# need to check if binary file's content changed when copying,
# if not, don't extract it, just get it from previous revision later
if repo.index_content and action != 'remove' and change.path and (not change.base_path
or svn.fs.contents_changed(
base_root and base_root or None,
base_root and change.base_path or None,
fsroot, change.path
)):
props = svn.fs.node_proplist(fsroot, change.path)
if not repo.svn_ignore_mimetype:
mime = props.get('svn:mime-type', None)
else:
mime = None
mime = repo.guesser.guess_mime(
mime,
os.path.basename(change.path),
diffobj.tempfile2
)
# Read and guess charset by ourselves for text files
if mime and mime.startswith('text/') or (mime.startswith('application/') and mime.endswith('xml')):
try:
fd = open(diffobj.tempfile2, 'rb')
content = fd.read()
fd.close()
except: pass
# Guess charset
if content:
content, charset = repo.guesser.guess_charset(content)
if charset:
content = content.encode('utf-8')
if repo.verbose:
print 'Guessed %s for %s' % (charset, change.path)
elif repo.verbose:
print 'Failed to guess charset for %s, not indexing' % (change.path, )
# Try to extract content using Tika from binary documents
elif repo.tika_client:
content = repo.tika_client.get_text(diffobj.tempfile2, mime, change.path)
self.changes.append((path, action, plus, minus, content, mime))
def _get_root_for_rev(self, rev):
"""Fetch a revision root from a cache of such, or a fresh root
(which is then cached for later use."""
if not self.rev_roots.has_key(rev):
self.rev_roots[rev] = svn.fs.revision_root(self.repo.fs, rev)
return self.rev_roots[rev]
def handle_revision(db, command, repo, rev, verbose, force=0):
"""Adds a particular revision of the repository to the checkin database."""
revision = repo[rev]
committed = 0
if verbose: print "Building commit info for revision %d..." % (rev),
if not revision.changes:
if verbose: print "skipped (no changes)."
return
for (path, action, plus, minus, content, mime) in revision.changes:
directory, file = os.path.split(path)
commit = cvsdb.CreateCommit()
commit.SetRepository(repo.path)
commit.SetDirectory(directory)
commit.SetFile(file)
commit.SetRevision(str(rev))
commit.SetAuthor(revision.author)
commit.SetDescription(revision.log)
commit.SetTime(revision.date)
commit.SetPlusCount(plus)
commit.SetMinusCount(minus)
commit.SetBranch(None)
commit.SetContent(content)
commit.SetMimeType(mime)
if action == 'add':
commit.SetTypeAdd()
elif action == 'remove':
commit.SetTypeRemove()
elif action == 'change':
commit.SetTypeChange()
if command == 'update':
result = db.CheckCommit(commit)
if result and not force:
continue # already recorded
# commit to database
db.AddCommit(commit)
committed = 1
if verbose:
if committed:
print "done."
else:
print "skipped (already recorded)."
def main(command, repository, revs=[], verbose=0, force=0):
cfg = viewvc.load_config(CONF_PATHNAME)
db = cvsdb.ConnectDatabase(cfg)
repository = os.path.realpath(repository)
# Purge what must be purged.
if command in ('rebuild', 'purge'):
if verbose:
print "Purging commit info for repository root `%s'" % repository
try:
db.PurgeRepository(repository)
except cvsdb.UnknownRepositoryError, e:
if command == 'purge':
sys.stderr.write("ERROR: " + str(e) + "\n")
sys.exit(1)
tika_client = None
if cfg.utilities.tika_server:
tika_client = TikaClient(cfg.utilities.tika_server, cfg.utilities.tika_mime_types, verbose)
repo = SvnRepo(
path = repository,
index_content = cfg.cvsdb.index_content,
tika_client = tika_client,
guesser = cfg.guesser(),
svn_ignore_mimetype = cfg.options.svn_ignore_mimetype,
verbose = verbose,
)
# Record what must be recorded.
if command == 'rebuild' or (command == 'update' and not revs):
for rev in range(repo.rev_max+1):
handle_revision(db, command, repo, rev, verbose, force)
elif command == 'update':
if revs[0] is None:
revs[0] = repo.rev_max
if revs[1] is None:
revs[1] = repo.rev_max
revs.sort()
for rev in range(revs[0], revs[1]+1):
handle_revision(db, command, repo, rev, verbose, force)
def _rev2int(r):
if r == 'HEAD':
r = None
else:
r = int(r)
if r < 0:
raise ValueError, "invalid revision '%d'" % (r)
return r
def usage():
cmd = os.path.basename(sys.argv[0])
sys.stderr.write(
"""Administer the ViewVC checkins database data for the Subversion repository
located at REPOS-PATH.
Usage: 1. %s [-v] rebuild REPOS-PATH
2. %s [-v] update REPOS-PATH [REV[:REV2]] [--force]
3. %s [-v] purge REPOS-PATH
1. Rebuild the commit database information for the repository located
at REPOS-PATH across all revisions, after first purging
information specific to that repository (if any).
2. Update the commit database information for the repository located
at REPOS-PATH across all revisions or, optionally, only for the
specified revision REV (or revision range REV:REV2). This is just
like rebuilding, except that, unless --force is specified, no
commit information will be stored for commits already present in
the database. If a range is specified, the revisions will be
processed in ascending order, and you may specify "HEAD" to
indicate "the youngest revision currently in the repository".
3. Purge information specific to the repository located at REPOS-PATH
from the database.
Use the -v flag to cause this script to give progress information as it works.
""" % (cmd, cmd, cmd))
sys.exit(1)
if __name__ == '__main__':
verbose = 0
force = 0
args = sys.argv
try:
index = args.index('-v')
verbose = 1
del args[index]
except ValueError:
pass
try:
index = args.index('--force')
force = 1
del args[index]
except ValueError:
pass
if len(args) < 3:
usage()
command = args[1].lower()
if command not in ('rebuild', 'update', 'purge'):
sys.stderr.write('ERROR: unknown command %s\n' % command)
usage()
revs = []
if len(sys.argv) > 3:
if command == 'rebuild':
sys.stderr.write('ERROR: rebuild no longer accepts a revision '
'number argument. Usage update --force.')
usage()
elif command != 'update':
usage()
try:
revs = map(lambda x: _rev2int(x), sys.argv[3].split(':'))
if len(revs) > 2:
raise ValueError, "too many revisions in range"
if len(revs) == 1:
revs.append(revs[0])
except ValueError:
sys.stderr.write('ERROR: invalid revision specification "%s"\n' \
% sys.argv[3])
usage()
else:
rev = None
try:
repository = vclib.svn.canonicalize_rootpath(args[2])
repository = cvsdb.CleanRepository(os.path.abspath(repository))
main(command, repository, revs, verbose, force)
except KeyboardInterrupt:
print
print '** break **'
sys.exit(0)

50
bin/svnupdate-async Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/perl
# Скрипт для обновления SVN репозиториев svndbadmin-ом
# Берёт номера ревизий и имена репозиториев из перечисленных файлов или STDIN,
# группирует их по номерам и выводит список команд, необходимых для обновления
use strict;
# первый аргумент - путь к svndbadmin
my $svndbadmin = shift @ARGV
|| die "USAGE: $0 <path_to_svndbadmin> FILES...";
# считываем названия репозиториев и номера ревизий из файла
my $tou = {};
my ($repos, $rev);
while (<>)
{
s/^\s+//so;
s/\s+$//so;
($repos, $rev) = split /\s+/, $_;
$tou->{$repos}->{$rev} = 1;
}
# превращаем номера ревизий в диапазоны ревизий
my ($i, $j, $r, $nr);
foreach $repos (keys %$tou)
{
$rev = [ sort keys %{$tou->{$repos}} ];
$nr = [];
$j = 0;
for $i (1..@$rev)
{
if ($i > $#$rev || $rev->[$i]-$rev->[$j] > $i-$j)
{
$r = $rev->[$j];
$r .= ":".$rev->[$i-1] if $i-$j > 1;
push @$nr, $r;
$j = $i;
}
}
$tou->{$repos} = $nr;
}
# выводим список команд для выполнения
foreach $repos (keys %$tou)
{
foreach (@{$tou->{$repos}})
{
print "$svndbadmin update $repos $_\n";
}
}

8
bin/svnupdate-async.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
VIEWVC_DIR=$1
test -f "$VIEWVC_DIR/.svn-updating" -o ! -f "$VIEWVC_DIR/.svn-updated" && exit 0
mv "$VIEWVC_DIR/.svn-updated" "$VIEWVC_DIR/.svn-updating"
"$VIEWVC_DIR/bin/svnupdate-async" "$VIEWVC_DIR/bin/svndbadmin" "$VIEWVC_DIR/.svn-updating" | sh &> /tmp/svnupdate-async.log
rm "$VIEWVC_DIR/.svn-updating"

54
bin/wsgi/query.fcgi Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a fcgi entry point for the query ViewVC app. It's appropriate
# for use with mod_fcgid and flup. It defines a single application function
# that is a valid fcgi entry point.
#
# mod_fcgid: http://httpd.apache.org/mod_fcgid/
# flup:
# http://pypi.python.org/pypi/flup
# http://trac.saddi.com/flup
#
# -----------------------------------------------------------------------
import sys, os
LIBRARY_DIR = None
CONF_PATHNAME = None
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
import sapi
import viewvc
import query
from flup.server import fcgi
def application(environ, start_response):
server = sapi.WsgiServer(environ, start_response)
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc_base_url = cfg.query.viewvc_base_url
if viewvc_base_url is None:
viewvc_base_url = "viewvc.fcgi"
query.main(server, cfg, viewvc_base_url)
return []
fcgi.WSGIServer(application).run()

45
bin/wsgi/query.wsgi Normal file
View File

@@ -0,0 +1,45 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a wsgi entry point for the query ViewVC app. It's appropriate
# for use with mod_wsgi. It defines a single application function that
# is a valid wsgi entry point.
#
# -----------------------------------------------------------------------
import sys, os
LIBRARY_DIR = None
CONF_PATHNAME = None
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
import sapi
import viewvc
import query
def application(environ, start_response):
server = sapi.WsgiServer(environ, start_response)
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc_base_url = cfg.query.viewvc_base_url
if viewvc_base_url is None:
viewvc_base_url = "viewvc.wsgi"
query.main(server, cfg, viewvc_base_url)
return []

50
bin/wsgi/viewvc.fcgi Normal file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a fcgi entry point for the main ViewVC app. It's appropriate
# for use with mod_fcgid and flup. It defines a single application function
# that is a valid fcgi entry point.
#
# mod_fcgid: http://httpd.apache.org/mod_fcgid/
# flup:
# http://pypi.python.org/pypi/flup
# http://trac.saddi.com/flup
#
# -----------------------------------------------------------------------
import sys, os
LIBRARY_DIR = None
CONF_PATHNAME = None
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
import sapi
import viewvc
from flup.server import fcgi
def application(environ, start_response):
server = sapi.WsgiServer(environ, start_response)
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)
return []
fcgi.WSGIServer(application).run()

41
bin/wsgi/viewvc.wsgi Normal file
View File

@@ -0,0 +1,41 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a wsgi entry point for the main ViewVC app. It's appropriate
# for use with mod_wsgi. It defines a single application function that
# is a valid wsgi entry point.
#
# -----------------------------------------------------------------------
import sys, os
LIBRARY_DIR = None
CONF_PATHNAME = None
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
"../../../lib")))
import sapi
import viewvc
def application(environ, start_response):
server = sapi.WsgiServer(environ, start_response)
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)
return []

41
bin/wsgi/viewvcwsgi.py Normal file
View File

@@ -0,0 +1,41 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# viewvc: View CVS/SVN repositories via a web browser
#
# -----------------------------------------------------------------------
#
# This is a wsgi entry point for the main ViewVC app. It's appropriate
# for use with mod_wsgi. It defines a single application function that
# is a valid wsgi entry point.
#
# -----------------------------------------------------------------------
import sys, os
import viewvcinstallpath
LIBRARY_DIR = viewvcinstallpath.LIBRARY_DIR
CONF_PATHNAME = viewvcinstallpath.CONF_PATHNAME
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path.insert(0, os.path.abspath(os.path.join(
os.path.dirname(__file__), "../../lib")))
import sapi
import viewvc
def application(environ, start_response):
server = sapi.WsgiServer(environ, start_response)
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)
return []

View File

@@ -1,192 +0,0 @@
# CvsGraph configuration
#
# - Empty lines and whitespace are ignored.
#
# - Comments start with '#' and everything until
# end of line is ignored.
#
# - Strings are C-style strings in which characters
# may be escaped with '\' and written in octal
# and hex escapes. Note that '\' must be escaped
# if it is to be entered as a character.
#
# - Some strings are expanded with printf like
# conversions which start with '%'. Not all
# are applicable at all times, in which case they
# will expand to noting.
# %c = cvsroot (with trailing '/')
# %C = cvsroot (*without* trailing '/')
# %m = module (with trailing '/')
# %M = module (*without* trailing '/')
# %f = filename without path
# %F = filename without path and with ",v" stripped
# %p = path part of filename (with trailing '/')
# %r = number of revisions
# %b = number of branches
# %% = '%'
# %R = the revision number (e.g. '1.2.4.4')
# %P = previous revision number
# %B = the branch number (e.g. '1.2.4')
# %d = date of revision
# %a = author of revision
# %s = state of revision
# %t = current tag of branch or revision
# %0..%9 = command-line argument -0 .. -9
# ViewCVS currently uses the following two command-line arguments to
# pass URL information to cvsgraph:
# -6 request.amp_query (the query preceeded with '&')
# -7 request.qmark_query (the query preceed with '?')
#
# - Numbers may be entered as octal, decimal or
# hex as in 0117, 79 and 0x4f respectively.
#
# - Fonts are numbered 0..4 (defined as in libgd)
# 0 = tiny
# 1 = small
# 2 = medium (bold)
# 3 = large
# 4 = giant
#
# - Colors are a string like html-type colors in
# the form "#rrggbb" with parts written in hex
# rr = red (00..ff)
# gg = green (00-ff)
# bb = blue (00-ff)
#
# - There are several reserved words besides of the
# feature-keywords. These additional reserved words
# expand to numerical values:
# * false = 0
# * true = 1
# * left = 0
# * center = 1
# * right = 2
# * gif = 0
# * png = 1
# * jpeg = 2
# * tiny = 0
# * small = 1
# * medium = 2
# * large = 3
# * giant = 4
# cvsroot <string>
# The *absolute* base directory where the
# CSV/RCS repository can be found
# cvsmodule <string>
#
cvsroot = "--unused--"; # unused with ViewCVS, will be overridden
cvsmodule = ""; # unused with ViewCVS -- please leave it blank
# color_bg <color>
# The background color of the image
color_bg = "#ffffff";
# date_format <string>
# The strftime(3) format string for date and time
date_format = "%d-%b-%Y %H:%M:%S";
box_shadow = true;
tag_font = medium;
tag_color = "#007000";
rev_font = giant;
rev_color = "#000000";
rev_bgcolor = "#f0f0f0";
rev_separator = 1;
rev_minline = 15;
rev_maxline = 30;
rev_lspace = 5;
rev_rspace = 5;
rev_tspace = 3;
rev_bspace = 3;
rev_text = "%d"; # or "%d\n%a, %s" for author and state too
rev_text_font = tiny;
rev_text_color = "#500020";
# branch_font <number>
# The font of the number and tags
# branch_color <color>
# All branch element's color
# branch_[lrtb]space <number>
# Interior spacing (margin)
# branch_margin <number>
# Exterior spacing
# branch_connect <number>
# Length of the vertical connector
branch_font = medium;
branch_color = "#0000c0";
branch_bgcolor = "#ffffc0";
branch_lspace = 5;
branch_rspace = 5;
branch_tspace = 3;
branch_bspace = 3;
branch_margin = 15;
branch_connect = 8;
# title <string>
# The title string is expanded (see above for details)
# title_[xy] <number>
# Postion of title
# title_font <number>
# The font
# title_align <number>
# 0 = left
# 1 = center
# 2 = right
# title_color <color>
title = "%C: %p%F\nRevisions: %r, Branches: %b";
title_x = 10;
title_y = 5;
title_font = small;
title_align = left;
title_color = "#800000";
# Margins of the image
# Note: the title is outside the margin
margin_top = 35;
margin_bottom = 10;
margin_left = 10;
margin_right = 10;
# Image format(s)
# image_type <number|{gif,jpeg,png}>
# gif (0) = Create gif image
# png (1) = Create png image
# jpeg (2) = Create jpeg image
# Image types are available if they can be found in
# the gd library. Newer versions of gd do not have
# gif anymore. CvsGraph will automatically generate
# png images instead.
# image_quality <number>
# The quality of a jpeg image (1..100)
image_type = png;
image_quality = 75;
# HTML ImageMap generation
# map_name <string>
# The name= attribute in <map name="mapname">...</map>
# map_branch_href <string>
# map_branch_alt <string>
# map_rev_href <string>
# map_rev_alt <string>
# map_diff_href <string>
# map_diff_alt <string>
# These are the href= and alt= attributes in the <area>
# tags of html. The strings are expanded (see above).
map_name = "MyMapName";
map_branch_href = "href=\"%m%F?only_with_tag=%t%8%6\"";
map_branch_alt = "alt=\"%0 %t (%B)\"";
# You might want to experiment with the following setting:
# 1. The default setting will take you to a ViewCVS generated page displaying
# that revision of the file, if you click into a revision box:
map_rev_href = "href=\"%m%F?rev=%R&content-type=text/vnd.viewcvs-markup%6\"";
# 2. This alternative setting will take you to the anchor representing this
# revision on a ViewCVS generated Log page for that file:
# map_rev_href = "href=\"%m%F%7#rev%R\"";
#
map_rev_alt = "alt=\"%1 %t (%R)\"";
map_diff_href = "href=\"%m%F.diff?r1=%P&r2=%R%8%6\"";
map_diff_alt = "alt=\"%2 %P &lt;-&gt; %R\"";

View File

@@ -1,529 +0,0 @@
#!/usr/bin/python
# -*- Mode: python -*-
"""
Granny.py - display CVS annotations in HTML
with lines colored by code age in days.
Original Perl version by J. Gabriel Foster (gabe@sgrail.com)
Posted to info-cvs on 02/27/1997
You can still get the original shell archive here:
http://www.geocrawler.com/archives/3/382/1997/2/0/2103824/
Perl modifications for NT by Marc Paquette (marcpa@cam.org)
Python port and CGI modifications by Brian Lenihan (brianl@real.com)
From the original granny.pl README:
--
What is Granny? Why do I care?
Granny is a tool for viewing cvs annotation information graphically. Using
Netscape, granny indicates the age of lines by color. Red lines are new,
blue lines are old. This information can be very useful in determining
what lines are 'hot'. New lines are more likely to contain bugs, and this
is an easy way to visualize that information.
Requirements:
Netscape (version 2.0 or better)
Perl5
CVS 1.9 (1.8 should work, but I have not tried it.)
Installation:
Put granny somewhere in your path. You may need to edit the
first line to point to your perl5 binary and libraries.
What to do:
Run granny just like you would 'cvs annotate' for a single file.
granny thefile.C
To find out who is to blame for that new 'feature'.
granny -U thefile.C
For all your options:
granny -h
Questions, Comments, Assertions?
send e-mail to the author: Gabe Foster (gabe@sgrail.com)
Notes:
I'm not the first person to try this sort of display, I just read about it
in a magazine somewhere and decided that cvs had all the information
I needed. To whomever first had this idea, it's a great one.
Granny is free, please use it as you see fit. I give no warranties.
As a courtesy, I ask that you tell me about any modifications you have made,
and also ask that you acknowledge my work if you use Granny in your own
software.
--
Granny.py:
granny.py [-h][-d days][-i input][-o output][-DUV] file
-h: Get this help display.
-i: Specify the input file. (Use - for stdin.)
-o: Specify the output file. (Use - for stdout.)
-d: Specify the day range for the coloring.\n
-r: Specify the cvs revision of the file.
-D: Display the date the line was last edited.
-U Display the user that last edited the line.
-V: Display the version the line was last edited.
By default, granny.py executes cvs annotate on a FILE and
runs netscape to display the graphic.
It is assumed that cvs and Netscape (for command line version) are
in your path.
If granny.py is placed in the cgi-bin directory of your Web
server, it will act as a CGI script. The working directory
defaults to /usr/tmp, but it can be overridden in the class
constructor:
A = CGIAnnotate(tempdir='/tmp')
Required fields:
root The full path to the cvs root directory.
Name The module/filename of the annotated file.
Optional fields:
rev The cvs revision number to use. (default HEAD).
Set the following fields to display extra info:
showUser Display the user that last edited the line.
showVersion Display version that the line was last edited in.
showDate Display the date the line was last edited.
http://yourserver.yourdomain.com/cgi-bin/granny.py?root=/cvsroot&Name=module/file
TODO:
Add support for determining the MIME type of files and/or a binary check.
- easily done by parsing Apache (mime.conf) or Roxen (extensions) MIME
files.
Consider adding buttons to HTML for optional display fields.
Add support for launching other browsers.
"""
import os
import sys
import string
import re
import time
import getopt
import cStringIO
import tempfile
import traceback
month_num = {
'Jan' : 1, 'Feb' : 2, 'Mar' : 3, 'Apr' : 4, 'May' : 5, 'Jun' : 6,
'Jul' : 7, 'Aug' : 8, 'Sep' : 9, 'Oct' : 10, 'Nov' : 11, 'Dec' : 12
}
class Annotate:
def __init__(self):
self.day_range = 365
self.counter = 0
self.color_table = {}
self.user = {}
self.version = {}
self.rtime = {}
self.source = {}
self.tmp = None
self.tmpfile = None
self.revision = ''
self.showUser = 0
self.showDate = 0
self.showVersion = 0
self.set_today()
def run(self):
try:
self.process_args()
self.parse_raw_annotated_file()
self.write_annotated_html_file()
if self.tmp:
self.display_annotated_html_file()
finally:
if sys.exc_info()[0] is not None:
traceback.print_exc()
self.cleanup()
def cleanup(self):
if self.tmp:
self.tmp.close()
os.unlink(self.tmpfile)
sys.exit(0)
def getoutput(self, cmd):
"""
Get stdin and stderr from cmd and
return exit status and captured output
"""
if os.name == 'nt':
# os.popen is broken on win32, but seems to work so far...
pipe = os.popen('%s 2>&1' % cmd, 'r')
else:
pipe = os.popen('{ %s ; } 2>&1' % cmd, 'r')
text = pipe.read()
sts = pipe.close()
if sts == None:
sts = 0
if text[:-1] == '\n':
text = text[-1:]
return sts, text
def set_today(self):
"""
compute the start of this day
"""
(year,mon,day,hour,min,sec,dow,doy,dst) = time.gmtime(time.time())
self.today = time.mktime((year,mon,day,0,0,0,0,0,0))
def get_today(self):
return self.today
# entify stuff which breaks HTML display
# this was lifted from some Zope Code in
# StructuredText.py
#
# XXX try it with string.replace and run it in the profiler
def html_quote(self,v,
character_entities=((re.compile('&'), '&amp;'),
(re.compile("<"), '&lt;' ),
(re.compile(">"), '&gt;' ),
(re.compile('"'), '&quot;'))):
gsub = re.sub
text=str(v)
for regexp,name in character_entities:
text=gsub(regexp,name,text)
return text
def display_annotated_html_file(self):
if os.name == 'nt':
path = '"C:\\Program Files\\Netscape\\Communicator'\
'\\Program\\Netscape"'
if os.system('%s %s' % (path, self.tmpfile)) != 0:
sys.stderr.write('%s: Unable to start Netscape' % sys.argv[0])
sys.exit(1)
else:
if os.system('netscape -remote openFile\(%s\)' %
self.tmpfile) != 0:
sys.stderr.write('%s: Trying to run netscape, please wait\n' %
sys.argv[0])
if os.system('netscape &') == 0:
for i in range(10):
time.sleep(1)
if os.system('netscape -remote openFile\(%s\)' %
self.tmpfile) == 0:
break
if i == 10:
sys.stderr.write('%s:Unable to start netscape\n' %
sys.argv[0])
else:
sys.stderr.write('%s:Unable to start netscape\n' %
sys.argv[0])
# give Netscape time to read the file
# XXX big files may raise an OSError exception on NT
# if the sleep is too short.
time.sleep(5)
def get_opts(self):
opt_dict = {}
if not len(sys.argv[1:]) > 0:
self.usage()
opts, args = getopt.getopt(sys.argv[1:], 'DUVhi:o:d:r:')
for k,v in opts:
opt_dict[k] = v
return opt_dict
def process_args(self):
opts = self.get_opts()
if opts.has_key('-r'):
self.revision = '-r%s' % opts['-r']
if opts.has_key('-h'):
self.usage(help=1)
if opts.has_key('-i'):
if opts['-i'] != '-':
self.filename = v
infile = open(filename, 'r')
sys.stdin = infile
else:
self.file = sys.stdin
else:
self.filename = sys.argv[len(sys.argv) - 1]
cmd = 'cvs annotate %s %s' % (self.revision, self.filename)
status, text = self.getoutput(cmd)
if status != 0 or text == '':
sys.stderr.write("Can't run cvs annotate on %s\n" %
self.filename)
sys.stderr.write('%s\n' % text)
sys.exit(1)
self.file = cStringIO.StringIO(text)
if opts.has_key('-o'):
if opts['-o'] != '-':
outfile = open(v, 'w')
sys.stdout = outfile
else:
# this could be done without a temp file
target = sys.argv[len(sys.argv) -1]
self.tmpfile = tempfile.mktemp()
self.tmp = open(self.tmpfile, 'w')
sys.stdout = self.tmp
if opts.has_key('-d'):
if opts['-d'] > 0:
self.day_range = opts['-d']
if opts.has_key('-D'):
self.showDate = 1
if opts.has_key('-U'):
self.showUser = 1
if opts.has_key('-V'):
self.showVersion = 1
def parse_raw_annotated_file(self):
ann = re.compile('((\d+\.?)+)\s+\((\w+)\s+(\d\d)-'\
'(\w{3})-(\d\d)\): (.*)')
text = self.file.read()
lines = string.split(text, '\n')
for line in lines:
# Parse an annotate string
m = ann.search(line)
if m:
self.version[self.counter] = m.group(1)
self.user[self.counter] = m.group(3)
oldtime = self.today - time.mktime((
int(m.group(6)),
int(month_num[m.group(5)]),
int(m.group(4)),0,0,0,0,0,0))
self.rtime[self.counter] = oldtime / 86400
self.source[self.counter] = self.html_quote(m.group(7))
else:
self.source[self.counter] = self.html_quote(line)
pass
self.counter = self.counter + 1
def write_annotated_html_file(self):
if os.environ.has_key('SCRIPT_NAME'):
print 'Status: 200 OK\r\n'
print 'Content-type: text/html\r\n\r\n'
print ('<html><head><title>%s</title></head>\n' \
'<body bgcolor="#000000">\n' \
'<font color="#FFFFFF"><H1>File %s</H1>\n' \
'<H3>Code age in days</H2>' % (self.filename, self.filename))
for i in range(self.day_range + 1):
self.color_table[i] = \
self.hsvtorgb(240.0 * i / self.day_range, 1.0, 1.0)
step = self.day_range / 40
if step < 5:
step = 1
while self.day_range/step > 40:
step = step + 1
if step >= 5:
if step != 5:
step = step + 5 - (step % 5)
while self.day_range / step > 20:
step = step + 5
for i in range(self.day_range + 1, step):
print '<font color=%s>%s ' % (self.color_table[i], i),
print '<pre><code>'
for i in range(self.counter):
if self.showUser and self.user.has_key(i):
print '%s%s ' % ('<font color=#FFFFFF>',
string.ljust(self.user[i],10)),
if self.showVersion and self.version.has_key(i):
print '%s%s ' % ('<font color=#FFFFFF>',
string.ljust(self.version[i],6)),
if self.showDate and self.rtime.has_key(i):
(year,mon,day,hour,min,sec,dow,doy,dst) = time.gmtime(
self.today - self.rtime[i] * 86400)
print '<font color=#FFFFFF>%02d/%02d/%4d ' % (mon, day, year),
if self.rtime.get(i, self.day_range) < self.day_range:
fcolor = self.color_table.get(
self.rtime[i],
self.color_table[self.day_range])
else:
fcolor = self.color_table[self.day_range]
print '<font color=%s> %s' % (fcolor, self.source[i])
print ('</code></pre>\n' \
'<font color=#FFFFFF>\n' \
'<H5>Granny original Perl version by' \
'<I>J. Gabriel Foster</I>\n' \
'<ADDRESS><A HREF=\"mailto:gabe@sgrail.com\">'\
'gabe@sgrail.com</A></ADDRESS>\n' \
'Python version by <I>Brian Lenihan</I>\n' \
'<ADDRESS><A HREF=\"mailto:brianl@real.com\">' \
'brianl@real.com</A></ADDRESS>\n' \
'</body></html>')
sys.stdout.flush()
def hsvtorgb(self,h,s,v):
"""
a veritable technicolor spew
"""
if s == 0.0:
r = v; g = v; b = v
else:
if h < 0:
h = h + 360.0
elif h >= 360.0:
h = h - 360.0
h = h / 60.0
i = int(h)
f = h - i
if s > 1.0:
s = 1.0
p = v * (1.0 - s)
q = v * (1.0 - (s * f))
t = v * (1.0 - (s * (1.0 - f)))
if i == 0: r = v; g = t; b = p
elif i == 1: r = q; g = v; b = p
elif i == 2: r = p; g = v; b = t
elif i == 3: r = p; g = q; b = v
elif i == 4: r = t; g = p; b = v
elif i == 5: r = v; g = p; b = q
return '#%02X%02X%02X' % (r * 255 + 0.5, g * 255 + 0.5, b * 255 + 0.5)
def usage(self, help=None):
sys.stderr.write('\nusage: %s %s\n\n' % (
sys.argv[0],
'[-hDUV][-d days][-i input][-o output][-r rev] FILE')
)
if help is not None:
sys.stderr.write(
'-h: Get this help display.\n' \
'-i: Specify the input file. (Use - for stdin.)\n' \
'-o: Specify the output file. (Use - for stdout.)\n' \
'-d: Specify the day range for the coloring.\n' \
'-r: Specify the cvs revision of the file.\n' \
'-D: Display the date the line was last edited.\n' \
'-U Display the user that last edited the line.\n' \
'-V: Display the version the line was last edited.\n\n' \
'By default, %s executes a cvs annotate on a FILE and\n' \
'runs netscape to display the graphical ' \
'annotation\n' % sys.argv[0]
)
sys.exit(0)
class CGIAnnotate(Annotate):
def __init__(self,tempdir='/usr/tmp'):
Annotate.__init__(self)
if os.name == 'nt':
self.tempdir = os.environ.get('TEMP') or os.environ.get('TMP')
else:
# XXX need a sanity check here
self.tempdir = tempdir
os.chdir(self.tempdir)
def process_args(self):
f = cgi.FieldStorage()
cvsroot = f['root'].value
if f.has_key('showUser'):
self.showUser = 1
if f.has_key('showDate'):
self.showDate = 1
if f.has_key('showVersion'):
self.showVersion = 1
if f.has_key('rev'):
self.revision = '-r%s' % f['rev'].value
path = f['Name'].value
module = os.path.dirname(path)
self.workingdir = 'ann.%s' % os.getpid()
self.filename = os.path.basename(path)
os.mkdir(self.workingdir)
os.chdir(os.path.join(self.tempdir, self.workingdir))
os.system('cvs -d %s co %s' % (cvsroot, path))
os.chdir(module)
cmd = 'cvs annotate %s %s' % (self.revision, self.filename)
status, text = self.getoutput(cmd)
if status != 0 or text == '':
text = "Can't run cvs annotate on %s\n" % path
self.file = cStringIO.StringIO(text)
def cleanup(self):
os.chdir(self.tempdir)
os.system('rm -rf %s' % self.workingdir)
def display_annotated_html_file(self):
pass
def usage(self):
pass
if __name__ == '__main__':
if os.environ.has_key('SCRIPT_NAME'):
import cgi
A = CGIAnnotate()
else:
A = Annotate()
A.run()

View File

@@ -1,51 +0,0 @@
#!/usr/bin/python
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# query.cgi: View CVS commit database by web browser
#
# -----------------------------------------------------------------------
#
# This is a teeny stub to launch the main ViewCVS app. It checks the load
# average, then loads the (precompiled) viewcvs.py file and runs it.
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
LIBRARY_DIR = None
#########################################################################
#
# Adjust sys.path to include our library directory
#
import sys
if LIBRARY_DIR:
sys.path.insert(0, LIBRARY_DIR)
else:
sys.path[:0] = ['../lib'] # any other places to look?
#########################################################################
import query
query.run_cgi()

View File

@@ -1,460 +0,0 @@
#---------------------------------------------------------------------------
#
# Configuration file for ViewCVS
#
# Information on ViewCVS is located at the following web site:
# http://viewcvs.sourceforge.net/
#
#---------------------------------------------------------------------------
#
# BASIC CONFIGURATION
#
# For correct operation, you will probably need to change the following
# configuration variables:
#
# cvs_roots
# default_root
# rcs_path
# mime_types_file
#
# It is usually desirable to change the following variables:
#
# address
# main_title
# forbidden
#
# use_enscript
# use_cvsgraph
#
# For Python source colorization:
#
# py2html_path
#
# If your icons are in a special location:
#
# icons
#
# Also, review the .ezt templates in the templates/ directory to adjust them
# for your particular site.
#
#
# FORMAT INFORMATION
#
# This file is delineated by sections, specified in [brackets]. Within each
# section, are a number of configuration settings. These settings take the
# form of: name = value. Values may be continued on the following line by
# indenting the continued line.
#
# WARNING: indentation *always* means continuation. name=value lines should
# always start in column zero.
#
# Comments should always start in column zero, and are identified with "#".
#
# Certain configuration settings may have multiple values. These should be
# separated by a comma. The settings where this is allowed are noted below.
#
# Any other setting that requires special syntax is noted at that setting.
#
#---------------------------------------------------------------------------
[general]
#
# This setting specifies each of the CVS roots on your system and assigns
# names to them. Each root should be given by a "name: path" value. Multiple
# roots should be separated by commas.
#
cvs_roots =
Development : /home/cvsroot
# this is the name of the default CVS root.
default_root = Development
# uncomment if the RCS binaries are not on the standard path
#rcs_path = /usr/bin/
#
# This is a pathname to a MIME types file to help viewcvs to guess the
# correct MIME type on checkout.
#
# If you are having problems with the default guess on the MIME type, then
# uncomment this option and point it at a MIME type file.
#
# For example, you can use the mime.types from apache here:
#mime_types_file = /usr/local/apache/conf/mime.types
# This address is shown in the footer of the generated pages.
# It must be replaced with the address of the local CVS maintainer.
address = <a href="mailto:cvs-admin@insert.your.domain.here">No CVS admin address has been configured</a>
# this title is used on the main entry page
main_title = CVS Repository
#
# This should contain a list of modules in the repository that should not be
# displayed (by default or by explicit path specification).
#
# This configuration can be a simple list of modules, or it can get quite
# complex:
#
# *) The "!" can be used before a module to explicitly state that it
# is NOT forbidden. Whenever this form is seen, then all modules will
# be forbidden unless one of the "!" modules match.
#
# *) Shell-style "glob" expressions may be used. "*" will match any
# sequence of zero or more characters, "?" will match any single
# character, "[seq]" will match any character in seq, and "[!seq]"
# will match any character not in seq.
#
# *) Tests are performed in sequence. The first match will terminate the
# testing. This allows for more complex allow/deny patterns.
#
# Tests are case-sensitive.
#
forbidden =
# Some examples:
#
# Disallow "example" but allow all others:
# forbidden = example
#
# Disallow "example1" and "example2" but allow all others:
# forbidden = example1, example2
#
# Allow *only* "example1" and "example2":
# forbidden = !example1, !example2
#
# Forbid modules starting with "x":
# forbidden = x*
#
# Allow modules starting with "x" but no others:
# forbidden = !x*
#
# Allow "xml", forbid other modules starting with "x", and allow the rest:
# forbidden = !xml, x*, !*
#
#
# This option provides a mechanism for custom key/value pairs to be
# available to templates. These are stored in key/value files (KV files).
#
# Pathnames to the KV files are listed here, specified as absolute paths
# or relative to this configuration file. The kV files follow the same
# format as this configuration file. It may have multiple, user-defined
# sections, and user-defined options in those sections. These are all
# placed into a structure available to the templates as:
#
# kv.SECTION.OPTION
#
# Note that an option name can be dotted. For example:
#
# [my_images]
# logos.small = /images/small-logo.png
# logos.big = /images/big-logo.png
#
# Templates can use these with a directive like: [kv.my_images.logos.small]
#
# Note that sections across multiple files will be merged. If two files
# have a [my_images] section, then the options will be merged together.
# If two files have the same option name in a section, then one will
# overwrite the other (it is unspecified regarding which "wins").
#
# To further categorize the KV files, and how the values are provided to
# the templates, a KV file name may be annotated with an additional level
# of dotted naming. For example:
#
# kv_files = [asf]kv/images.conf
#
# Assuming the same section as above, the template would refer to an image
# using [kv.asf.my_images.logos.small]
#
# Lastly, it is possible to use %lang% in the filenames to specify a
# substitution of the selected language-tag.
#
kv_files =
# example:
# kv_files = kv/file1.conf, kv/file2.conf, [i18n]kv/%lang%_data.conf
#
#
# The languages available to ViewCVS. There are several i18n mechanisms
# available:
#
# 1) using key/value extension system and reading KV files based on
# the selected language
# 2) GNU gettext to substitute text in the templates
# 3) using different templates, based on the selected language
#
# ### NOTE: at the moment, the GNU gettext style is not implemented
#
# This option is a comma-separated list of language-tag values. The first
# language-tag listed is the default language, and will be used if an
# Accept-Language header is not present in the request, or none of the
# user's requested languages are available. If there are ties on the
# selection of a language, then the first to appear in the list is chosen.
#
languages = en-us
# other examples:
#
# languages = en-us, de
# languages = en-us, en-gb, de
# languages = de, fr, en-us
#
#---------------------------------------------------------------------------
[templates]
#
# The templates are specified relative to the configuration file. Absolute
# paths may be used, if you want to keep these elsewhere.
#
# If %lang% occurs in the pathname, then the selected language will be
# substituted.
#
# Note: the selected language is defined by the "languages" item in the
# [general] section, and based on the request's Accept-Language
# header.
#
query = templates/query.ezt
footer = templates/footer.ezt
diff = templates/diff.ezt
graph = templates/graph.ezt
annotate = templates/annotate.ezt
markup = templates/markup.ezt
directory = templates/directory.ezt
# For an alternate form, where the first column displays a revision number
# and brings you to the log view (and the filename displays the HEAD), then
# you may use this template:
# directory = templates/dir_alternate.ezt
log = templates/log.ezt
# For a log view where the revisions are displayed in a table, you may
# want to try this template:
# log = templates/log_table.ezt
#---------------------------------------------------------------------------
[cvsdb]
#host = localhost
#database_name = ViewCVS
#user =
#passwd =
#readonly_user =
#readonly_passwd =
#row_limit = 1000
#---------------------------------------------------------------------------
[options]
### DOC
# sort_by: File sort order
# file Sort by filename
# rev Sort by revision number
# date Sort by commit date
# author Sort by author
# log Sort by log message
sort_by = file
# hide_attic: Hide or show the contents of the Attic subdirectory
# 1 Hide dead files inside Attic subdir
# 0 Show the files which are inside the Attic subdir
hide_attic = 1
# log_sort: Sort order for CVS logs
# date Sort revisions by date
# rev Sort revision by revision number
# cvs Don't sort them. Same order as CVS/RCS shows them.
log_sort = date
# diff_format: Default diff format
# h Human readable
# u Unified diff
# c Context diff
# s Side by side
# l Long human readable (more context)
diff_format = h
# hide_cvsroot: Don't show the CVSROOT directory
# 1 Hide CVSROOT directory
# 0 Show CVSROOT directory
hide_cvsroot = 1
# set to 1 to make lines break at spaces,
# set to 0 to make no-break lines,
# set to a positive integer to make the lines cut at that length
hr_breakable = 1
# give out function names in human readable diffs
# this just makes sense if we have C-files, otherwise
# diff's heuristic doesn't work well ..
# ( '-p' option to diff)
hr_funout = 0
# ignore whitespaces for human readable diffs
# (indendation and stuff ..)
# ( '-w' option to diff)
hr_ignore_white = 1
# ignore diffs which are caused by
# keyword-substitution like $Id - Stuff
# ( '-kk' option to rcsdiff)
hr_ignore_keyword_subst = 1
# allow annotation of files.
allow_annotate = 1
# allow pretty-printed version of files
allow_markup = 1
# allow compression with gzip of output if the Browser accepts it
# (HTTP_ACCEPT_ENCODING=gzip)
# [make sure to have gzip in the path]
allow_compress = 1
# If you have files which automatically refers to other files
# (such as HTML) then this allows you to browse the checked
# out files as if outside CVS.
checkout_magic = 1
# Show last changelog message for sub directories
# The current implementation makes many assumptions and may show the
# incorrect file at some times. The main assumption is that the last
# modified file has the newest filedate. But some CVS operations
# touches the file without even when a new version is't checked in,
# and TAG based browsing essientially puts this out of order, unless
# the last checkin was on the same tag as you are viewing.
# Enable this if you like the feature, but don't rely on correct results.
show_subdir_lastmod = 0
# show a portion of the most recent log entry in directory listings
show_logs = 1
# Show CVS log when viewing file contents
show_log_in_markup = 1
# == Configuration defaults ==
# Defaults for configuration variables that shouldn't need
# to be configured..
#
# If you want to use Marc-Andrew Lemburg's py2html (and Just van Rossum's
# PyFontify) to colorize Python files, then you may need to change this
# variable to point to their directory location.
#
# This directory AND the standard Python path will be searched.
#
py2html_path = .
#py2html_path = /usr/local/lib/python1.5/site-python
# the length to which the most recent log entry should be truncated when
# shown in the directory view
short_log_len = 80
diff_font_face = Helvetica,Arial
diff_font_size = -1
# should we use 'enscript' for syntax coloring?
use_enscript = 0
#
# if the enscript program is not on the path, set this value
#
enscript_path =
# enscript_path = /usr/bin/
#
# ViewCVS has its own set of mappings from filename extensions and filenames
# to languages. If the language is not supported by enscript, then it can
# be listed here to disable the use of enscript.
#
disable_enscript_lang =
# disable_enscript_lang = perl, cpp
#
# ViewCVS can generate tarball from a repository on the fly.
#
allow_tar = 0
# allow_tar = 1
#
# Use CvsGraph. See http://www.akhphd.au.dk/~bertho/cvsgraph/ for
# documentation and download.
#
use_cvsgraph = 0
# use_cvsgraph = 1
#
# if the cvsgraph program is not on the path, set this value
#
cvsgraph_path =
# cvsgraph_path = /usr/local/bin/
#
# Location of the customized cvsgraph configuration file.
# You will need an absolute pathname here:
#
cvsgraph_conf = <VIEWCVS_INSTALL_DIRECTORY>/cvsgraph.conf
#
# Set to enable regular expression search of all files in a directory
#
# WARNING:
#
# Enabling this option can consume HUGE amounts of server time. A
# "checkout" must be performed on *each* file in a directory, and
# the result needs to be searched for a match against the regular
# expression.
#
#
# SECURITY WARNING: Denial Of Service
#
# Since a user can enter the regular expression, it is possible for
# them to enter an expression with many alternatives and a lot of
# backtracking. Executing that search over thousands of lines over
# dozens of files can easily tie up a server for a long period of
# time.
#
# This option should only be used on sites with trusted users. It is
# highly inadvisable to use this on a public site.
#
use_re_search = 0
# use_re_search = 1
#---------------------------------------------------------------------------
[vhosts]
### DOC
# vhost1 = glob1, glob2
# vhost2 = glob3, glob4
# [vhost1-section]
# option = value
# [vhost1-othersection]
# option = value
# [vhost2-section]
# option = value
#
# Here is an example:
#
# [vhosts]
# lyra = *lyra.org
#
# [lyra-general]
# forbidden = hideme
#
# [lyra-options]
# show_logs = 0
#
# Note that "lyra" is the "canonical" name for all hosts in the lyra.org
# domain. This canonical name is then used within the additional, vhost-
# specific sections to override specific values in the common sections.
#
#---------------------------------------------------------------------------

394
conf/cvsgraph.conf.dist Normal file
View File

@@ -0,0 +1,394 @@
# CvsGraph configuration
#
# - Empty lines and whitespace are ignored.
#
# - Comments start with '#' and everything until
# end of line is ignored.
#
# - Strings are C-style strings in which characters
# may be escaped with '\' and written in octal
# and hex escapes. Note that '\' must be escaped
# if it is to be entered as a character.
#
# - Some strings are expanded with printf like
# conversions which start with '%'. Not all
# are applicable at all times, in which case they
# will expand to nothing.
# %c = cvsroot (with trailing '/')
# %C = cvsroot (*without* trailing '/')
# %m = module (with trailing '/')
# %M = module (*without* trailing '/')
# %f = filename without path
# %F = filename without path and with ",v" stripped
# %p = path part of filename (with trailing '/')
# %r = number of revisions
# %b = number of branches
# %% = '%'
# %R = the revision number (e.g. '1.2.4.4')
# %P = previous revision number
# %B = the branch number (e.g. '1.2.4')
# %d = date of revision
# %a = author of revision
# %s = state of revision
# %t = current tag of branch or revision
# %0..%9 = command-line argument -0 .. -9
# %l = HTMLized log entry of the revision
# NOTE: %l is obsolete. See %(%) and cvsgraph.conf(5) for
# more details.
# %L = log entry of revision
# The log entry expansion takes an optional argument to
# specify maximum length of the expansion like %L[25].
# %(...%) = HTMLize the string within the parenthesis.
# ViewVC currently uses the following four command-line arguments to
# pass URL information to cvsgraph:
# -3 link to current file's log page
# -4 link to current file's checkout page minus "rev" parameter
# -5 link to current file's diff page minus "r1" and "r2" parameters
# -6 link to current directory page minus "pathrev" parameter
#
# - Numbers may be entered as octal, decimal or
# hex as in 0117, 79 and 0x4f respectively.
#
# - Fonts are numbered 0..4 (defined as in libgd)
# 0 = tiny
# 1 = small
# 2 = medium (bold)
# 3 = large
# 4 = giant
#
# - Colors are a string like HTML type colors in
# the form "#rrggbb" with parts written in hex
# rr = red (00..ff)
# gg = green (00-ff)
# bb = blue (00-ff)
#
# - There are several reserved words besides of the
# feature-keywords. These additional reserved words
# expand to numerical values:
# * false = 0
# * true = 1
# * not = -1
# * left = 0
# * center = 1
# * right = 2
# * gif = 0
# * png = 1
# * jpeg = 2
# * tiny = 0
# * small = 1
# * medium = 2
# * large = 3
# * giant = 4
#
# - Booleans have three possible arguments: true, false
# and not. `Not' means inverse of what it was (logical
# negation) and is represented by the value -1.
# For the configuration file that means that the default
# value is negated.
#
# cvsroot <string>
# The *absolute* base directory where the
# CVS/RCS repository can be found
# cvsmodule <string>
#
cvsroot = "--unused--"; # unused with ViewVC, will be overridden
cvsmodule = ""; # unused with ViewVC -- please leave it blank
# color_bg <color>
# The background color of the image
# transparent_bg <boolean>
# Make color_bg the transparent color (only useful with PNG)
color_bg = "#ffffff";
transparent_bg = false;
# date_format <string>
# The strftime(3) format string for date and time
date_format = "%d-%b-%Y %H:%M:%S";
# box_shadow <boolean>
# Add a shadow around the boxes
# upside_down <boolean>
# Reverse the order of the revisions
# left_right <boolean>
# Draw the image left to right instead of top down,
# or right to left is upside_down is set simultaneously.
# strip_untagged <boolean>
# Remove all untagged revisions except the first, last and tagged ones
# strip_first_rev <boolean>
# Also remove the first revision if untagged
# auto_stretch <boolean>
# Try to reformat the tree to minimize image size
# use_ttf <boolean>
# Use TrueType fonts for text
# anti_alias <boolean>
# Enable pretty TrueType anti-alias drawing
# thick_lines <number>
# Draw all connector lines thicker (range: 1..11)
box_shadow = true;
upside_down = false;
left_right = false;
strip_untagged = false;
strip_first_rev = false;
#auto_stretch = true; # not yet stable.
use_ttf = false;
anti_alias = true;
thick_lines = 1;
# msg_color <color>
# Sets the error/warning message color
# msg_font <number>
# msg_ttfont <string>
# msg_ttsize <float>
# Sets the error/warning message font
msg_color = "#800000";
msg_font = medium;
msg_ttfont = "/dos/windows/fonts/ariali.ttf";
msg_ttsize = 11.0;
# parse_logs <boolean>
# Enable the parsing of the *entire* ,v file to read the
# log-entries between revisions. This is necessary for
# the %L expansion to work, but slows down parsing by
# a very large factor. You're warned.
parse_logs = false;
# tag_font <number>
# The font of the tag text
# tag_color <color>
# The color of the tag text
# tag_ignore <string>
# A extended regular expression to exclude certain tags from view.
# See regex(7) for details on the format.
# Note 1: tags matched in merge_from/merge_to are always displayed unless
# tag_ignore_merge is set to true.
# Note 2: normal string rules apply and special characters must be
# escaped.
# tag_ignore_merge <boolean>
# If set to true, allows tag_ignore to also hide merge_from and merge_to
# tags.
# tag_nocase <boolean>
# Ignore the case is tag_ignore expressions
# tag_negate <boolean>
# Negate the matching criteria of tag_ignore. When true, only matching
# tags will be shown.
# Note: tags matched with merge_from/merge_to will still be displayed.
tag_font = medium;
#tag_ttfont = "/dos/windows/fonts/ariali.ttf";
#tag_ttsize = 11.0;
tag_color = "#007000";
#tag_ignore = "(test|alpha)_release";
#tag_ignore_merge = false;
#tag_nocase = false;
#tag_negate = false;
# rev_hidenumber <boolean>
# If set to true no revision numbers will be printed in the graph.
#rev_hidenumber = false;
rev_font = giant;
#rev_ttfont = "/dos/windows/fonts/arial.ttf";
#rev_ttsize = 12.0;
rev_color = "#000000";
rev_bgcolor = "#f0f0f0";
rev_separator = 1;
rev_minline = 15;
rev_maxline = 75;
rev_lspace = 5;
rev_rspace = 5;
rev_tspace = 3;
rev_bspace = 3;
rev_text = "%d"; # or "%d\n%a, %s" for author and state too
rev_text_font = tiny;
#rev_text_ttfont = "/dos/windows/fonts/times.ttf";
#rev_text_ttsize = 9.0;
rev_text_color = "#500020";
rev_maxtags = 25;
# merge_color <color>
# The color of the line connecting merges
# merge_front <boolean>
# If true, draw the merge-lines on top if the image
# merge_nocase <boolean>
# Ignore case in regular expressions
# merge_from <string>
# A regex describing a tag that is used as the merge source
# merge_to <string>
# A regex describing a tag that is the target of the merge
# merge_findall <boolean>
# Try to match all merge_to targets possible. This can result in
# multiple lines originating from one tag.
# merge_arrows <boolean>
# Use arrows to point to the merge destination. Default is true.
# merge_cvsnt <boolean>
# Use CVSNT's mergepoint registration for merges
# merge_cvsnt_color <color>
# The color of the line connecting merges from/to registered
# mergepoints.
# arrow_width <number>
# arrow_length <number>
# Specify the size of the arrows. Default is 3 wide and 12 long.
#
# NOTE:
# - The merge_from is an extended regular expression as described in
# regex(7) and POSIX 1003.2 (see also Single Unix Specification at
# http://www.opengroup.com).
# - The merge_to is an extended regular expression with a twist. All
# subexpressions from the merge_from are expanded into merge_to
# using %[1-9] (in contrast to \[1-9] for backreferences). Care is
# taken to escape the constructed expression.
# - A '$' at the end of the merge_to expression can be important to
# prevent 'near match' references. Normally, you want the destination
# to be a good representation of the source. However, this depends
# on how well you defined the tags in the first place.
#
# Example:
# merge_from = "^f_(.*)";
# merge_to = "^t_%1$";
# tags: f_foo, f_bar, f_foobar, t_foo, t_bar
# result:
# f_foo -> "^t_foo$" -> t_foo
# f_bar -> "^t_bar$" -> t_bar
# f_foobar-> "^t_foobar$" -> <no match>
#
merge_color = "#a000a0";
merge_front = false;
merge_nocase = false;
merge_from = "^f_(.*)";
merge_to = "^t_%1$";
merge_findall = false;
#merge_arrows = true;
#arrow_width = 3;
#arrow_length = 12;
merge_cvsnt = true;
merge_cvsnt_color = "#606000";
# branch_font <number>
# The font of the number and tags
# branch_color <color>
# All branch element's color
# branch_[lrtb]space <number>
# Interior spacing (margin)
# branch_margin <number>
# Exterior spacing
# branch_connect <number>
# Length of the vertical connector
# branch_dupbox <boolean>
# Add the branch-tag also at the bottom/top of the trunk
# branch_fold <boolean>
# Fold empty branches in one box to save space
# branch_foldall <boolean>
# Put all empty branches in one box, even if they
# were interspaced with branches with revisions.
# branch_resort <boolean>
# Resort the branches by the number of revisions to save space
# branch_subtree <string>
# Only show the branch denoted or all branches that sprout
# from the denoted revision. The argument may be a symbolic
# tag. This option you would normally want to set from the
# command line with the -O option.
branch_font = medium;
#branch_ttfont = "/dos/windows/fonts/arialbd.ttf";
#branch_ttsize = 18.0;
branch_tag_color= "#000080";
branch_tag_font = medium;
#branch_tag_ttfont = "/dos/windows/fonts/arialbi.ttf";
#branch_tag_ttsize = 14.0;
branch_color = "#0000c0";
branch_bgcolor = "#ffffc0";
branch_lspace = 5;
branch_rspace = 5;
branch_tspace = 3;
branch_bspace = 3;
branch_margin = 15;
branch_connect = 8;
branch_dupbox = false;
branch_fold = true;
branch_foldall = false;
branch_resort = false;
#branch_subtree = "1.2.4";
# title <string>
# The title string is expanded (see above for details)
# title_[xy] <number>
# Position of title
# title_font <number>
# The font
# title_align <number>
# 0 = left
# 1 = center
# 2 = right
# title_color <color>
title = "%c%p%f\nRevisions: %r, Branches: %b";
title_x = 10;
title_y = 5;
title_font = small;
#title_ttfont = "/dos/windows/fonts/times.ttf";
#title_ttsize = 10.0;
title_align = left;
title_color = "#800000";
# Margins of the image
# Note: the title is outside the margin
margin_top = 35;
margin_bottom = 10;
margin_left = 10;
margin_right = 10;
# Image format(s)
# image_type <number|{gif,jpeg,png}>
# gif (0) = Create gif image
# png (1) = Create png image
# jpeg (2) = Create jpeg image
# Image types are available if they can be found in
# the gd library. Newer versions of gd do not have
# gif anymore. CvsGraph will automatically generate
# png images instead.
# image_quality <number>
# The quality of a jpeg image (1..100)
# image_compress <number>
# Set the compression of a PNG image (gd version >= 2.0.12).
# Values range from -1 to 9 where:
# - -1 default compression (usually 3)
# - 0 no compression
# - 1 lowest level compression
# - ... ...
# - 9 highest level of compression
# image_interlace <boolean>
# Write interlaces PNG/JPEG images for progressive loading.
image_type = png;
image_quality = 75;
image_compress = 3;
image_interlace = true;
# HTML image map generation
# map_name <string>
# The name= attribute in <map name="mapname">...</map>
# map_branch_href <string>
# map_branch_alt <string>
# map_rev_href <string>
# map_rev_alt <string>
# map_diff_href <string>
# map_diff_alt <string>
# map_merge_href <string>
# map_merge_alt <string>
# These are the href= and alt= attributes in the <area>
# tags of HTML. The strings are expanded (see above).
map_name = "MyMapName\" name=\"MyMapName";
map_branch_href = "href=\"%6pathrev=%(%t%)\"";
map_branch_alt = "alt=\"%0 %(%t%) (%B)\"";
# You might want to experiment with the following setting:
# 1. The default setting will take you to a ViewVC generated page displaying
# that revision of the file, if you click into a revision box:
map_rev_href = "href=\"%4rev=%R\"";
# 2. This alternative setting will take you to the anchor representing this
# revision on a ViewVC generated Log page for that file:
# map_rev_href = "href=\"%3#rev%R\"";
#
map_rev_alt = "alt=\"%1 %(%t%) (%R)\"";
map_diff_href = "href=\"%5r1=%P&amp;r2=%R\"";
map_diff_alt = "alt=\"%2 %P &lt;-&gt; %R\"";
map_merge_href = "href=\"%5r1=%P&amp;r2=%R\"";
map_merge_alt = "alt=\"%2 %P &lt;-&gt; %R\"";

32
conf/mimetypes.conf.dist Normal file
View File

@@ -0,0 +1,32 @@
#---------------------------------------------------------------------------
#
# MIME type mapping file for ViewVC
#
# Information on ViewVC is located at the following web site:
# http://viewvc.org/
#
#---------------------------------------------------------------------------
# THE FORMAT OF THIS FILE
#
# This file contains records -- one per line -- of the following format:
#
# MIME_TYPE [EXTENSION [EXTENSION ...]]
#
# where whitespace separates the MIME_TYPE from the EXTENSION(s),
# and the EXTENSIONs from each other.
#
# For example:
#
# text/x-csh csh
# text/x-csrc c
# text/x-diff diff patch
# image/png png
# image/jpeg jpeg jpg jpe
#
# By default, this file is left empty, allowing ViewVC to continue
# consulting it first without overriding the MIME type mappings
# found in more standard mapping files (such as those provided as
# part of the operating system or web server software).
#
#

1304
conf/viewvc.conf.dist Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,213 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>ViewVC: 1.1.0 Release Notes</title>
<style>
.h2, .h3 {
padding: 0.25em 0em;
background: white;
}
.warning {
font-style: italic;
}
</style>
</head>
<body>
<h1>ViewVC 1.1.0 Release Notes</h1>
<div class="h2">
<h2 id="introduction">Introduction</h2>
<p>ViewVC 1.1.0 is the superset of all previous ViewVC releases.</p>
</div> <!-- h2 -->
<div class="h2">
<h2 id="compatibility">Compatibility</h2>
<p>Each ViewVC release strives to maintain URL stability with previous
releases, and 1.1.0 is no exception. All URLs considered valid for
previous ViewVC releases should continue to work correctly in this
release, though possibly only via the use of HTTP redirects
(generated by ViewVC itself).</p>
<p>The commits database functionality has changed in ViewVC 1.1.0 in
way that breaks compatibility with prior ViewVC releases, but only
for new database instantiations. ViewVC 1.1.0 will continue to
understand (for both read and write operations) the previous
schema, so you are not required to rebuild your commits database
for ViewVC 1.1.0 compatibility. By default, new commits databases
created using the 1.1.0 version of the <code>make-database</code>
script will use a new database schema that is unreadable by
previous ViewVC versions. However, if you need a database which
can co-exist with a previous ViewVC version, you can use
the <code>--version=1.0</code> option
to <code>make-database</code>.</p>
<p>The ViewVC configuration files and template language have changed
dramatically. See the file <code>docs/upgrading-howto.html</code>
in the release for information on porting existing versions of
those items for use with ViewVC 1.1.0.</p>
</div> <!-- h2 -->
<div class="h2">
<h2 id="compatibility">Features and Fixes</h2>
<div class="h3">
<h3 id="">Extensible path-based authorization w/ Subversion authz support</h3>
<p>In a nutshell, ViewVC is now able to do path-based authorization.
ViewVC 1.0 has a configuration option for naming 'forbidden'
modules, but it is really limited &mdash; it basically just makes a
universal decision about which top-level directories in every
hosted repository should be hidden by ViewVC. People want
more, and specifically requested that ViewVC learn how to honor
Subversion's authz files and semantics. So, along with some other
types of authorization approaches, that's what ViewVC 1.1 can now
do. If you are using mod_authz_svn with Apache today, or
svnserve's built-in authorization support, then you can now point
ViewVC to the same authz configuration file and have it honor the
access rules you've defined for your repositories.</p>
<p>Note that ViewVC does <strong>not</strong> handle authentication,
though. You'll need to configure your web server to demand login
credentials from users, which the web server itself can then hand
off to ViewVC for application against the authorization rules
you've defined.</p>
<p class="warning">WARNING: The root listing view does not consult the
authorization subsystem when deciding what roots to display to a
given user. If you need to protect your root names, consider
disabling it by removing <code>roots</code> from the set of views
listed in the <code>allowed_views</code> configuration option.
<strong>UPDATE: This was fixed in ViewVC 1.1.3.</strong></p>
<p class="warning">WARNING: Support for path-based authorization is
incomplete in the experimental version control backend modules,
including the one that permits display of remote Subversion
repositories. <strong>UPDATE: This was fixed in ViewVC
1.1.15.</strong></p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Subversion versioned properties display</h3>
<p>ViewVC 1.1 displays the properties that Subversion lets you store
on files and directories
(<code>svn:mime-type</code>, <code>svn:mergeinfo</code>,
<code>svn:ignore</code>, etc.). Directory properties are shown by
default at the bottom of that directory's entry listing. File
properties are displayed at the bottom of that file's
markup/annotate view.</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Unified markup and annotation views</h3>
<p>The "markup" and "annotate" views in ViewVC now have a unified look
and feel (driven by a single EZT template). Both views support
syntax highlighting and Subversion file property display.</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Unified, hassle-free Pygments-based syntax highlighting</h3>
<p>ViewVC 1.0 does syntax highlighting by working with GNU enscript, or
highlight, or php, or py2html &mdash; all these external tools just
to accomplish a single task. But they all do things in slightly
different ways. And if you configure them wrongly, you get strange
errors. <a href="http://www.pygments.org/">Pygments</a> (which is
also used by <a href="http://trac.edgewall.org/">Trac</a> for
syntax highlighting) is a Python package that requires no
configuration, is easier to use inside ViewVC, and so on. So
ViewVC 1.1 drops support for all those various old integrations,
and just uses Pygments for everything now. This change was about
developer and administrator sanity. There will be complaints, to
be sure, about how various color schemes differ and what file types
now are and aren't understood by the syntax highlighting engine,
but this change should vastly simplify the discussions of such
things.</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Better MIME detection and handling</h3>
<p>ViewVC typically consults a MIME types file to determine what kind
of file a given document is, based on its filename extension
(<code>.jpg</code> = <code>image/jpeg</code>, &hellip;). But
Subversion lets you dictate a file's MIME type using
the <code>svn:mime-type</code> property. ViewVC now recognizes and
honors that property as the preferred source of a file's MIME type.
This can be disabled in the configuration, though, which might be
desirable if many of your Subversion-versioned files carry the
generic <code>application/octet-stream</code> MIME type that
Subversion uses by default for non-human-readable files.</p>
<p>Also, ViewVC now allows you to specify multiple MIME type mapping
files that you'd like it to consult when determine the MIME type of
files based on their extensions. This allows administrators to
easily define their own custom mappings for ViewVC's benefit
without potentially affecting the mappings used by other site
services.</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Support for full content diffs</h3>
<p>ViewVC 1.1 expands the previously existing options of "colored
diff" and "long colored diff" with a new "full colored diff", which
shows the full contents of the changed file (instead of only the 3
or 15 lines of context shown via the older diff display types).</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Support for per-root configuration overrides</h3>
<p>In ViewVC 1.1, you can setup configuration option overrides on a
per-root (per-repository) basis (if you need/care to do so). See
the comments in the <code>viewvc.conf.dist</code> file for more on
how to do this.</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Optional email address obfuscation/mangling</h3>
<p>ViewVC can, when displaying revision metadata, munge strings that
look like email addresses to protect them from screen-scraping
spammers. For example, a log message that says, "Patch by:
cmpilato@red-bean.com" can optionally be displayed by ViewVC using
HTML entity encoding for the characters (a trick that causes no
visible change to the output, but that might confuse
unsophisticated spam bot crawlers) or as "Patch by: cmpilato@..."
(which isn't a complete email address at all, but might be enough
information for the human reading the log message to know who to
blame for the patch).</p>
</div> <!-- h3 -->
<div class="h3">
<h3 id="">Pagination improvements</h3>
<p>The way that ViewVC splits directory and log views across pages has
been reworked. The old way was "Fetch all the information you can
find, then display only one page's worth." The new way is "Fetch
only what you need to display the page requested, plus a little bit
of border information." This provides a large performance
enhancement for the default sort orderings.</p>
</div> <!-- h3 -->
</div> <!-- h2 -->
</body>
</html>

View File

@@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>ViewVC: 1.2.0 Release Notes</title>
<style>
.h2, .h3 {
padding: 0.25em 0em;
background: white;
}
.warning {
font-style: italic;
}
</style>
</head>
<body>
<h1>ViewVC 1.2.0 Release Notes</h1>
<div class="h2">
<h2 id="introduction">Introduction</h2>
<p>ViewVC 1.2.0 is the superset of all previous ViewVC releases.</p>
</div> <!-- h2 -->
<div class="h2">
<h2 id="compatibility">Compatibility</h2>
<p>Each ViewVC release strives to maintain URL stability with previous
releases, and 1.2.0 is no exception. All URLs considered valid for
previous ViewVC releases should continue to work correctly in this
release, though possibly only via the use of HTTP redirects
(generated by ViewVC itself).</p>
</div> <!-- h2 -->
<div class="h2">
<h2 id="compatibility">Features and Fixes</h2>
<div class="h3">
<h3 id=""></h3>
</div> <!-- h3 -->
</div> <!-- h2 -->
</body>
</html>

File diff suppressed because it is too large Load Diff

1704
docs/upgrading-howto.html Normal file

File diff suppressed because it is too large Load Diff

1540
docs/url-reference.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,153 +0,0 @@
"""Module to analyze Python source code; for syntax coloring tools.
Interface:
tags = fontify(pytext, searchfrom, searchto)
The 'pytext' argument is a string containing Python source code.
The (optional) arguments 'searchfrom' and 'searchto' may contain a slice in pytext.
The returned value is a list of tuples, formatted like this:
[('keyword', 0, 6, None), ('keyword', 11, 17, None), ('comment', 23, 53, None), etc. ]
The tuple contents are always like this:
(tag, startindex, endindex, sublist)
tag is one of 'keyword', 'string', 'comment' or 'identifier'
sublist is not used, hence always None.
"""
# Based on FontText.py by Mitchell S. Chapman,
# which was modified by Zachary Roadhouse,
# then un-Tk'd by Just van Rossum.
# Many thanks for regular expression debugging & authoring are due to:
# Tim (the-incredib-ly y'rs) Peters and Cristian Tismer
# So, who owns the copyright? ;-) How about this:
# Copyright 1996-1997:
# Mitchell S. Chapman,
# Zachary Roadhouse,
# Tim Peters,
# Just van Rossum
__version__ = "0.3.1"
import string, regex
# First a little helper, since I don't like to repeat things. (Tismer speaking)
import string
def replace(where, what, with):
return string.join(string.split(where, what), with)
# This list of keywords is taken from ref/node13.html of the
# Python 1.3 HTML documentation. ("access" is intentionally omitted.)
keywordsList = [
"del", "from", "lambda", "return",
"and", "elif", "global", "not", "try",
"break", "else", "if", "or", "while",
"class", "except", "import", "pass",
"continue", "finally", "in", "print",
"def", "for", "is", "raise"]
# Build up a regular expression which will match anything
# interesting, including multi-line triple-quoted strings.
commentPat = "#.*"
pat = "q[^\q\n]*\(\\\\[\000-\377][^\q\n]*\)*q"
quotePat = replace(pat, "q", "'") + "\|" + replace(pat, 'q', '"')
# Way to go, Tim!
pat = """
qqq
[^\\q]*
\(
\( \\\\[\000-\377]
\| q
\( \\\\[\000-\377]
\| [^\\q]
\| q
\( \\\\[\000-\377]
\| [^\\q]
\)
\)
\)
[^\\q]*
\)*
qqq
"""
pat = string.join(string.split(pat), '') # get rid of whitespace
tripleQuotePat = replace(pat, "q", "'") + "\|" + replace(pat, 'q', '"')
# Build up a regular expression which matches all and only
# Python keywords. This will let us skip the uninteresting
# identifier references.
# nonKeyPat identifies characters which may legally precede
# a keyword pattern.
nonKeyPat = "\(^\|[^a-zA-Z0-9_.\"']\)"
keyPat = nonKeyPat + "\("
for keyword in keywordsList:
keyPat = keyPat + keyword + "\|"
keyPat = keyPat[:-2] + "\)" + nonKeyPat
matchPat = keyPat + "\|" + commentPat + "\|" + tripleQuotePat + "\|" + quotePat
matchRE = regex.compile(matchPat)
idKeyPat = "[ \t]*[A-Za-z_][A-Za-z_0-9.]*" # Ident w. leading whitespace.
idRE = regex.compile(idKeyPat)
def fontify(pytext, searchfrom = 0, searchto = None):
if searchto is None:
searchto = len(pytext)
# Cache a few attributes for quicker reference.
search = matchRE.search
group = matchRE.group
idSearch = idRE.search
idGroup = idRE.group
tags = []
tags_append = tags.append
commentTag = 'comment'
stringTag = 'string'
keywordTag = 'keyword'
identifierTag = 'identifier'
start = 0
end = searchfrom
while 1:
start = search(pytext, end)
if start < 0 or start >= searchto:
break # EXIT LOOP
match = group(0)
end = start + len(match)
c = match[0]
if c not in "#'\"":
# Must have matched a keyword.
if start <> searchfrom:
# there's still a redundant char before and after it, strip!
match = match[1:-1]
start = start + 1
else:
# this is the first keyword in the text.
# Only a space at the end.
match = match[:-1]
end = end - 1
tags_append((keywordTag, start, end, None))
# If this was a defining keyword, look ahead to the
# following identifier.
if match in ["def", "class"]:
start = idSearch(pytext, end)
if start == end:
match = idGroup(0)
end = start + len(match)
tags_append((identifierTag, start, end, None))
elif c == "#":
tags_append((commentTag, start, end, None))
else:
tags_append((stringTag, start, end, None))
return tags
def test(path):
f = open(path)
text = f.read()
f.close()
tags = fontify(text)
for tag, start, end, sublist in tags:
print tag, `text[start:end]`

View File

@@ -1,24 +1,20 @@
# -*-python-*-
#
# Copyright (C) 1999-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# accept.py: parse/handle the various Accept headers from the client
#
# -----------------------------------------------------------------------
#
import re
import string
def language(hdr):
@@ -42,8 +38,8 @@ def _parse(hdr, result):
while pos < len(hdr):
name = _re_token.match(hdr, pos)
if not name:
raise AcceptParseError()
a = result.item_class(string.lower(name.group(1)))
raise AcceptLanguageParseError()
a = result.item_class(name.group(1).lower())
pos = name.end()
while 1:
# are we looking at a parameter?
@@ -59,7 +55,7 @@ def _parse(hdr, result):
# the "=" was probably missing
continue
pname = string.lower(match.group(1))
pname = match.group(1).lower()
if pname == 'q' or pname == 'qs':
try:
a.quality = float(match.group(2))
@@ -73,7 +69,7 @@ def _parse(hdr, result):
# bad float literal
pass
elif pname == 'charset':
a.charset = string.lower(match.group(2))
a.charset = match.group(2).lower()
result.append(a)
if hdr[pos:pos+1] == ',':
@@ -111,6 +107,23 @@ class _LanguageRange(_AcceptItem):
return None
class _LanguageSelector:
"""Instances select an available language based on the user's request.
Languages found in the user's request are added to this object with the
append() method (they should be instances of _LanguageRange). After the
languages have been added, then the caller can use select_from() to
determine which user-request language(s) best matches the set of
available languages.
Strictly speaking, this class is pretty close for more than just
language matching. It has been implemented to enable q-value based
matching between requests and availability. Some minor tweaks may be
necessary, but simply using a new 'item_class' should be sufficient
to allow the _parse() function to construct a selector which holds
the appropriate item implementations (e.g. _LanguageRange is the
concrete _AcceptItem class that handles matching of language tags).
"""
item_class = _LanguageRange
def __init__(self):
@@ -120,7 +133,8 @@ class _LanguageSelector:
"""Select one of the available choices based on the request.
Note: if there isn't a match, then the first available choice is
considered the default.
considered the default. Also, if a number of matches are equally
relevant, then the first-requested will be used.
avail is a list of language-tag strings of available languages
"""
@@ -140,7 +154,8 @@ class _LanguageSelector:
qvalue = want.matches(tag)
#print 'have %s. want %s. qvalue=%s' % (tag, want.name, qvalue)
if qvalue is not None and len(want.name) > longest:
# we have a match and it is longer than any we may have had
# we have a match and it is longer than any we may have had.
# the final qvalue should be from this tag.
final = qvalue
longest = len(want.name)
@@ -148,27 +163,53 @@ class _LanguageSelector:
if final:
matches.append((final, tag))
# if we have any matches, then look at the highest qvalue
if matches:
matches.sort()
qvalue, tag = matches[-1]
# if there are no matches, then return the default language tag
if not matches:
return avail[0]
if len(matches) >= 2 and matches[-2][0] == qvalue:
#print "non-deterministic choice", avail
pass
# get the highest qvalue and its corresponding tag
matches.sort()
qvalue, tag = matches[-1]
# if the qvalue is non-zero, then we have a valid match
if qvalue:
return tag
# the qvalue is zero (non-match). drop thru to return the default
# if the qvalue is zero, then we have no valid matches. return the
# default language tag.
if not qvalue:
return avail[0]
# return the default language tag
return avail[0]
# if there are two or more matches, and the second-highest has a
# qvalue equal to the best, then we have multiple "best" options.
# select the one that occurs first in self.requested
if len(matches) >= 2 and matches[-2][0] == qvalue:
# remove non-best matches
while matches[0][0] != qvalue:
del matches[0]
#print "non-deterministic choice", matches
# sequence through self.requested, in order
for want in self.requested:
# try to find this one in our best matches
for qvalue, tag in matches:
if want.matches(tag):
# this requested item is one of the "best" options
### note: this request item could match *other* "best" options,
### so returning *this* one is rather non-deterministic.
### theoretically, we could go further here, and do another
### search based on the ordering in 'avail'. however, note
### that this generally means that we are picking from multiple
### *SUB* languages, so I'm all right with the non-determinism
### at this point. stupid client should send a qvalue if they
### want to refine.
return tag
# NOTREACHED
# return the best match
return tag
def append(self, item):
self.requested.append(item)
class AcceptParseError(Exception):
class AcceptLanguageParseError(Exception):
pass
def _test():
@@ -177,6 +218,10 @@ def _test():
assert s.select_from(['en', 'de']) == 'en'
assert s.select_from(['de', 'en']) == 'en'
# Netscape 4.x and early version of Mozilla may not send a q value
s = language('en, ja')
assert s.select_from(['en', 'ja']) == 'en'
s = language('fr, de;q=0.9, en-gb;q=0.7, en;q=0.6, en-gb-foo;q=0.8')
assert s.select_from(['en']) == 'en'
assert s.select_from(['en-gb-foo']) == 'en-gb-foo'

View File

@@ -1,199 +0,0 @@
#! /usr/bin/env python
# This file was automatically generated! DO NOT EDIT!
# Howto regenerate: see ../tools/bin2inline.py
# $Id$
# You have been warned. But if you want to edit, go ahead using your
# favorite editor :-)
## vim:ts=4:et:nowrap
# [Emacs: -*- python -*-]
_ap_icons = {
"/icons/apache_pb.gif" :
'GIF89a\003\001 \000\367\000\000\377\377\377'
'\316\316\316\245\245\245\204\204\204ssskkkZ'
'ZZ!\030\030\377B\030\3771\000\275R\020\336\255'
'\204\357\234B\377\204\000\377\316\030\377\316\000\316\316\306'
'\275\275\3061\000\377c\000\377\234\000\377\357\000\377\347'
'J\357\336{\336\326\245\316\377\000\234\357J\214\377\000'
'c\347\204\234\357Rc\377\000\030\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000'
'\000\000\000\000\000\000\000\000\000\000\000\000\000!\371\004'
'\001\000\000\001\000,\000\000\000\000\003\001 \000G\010'
'\377\000\003\010\034H\260\240\301\203\010\023*\\\310\260'
'\241\303\207\020#J\234H\261\242E\206\021\016\034\030'
'0\260\300\200\001\002\002l0\260!\303\006\017(Q'
'&X\331\300A\204\201\007\376\3753\020\363_\004\231'
'\007h\376;\020 \246\001\0032\011\370\024\2603\302'
'\200\231=e\006%03\002P\002\001p\352\374W'
'\020\350L\253\004\254\336\264y\261\253\327\257`\303\026'
'|Iv\203\331\012\033*P\2400a\302?\011J'
'\343\276\225@w\002\333\265\0252P\3100!\203I'
'\277\005P\376;\231\022\001\002\001._\212]\314\270'
'\261\343\307b#Dh0\000A\203\225\011R\012N'
'\371\317\203\001\017f\375\206\366+\332d^\275\245\323'
"f\030\360\240u\353\006\017\032\314\374'\200\243\300\013"
"u'Hh\333\226\356\356\335\272%\\0xa\355"
'\332\341\022/\220^\316\274y\006\015\0065{X\330'
'A3\206\202\0300\257d\270@{\202\203\014\032\210'
'\377o\000\371\253\200\363\347\313/\214\220\236 \373\220'
'\352\343\313\237\357\360\345y\271o\347\266]\233!o'
'\337\275\031L\225\222\001\010(PSQ\002\035\305S'
'T\264\011$\300\201P\305\264\240@L)\025\222S'
'rU\025\327F\016\312\244\030} \2068_\004\010'
'\030\260Rg\240\225d\332r\024T`\327ZnY'
'\205\237\\p\375\366\033[\025\2505\300^\033\000\230'
'\300\000-\271\324P\004\272\265\025\200\005\277M\360\341'
'A\305\031G\301BN"\207\335r\303Y\260\334u'
'\011I\267\220\006\326a\347\035w_\032\024\336x"'
'\226i\346\231h\246\251\346\232l\266\351\246A\017.'
'9\320y\005(\346\200\000\015\340\331PM\002X\305'
'\221Q\006\014`\337O/\031\000\225S\006\220E\200'
'\240\024\032 \200S\360\011@\000|\002E@@V'
'2i\370\317\000\216\006\320g\242\236\032\372\346\250e'
'\032U\023P \355\367_\217*J\247RM\037n'
'\377\005U\205\222)\365\023N\001\034E\033zIM'
'\010\324\001\350=*S\242Vi\352\351\260\001\310('
"'\251\314\252\367\350O\004\024\020\000_\301\3218\227"
'\001\022\030p\227\213\250M0\022a\011\240\310\222x'
'\206!\260\254|[Q\332\354\272"\032\225\222Y\241'
'\251\325\237\213l\3015c~\276\365\266\037\275x\241'
'6\322_&\201\326\300\271\023\345;\201\005\0155\351'
'\344\302\014\033\207%B\0324\367pB\030\270j\261'
'\253\034\030\224\035f\035\200\251\035x\343\205,\362\310'
'\013<\206\247\211\232\015\206\222\212\244\261\314\234qj'
'\3355\301On\331;#P\015\030\020\333k\2559'
" \244\306ENP\020\222ENL\220\302\015'\275"
'\226\321\312\221&\345m\313e|\220\226\025m\354\335'
'\325Xc\006\362\310"\227<\252d\001HfT\003'
'\033!p\000\002)\036\340\301\000\033\014\000\332\333\360'
'\232\205\322\001q\033\345\300\000w\252{d\276F\037'
'\377\204Ap\022 <\020\322O7\304\\\337~\037'
'>\020\007\0277\216R\307^~\274Pw\222\0274'
'&\327\230\213\007\001\273\234w\356\371\347\240\207.\372'
'\350\244\227\3169\301a\203M\321\201\310\212X,A'
'\257\233.;D\246\352-)\243hk\226\200e\003'
'#T\323\261\377L*\227\260\233\022e\323\257\311*'
'\005lRV\361t\340\001/U\030\227\246\312oe'
'\000\363\263go\320\000\032\011\012@\001\005@\205Z'
'\005\004\2304RJ,\355~\030\353\300\032?\253L'
'\222\342$!\374\025j\224)\237\317\356d?\2602'
'q\024\273@\257\363\311V|\242\275\002\036DF\267'
'\252\213\223\374\223\232\317x@)\0360\314\300jB'
'A\000\302OW\327\263\236\244\234\267\2239\015\353S'
'I\311\020\354\360\023\022\343]\317\200(\014[\001\200'
'b\000\217\330L)\276\221\000\214\214\343\257\275\020\000'
'\\\036X\211\002,\203\030\325%\204=\014yTW'
'\377X\230B\024\212\215=/\351Vo^\010\303|'
'\311\320.}\351V\3344\343\300\0346\240\\z\203'
'\314\005rR\304.V*l\271\353\221_\3622\303'
'\266\334k.7z"\031\333\242\032\322\334\020\\\231'
')\014\352(R\227\302%Dix\274\000\342\012r'
'\001\013\370Qp\015\201\000\007\030\347\270\224p\000q'
'\030\350\200";\3405\205Pn%\215$\010\003&'
'I\311JZ\262\222\221\264\310d\334\366.\227\235\246'
'E0b"~jd\243\375\340H-1\243@\001'
'\344V\030\004\260\315\\\022\311\315o\000\231\020\244Q'
'\340\002\270\314\245.\011\227\020\347\370e\217\003\221\316'
' \207IL\016h\240:)\331\034A\254\346\001\310'
'92L\226\013\331\002\246I\315jZ\2231w\273'
'L\034W\026\232\264\250\34649B\245]\012\000\027'
'\031\235Q&\300\341\015o\332&\236\330\300\346g\010'
'!\022p\006B\264\335\240\316\226\273\314g\2244F'
'\363\245\301])K\232Y\010\006\016\211\310\254\031\364'
"j[\023\317%'\231I\365\214\315D+\331\014J"
'H\302\315n.\3474\375\361\313^\310\330\242\276\304'
'\314\0003\273U\\~b\000\361\300S \177K\222'
':y\223$\304\331\022\217\306\321#\037}IS\251'
'\025\204j\011\341\200"\017\2511\357\024\223\003\326|'
'\244\326\304$\315\240.@\231i\222Lm\\\351\235'
'\034\272\252G\025e\245\001\376B\030\222\250\250\000\355'
'\204\215k|\366!\334\000G\217\030\010k\000\302J'
'\326\013,\261p\274\214H\323\374\002V\262\2725\254'
'\034X\016t\010"\314\237\016\363\230\232A*J\241'
'\231\020\241~\207\250\343\241\244Q\257\351E\332\351r'
'\216\3569\354@0\240K`\372M\227\020\031\3500'
"'&Y\273ZV\257\003\201@5\035+\020\315V"
'\363 \203\015-5\013K\332\322\232\366\264\250=\010'
'@\002\004\004\000;',
"/icons/small/back.gif" :
'GIF89a\020\000\020\000\242\377\000!!!'
'111ZZZ\204\204\204\214\214\214\300\300\300\000'
'\000\000\000\000\000!\371\004\001\000\000\005\000,\000\000'
'\000\000\020\000\020\000\000\003FX\272\334\015\300I`'
'L\224\213V\213\213\320\025 t\304f\020]Qn'
'(i\266\303\240\310\312Z\215D,\010\255\022\230\236'
'\20000Z\010L\203\241\320a"*\035 \321\260'
'\267\260\235\204E\307q3\310J\010`p#\001\000'
';',
"/icons/small/dir.gif" :
'GIF89a\020\000\020\000\242\377\000\377\336\255'
'\377\334\256\300\300\300\270\240}WK;+%\035\000'
'\000\000\000\000\000!\371\004\001\000\000\002\000,\000\000'
'\000\000\020\000\020\000\000\003I(b\246\376\316\2241'
'\230\262\320\2002\253\031\001v\001$GQA\025\221'
'\254y6#\333v\360"\337_\255\335dE\350\274'
'\236\341\267\012\372t\204\001\357\370`$e\314\314P'
'\0118\026 \227\251\365\212]\014\277\234n\204\021\026'
'$\000\000;',
"/icons/small/text.gif" :
'GIF89a\020\000\020\000\242\377\000\377\377\377'
'999kkk\214\214\214\300\300\300\316\316\316\347'
'\347\347\000\000\000!\371\004\001\000\000\004\000,\000\000'
'\000\000\020\000\020\000\000\003EH\272\334\276\343\025@'
"k1\261\315J'\326\\W\024D\246LA\232\002"
'j\300xFlP\212\360\262me\330\013,\307\024'
'\336\011\327Z\011\011\276\337\354\210*\032oJ\031\200'
'I,No!\316\261$\350z\275\256E\002\000;',
}
def serve_icon(pathname, fp):
if _ap_icons.has_key(pathname):
fp.write(_ap_icons[pathname])
else:
raise OSError # icon not found

View File

@@ -1,16 +1,14 @@
#!/usr/local/bin/python
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 2000 Curt Hagenlocher <curt@hagenlocher.org>
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
@@ -19,10 +17,6 @@
#
# -----------------------------------------------------------------------
#
# This software is being maintained as part of the ViewCVS project.
# Information is available at:
# http://viewcvs.sourceforge.net/
#
# This file is based on the cvsblame.pl portion of the Bonsai CVS tool,
# developed by Steve Lamm for Netscape Communications Corporation. More
# information about Bonsai can be found at
@@ -31,542 +25,119 @@
# cvsblame.pl, in turn, was based on Scott Furman's cvsblame script
#
# -----------------------------------------------------------------------
#
import string
import sys
import os
import re
import time
import math
import cgi
import rcsparse
class CVSParser(rcsparse.Sink):
# Precompiled regular expressions
trunk_rev = re.compile('^[0-9]+\\.[0-9]+$')
last_branch = re.compile('(.*)\\.[0-9]+')
is_branch = re.compile('(.*)\\.0\\.([0-9]+)')
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
SECONDS_PER_DAY = 86400
def __init__(self):
self.Reset()
def Reset(self):
self.last_revision = {}
self.prev_revision = {}
self.revision_date = {}
self.revision_author = {}
self.revision_branches = {}
self.next_delta = {}
self.prev_delta = {}
self.tag_revision = {}
self.revision_symbolic_name = {}
self.timestamp = {}
self.revision_ctime = {}
self.revision_age = {}
self.revision_log = {}
self.revision_deltatext = {}
self.revision_map = []
self.lines_added = {}
self.lines_removed = {}
# Map a tag to a numerical revision number. The tag can be a symbolic
# branch tag, a symbolic revision tag, or an ordinary numerical
# revision number.
def map_tag_to_revision(self, tag_or_revision):
try:
revision = self.tag_revision[tag_or_revision]
match = self.is_branch.match(revision)
if match:
branch = match.group(1) + '.' + match.group(2)
if self.last_revision.get(branch):
return self.last_revision[branch]
else:
return match.group(1)
else:
return revision
except:
return ''
# Construct an ordered list of ancestor revisions to the given
# revision, starting with the immediate ancestor and going back
# to the primordial revision (1.1).
#
# Note: The generated path does not traverse the tree the same way
# that the individual revision deltas do. In particular,
# the path traverses the tree "backwards" on branches.
def ancestor_revisions(self, revision):
ancestors = []
revision = self.prev_revision.get(revision)
while revision:
ancestors.append(revision)
revision = self.prev_revision.get(revision)
return ancestors
# Split deltatext specified by rev to each line.
def deltatext_split(self, rev):
lines = string.split(self.revision_deltatext[rev], '\n')
if lines[-1] == '':
del lines[-1]
return lines
# Extract the given revision from the digested RCS file.
# (Essentially the equivalent of cvs up -rXXX)
def extract_revision(self, revision):
path = []
add_lines_remaining = 0
start_line = 0
count = 0
while revision:
path.append(revision)
revision = self.prev_delta.get(revision)
path.reverse()
path = path[1:] # Get rid of head revision
text = self.deltatext_split(self.head_revision)
# Iterate, applying deltas to previous revision
for revision in path:
adjust = 0
diffs = self.deltatext_split(revision)
self.lines_added[revision] = 0
self.lines_removed[revision] = 0
lines_added_now = 0
lines_removed_now = 0
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
begin = start_line + adjust - 1
del text[begin:begin + count]
adjust = adjust - count
lines_removed_now = lines_removed_now + count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
add_lines_remaining = count
lines_added_now = lines_added_now + count
else:
raise RuntimeError, 'Error parsing diff commands'
self.lines_added[revision] = self.lines_added[revision] + lines_added_now
self.lines_removed[revision] = self.lines_removed[revision] + lines_removed_now
return text
def set_head_revision(self, revision):
self.head_revision = revision
def set_principal_branch(self, branch_name):
self.principal_branch = branch_name
def define_tag(self, name, revision):
# Create an associate array that maps from tag name to
# revision number and vice-versa.
self.tag_revision[name] = revision
### actually, this is a bit bogus... a rev can have multiple names
self.revision_symbolic_name[revision] = name
def set_comment(self, comment):
self.file_description = comment
def set_description(self, description):
self.rcs_file_description = description
# Construct dicts that represent the topology of the RCS tree
# and other arrays that contain info about individual revisions.
#
# The following dicts are created, keyed by revision number:
# self.revision_date -- e.g. "96.02.23.00.21.52"
# self.timestamp -- seconds since 12:00 AM, Jan 1, 1970 GMT
# self.revision_author -- e.g. "tom"
# self.revision_branches -- descendant branch revisions, separated by spaces,
# e.g. "1.21.4.1 1.21.2.6.1"
# self.prev_revision -- revision number of previous *ancestor* in RCS tree.
# Traversal of this array occurs in the direction
# of the primordial (1.1) revision.
# self.prev_delta -- revision number of previous revision which forms
# the basis for the edit commands in this revision.
# This causes the tree to be traversed towards the
# trunk when on a branch, and towards the latest trunk
# revision when on the trunk.
# self.next_delta -- revision number of next "delta". Inverts prev_delta.
#
# Also creates self.last_revision, keyed by a branch revision number, which
# indicates the latest revision on a given branch,
# e.g. self.last_revision{"1.2.8"} == 1.2.8.5
def define_revision(self, revision, timestamp, author, state,
branches, next):
self.tag_revision[revision] = revision
branch = self.last_branch.match(revision).group(1)
self.last_revision[branch] = revision
#self.revision_date[revision] = date
self.timestamp[revision] = timestamp
# Pretty print the date string
ltime = time.localtime(self.timestamp[revision])
formatted_date = time.strftime("%d %b %Y %H:%M", ltime)
self.revision_ctime[revision] = formatted_date
# Save age
self.revision_age[revision] = ((time.time() - self.timestamp[revision])
/ self.SECONDS_PER_DAY)
# save author
self.revision_author[revision] = author
# ignore the state
# process the branch information
branch_text = ''
for branch in branches:
self.prev_revision[branch] = revision
self.next_delta[revision] = branch
self.prev_delta[branch] = revision
branch_text = branch_text + branch + ''
self.revision_branches[revision] = branch_text
# process the "next revision" information
if next:
self.next_delta[revision] = next
self.prev_delta[next] = revision
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
self.prev_revision[revision] = next
else:
self.prev_revision[next] = revision
# Construct associative arrays containing info about individual revisions.
#
# The following associative arrays are created, keyed by revision number:
# revision_log -- log message
# revision_deltatext -- Either the complete text of the revision,
# in the case of the head revision, or the
# encoded delta between this revision and another.
# The delta is either with respect to the successor
# revision if this revision is on the trunk or
# relative to its immediate predecessor if this
# revision is on a branch.
def set_revision_info(self, revision, log, text):
self.revision_log[revision] = log
self.revision_deltatext[revision] = text
def parse_cvs_file(self, rcs_pathname, opt_rev = None, opt_m_timestamp = None):
# Args in: opt_rev - requested revision
# opt_m - time since modified
# Args out: revision_map
# timestamp
# revision_deltatext
# CheckHidden(rcs_pathname);
try:
rcsfile = open(rcs_pathname, 'r')
except:
raise RuntimeError, ('error: %s appeared to be under CVS control, ' +
'but the RCS file is inaccessible.') % rcs_pathname
rcsparse.Parser().parse(rcsfile, self)
rcsfile.close()
if opt_rev in [None, '', 'HEAD']:
# Explicitly specified topmost revision in tree
revision = self.head_revision
else:
# Symbolic tag or specific revision number specified.
revision = self.map_tag_to_revision(opt_rev)
if revision == '':
raise RuntimeError, 'error: -r: No such revision: ' + opt_rev
# The primordial revision is not always 1.1! Go find it.
primordial = revision
while self.prev_revision.get(primordial):
primordial = self.prev_revision[primordial]
# Don't display file at all, if -m option is specified and no
# changes have been made in the specified file.
if opt_m_timestamp and self.timestamp[revision] < opt_m_timestamp:
return ''
# Figure out how many lines were in the primordial, i.e. version 1.1,
# check-in by moving backward in time from the head revision to the
# first revision.
line_count = 0
if self.revision_deltatext.get(self.head_revision):
tmp_array = self.deltatext_split(self.head_revision)
line_count = len(tmp_array)
skip = 0
rev = self.prev_revision.get(self.head_revision)
while rev:
diffs = self.deltatext_split(rev)
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if skip > 0:
# Skip insertion lines from a prior "a" command
skip = skip - 1
elif dmatch:
# "d" - Delete command
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
line_count = line_count - count
elif amatch:
# "a" - Add command
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count;
line_count = line_count + count
else:
raise RuntimeError, 'error: illegal RCS file'
rev = self.prev_revision.get(rev)
# Now, play the delta edit commands *backwards* from the primordial
# revision forward, but rather than applying the deltas to the text of
# each revision, apply the changes to an array of revision numbers.
# This creates a "revision map" -- an array where each element
# represents a line of text in the given revision but contains only
# the revision number in which the line was introduced rather than
# the line text itself.
#
# Note: These are backward deltas for revisions on the trunk and
# forward deltas for branch revisions.
# Create initial revision map for primordial version.
self.revision_map = [primordial] * line_count
ancestors = [revision, ] + self.ancestor_revisions(revision)
ancestors = ancestors[:-1] # Remove "1.1"
last_revision = primordial
ancestors.reverse()
for revision in ancestors:
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
diffs = self.deltatext_split(last_revision)
# Revisions on the trunk specify deltas that transform a
# revision into an earlier revision, so invert the translation
# of the 'diff' commands.
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line - 1] +
temp + self.revision_map[start_line - 1:])
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
del self.revision_map[start_line:start_line + count]
skip = count
else:
raise RuntimeError, 'Error parsing diff commands'
else:
# Revisions on a branch are arranged backwards from those on
# the trunk. They specify deltas that transform a revision
# into a later revision.
adjust = 0
diffs = self.deltatext_split(revision)
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = string.atoi(dmatch.group(1))
count = string.atoi(dmatch.group(2))
del self.revision_map[start_line + adjust - 1:start_line + adjust - 1 + count]
adjust = adjust - count
elif amatch:
start_line = string.atoi(amatch.group(1))
count = string.atoi(amatch.group(2))
skip = count
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line + adjust] +
temp + self.revision_map[start_line + adjust:])
adjust = adjust + skip
else:
raise RuntimeError, 'Error parsing diff commands'
last_revision = revision
return revision
from common import _item
import vclib
import sapi
re_includes = re.compile('\\#(\\s*)include(\\s*)"(.*?)"')
re_filename = re.compile('(.*[\\\\/])?(.+)')
def link_includes(text, root, rcs_path, sticky = None):
def link_includes(text, repos, path_parts, include_url):
match = re_includes.match(text)
if match:
incfile = match.group(3)
for rel_path in ('', 'Attic', '..'):
trial_root = os.path.join(rcs_path, rel_path)
file = os.path.join(root, trial_root)
file = os.path.normpath(os.path.join(file, incfile + ',v'))
if os.access(file, os.F_OK):
url = os.path.join(rel_path, incfile)
if sticky:
url = url + '?' + sticky
return '#%sinclude%s"<a href="%s">%s</a>"' % \
(match.group(1), match.group(2), url, incfile)
include_path_parts = path_parts[:-1]
for part in filter(None, incfile.split('/')):
if part == "..":
if not include_path_parts:
# nothing left to pop; don't bother marking up this include.
return text
include_path_parts.pop()
elif part and part != ".":
include_path_parts.append(part)
include_path = None
try:
if repos.itemtype(include_path_parts, None) == vclib.FILE:
include_path = '/'.join(include_path_parts)
except vclib.ItemNotFound:
pass
if include_path:
return '#%sinclude%s<a href="%s">"%s"</a>' % \
(match.group(1), match.group(2),
include_url.replace('/WHERE/', include_path), incfile)
return text
def make_html(root, rcs_path, opt_rev = None, sticky = None):
filename = os.path.join(root, rcs_path)
parser = CVSParser()
revision = parser.parse_cvs_file(filename, opt_rev)
count = len(parser.revision_map)
text = parser.extract_revision(revision)
if len(text) != count:
raise RuntimeError, 'Internal consistency error'
match = re_filename.match(rcs_path)
if not match:
raise RuntimeError, 'Unable to parse filename'
file_head = match.group(1)
file_tail = match.group(2)
class HTMLBlameSource:
"""Wrapper around a the object by the vclib.annotate() which does
HTML escaping, diff URL generation, and #include linking."""
def __init__(self, repos, path_parts, diff_url, include_url, opt_rev=None):
self.repos = repos
self.path_parts = path_parts
self.diff_url = diff_url
self.include_url = include_url
self.annotation, self.revision = self.repos.annotate(path_parts, opt_rev,
True)
open_table_tag = '<table border=0 cellpadding=0 cellspacing=0 width="100%">'
startOfRow = '<tr><td colspan=3%s><pre>'
endOfRow = '</td></tr>'
def __getitem__(self, idx):
item = self.annotation.__getitem__(idx)
diff_url = None
if item.prev_rev:
diff_url = '%sr1=%s&amp;r2=%s' % (self.diff_url, item.prev_rev, item.rev)
thisline = link_includes(sapi.escape(item.text), self.repos,
self.path_parts, self.include_url)
return _item(text=thisline, line_number=item.line_number,
rev=item.rev, prev_rev=item.prev_rev,
diff_url=diff_url, date=item.date, author=item.author)
print open_table_tag + (startOfRow % '')
if count == 0:
count = 1
def blame(repos, path_parts, diff_url, include_url, opt_rev=None):
source = HTMLBlameSource(repos, path_parts, diff_url, include_url, opt_rev)
return source, source.revision
def make_html(root, rcs_path):
import vclib.ccvs.blame
bs = vclib.ccvs.blame.BlameSource(os.path.join(root, rcs_path))
line_num_width = int(math.log10(count)) + 1
revision_width = 3
author_width = 5
line = 0
usedlog = {}
usedlog[revision] = 1
old_revision = 0
row_color = ''
lines_in_table = 0
inMark = 0
row_color = 'ffffff'
rev_count = 0
for revision in parser.revision_map:
thisline = text[line]
line = line + 1
usedlog[revision] = 1
line_in_table = lines_in_table + 1
align = ' style="text-align: %s;"'
# Escape HTML meta-characters
thisline = cgi.escape(thisline)
# Add a link to traverse to included files
if 1: # opt_includes
thisline = link_includes(thisline, root, file_head, sticky)
output = ''
# Highlight lines
#mark_cmd;
#if (defined($mark_cmd = $mark_line{$line}) and mark_cmd != 'end':
# output = output + endOfRow + '<tr><td bgcolor=LIGHTGREEN width="100%"><pre>'
# inMark = 1
sys.stdout.write('<table cellpadding="2" cellspacing="2" style="font-family: monospace; whitespace: pre;">\n')
for line_data in bs:
revision = line_data.rev
thisline = line_data.text
line = line_data.line_number
author = line_data.author
prev_rev = line_data.prev_rev
if old_revision != revision and line != 1:
if row_color == '':
row_color = ' bgcolor="#e7e7e7"'
if row_color == 'ffffff':
row_color = 'e7e7e7'
else:
row_color = ''
row_color = 'ffffff'
if not inMark:
if lines_in_table > 100:
output = output + endOfRow + '</table>' + open_table_tag + (startOfRow % row_color)
lines_in_table = 0
else:
output = output + endOfRow + (startOfRow % row_color)
elif lines_in_table > 200 and not inMark:
output = output + endOfRow + '</table>' + open_table_tag + (startOfRow % row_color)
lines_in_table = 0
output = output + "<a name=%d></a>" % (line, )
if 1: # opt_line_nums
output = output + ('%%%dd' % (line_num_width, )) % (line, )
sys.stdout.write('<tr id="l%d" style="background-color: #%s; vertical-align: center;">' % (line, row_color))
sys.stdout.write('<td%s>%d</td>' % (align % 'right', line))
if old_revision != revision or rev_count > 20:
revision_width = max(revision_width, len(revision))
if parser.prev_revision.get(revision):
fname = file_tail[:-2] # strip the ",v"
url = '%s.diff?r1=%s&amp;r2=%s' % \
(fname, parser.prev_revision[revision], revision)
if sticky:
url = url + '&' + sticky
output = output + ' <a href="%s"' % (url, )
if 0: # use_layers
output = output + " onmouseover='return log(event,\"%s\",\"%s\");'" % (
parser.prev_revision[revision], revision)
output = output + ">"
else:
output = output + " "
parser.prev_revision[revision] = ''
author = parser.revision_author[revision]
# $author =~ s/%.*$//;
author_width = max(author_width, len(author))
output = output + ('%%-%ds ' % (author_width, )) % (author, )
output = output + revision
if parser.prev_revision.get(revision):
output = output + '</a>'
output = output + (' ' * (revision_width - len(revision) + 1))
sys.stdout.write('<td%s>%s</td>' % (align % 'right', author or '&nbsp;'))
sys.stdout.write('<td%s>%s</td>' % (align % 'left', revision))
old_revision = revision
rev_count = 0
else:
output = output + ' ' + (' ' * (author_width + revision_width))
sys.stdout.write('<td>&nbsp;</td><td>&nbsp;</td>')
rev_count = rev_count + 1
output = output + thisline
# Close the highlighted section
#if (defined $mark_cmd and mark_cmd != 'begin'):
# chop($output)
# output = output + endOfRow + (startOfRow % row_color)
# inMark = 0
print output
print endOfRow + '</table>'
sys.stdout.write('<td%s>%s</td></tr>\n' % (align % 'left', thisline.rstrip() or '&nbsp;'))
sys.stdout.write('</table>\n')
def main():
import sys
if len(sys.argv) != 3:
print 'USAGE: %s cvsroot rcs-file' % sys.argv[0]
sys.exit(1)

60
lib/common.py Normal file
View File

@@ -0,0 +1,60 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# common: common definitions for the viewvc library
#
# -----------------------------------------------------------------------
# Special type indicators for diff header processing and idiff return codes
_RCSDIFF_IS_BINARY = 'binary-diff'
_RCSDIFF_ERROR = 'error'
_RCSDIFF_NO_CHANGES = "no-changes"
class _item:
def __init__(self, **kw):
vars(self).update(kw)
class TemplateData:
"""A custom dictionary-like object that allows one-time definition
of keys, and only value fetches and changes, and key deletions,
thereafter.
EZT doesn't require the use of this special class -- a normal
dict-type data dictionary works fine. But use of this class will
assist those who want the data sent to their templates to have a
consistent set of keys."""
def __init__(self, initial_data={}):
self._items = initial_data
def __getitem__(self, key):
return self._items.__getitem__(key)
def __setitem__(self, key, item):
assert self._items.has_key(key)
return self._items.__setitem__(key, item)
def __delitem__(self, key):
return self._items.__delitem__(key)
def keys(self):
return self._items.keys()
def merge(self, template_data):
"""Merge the data in TemplataData instance TEMPLATA_DATA into this
instance. Avoid the temptation to use this conditionally in your
code -- it rather defeats the purpose of this class."""
assert isinstance(template_data, TemplateData)
self._items.update(template_data._items)

View File

@@ -1,68 +0,0 @@
# -*- Mode: python -*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# compat.py: compatibility functions for operation across Python 1.5.x
#
# -----------------------------------------------------------------------
#
import urllib
import string
import time
import re
import os
#
# urllib.urlencode() is new to Python 1.5.2
#
try:
urlencode = urllib.urlencode
except AttributeError:
def urlencode(dict):
"Encode a dictionary as application/x-url-form-encoded."
if not dict:
return ''
quote = urllib.quote_plus
keyvalue = [ ]
for key, value in dict.items():
keyvalue.append(quote(key) + '=' + quote(str(value)))
return string.join(keyvalue, '&')
#
# time.strptime() is new to Python 1.5.2
#
if hasattr(time, 'strptime'):
def cvs_strptime(timestr):
'Parse a CVS-style date/time value.'
return time.strptime(timestr, '%Y/%m/%d %H:%M:%S')
else:
_re_rev_date = re.compile('([0-9]{4})/([0-9][0-9])/([0-9][0-9]) '
'([0-9][0-9]):([0-9][0-9]):([0-9][0-9])')
def cvs_strptime(timestr):
'Parse a CVS-style date/time value.'
matches = _re_rev_date.match(timestr).groups()
return tuple(map(int, matches)) + (0, 1, 0)
#
# os.makedirs() is new to Python 1.5.2
#
try:
makedirs = os.makedirs
except AttributeError:
def makedirs(path, mode=0777):
head, tail = os.path.split(path)
if head and tail and not os.path.exists(head):
makedirs(head, mode)
os.mkdir(path, mode)

786
lib/compat_difflib.py Executable file
View File

@@ -0,0 +1,786 @@
#! /usr/bin/env python
# Backported to Python 1.5.2 for the ViewCVS project by pf@artcom-gmbh.de
# 24-Dec-2001, original version "stolen" from Python-2.1.1
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
word is a sequence for which close matches are desired (typically a
string).
possibilities is a list of sequences against which to match word
(typically a list of strings).
Optional arg n (default 3) is the maximum number of close matches to
return. n must be > 0.
Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities
that don't score at least that similar to word are ignored.
The best (no more than n) matches among the possibilities are returned
in a list, sorted by similarity score, most similar first.
>>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
['apple', 'ape']
>>> import keyword
>>> get_close_matches("wheel", keyword.kwlist)
['while']
>>> get_close_matches("apple", keyword.kwlist)
[]
>>> get_close_matches("accept", keyword.kwlist)
['except']
Class SequenceMatcher
SequenceMatcher is a flexible class for comparing pairs of sequences of any
type, so long as the sequence elements are hashable. The basic algorithm
predates, and is a little fancier than, an algorithm published in the late
1980's by Ratcliff and Obershelp under the hyperbolic name "gestalt pattern
matching". The basic idea is to find the longest contiguous matching
subsequence that contains no "junk" elements (R-O doesn't address junk).
The same idea is then applied recursively to the pieces of the sequences to
the left and to the right of the matching subsequence. This does not yield
minimal edit sequences, but does tend to yield matches that "look right"
to people.
Example, comparing two strings, and considering blanks to be "junk":
>>> s = SequenceMatcher(lambda x: x == " ",
... "private Thread currentThread;",
... "private volatile Thread currentThread;")
>>>
.ratio() returns a float in [0, 1], measuring the "similarity" of the
sequences. As a rule of thumb, a .ratio() value over 0.6 means the
sequences are close matches:
>>> print round(s.ratio(), 3)
0.866
>>>
If you're only interested in where the sequences match,
.get_matching_blocks() is handy:
>>> for block in s.get_matching_blocks():
... print "a[%d] and b[%d] match for %d elements" % block
a[0] and b[0] match for 8 elements
a[8] and b[17] match for 6 elements
a[14] and b[23] match for 15 elements
a[29] and b[38] match for 0 elements
Note that the last tuple returned by .get_matching_blocks() is always a
dummy, (len(a), len(b), 0), and this is the only case in which the last
tuple element (number of elements matched) is 0.
If you want to know how to change the first sequence into the second, use
.get_opcodes():
>>> for opcode in s.get_opcodes():
... print "%6s a[%d:%d] b[%d:%d]" % opcode
equal a[0:8] b[0:8]
insert a[8:8] b[8:17]
equal a[8:14] b[17:23]
equal a[14:29] b[23:38]
See Tools/scripts/ndiff.py for a fancy human-friendly file differencer,
which uses SequenceMatcher both to view files as sequences of lines, and
lines as sequences of characters.
See also function get_close_matches() in this module, which shows how
simple code building on SequenceMatcher can be used to do useful work.
Timing: Basic R-O is cubic time worst case and quadratic time expected
case. SequenceMatcher is quadratic time for the worst case and has
expected-case behavior dependent in a complicated way on how many
elements the sequences have in common; best case time is linear.
SequenceMatcher methods:
__init__(isjunk=None, a='', b='')
Construct a SequenceMatcher.
Optional arg isjunk is None (the default), or a one-argument function
that takes a sequence element and returns true iff the element is junk.
None is equivalent to passing "lambda x: 0", i.e. no elements are
considered to be junk. For example, pass
lambda x: x in " \\t"
if you're comparing lines as sequences of characters, and don't want to
synch up on blanks or hard tabs.
Optional arg a is the first of two sequences to be compared. By
default, an empty string. The elements of a must be hashable.
Optional arg b is the second of two sequences to be compared. By
default, an empty string. The elements of b must be hashable.
set_seqs(a, b)
Set the two sequences to be compared.
>>> s = SequenceMatcher()
>>> s.set_seqs("abcd", "bcde")
>>> s.ratio()
0.75
set_seq1(a)
Set the first sequence to be compared.
The second sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq1("bcde")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against many
sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for
each of the other sequences.
See also set_seqs() and set_seq2().
set_seq2(b)
Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against many
sequences, use .set_seq2(S) once and call .set_seq1(x) repeatedly for
each of the other sequences.
See also set_seqs() and set_seq1().
find_longest_match(alo, ahi, blo, bhi)
Find longest matching block in a[alo:ahi] and b[blo:bhi].
If isjunk is not defined:
Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
alo <= i <= i+k <= ahi
blo <= j <= j+k <= bhi
and for all (i',j',k') meeting those conditions,
k >= k'
i <= i'
and if i == i', j <= j'
In other words, of all maximal matching blocks, return one that starts
earliest in a, and of all those maximal matching blocks that start
earliest in a, return the one that starts earliest in b.
>>> s = SequenceMatcher(None, " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(0, 4, 5)
If isjunk is defined, first the longest matching block is determined as
above, but with the additional restriction that no junk element appears
in the block. Then that block is extended as far as possible by
matching (only) junk elements on both sides. So the resulting block
never matches on junk except as identical junk happens to be adjacent
to an "interesting" match.
Here's the same example as before, but considering blanks to be junk.
That prevents " abcd" from matching the " abcd" at the tail end of the
second sequence directly. Instead only the "abcd" can match, and
matches the leftmost "abcd" in the second sequence:
>>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(1, 0, 4)
If no blocks match, return (alo, blo, 0).
>>> s = SequenceMatcher(None, "ab", "c")
>>> s.find_longest_match(0, 2, 0, 1)
(0, 0, 0)
get_matching_blocks()
Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in i
and in j.
The last triple is a dummy, (len(a), len(b), 0), and is the only triple
with n==0.
>>> s = SequenceMatcher(None, "abxcd", "abcd")
>>> s.get_matching_blocks()
[(0, 0, 2), (3, 2, 2), (5, 4, 0)]
get_opcodes()
Return list of 5-tuples describing how to turn a into b.
Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple has
i1 == j1 == 0, and remaining tuples have i1 == the i2 from the tuple
preceding it, and likewise for j1 == the previous j2.
The tags are strings, with these meanings:
'replace': a[i1:i2] should be replaced by b[j1:j2]
'delete': a[i1:i2] should be deleted.
Note that j1==j2 in this case.
'insert': b[j1:j2] should be inserted at a[i1:i1].
Note that i1==i2 in this case.
'equal': a[i1:i2] == b[j1:j2]
>>> a = "qabxcd"
>>> b = "abycdf"
>>> s = SequenceMatcher(None, a, b)
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
delete a[0:1] (q) b[0:0] ()
equal a[1:3] (ab) b[0:2] (ab)
replace a[3:4] (x) b[2:3] (y)
equal a[4:6] (cd) b[3:5] (cd)
insert a[6:6] () b[5:6] (f)
ratio()
Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and M is the
number of matches, this is 2,0*M / T. Note that this is 1 if the
sequences are identical, and 0 if they have nothing in common.
.ratio() is expensive to compute if you haven't already computed
.get_matching_blocks() or .get_opcodes(), in which case you may want to
try .quick_ratio() or .real_quick_ratio() first to get an upper bound.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.quick_ratio()
0.75
>>> s.real_quick_ratio()
1.0
quick_ratio()
Return an upper bound on .ratio() relatively quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute.
real_quick_ratio():
Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio().
"""
TRACE = 0
class SequenceMatcher:
def __init__(self, isjunk=None, a='', b=''):
"""Construct a SequenceMatcher.
Optional arg isjunk is None (the default), or a one-argument
function that takes a sequence element and returns true iff the
element is junk. None is equivalent to passing "lambda x: 0", i.e.
no elements are considered to be junk. For example, pass
lambda x: x in " \\t"
if you're comparing lines as sequences of characters, and don't
want to synch up on blanks or hard tabs.
Optional arg a is the first of two sequences to be compared. By
default, an empty string. The elements of a must be hashable. See
also .set_seqs() and .set_seq1().
Optional arg b is the second of two sequences to be compared. By
default, an empty string. The elements of b must be hashable. See
also .set_seqs() and .set_seq2().
"""
# Members:
# a
# first sequence
# b
# second sequence; differences are computed as "what do
# we need to do to 'a' to change it into 'b'?"
# b2j
# for x in b, b2j[x] is a list of the indices (into b)
# at which x appears; junk elements do not appear
# b2jhas
# b2j.has_key
# fullbcount
# for x in b, fullbcount[x] == the number of times x
# appears in b; only materialized if really needed (used
# only for computing quick_ratio())
# matching_blocks
# a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k];
# ascending & non-overlapping in i and in j; terminated by
# a dummy (len(a), len(b), 0) sentinel
# opcodes
# a list of (tag, i1, i2, j1, j2) tuples, where tag is
# one of
# 'replace' a[i1:i2] should be replaced by b[j1:j2]
# 'delete' a[i1:i2] should be deleted
# 'insert' b[j1:j2] should be inserted
# 'equal' a[i1:i2] == b[j1:j2]
# isjunk
# a user-supplied function taking a sequence element and
# returning true iff the element is "junk" -- this has
# subtle but helpful effects on the algorithm, which I'll
# get around to writing up someday <0.9 wink>.
# DON'T USE! Only __chain_b uses this. Use isbjunk.
# isbjunk
# for x in b, isbjunk(x) == isjunk(x) but much faster;
# it's really the has_key method of a hidden dict.
# DOES NOT WORK for x in a!
self.isjunk = isjunk
self.a = self.b = None
self.set_seqs(a, b)
def set_seqs(self, a, b):
"""Set the two sequences to be compared.
>>> s = SequenceMatcher()
>>> s.set_seqs("abcd", "bcde")
>>> s.ratio()
0.75
"""
self.set_seq1(a)
self.set_seq2(b)
def set_seq1(self, a):
"""Set the first sequence to be compared.
The second sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq1("bcde")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.
See also set_seqs() and set_seq2().
"""
if a is self.a:
return
self.a = a
self.matching_blocks = self.opcodes = None
def set_seq2(self, b):
"""Set the second sequence to be compared.
The first sequence to be compared is not changed.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.set_seq2("abcd")
>>> s.ratio()
1.0
>>>
SequenceMatcher computes and caches detailed information about the
second sequence, so if you want to compare one sequence S against
many sequences, use .set_seq2(S) once and call .set_seq1(x)
repeatedly for each of the other sequences.
See also set_seqs() and set_seq1().
"""
if b is self.b:
return
self.b = b
self.matching_blocks = self.opcodes = None
self.fullbcount = None
self.__chain_b()
# For each element x in b, set b2j[x] to a list of the indices in
# b where x appears; the indices are in increasing order; note that
# the number of times x appears in b is len(b2j[x]) ...
# when self.isjunk is defined, junk elements don't show up in this
# map at all, which stops the central find_longest_match method
# from starting any matching block at a junk element ...
# also creates the fast isbjunk function ...
# note that this is only called when b changes; so for cross-product
# kinds of matches, it's best to call set_seq2 once, then set_seq1
# repeatedly
def __chain_b(self):
# Because isjunk is a user-defined (not C) function, and we test
# for junk a LOT, it's important to minimize the number of calls.
# Before the tricks described here, __chain_b was by far the most
# time-consuming routine in the whole module! If anyone sees
# Jim Roskind, thank him again for profile.py -- I never would
# have guessed that.
# The first trick is to build b2j ignoring the possibility
# of junk. I.e., we don't call isjunk at all yet. Throwing
# out the junk later is much cheaper than building b2j "right"
# from the start.
b = self.b
self.b2j = b2j = {}
self.b2jhas = b2jhas = b2j.has_key
for i in xrange(len(b)):
elt = b[i]
if b2jhas(elt):
b2j[elt].append(i)
else:
b2j[elt] = [i]
# Now b2j.keys() contains elements uniquely, and especially when
# the sequence is a string, that's usually a good deal smaller
# than len(string). The difference is the number of isjunk calls
# saved.
isjunk, junkdict = self.isjunk, {}
if isjunk:
for elt in b2j.keys():
if isjunk(elt):
junkdict[elt] = 1 # value irrelevant; it's a set
del b2j[elt]
# Now for x in b, isjunk(x) == junkdict.has_key(x), but the
# latter is much faster. Note too that while there may be a
# lot of junk in the sequence, the number of *unique* junk
# elements is probably small. So the memory burden of keeping
# this dict alive is likely trivial compared to the size of b2j.
self.isbjunk = junkdict.has_key
def find_longest_match(self, alo, ahi, blo, bhi):
"""Find longest matching block in a[alo:ahi] and b[blo:bhi].
If isjunk is not defined:
Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
alo <= i <= i+k <= ahi
blo <= j <= j+k <= bhi
and for all (i',j',k') meeting those conditions,
k >= k'
i <= i'
and if i == i', j <= j'
In other words, of all maximal matching blocks, return one that
starts earliest in a, and of all those maximal matching blocks that
start earliest in a, return the one that starts earliest in b.
>>> s = SequenceMatcher(None, " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(0, 4, 5)
If isjunk is defined, first the longest matching block is
determined as above, but with the additional restriction that no
junk element appears in the block. Then that block is extended as
far as possible by matching (only) junk elements on both sides. So
the resulting block never matches on junk except as identical junk
happens to be adjacent to an "interesting" match.
Here's the same example as before, but considering blanks to be
junk. That prevents " abcd" from matching the " abcd" at the tail
end of the second sequence directly. Instead only the "abcd" can
match, and matches the leftmost "abcd" in the second sequence:
>>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
>>> s.find_longest_match(0, 5, 0, 9)
(1, 0, 4)
If no blocks match, return (alo, blo, 0).
>>> s = SequenceMatcher(None, "ab", "c")
>>> s.find_longest_match(0, 2, 0, 1)
(0, 0, 0)
"""
# CAUTION: stripping common prefix or suffix would be incorrect.
# E.g.,
# ab
# acab
# Longest matching block is "ab", but if common prefix is
# stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
# strip, so ends up claiming that ab is changed to acab by
# inserting "ca" in the middle. That's minimal but unintuitive:
# "it's obvious" that someone inserted "ac" at the front.
# Windiff ends up at the same place as diff, but by pairing up
# the unique 'b's and then matching the first two 'a's.
a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.isbjunk
besti, bestj, bestsize = alo, blo, 0
# find longest junk-free match
# during an iteration of the loop, j2len[j] = length of longest
# junk-free match ending with a[i-1] and b[j]
j2len = {}
nothing = []
for i in xrange(alo, ahi):
# look at all instances of a[i] in b; note that because
# b2j has no junk keys, the loop is skipped if a[i] is junk
j2lenget = j2len.get
newj2len = {}
for j in b2j.get(a[i], nothing):
# a[i] matches b[j]
if j < blo:
continue
if j >= bhi:
break
k = newj2len[j] = j2lenget(j-1, 0) + 1
if k > bestsize:
besti, bestj, bestsize = i-k+1, j-k+1, k
j2len = newj2len
# Now that we have a wholly interesting match (albeit possibly
# empty!), we may as well suck up the matching junk on each
# side of it too. Can't think of a good reason not to, and it
# saves post-processing the (possibly considerable) expense of
# figuring out what to do with it. In the case of an empty
# interesting match, this is clearly the right thing to do,
# because no other kind of match is possible in the regions.
while besti > alo and bestj > blo and \
isbjunk(b[bestj-1]) and \
a[besti-1] == b[bestj-1]:
besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
while besti+bestsize < ahi and bestj+bestsize < bhi and \
isbjunk(b[bestj+bestsize]) and \
a[besti+bestsize] == b[bestj+bestsize]:
bestsize = bestsize + 1
if TRACE:
print "get_matching_blocks", alo, ahi, blo, bhi
print " returns", besti, bestj, bestsize
return besti, bestj, bestsize
def get_matching_blocks(self):
"""Return list of triples describing matching subsequences.
Each triple is of the form (i, j, n), and means that
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
i and in j.
The last triple is a dummy, (len(a), len(b), 0), and is the only
triple with n==0.
>>> s = SequenceMatcher(None, "abxcd", "abcd")
>>> s.get_matching_blocks()
[(0, 0, 2), (3, 2, 2), (5, 4, 0)]
"""
if self.matching_blocks is not None:
return self.matching_blocks
self.matching_blocks = []
la, lb = len(self.a), len(self.b)
self.__helper(0, la, 0, lb, self.matching_blocks)
self.matching_blocks.append( (la, lb, 0) )
if TRACE:
print '*** matching blocks', self.matching_blocks
return self.matching_blocks
# builds list of matching blocks covering a[alo:ahi] and
# b[blo:bhi], appending them in increasing order to answer
def __helper(self, alo, ahi, blo, bhi, answer):
i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi)
# a[alo:i] vs b[blo:j] unknown
# a[i:i+k] same as b[j:j+k]
# a[i+k:ahi] vs b[j+k:bhi] unknown
if k:
if alo < i and blo < j:
self.__helper(alo, i, blo, j, answer)
answer.append(x)
if i+k < ahi and j+k < bhi:
self.__helper(i+k, ahi, j+k, bhi, answer)
def get_opcodes(self):
"""Return list of 5-tuples describing how to turn a into b.
Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
tuple preceding it, and likewise for j1 == the previous j2.
The tags are strings, with these meanings:
'replace': a[i1:i2] should be replaced by b[j1:j2]
'delete': a[i1:i2] should be deleted.
Note that j1==j2 in this case.
'insert': b[j1:j2] should be inserted at a[i1:i1].
Note that i1==i2 in this case.
'equal': a[i1:i2] == b[j1:j2]
>>> a = "qabxcd"
>>> b = "abycdf"
>>> s = SequenceMatcher(None, a, b)
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
... print ("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2]))
delete a[0:1] (q) b[0:0] ()
equal a[1:3] (ab) b[0:2] (ab)
replace a[3:4] (x) b[2:3] (y)
equal a[4:6] (cd) b[3:5] (cd)
insert a[6:6] () b[5:6] (f)
"""
if self.opcodes is not None:
return self.opcodes
i = j = 0
self.opcodes = answer = []
for ai, bj, size in self.get_matching_blocks():
# invariant: we've pumped out correct diffs to change
# a[:i] into b[:j], and the next matching block is
# a[ai:ai+size] == b[bj:bj+size]. So we need to pump
# out a diff to change a[i:ai] into b[j:bj], pump out
# the matching block, and move (i,j) beyond the match
tag = ''
if i < ai and j < bj:
tag = 'replace'
elif i < ai:
tag = 'delete'
elif j < bj:
tag = 'insert'
if tag:
answer.append( (tag, i, ai, j, bj) )
i, j = ai+size, bj+size
# the list of matching blocks is terminated by a
# sentinel with size 0
if size:
answer.append( ('equal', ai, i, bj, j) )
return answer
def ratio(self):
"""Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and
M is the number of matches, this is 2,0*M / T.
Note that this is 1 if the sequences are identical, and 0 if
they have nothing in common.
.ratio() is expensive to compute if you haven't already computed
.get_matching_blocks() or .get_opcodes(), in which case you may
want to try .quick_ratio() or .real_quick_ratio() first to get an
upper bound.
>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio()
0.75
>>> s.quick_ratio()
0.75
>>> s.real_quick_ratio()
1.0
"""
matches = reduce(lambda sum, triple: sum + triple[-1],
self.get_matching_blocks(), 0)
return 2.0 * matches / (len(self.a) + len(self.b))
def quick_ratio(self):
"""Return an upper bound on ratio() relatively quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute.
"""
# viewing a and b as multisets, set matches to the cardinality
# of their intersection; this counts the number of matches
# without regard to order, so is clearly an upper bound
if self.fullbcount is None:
self.fullbcount = fullbcount = {}
for elt in self.b:
fullbcount[elt] = fullbcount.get(elt, 0) + 1
fullbcount = self.fullbcount
# avail[x] is the number of times x appears in 'b' less the
# number of times we've seen it in 'a' so far ... kinda
avail = {}
availhas, matches = avail.has_key, 0
for elt in self.a:
if availhas(elt):
numb = avail[elt]
else:
numb = fullbcount.get(elt, 0)
avail[elt] = numb - 1
if numb > 0:
matches = matches + 1
return 2.0 * matches / (len(self.a) + len(self.b))
def real_quick_ratio(self):
"""Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio().
"""
la, lb = len(self.a), len(self.b)
# can't have more matches than the number of elements in the
# shorter sequence
return 2.0 * min(la, lb) / (la + lb)
def get_close_matches(word, possibilities, n=3, cutoff=0.6):
"""Use SequenceMatcher to return list of the best "good enough" matches.
word is a sequence for which close matches are desired (typically a
string).
possibilities is a list of sequences against which to match word
(typically a list of strings).
Optional arg n (default 3) is the maximum number of close matches to
return. n must be > 0.
Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities
that don't score at least that similar to word are ignored.
The best (no more than n) matches among the possibilities are returned
in a list, sorted by similarity score, most similar first.
>>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
['apple', 'ape']
>>> import keyword
>>> get_close_matches("wheel", keyword.kwlist)
['while']
>>> get_close_matches("apple", keyword.kwlist)
[]
>>> get_close_matches("accept", keyword.kwlist)
['except']
"""
if not n > 0:
raise ValueError("n must be > 0: " + `n`)
if not 0.0 <= cutoff <= 1.0:
raise ValueError("cutoff must be in [0.0, 1.0]: " + `cutoff`)
result = []
s = SequenceMatcher()
s.set_seq2(word)
for x in possibilities:
s.set_seq1(x)
if s.real_quick_ratio() >= cutoff and \
s.quick_ratio() >= cutoff and \
s.ratio() >= cutoff:
result.append((s.ratio(), x))
# Sort by score.
result.sort()
# Retain only the best n.
result = result[-n:]
# Move best-scorer to head of list.
result.reverse()
# Strip scores.
# Python 2.x list comprehensions: return [x for score, x in result]
return_result = []
for score, x in result:
return_result.append(x)
return return_result
def _test():
import doctest, difflib
return doctest.testmod(difflib)
if __name__ == "__main__":
_test()

View File

@@ -4,6 +4,8 @@
# Released to the public domain 08-Dec-2000,
# by Tim Peters (tim.one@home.com).
# Backported to Python 1.5.2 for ViewCVS by pf@artcom-gmbh.de, 24-Dec-2001
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
"""ndiff [-q] file1 file2
@@ -43,7 +45,7 @@ recovered by piping the output through
See module comments for details and programmatic interface.
"""
__version__ = 1, 5, 0
__version__ = 1, 6, 1
# SequenceMatcher tries to compute a "human-friendly diff" between
# two sequences (chiefly picturing a file as a sequence of lines,
@@ -97,9 +99,8 @@ __version__ = 1, 5, 0
# is sent to stdout. Or you can call main(args), passing what would
# have been in sys.argv[1:] had the cmd-line form been used.
from difflib import SequenceMatcher
from compat_difflib import SequenceMatcher
import string
TRACE = 0
# define what "junk" means
@@ -200,15 +201,15 @@ def fancy_replace(a, alo, ahi, b, blo, bhi):
for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes():
la, lb = ai2 - ai1, bj2 - bj1
if tag == 'replace':
atags += '^' * la
btags += '^' * lb
atags = atags + '^' * la
btags = btags + '^' * lb
elif tag == 'delete':
atags += '-' * la
atags = atags + '-' * la
elif tag == 'insert':
btags += '+' * lb
btags = btags + '+' * lb
elif tag == 'equal':
atags += ' ' * la
btags += ' ' * lb
atags = atags + ' ' * la
btags = btags + ' ' * lb
else:
raise ValueError, 'unknown tag ' + `tag`
printq(aelt, belt, atags, btags)
@@ -245,7 +246,7 @@ def printq(aline, bline, atags, btags):
def count_leading(line, ch):
i, n = 0, len(line)
while i < n and line[i] == ch:
i += 1
i = i+1
return i
def fail(msg):

View File

@@ -1,82 +1,194 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# config.py: configuration utilities
#
# -----------------------------------------------------------------------
#
import sys
import os
import string
import ConfigParser
import fnmatch
import vclib
import vclib.ccvs
import vclib.svn
import cvsdb
import viewvc
import copy
from viewvcmagic import ContentMagic
#########################################################################
#
# CONFIGURATION
# -------------
#
# There are three forms of configuration:
#
# 1) edit the viewcvs.conf created by the viewcvs-install(er)
# 2) as (1), but delete all unchanged entries from viewcvs.conf
# 3) do not use viewcvs.conf and just edit the defaults in this file
# 1. edit the viewvc.conf created by the viewvc-install(er)
# 2. as (1), but delete all unchanged entries from viewvc.conf
# 3. do not use viewvc.conf and just edit the defaults in this file
#
# Most users will want to use (1), but there are slight speed advantages
# to the other two options. Note that viewcvs.conf values are a bit easier
# to the other two options. Note that viewvc.conf values are a bit easier
# to work with since it is raw text, rather than python literal values.
#
#
# A WORD ABOUT OPTION LAYERING/OVERRIDES
# --------------------------------------
#
# ViewVC has three "layers" of configuration options:
#
# 1. base configuration options - very basic configuration bits
# found in sections like 'general', 'options', etc.
# 2. vhost overrides - these options overlay/override the base
# configuration on a per-vhost basis.
# 3. root overrides - these options overlay/override the base
# configuration and vhost overrides on a per-root basis.
#
# Here's a diagram of the valid overlays/overrides:
#
# PER-ROOT PER-VHOST BASE
#
# ,-----------. ,-----------.
# | vhost-*/ | | |
# | general | --> | general |
# | | | |
# `-----------' `-----------'
# ,-----------. ,-----------. ,-----------.
# | root-*/ | | vhost-*/ | | |
# | options | --> | options | --> | options |
# | | | | | |
# `-----------' `-----------' `-----------'
# ,-----------. ,-----------. ,-----------.
# | root-*/ | | vhost-*/ | | |
# | templates | --> | templates | --> | templates |
# | | | | | |
# `-----------' `-----------' `-----------'
# ,-----------. ,-----------. ,-----------.
# | root-*/ | | vhost-*/ | | |
# | utilities | --> | utilities | --> | utilities |
# | | | | | |
# `-----------' `-----------' `-----------'
# ,-----------. ,-----------.
# | vhost-*/ | | |
# | cvsdb | --> | cvsdb |
# | | | |
# `-----------' `-----------'
# ,-----------. ,-----------. ,-----------.
# | root-*/ | | vhost-*/ | | |
# | authz-* | --> | authz-* | --> | authz-* |
# | | | | | |
# `-----------' `-----------' `-----------'
# ,-----------.
# | |
# | vhosts |
# | |
# `-----------'
# ,-----------.
# | |
# | query |
# | |
# `-----------'
#
# ### TODO: Figure out what this all means for the 'kv' stuff.
#
#########################################################################
class Config:
_sections = ('general', 'options', 'cvsdb', 'templates')
_force_multi_value = ('cvs_roots', 'forbidden', 'disable_enscript_lang',
'languages', 'kv_files')
_base_sections = (
# Base configuration sections.
'authz-*',
'cvsdb',
'general',
'options',
'query',
'templates',
'utilities',
)
_force_multi_value = (
# Configuration values with multiple, comma-separated values.
'allowed_views',
'binary_mime_types',
'custom_log_formatting',
'cvs_roots',
'kv_files',
'languages',
'mime_types_files',
'root_parents',
'svn_roots',
)
_allowed_overrides = {
# Mapping of override types to allowed overridable sections.
'vhost' : ('authz-*',
'cvsdb',
'general',
'options',
'templates',
'utilities',
),
'root' : ('authz-*',
'options',
'templates',
'utilities',
)
}
def __init__(self):
for section in self._sections:
self.__guesser = None
self.__root_configs = {}
self.__parent = None
self.root_options_overlayed = 0
for section in self._base_sections:
if section[-1] == '*':
continue
setattr(self, section, _sub_config())
def load_config(self, fname, vhost=None):
this_dir = os.path.dirname(sys.argv[0])
pathname = os.path.join(this_dir, fname)
def load_config(self, pathname, vhost=None):
"""Load the configuration file at PATHNAME, applying configuration
settings there as overrides to the built-in default values. If
VHOST is provided, also process the configuration overrides
specific to that virtual host."""
self.conf_path = os.path.isfile(pathname) and pathname or None
self.base = os.path.dirname(pathname)
self.parser = ConfigParser.ConfigParser()
self.parser.optionxform = lambda x: x # don't case-normalize option names.
self.parser.read(self.conf_path or [])
for section in self.parser.sections():
if self._is_allowed_section(section, self._base_sections):
self._process_section(self.parser, section, section)
parser = ConfigParser.ConfigParser()
parser.read(pathname)
for section in self._sections:
if parser.has_section(section):
self._process_section(parser, section, section)
if vhost and parser.has_section('vhosts'):
self._process_vhost(parser, vhost)
if vhost and self.parser.has_section('vhosts'):
self._process_vhost(self.parser, vhost)
def load_kv_files(self, language):
"""Process the key/value (kv) files specified in the
configuration, merging their values into the configuration as
dotted heirarchical items."""
kv = _sub_config()
for fname in self.general.kv_files:
if fname[0] == '[':
idx = string.index(fname, ']')
parts = string.split(fname[1:idx], '.')
fname = string.strip(fname[idx+1:])
idx = fname.index(']')
parts = fname[1:idx].split('.')
fname = fname[idx+1:].strip()
else:
parts = [ ]
fname = string.replace(fname, '%lang%', language)
fname = fname.replace('%lang%', language)
parser = ConfigParser.ConfigParser()
parser.optionxform = lambda x: x # don't case-normalize option names.
parser.read(os.path.join(self.base, fname))
for section in parser.sections():
for option in parser.options(section):
@@ -93,134 +205,319 @@ class Config:
return kv
def path(self, path):
"""Return PATH relative to the config file directory."""
return os.path.join(self.base, path)
def _process_section(self, parser, section, subcfg_name):
if not hasattr(self, subcfg_name):
setattr(self, subcfg_name, _sub_config())
sc = getattr(self, subcfg_name)
for opt in parser.options(section):
value = parser.get(section, opt)
if opt in self._force_multi_value:
value = map(string.strip, filter(None, string.split(value, ',')))
value = map(lambda x: x.strip(), filter(None, value.split(',')))
else:
try:
value = int(value)
except ValueError:
pass
if opt == 'cvs_roots':
roots = { }
for root in value:
name, path = map(string.strip, string.split(root, ':'))
roots[name] = path
value = roots
### FIXME: This feels like unnecessary depth of knowledge for a
### semi-generic configuration object.
if opt == 'cvs_roots' or opt == 'svn_roots':
value = _parse_roots(opt, value)
setattr(sc, opt, value)
def _is_allowed_section(self, section, allowed_sections):
"""Return 1 iff SECTION is an allowed section, defined as being
explicitly present in the ALLOWED_SECTIONS list or present in the
form 'someprefix-*' in that list."""
for allowed_section in allowed_sections:
if allowed_section[-1] == '*':
if _startswith(section, allowed_section[:-1]):
return 1
elif allowed_section == section:
return 1
return 0
def _is_allowed_override(self, sectype, secspec, section):
"""Test if SECTION is an allowed override section for sections of
type SECTYPE ('vhosts' or 'root', currently) and type-specifier
SECSPEC (a rootname or vhostname, currently). If it is, return
the overridden base section name. If it's not an override section
at all, return None. And if it's an override section but not an
allowed one, raise IllegalOverrideSection."""
cv = '%s-%s/' % (sectype, secspec)
lcv = len(cv)
if section[:lcv] != cv:
return None
base_section = section[lcv:]
if self._is_allowed_section(base_section,
self._allowed_overrides[sectype]):
return base_section
raise IllegalOverrideSection(sectype, section)
def _process_vhost(self, parser, vhost):
# Find a vhost name for this VHOST, if any (else, we've nothing to do).
canon_vhost = self._find_canon_vhost(parser, vhost)
if not canon_vhost:
# none of the vhost sections matched
return
cv = canon_vhost + '-'
lcv = len(cv)
# Overlay any option sections associated with this vhost name.
for section in parser.sections():
if section[:lcv] == cv:
self._process_section(parser, section, section[lcv:])
base_section = self._is_allowed_override('vhost', canon_vhost, section)
if base_section:
self._process_section(parser, section, base_section)
def _find_canon_vhost(self, parser, vhost):
vhost = string.lower(vhost)
vhost = vhost.lower().split(':')[0] # lower-case, no port
for canon_vhost in parser.options('vhosts'):
value = parser.get('vhosts', canon_vhost)
patterns = map(string.lower, map(string.strip,
filter(None, string.split(value, ','))))
patterns = map(lambda x: x.lower().strip(),
filter(None, value.split(',')))
for pat in patterns:
if fnmatch.fnmatchcase(vhost, pat):
return canon_vhost
return None
def get_root_config(self, rootname):
"""Get configuration object with per-root overrides for 'rootname'"""
if self.__parent:
return self.__parent.get_root_config(rootname)
elif rootname in self.__root_configs:
return self.__root_configs[rootname]
__guesser = self.__guesser
__root_configs = self.__root_configs
parser = self.parser
self.parser = None
self.__guesser = None
self.__root_configs = None
sub = copy.deepcopy(self)
sub.parser = parser
self.parser = parser
self.__guesser = __guesser
self.__root_configs = __root_configs
self.__root_configs[rootname] = sub
sub.__parent = self
sub.overlay_root_options(rootname)
return sub
def get_parent_config(self):
"""Get the parent non-overridden config."""
if self.__parent:
return self.__parent
return self
def overlay_root_options(self, rootname):
"""Overlay per-root options for ROOTNAME atop the existing option
set. This is a destructive change to the configuration."""
did_overlay = 0
if not self.conf_path:
return
for section in self.parser.sections():
base_section = self._is_allowed_override('root', rootname, section)
if base_section:
# We can currently only deal with root overlays happening
# once, so check that we've not yet done any overlaying of
# per-root options.
assert(self.root_options_overlayed == 0)
self._process_section(self.parser, section, base_section)
did_overlay = 1
# If we actually did any overlaying, remember this fact so we
# don't do it again later.
if did_overlay:
self.root_options_overlayed = 1
def _get_parser_items(self, parser, section):
"""Basically implement ConfigParser.items() for pre-Python-2.3 versions."""
try:
return self.parser.items(section)
except AttributeError:
d = {}
for option in parser.options(section):
d[option] = parser.get(section, option)
return d.items()
def get_authorizer_params(self, authorizer=None):
"""Return a dictionary of parameter names and values which belong
to the configured authorizer (or AUTHORIZER, if provided)."""
params = {}
if authorizer is None:
authorizer = self.options.authorizer
if authorizer:
authz_section = 'authz-%s' % (self.options.authorizer)
if hasattr(self, authz_section):
sub_config = getattr(self, authz_section)
for attr in dir(sub_config):
params[attr] = getattr(sub_config, attr)
params['__config'] = self
return params
def guesser(self):
if not self.__guesser:
self.__guesser = ContentMagic(self.options.encodings)
return self.__guesser
def set_defaults(self):
"Set some default values in the configuration."
self.general.cvs_roots = {
# user-visible-name : path
"Development" : "/home/cvsroot",
}
self.general.default_root = "Development"
self.general.rcs_path = ''
self.general.mime_types_file = ''
self.general.address = '<a href="mailto:user@insert.your.domain.here">No CVS admin address has been configured</a>'
self.general.main_title = 'CVS Repository'
self.general.forbidden = ()
self.general.cvs_roots = { }
self.general.svn_roots = { }
self.general.root_parents = []
self.general.default_root = ''
self.general.mime_types_files = ["mimetypes.conf"]
self.general.address = ''
self.general.kv_files = [ ]
self.general.languages = ['en-us']
self.templates.directory = 'templates/directory.ezt'
self.templates.log = 'templates/log.ezt'
self.templates.query = 'templates/query.ezt'
self.templates.footer = 'templates/footer.ezt'
self.templates.diff = 'templates/diff.ezt'
self.templates.graph = 'templates/graph.ezt'
self.templates.annotate = 'templates/annotate.ezt'
self.templates.markup = 'templates/markup.ezt'
self.cvsdb.enabled = 0
self.cvsdb.host = ''
self.cvsdb.database_name = ''
self.cvsdb.user = ''
self.cvsdb.passwd = ''
self.cvsdb.readonly_user = ''
self.cvsdb.readonly_passwd = ''
self.cvsdb.row_limit = 1000
self.utilities.rcs_dir = ''
if sys.platform == "win32":
self.utilities.cvsnt = 'cvs'
else:
self.utilities.cvsnt = None
self.utilities.rcsfile_socket = ''
self.utilities.svn = ''
self.utilities.diff = ''
self.utilities.cvsgraph = ''
self.utilities.tika_server = ''
self.utilities.tika_mime_types = ''
self.options.root_as_url_component = 1
self.options.checkout_magic = 0
self.options.allowed_views = ['annotate', 'diff', 'markup', 'roots']
self.options.authorizer = None
self.options.mangle_email_addresses = 0
self.options.custom_log_formatting = []
self.options.default_file_view = "log"
self.options.binary_mime_types = []
self.options.http_expiration_time = 600
self.options.generate_etags = 1
self.options.svn_ignore_mimetype = 0
self.options.svn_config_dir = None
self.options.max_filesize_kbytes = 512
self.options.use_rcsparse = 0
self.options.sort_by = 'file'
self.options.sort_group_dirs = 1
self.options.hide_attic = 1
self.options.hide_errorful_entries = 0
self.options.log_sort = 'date'
self.options.diff_format = 'h'
self.options.hide_cvsroot = 1
self.options.hr_breakable = 1
self.options.hr_funout = 1
self.options.hr_ignore_white = 1
self.options.hr_ignore_white = 0
self.options.hr_ignore_keyword_subst = 1
self.options.allow_annotate = 1
self.options.allow_markup = 1
self.options.allow_compress = 1
self.options.checkout_magic = 1
self.options.hr_intraline = 0
self.options.allow_compress = 0
self.options.template_dir = "templates/default"
self.options.docroot = None
self.options.show_subdir_lastmod = 0
self.options.show_roots_lastmod = 0
self.options.show_logs = 1
self.options.show_log_in_markup = 1
self.options.py2html_path = '.'
self.options.cross_copies = 1
self.options.use_localtime = 0
self.options.iso8601_timestamps = 0
self.options.short_log_len = 80
self.options.diff_font_face = 'Helvetica,Arial'
self.options.diff_font_size = -1
self.options.use_enscript = 0
self.options.enscript_path = ''
self.options.disable_enscript_lang = ()
self.options.allow_tar = 0
self.options.enable_syntax_coloration = 1
self.options.tabsize = 8
self.options.detect_encoding = 0
self.options.use_cvsgraph = 0
self.options.cvsgraph_path = ''
self.options.cvsgraph_conf = "<VIEWCVS_INSTALL_DIRECTORY>/cvsgraph.conf"
self.options.cvsgraph_conf = "cvsgraph.conf"
self.options.allowed_cvsgraph_useropts = []
self.options.use_re_search = 0
self.options.dir_pagesize = 0
self.options.log_pagesize = 0
self.options.log_pagesextra = 3
self.options.limit_changes = 100
self.options.cvs_ondisk_charset = 'cp1251'
self.options.encodings = 'cp1251:iso-8859-1'
self.templates.diff = None
self.templates.directory = None
self.templates.error = None
self.templates.file = None
self.templates.graph = None
self.templates.log = None
self.templates.query = None
self.templates.query_form = None
self.templates.query_results = None
self.templates.roots = None
self.cvsdb.enabled = 0
self.cvsdb.index_content = 0
self.cvsdb.enable_snippets = 1
self.cvsdb.content_max_size = 0
self.cvsdb.host = ''
self.cvsdb.port = 3306
self.cvsdb.socket = ''
self.cvsdb.database_name = ''
self.cvsdb.user = ''
self.cvsdb.passwd = ''
self.cvsdb.readonly_user = ''
self.cvsdb.readonly_passwd = ''
self.cvsdb.row_limit = 1000
self.cvsdb.rss_row_limit = 100
self.cvsdb.check_database_for_root = 0
self.cvsdb.fulltext_min_relevance = 0.2
self.cvsdb.sphinx_host = ''
self.cvsdb.sphinx_port = 3307
self.cvsdb.sphinx_socket = ''
self.cvsdb.sphinx_index = ''
self.cvsdb.sphinx_preformatted_mime = 'text/(?!html|xml).*'
self.cvsdb.sphinx_snippet_options = \
'around: 15\n'\
'limit: 200\n'\
'before_match: <span style="color:red">\n'\
'after_match: </span>\n'\
'chunk_separator: ... \n\n'
self.query.viewvc_base_url = None
def _startswith(somestr, substr):
return somestr[:len(substr)] == substr
def _parse_roots(config_name, config_value):
roots = { }
for root in config_value:
try:
name, path = root.split(':', 1)
except:
raise MalformedRoot(config_name, root)
roots[name.strip()] = path.strip()
return roots
class ViewVCConfigurationError(Exception):
pass
class IllegalOverrideSection(ViewVCConfigurationError):
def __init__(self, override_type, section_name):
self.section_name = section_name
self.override_type = override_type
def __str__(self):
return "malformed configuration: illegal %s override section: %s" \
% (self.override_type, self.section_name)
class MalformedRoot(ViewVCConfigurationError):
def __init__(self, config_name, value_given):
Exception.__init__(self, config_name, value_given)
self.config_name = config_name
self.value_given = value_given
def __str__(self):
return "malformed configuration: '%s' uses invalid syntax: %s" \
% (self.config_name, self.value_given)
def is_forbidden(self, module):
if not module:
return 0
default = 0
for pat in self.general.forbidden:
if pat[0] == '!':
default = 1
if fnmatch.fnmatchcase(module, pat[1:]):
return 0
elif fnmatch.fnmatchcase(module, pat):
return 1
return default
class _sub_config:
pass
if not hasattr(sys, 'hexversion'):
# Python 1.5 or 1.5.1. fix the syntax for ConfigParser options.
import regex
ConfigParser.option_cre = regex.compile('^\([-A-Za-z0-9._]+\)\(:\|['
+ string.whitespace
+ ']*=\)\(.*\)$')

File diff suppressed because it is too large Load Diff

View File

@@ -1,71 +1,71 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
import sys
import time
import types
import re
import calendar
import MySQLdb
# set to 1 to store commit times in UTC, or 0 to use the ViewVC machine's
# local timezone. Using UTC is recommended because it ensures that the
# database will remain valid even if it is moved to another machine or the host
# computer's time zone is changed. UTC also avoids the ambiguity associated
# with daylight saving time (for example if a computer in New York recorded the
# local time 2002/10/27 1:30 am, there would be no way to tell whether the
# actual time was recorded before or after clocks were rolled back). Use local
# times for compatibility with databases used by ViewCVS 0.92 and earlier
# versions.
utc_time = 1
dbi_error = "dbi error"
def DateTimeFromTicks(ticks):
"""Return a MySQL DATETIME value from a unix timestamp"""
if utc_time:
t = time.gmtime(ticks)
else:
t = time.localtime(ticks)
return "%04d-%02d-%02d %02d:%02d:%02d" % t[:6]
## make some checks in MySQLdb
_no_datetime = """\
ERROR: Your version of MySQLdb requires the mxDateTime module
for the Timestamp() and TimestampFromTicks() methods.
You will need to install mxDateTime to use the ViewCVS
database.
"""
_re_datetime = re.compile('([0-9]{4})-([0-9][0-9])-([0-9][0-9]) '
'([0-9][0-9]):([0-9][0-9]):([0-9][0-9])')
if not hasattr(MySQLdb, "Timestamp") or \
not hasattr(MySQLdb, "TimestampFromTicks"):
sys.stderr.write(_no_datetime)
sys.exit(1)
def TicksFromDateTime(datetime):
"""Return a unix timestamp from a MySQL DATETIME value"""
if type(datetime) == types.StringType:
# datetime is a MySQL DATETIME string
matches = _re_datetime.match(datetime).groups()
t = tuple(map(int, matches)) + (0, 0, 0)
elif hasattr(datetime, "timetuple"):
# datetime is a Python >=2.3 datetime.DateTime object
t = datetime.timetuple()
else:
# datetime is an eGenix mx.DateTime object
t = datetime.tuple()
class Cursor:
def __init__(self, mysql_cursor):
self.__cursor = mysql_cursor
def execute(self, *args):
apply(self.__cursor.execute, args)
def fetchone(self):
try:
row = self.__cursor.fetchone()
except IndexError:
row = None
return row
if utc_time:
return calendar.timegm(t)
else:
return time.mktime(t[:8] + (-1,))
class Connection:
def __init__(self, host, user, passwd, db):
self.__mysql = MySQLdb.connect(
host=host, user=user, passwd=passwd, db=db)
def cursor(self):
return Cursor(self.__mysql.cursor())
def Timestamp(year, month, date, hour, minute, second):
return MySQLdb.Timestamp(year, month, date, hour, minute, second)
def TimestampFromTicks(ticks):
return MySQLdb.TimestampFromTicks(ticks)
def connect(host, user, passwd, db):
return Connection(host, user, passwd, db)
def connect(host, port, socket, user, passwd, db, charset = 'utf8'):
return MySQLdb.connect(
host = host,
port = port,
unix_socket = socket,
user = user,
passwd = passwd,
db = db,
charset = charset,
use_unicode = charset == 'utf8')

View File

@@ -1,22 +1,37 @@
# -*- Mode: python -*-
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Note: a t_start/t_end pair consumes about 0.00005 seconds on a P3/700.
# the lambda form (when debugging is disabled) should be even faster.
#
if 0:
import sys
# Set to non-zero to track and print processing times
SHOW_TIMES = 0
# Set to non-zero to display child process info
SHOW_CHILD_PROCESSES = 0
# Set to a server-side path to force the tarball view to generate the
# tarball as a file on the server, instead of transmitting the data
# back to the browser. This enables easy display of error
# considitions in the browser, as well as tarball inspection on the
# server. NOTE: The file will be a TAR archive, *not* gzip-compressed.
TARFILE_PATH = ''
if SHOW_TIMES:
import time
@@ -33,10 +48,156 @@ if 0:
else:
_times[which] = t
def dump():
for name, value in _times.items():
print '%s: %.6f<br>' % (name, value)
def t_dump(out):
out.write('<div>')
names = _times.keys()
names.sort()
for name in names:
out.write('%s: %.6fs<br/>\n' % (name, _times[name]))
out.write('</div>')
else:
t_start = t_end = dump = lambda *args: None
t_start = t_end = t_dump = lambda *args: None
class ViewVCException:
def __init__(self, msg, status=None):
self.msg = msg
self.status = status
def __str__(self):
if self.status:
return '%s: %s' % (self.status, self.msg)
return "ViewVC Unrecoverable Error: %s" % self.msg
def PrintException(server, exc_data):
status = exc_data['status']
msg = exc_data['msg']
tb = exc_data['stacktrace']
server.header(status=status)
server.write("<h3>An Exception Has Occurred</h3>\n")
s = ''
if msg:
s = '<p><pre>%s</pre></p>' % server.escape(msg)
if status:
s = s + ('<h4>HTTP Response Status</h4>\n<p><pre>\n%s</pre></p><hr />\n'
% status)
server.write(s)
server.write("<h4>Python Traceback</h4>\n<p><pre>")
server.write(server.escape(tb))
server.write("</pre></p>\n")
def GetExceptionData():
# capture the exception before doing anything else
exc_type, exc, exc_tb = sys.exc_info()
exc_dict = {
'status' : None,
'msg' : None,
'stacktrace' : None,
}
try:
import traceback, string
if isinstance(exc, ViewVCException):
exc_dict['msg'] = exc.msg
exc_dict['status'] = exc.status
tb = string.join(traceback.format_exception(exc_type, exc, exc_tb), '')
exc_dict['stacktrace'] = tb
finally:
# prevent circular reference. sys.exc_info documentation warns
# "Assigning the traceback return value to a local variable in a function
# that is handling an exception will cause a circular reference..."
# This is all based on 'exc_tb', and we're now done with it. Toss it.
del exc_tb
return exc_dict
if SHOW_CHILD_PROCESSES:
class Process:
def __init__(self, command, inStream, outStream, errStream):
self.command = command
self.debugIn = inStream
self.debugOut = outStream
self.debugErr = errStream
import sapi
if not sapi.server is None:
if not sapi.server.pageGlobals.has_key('processes'):
sapi.server.pageGlobals['processes'] = [self]
else:
sapi.server.pageGlobals['processes'].append(self)
def DumpChildren(server):
import os
if not server.pageGlobals.has_key('processes'):
return
server.header()
lastOut = None
i = 0
for k in server.pageGlobals['processes']:
i = i + 1
server.write("<table>\n")
server.write("<tr><td colspan=\"2\">Child Process%i</td></tr>" % i)
server.write("<tr>\n <td style=\"vertical-align:top\">Command Line</td> <td><pre>")
server.write(server.escape(k.command))
server.write("</pre></td>\n</tr>\n")
server.write("<tr>\n <td style=\"vertical-align:top\">Standard In:</td> <td>")
if k.debugIn is lastOut and not lastOut is None:
server.write("<em>Output from process %i</em>" % (i - 1))
elif k.debugIn:
server.write("<pre>")
server.write(server.escape(k.debugIn.getvalue()))
server.write("</pre>")
server.write("</td>\n</tr>\n")
if k.debugOut is k.debugErr:
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Out & Error:</td> <td><pre>")
if k.debugOut:
server.write(server.escape(k.debugOut.getvalue()))
server.write("</pre></td>\n</tr>\n")
else:
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Out:</td> <td><pre>")
if k.debugOut:
server.write(server.escape(k.debugOut.getvalue()))
server.write("</pre></td>\n</tr>\n")
server.write("<tr>\n <td style=\"vertical-align:top\">Standard Error:</td> <td><pre>")
if k.debugErr:
server.write(server.escape(k.debugErr.getvalue()))
server.write("</pre></td>\n</tr>\n")
server.write("</table>\n")
server.flush()
lastOut = k.debugOut
server.write("<table>\n")
server.write("<tr><td colspan=\"2\">Environment Variables</td></tr>")
for k, v in os.environ.items():
server.write("<tr>\n <td style=\"vertical-align:top\"><pre>")
server.write(server.escape(k))
server.write("</pre></td>\n <td style=\"vertical-align:top\"><pre>")
server.write(server.escape(v))
server.write("</pre></td>\n</tr>")
server.write("</table>")
else:
def DumpChildren(server):
pass

View File

@@ -1,18 +1,19 @@
#!/usr/bin/env python
"""ezt.py -- easy templating
ezt templates are very similar to standard HTML files. But additionaly
they contain directives sprinkled in between. With these directives
it possible to generate the dynamic content from the ezt templates.
ezt templates are simply text files in whatever format you so desire
(such as XML, HTML, etc.) which contain directives sprinkled
throughout. With these directives it is possible to generate the
dynamic content from the ezt templates.
These directives are enclosed in square brackets. If you are a
C-programmer, you might be familar with the #ifdef directives of the
C preprocessor 'cpp'. ezt provides a similar concept for HTML. Additionally
EZT has a 'for' directive, which allows to iterate (repeat) certain
These directives are enclosed in square brackets. If you are a
C-programmer, you might be familar with the #ifdef directives of the C
preprocessor 'cpp'. ezt provides a similar concept. Additionally EZT
has a 'for' directive, which allows it to iterate (repeat) certain
subsections of the template according to sequence of data items
provided by the application.
The HTML rendering is performed by the method generate() of the Template
The final rendering is performed by the method generate() of the Template
class. Building template instances can either be done using external
EZT files (convention: use the suffix .ezt for such files):
@@ -26,7 +27,7 @@ a EZT template string:
... <title>[title_string]</title></head>
... <body><h1>[title_string]</h1>
... [for a_sequence] <p>[a_sequence]</p>
... [end] <hr>
... [end] <hr />
... The [person] is [if-any state]in[else]out[end].
... </body>
... </html>
@@ -47,11 +48,32 @@ with the output fileobject to the templates generate method:
<p>list item 1</p>
<p>list item 2</p>
<p>another element</p>
<hr>
<hr />
The doctor is out.
</body>
</html>
Template syntax error reporting should be improved. Currently it is
very sparse (template line numbers would be nice):
>>> Template().parse("[if-any where] foo [else] bar [end unexpected args]")
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "ezt.py", line 220, in parse
self.program = self._parse(text)
File "ezt.py", line 275, in _parse
raise ArgCountSyntaxError(str(args[1:]))
ArgCountSyntaxError: ['unexpected', 'args']
>>> Template().parse("[if unmatched_end]foo[end]")
Traceback (innermost last):
File "<stdin>", line 1, in ?
File "ezt.py", line 206, in parse
self.program = self._parse(text)
File "ezt.py", line 266, in _parse
raise UnmatchedEndError()
UnmatchedEndError
Directives
==========
@@ -59,19 +81,58 @@ Directives
or attributes of objects contained in the data dictionary given to the
.generate() method.
Qualified names
---------------
Qualified names have two basic forms: a variable reference, or a string
constant. References are a name from the data dictionary with optional
dotted attributes (where each intermediary is an object with attributes,
of course).
Examples:
[varname]
[ob.attr]
["string"]
Simple directives
-----------------
[QUAL_NAME]
This directive is simply replaced by the value of identifier from the data
dictionary. QUAL_NAME might be a dotted qualified name refering to some
instance attribute of objects contained in the dats dictionary.
Numbers are converted to string though.
This directive is simply replaced by the value of the qualified name.
If the value is a number it's converted to a string before being
outputted. If it is None, nothing is outputted. If it is a python file
object (i.e. any object with a "read" method), it's contents are
outputted. If it is a callback function (any callable python object
is assumed to be a callback function), it is invoked and passed an EZT
Context object as an argument.
[QUAL_NAME QUAL_NAME ...]
If the first value is a callback function, it is invoked with an EZT
Context object as a first argument, and the rest of the values as
additional arguments.
Otherwise, the first value defines a substitution format, specifying
constant text and indices of the additional arguments. The arguments
are substituted and the result is inserted into the output stream.
Example:
["abc %0 def %1 ghi %0" foo bar.baz]
Note that the first value can be any type of qualified name -- a string
constant or a variable reference. Use %% to substitute a percent sign.
Argument indices are 0-based.
[include "filename"] or [include QUAL_NAME]
This directive is replaced by content of the named include file.
This directive is replaced by content of the named include file. Note
that a string constant is more efficient -- the target file is compiled
inline. In the variable form, the target file is compiled and executed
at runtime.
Block directives
----------------
@@ -79,40 +140,68 @@ Directives
[for QUAL_NAME] ... [end]
The text within the [for ...] directive and the corresponding [end]
is repeated for each element in the sequence referred to by the qualified
name in the for directive. Within the for block this identifiers now
refers to the actual item indexed by this loop iteration.
is repeated for each element in the sequence referred to by the
qualified name in the for directive. Within the for block this
identifiers now refers to the actual item indexed by this loop
iteration.
[if-any QUAL_NAME] ... [else] ... [end]
[if-any QUAL_NAME [QUAL_NAME2 ...]] ... [else] ... [end]
Test if the value QUAL_NAME is not None or an empty string or list.
The [else] clause is optional. CAUTION: Numeric values are converted to string,
so if QUAL_NAME refers to a numeric value 0, the then-clause is
substituted!
Test if any QUAL_NAME value is not None or an empty string or list.
The [else] clause is optional. CAUTION: Numeric values are
converted to string, so if QUAL_NAME refers to a numeric value 0,
the then-clause is substituted!
[if-index odd] ... [else] ... [end]
[if-index even] ... [else] ... [end]
[if-index first] ... [else] ... [end]
[if-index last] ... [else] ... [end]
[if-index NUMBER] ... [else] ... [end]
[if-index INDEX_FROM_FOR odd] ... [else] ... [end]
[if-index INDEX_FROM_FOR even] ... [else] ... [end]
[if-index INDEX_FROM_FOR first] ... [else] ... [end]
[if-index INDEX_FROM_FOR last] ... [else] ... [end]
[if-index INDEX_FROM_FOR NUMBER] ... [else] ... [end]
These five directives work similar to [if-any], but are only useful
within a [for ...]-block (see above). The odd/even directives are
for example useful to choose different background colors for adjacent rows
in a table. Similar the first/last directives might be used to
remove certain parts (for example "Diff to previous" doesn't make sense,
if there is no previous).
These five directives work similar to [if-any], but are only useful
within a [for ...]-block (see above). The odd/even directives are
for example useful to choose different background colors for
adjacent rows in a table. Similar the first/last directives might
be used to remove certain parts (for example "Diff to previous"
doesn't make sense, if there is no previous).
[is QUAL_NAME STRING] ... [else] ... [end]
[is QUAL_NAME QUAL_NAME] ... [else] ... [end]
The [is ...] directive is similar to the other conditional directives
above. But it allows to compare two value references or a value reference
with some constant string.
The [is ...] directive is similar to the other conditional
directives above. But it allows to compare two value references or
a value reference with some constant string.
[define VARIABLE] ... [end]
The [define ...] directive allows you to create and modify template
variables from within the template itself. Essentially, any data
between inside the [define ...] and its matching [end] will be
expanded using the other template parsing and output generation
rules, and then stored as a string value assigned to the variable
VARIABLE. The new (or changed) variable is then available for use
with other mechanisms such as [is ...] or [if-any ...], as long as
they appear later in the template.
[format STRING] ... [end]
The format directive controls how the values substituted into
templates are escaped before they are put into the output stream. It
has no effect on the literal text of the templates, only the output
from [QUAL_NAME ...] directives. STRING can be one of "raw" "html"
"xml" or "uri". The "raw" mode leaves the output unaltered; the "html"
and "xml" modes escape special characters using entity escapes (like
&quot; and &gt;); the "uri" mode escapes characters using hexadecimal
escape sequences (like %20 and %7e).
[format CALLBACK]
Python applications using EZT can provide custom formatters as callback
variables. "[format CALLBACK][QUAL_NAME][end]" is in most cases
equivalent to "[CALLBACK QUAL_NAME]"
"""
#
# Copyright (C) 2001 Greg Stein. All Rights Reserved.
# Copyright (C) 2001-2007 Greg Stein. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -139,15 +228,28 @@ Directives
#
#
# This software is maintained by Greg and is available at:
# http://viewcvs.sourceforge.net/
# it is also used by the following projects:
# http://edna.sourceforge.net/
# http://svn.webdav.org/repos/projects/ezt/trunk/
#
import string
import re
from types import StringType, IntType, FloatType
from types import StringType, IntType, FloatType, LongType, TupleType
import os
import cgi
import urllib
try:
import cStringIO
except ImportError:
import StringIO
cStringIO = StringIO
#
# Formatting types
#
FORMAT_RAW = 'raw'
FORMAT_HTML = 'html'
FORMAT_XML = 'xml'
FORMAT_URI = 'uri'
#
# This regular expression matches three alternatives:
@@ -170,7 +272,7 @@ _re_parse = re.compile(r'\[(%s(?: +%s)*)\]|(\[\[\])|\[#[^\]]*\]' % (_item, _item
_re_args = re.compile(r'"(?:[^\\"]|\\.)*"|[-\w.]+')
# block commands and their argument counts
_block_cmd_specs = { 'if-any':1, 'if-index':2, 'for':1, 'is':2 }
_block_cmd_specs = { 'if-index':2, 'for':1, 'is':2, 'define':1, 'format':1 }
_block_cmds = _block_cmd_specs.keys()
# two regular expresssions for compressing whitespace. the first is used to
@@ -187,36 +289,47 @@ _re_subst = re.compile('%(%|[0-9]+)')
class Template:
def __init__(self, fname=None):
def __init__(self, fname=None, compress_whitespace=1,
base_format=FORMAT_RAW):
self.compress_whitespace = compress_whitespace
if fname:
self.parse_file(fname)
self.parse_file(fname, base_format)
def parse_file(self, fname):
"""fname -> a string object with pathname of file containg an EZT template.
def parse_file(self, fname, base_format=FORMAT_RAW):
"fname -> a string object with pathname of file containg an EZT template."
self.parse(_FileReader(fname), base_format)
def parse(self, text_or_reader, base_format=FORMAT_RAW):
"""Parse the template specified by text_or_reader.
The argument should be a string containing the template, or it should
specify a subclass of ezt.Reader which can read templates. The base
format for printing values is given by base_format.
"""
self.program = self._parse_file(fname)
if not isinstance(text_or_reader, Reader):
# assume the argument is a plain text string
text_or_reader = _TextReader(text_or_reader)
def parse(self, text):
"""text -> a string object containing the HTML template.
parse the template program into: (TEXT DIRECTIVE BRACKET)* TEXT
DIRECTIVE will be '[directive]' or None
BRACKET will be '[[]' or None
"""
self.program = self._parse(text)
self.program = self._parse(text_or_reader, base_format=base_format)
def generate(self, fp, data):
ctx = _context()
if hasattr(data, '__getitem__') or callable(getattr(data, 'keys', None)):
# a dictionary-like object was passed. convert it to an
# attribute-based object.
class _data_ob:
def __init__(self, d):
vars(self).update(d)
data = _data_ob(data)
ctx = Context(fp)
ctx.data = data
ctx.for_index = { }
self._execute(self.program, fp, ctx)
ctx.for_iterators = { }
ctx.defines = { }
self._execute(self.program, ctx)
def _parse_file(self, fname, for_names=None, file_args=()):
return self._parse(open(fname, "rt").read(), for_names, file_args,
os.path.dirname(fname))
def _parse(self, text, for_names=None, file_args=(), base=None):
"""text -> string object containing the HTML template.
def _parse(self, reader, for_names=None, file_args=(), base_format=None):
"""text -> string object containing the template.
This is a private helper function doing the real work for method parse.
It returns the parsed template as a 'program'. This program is a sequence
@@ -225,12 +338,16 @@ class Template:
Note: comment directives [# ...] are automatically dropped by _re_parse.
"""
parts = _re_parse.split(text)
# parse the template program into: (TEXT DIRECTIVE BRACKET)* TEXT
parts = _re_parse.split(reader.text)
program = [ ]
stack = [ ]
if not for_names:
for_names = [ ]
for_names = [ ]
if base_format:
program.append((self._cmd_format, _formatters[base_format]))
for i in range(len(parts)):
piece = parts[i]
@@ -238,7 +355,8 @@ class Template:
if which == 0:
# TEXT. append if non-empty.
if piece:
piece = _re_whitespace.sub(' ', _re_newline.sub('\n', piece))
if self.compress_whitespace:
piece = _re_whitespace.sub(' ', _re_newline.sub('\n', piece))
program.append(piece)
elif which == 2:
# BRACKET directive. append '[' if present.
@@ -250,7 +368,7 @@ class Template:
cmd = args[0]
if cmd == 'else':
if len(args) > 1:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args[1:]))
### check: don't allow for 'for' cmd
idx = stack[-1][1]
true_section = program[idx:]
@@ -258,133 +376,141 @@ class Template:
stack[-1][3] = true_section
elif cmd == 'end':
if len(args) > 1:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args[1:]))
# note: true-section may be None
cmd, idx, args, true_section = stack.pop()
try:
cmd, idx, args, true_section = stack.pop()
except IndexError:
raise UnmatchedEndError()
else_section = program[idx:]
func = getattr(self, '_cmd_' + re.sub('-', '_', cmd))
program[idx:] = [ (func, (args, true_section, else_section)) ]
if cmd == 'for':
for_names.pop()
if cmd == 'format':
program.append((self._cmd_end_format, None))
else:
func = getattr(self, '_cmd_' + re.sub('-', '_', cmd))
program[idx:] = [ (func, (args, true_section, else_section)) ]
if cmd == 'for':
for_names.pop()
elif cmd in _block_cmds:
if len(args) > _block_cmd_specs[cmd] + 1:
raise ArgCountSyntaxError()
### this assumes arg1 is always a ref
args[1] = _prepare_ref(args[1], for_names, file_args)
raise ArgCountSyntaxError(str(args[1:]))
### this assumes arg1 is always a ref unless cmd is 'define'
if cmd != 'define':
args[1] = _prepare_ref(args[1], for_names, file_args)
# handle arg2 for the 'is' command
if cmd == 'is':
args[2] = _prepare_ref(args[2], for_names, file_args)
elif cmd == 'for':
for_names.append(args[1][0])
for_names.append(args[1][0]) # append the refname
elif cmd == 'format':
if args[1][0]:
# argument is a variable reference
formatter = args[1]
else:
# argument is a string constant referring to built-in formatter
formatter = _formatters.get(args[1][1])
if not formatter:
raise UnknownFormatConstantError(str(args[1:]))
program.append((self._cmd_format, formatter))
# remember the cmd, current pos, args, and a section placeholder
stack.append([cmd, len(program), args[1:], None])
elif cmd == 'include':
if args[1][0] == '"':
include_filename = args[1][1:-1]
if base:
include_filename = os.path.join(base, include_filename)
f_args = [ ]
for arg in args[2:]:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.extend(self._parse_file(include_filename, for_names,
f_args))
program.extend(self._parse(reader.read_other(include_filename),
for_names, f_args))
else:
if len(args) != 2:
raise ArgCountSyntaxError()
raise ArgCountSyntaxError(str(args))
program.append((self._cmd_include,
(_prepare_ref(args[1], for_names, file_args),
base)))
reader)))
elif cmd == 'if-any':
f_args = [ ]
for arg in args[1:]:
f_args.append(_prepare_ref(arg, for_names, file_args))
stack.append(['if-any', len(program), f_args, None])
else:
# implied PRINT command
if len(args) > 1:
f_args = [ ]
for arg in args:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.append((self._cmd_format, (f_args[0], f_args[1:])))
else:
program.append((self._cmd_print,
_prepare_ref(args[0], for_names, file_args)))
f_args = [ ]
for arg in args:
f_args.append(_prepare_ref(arg, for_names, file_args))
program.append((self._cmd_print, f_args))
if stack:
### would be nice to say which blocks...
raise UnclosedBlocksError()
return program
def _execute(self, program, fp, ctx):
def _execute(self, program, ctx):
"""This private helper function takes a 'program' sequence as created
by the method '_parse' and executes it step by step. strings are written
to the file object 'fp' and functions are called.
"""
for step in program:
if isinstance(step, StringType):
fp.write(step)
ctx.fp.write(step)
else:
step[0](step[1], fp, ctx)
step[0](step[1], ctx)
def _cmd_print(self, valref, fp, ctx):
value = _get_value(valref, ctx)
def _cmd_print(self, valrefs, ctx):
value = _get_value(valrefs[0], ctx)
args = map(lambda valref, ctx=ctx: _get_value(valref, ctx), valrefs[1:])
try:
_write_value(value, args, ctx)
except TypeError:
raise Exception("Unprintable value type for '%s'" % (str(valrefs[0][0])))
# if the value has a 'read' attribute, then it is a stream: copy it
if hasattr(value, 'read'):
while 1:
chunk = value.read(16384)
if not chunk:
break
fp.write(chunk)
else:
fp.write(value)
def _cmd_format(self, formatter, ctx):
if type(formatter) is TupleType:
formatter = _get_value(formatter, ctx)
ctx.formatters.append(formatter)
def _cmd_format(self, (valref, args), fp, ctx):
fmt = _get_value(valref, ctx)
parts = _re_subst.split(fmt)
for i in range(len(parts)):
piece = parts[i]
if i%2 == 1 and piece != '%':
idx = int(piece)
if idx < len(args):
piece = _get_value(args[idx], ctx)
else:
piece = '<undef>'
fp.write(piece)
def _cmd_end_format(self, valref, ctx):
ctx.formatters.pop()
def _cmd_include(self, (valref, base), fp, ctx):
def _cmd_include(self, (valref, reader), ctx):
fname = _get_value(valref, ctx)
if base:
fname = os.path.join(base, fname)
### note: we don't have the set of for_names to pass into this parse.
### I don't think there is anything to do but document it.
self._execute(self._parse_file(fname), fp, ctx)
self._execute(self._parse(reader.read_other(fname)), ctx)
def _cmd_if_any(self, args, fp, ctx):
"If the value is a non-empty string or non-empty list, then T else F."
((valref,), t_section, f_section) = args
value = _get_value(valref, ctx)
self._do_if(value, t_section, f_section, fp, ctx)
def _cmd_if_any(self, args, ctx):
"If any value is a non-empty string or non-empty list, then T else F."
(valrefs, t_section, f_section) = args
value = 0
for valref in valrefs:
if _get_value(valref, ctx):
value = 1
break
self._do_if(value, t_section, f_section, ctx)
def _cmd_if_index(self, args, fp, ctx):
def _cmd_if_index(self, args, ctx):
((valref, value), t_section, f_section) = args
list, idx = ctx.for_index[valref[0]]
iterator = ctx.for_iterators[valref[0]]
if value == 'even':
value = idx % 2 == 0
value = iterator.index % 2 == 0
elif value == 'odd':
value = idx % 2 == 1
value = iterator.index % 2 == 1
elif value == 'first':
value = idx == 0
value = iterator.index == 0
elif value == 'last':
value = idx == len(list)-1
value = iterator.is_last()
else:
value = idx == int(value)
self._do_if(value, t_section, f_section, fp, ctx)
value = iterator.index == int(value)
self._do_if(value, t_section, f_section, ctx)
def _cmd_is(self, args, fp, ctx):
def _cmd_is(self, args, ctx):
((left_ref, right_ref), t_section, f_section) = args
value = _get_value(right_ref, ctx)
value = string.lower(_get_value(left_ref, ctx)) == string.lower(value)
self._do_if(value, t_section, f_section, fp, ctx)
self._do_if(value, t_section, f_section, ctx)
def _do_if(self, value, t_section, f_section, fp, ctx):
def _do_if(self, value, t_section, f_section, ctx):
if t_section is None:
t_section = f_section
f_section = None
@@ -393,19 +519,28 @@ class Template:
else:
section = f_section
if section is not None:
self._execute(section, fp, ctx)
self._execute(section, ctx)
def _cmd_for(self, args, fp, ctx):
def _cmd_for(self, args, ctx):
((valref,), unused, section) = args
list = _get_value(valref, ctx)
if isinstance(list, StringType):
raise NeedSequenceError()
raise NeedSequenceError("The value of '%s' is not a sequence"
% (valref[0]))
refname = valref[0]
ctx.for_index[refname] = idx = [ list, 0 ]
for item in list:
self._execute(section, fp, ctx)
idx[1] = idx[1] + 1
del ctx.for_index[refname]
ctx.for_iterators[refname] = iterator = _iter(list)
for unused in iterator:
self._execute(section, ctx)
del ctx.for_iterators[refname]
def _cmd_define(self, args, ctx):
((name,), unused, section) = args
origfp = ctx.fp
ctx.fp = cStringIO.StringIO()
if section is not None:
self._execute(section, ctx)
ctx.defines[name] = ctx.fp.getvalue()
ctx.fp = origfp
def boolean(value):
"Return a value suitable for [if-any bool_var] usage in a template."
@@ -418,34 +553,48 @@ def _prepare_ref(refname, for_names, file_args):
"""refname -> a string containing a dotted identifier. example:"foo.bar.bang"
for_names -> a list of active for sequences.
Returns a `value reference', a 3-Tupel made out of (refname, start, rest),
Returns a `value reference', a 3-tuple made out of (refname, start, rest),
for fast access later.
"""
# is the reference a string constant?
if refname[0] == '"':
return None, refname[1:-1], None
parts = string.split(refname, '.')
start = parts[0]
rest = parts[1:]
# if this is an include-argument, then just return the prepared ref
if refname[:3] == 'arg':
if start[:3] == 'arg':
try:
idx = int(refname[3:])
idx = int(start[3:])
except ValueError:
pass
else:
if idx < len(file_args):
return file_args[idx]
orig_refname, start, more_rest = file_args[idx]
if more_rest is None:
# the include-argument was a string constant
return None, start, None
# prepend the argument's "rest" for our further processing
rest[:0] = more_rest
# rewrite the refname to ensure that any potential 'for' processing
# has the correct name
### this can make it hard for debugging include files since we lose
### the 'argNNN' names
if not rest:
return start, start, [ ]
refname = start + '.' + string.join(rest, '.')
if for_names:
# From last to first part, check if this reference is part of a for loop
for i in range(len(parts), 0, -1):
name = string.join(parts[:i], '.')
if name in for_names:
return refname, name, parts[i:]
parts = string.split(refname, '.')
start = parts[0]
rest = parts[1:]
while rest and (start in for_names):
# check if the next part is also a "for name"
name = start + '.' + rest[0]
if name in for_names:
start = name
del rest[0]
else:
break
return refname, start, rest
def _get_value((refname, start, rest), ctx):
@@ -459,11 +608,14 @@ def _get_value((refname, start, rest), ctx):
if rest is None:
# it was a string constant
return start
if ctx.for_index.has_key(start):
list, idx = ctx.for_index[start]
ob = list[idx]
elif ctx.data.has_key(start):
ob = ctx.data[start]
# get the starting object
if ctx.for_iterators.has_key(start):
ob = ctx.for_iterators[start].last_item
elif ctx.defines.has_key(start):
ob = ctx.defines[start]
elif hasattr(ctx.data, start):
ob = getattr(ctx.data, start)
else:
raise UnknownReference(refname)
@@ -475,7 +627,9 @@ def _get_value((refname, start, rest), ctx):
raise UnknownReference(refname)
# make sure we return a string instead of some various Python types
if isinstance(ob, IntType) or isinstance(ob, FloatType):
if isinstance(ob, IntType) \
or isinstance(ob, LongType) \
or isinstance(ob, FloatType):
return str(ob)
if ob is None:
return ''
@@ -483,20 +637,202 @@ def _get_value((refname, start, rest), ctx):
# string or a sequence
return ob
class _context:
def _print_formatted(formatters, ctx, chunk):
# print chunk to ctx.fp after running it sequentially through formatters
for formatter in formatters:
chunk = formatter(chunk)
ctx.fp.write(chunk)
def _write_value(value, args, ctx):
# value is a callback function, generates its own output
if callable(value):
apply(value, [ctx] + list(args))
return
# squirrel away formatters in case one of them recursively calls
# _write_value() -- we'll use them (in reverse order) to format our
# output.
formatters = ctx.formatters[:]
formatters.reverse()
try:
# if the value has a 'read' attribute, then it is a stream: copy it
if hasattr(value, 'read'):
while 1:
chunk = value.read(16384)
if not chunk:
break
_print_formatted(formatters, ctx, chunk)
# value is a substitution pattern
elif args:
parts = _re_subst.split(value)
for i in range(len(parts)):
piece = parts[i]
if i%2 == 1 and piece != '%':
idx = int(piece)
if idx < len(args):
piece = args[idx]
else:
piece = '<undef>'
_print_formatted(formatters, ctx, piece)
# plain old value, write to output
else:
_print_formatted(formatters, ctx, value)
finally:
# restore our formatters
formatters.reverse()
ctx.formatters = formatters
class Context:
"""A container for the execution context"""
def __init__(self, fp):
self.fp = fp
self.formatters = []
def write(self, value, args=()):
_write_value(value, args, self)
class ArgCountSyntaxError(Exception):
pass
class Reader:
"Abstract class which allows EZT to detect Reader objects."
class UnknownReference(Exception):
pass
class _FileReader(Reader):
"""Reads templates from the filesystem."""
def __init__(self, fname):
self.text = open(fname, 'rb').read()
self._dir = os.path.dirname(fname)
def read_other(self, relative):
return _FileReader(os.path.join(self._dir, relative))
class NeedSequenceError(Exception):
pass
class _TextReader(Reader):
"""'Reads' a template from provided text."""
def __init__(self, text):
self.text = text
def read_other(self, relative):
raise BaseUnavailableError()
class UnclosedBlocksError(Exception):
pass
class _Iterator:
"""Specialized iterator for EZT that counts items and can look ahead
Implements standard iterator interface and provides an is_last() method
and two public members:
index - integer index of the current item
last_item - last item returned by next()"""
def __init__(self, sequence):
self._iter = iter(sequence)
def next(self):
if hasattr(self, '_next_item'):
self.last_item = self._next_item
del self._next_item
else:
self.last_item = self._iter.next() # may raise StopIteration
if hasattr(self, 'index'):
self.index = self.index + 1
else:
self.index = 0
return self.last_item
def is_last(self):
"""Return true if the current item is the last in the sequence"""
# the only way we can tell if the current item is last is to call next()
# and store the return value so it doesn't get lost
if not hasattr(self, '_next_item'):
try:
self._next_item = self._iter.next()
except StopIteration:
return 1
return 0
def __iter__(self):
return self
class _OldIterator:
"""Alternate implemention of _Iterator for old Pythons without iterators
This class implements the sequence protocol, instead of the iterator
interface, so it's really not an iterator at all. But it can be used in
python "for" loops as a drop-in replacement for _Iterator. It also provides
the is_last() method and "last_item" and "index" members described in the
_Iterator docstring."""
def __init__(self, sequence):
self._seq = sequence
def __getitem__(self, index):
self.last_item = self._seq[index] # may raise IndexError
self.index = index
return self.last_item
def is_last(self):
return self.index + 1 >= len(self._seq)
try:
iter
except NameError:
_iter = _OldIterator
else:
_iter = _Iterator
class EZTException(Exception):
"""Parent class of all EZT exceptions."""
class ArgCountSyntaxError(EZTException):
"""A bracket directive got the wrong number of arguments."""
class UnknownReference(EZTException):
"""The template references an object not contained in the data dictionary."""
class NeedSequenceError(EZTException):
"""The object dereferenced by the template is no sequence (tuple or list)."""
class UnclosedBlocksError(EZTException):
"""This error may be simply a missing [end]."""
class UnmatchedEndError(EZTException):
"""This error may be caused by a misspelled if directive."""
class BaseUnavailableError(EZTException):
"""Base location is unavailable, which disables includes."""
class UnknownFormatConstantError(EZTException):
"""The format specifier is an unknown value."""
def _raw_formatter(s):
try: s = s.encode('utf-8')
except: pass
return s
def _html_formatter(s):
try: s = s.encode('utf-8')
except: pass
return cgi.escape(s)
def _xml_formatter(s):
try: s = s.encode('utf-8')
except: pass
s = s.replace('&', '&#x26;')
s = s.replace('<', '&#x3C;')
s = s.replace('>', '&#x3E;')
return s
def _uri_formatter(s):
try: s = s.encode('utf-8')
except: pass
return urllib.quote(s)
_formatters = {
FORMAT_RAW : _raw_formatter,
FORMAT_HTML : _html_formatter,
FORMAT_XML : _xml_formatter,
FORMAT_URI : _uri_formatter,
}
# --- standard test environment ---
def test_parse():
@@ -513,7 +849,7 @@ def test_parse():
['', '["a \\"b[foo]" c.d f]', None, '']
def _test(argv):
import doctest, ezt
import doctest, ezt
verbose = "-v" in argv
return doctest.testmod(ezt, verbose=verbose)

283
lib/globalauth.py Normal file
View File

@@ -0,0 +1,283 @@
# -*-python-*-
# -----------------------------------------------------------------------
# Simple Global Authentication client for ViewVC
# License: GPLv2+
# Author: Vitaliy Filippov
# -----------------------------------------------------------------------
#
# USAGE:
#
# import globalauth
# c = globalauth.GlobalAuthClient()
# c.auth(server)
# user_name = c.user_name
# user_url = c.user_url
#
# auth() will call sys.exit() when it needs to stop request processing
#
# -----------------------------------------------------------------------
import os
import re
import sys
import struct
import cgi
import binascii
import time
import datetime
import urllib
import urllib2
import anyjson
import random
import Cookie
import ga_config
class FileCache:
def __init__(self, dir):
self.dir = dir
if not os.path.isdir(dir):
os.mkdir(dir)
def fn(self, key):
key = re.sub('([^a-zA-Z0-9_\-]+)', lambda x: binascii.hexlify(x.group(1)), key)
return self.dir+'/'+key
def clean(self):
t = time.time()
for fn in os.listdir(self.dir):
if t > os.stat(self.dir+'/'+fn).st_mtime:
os.unlink(self.dir+'/'+fn)
def set(self, key, value, expire = 86400):
fn = self.fn(key)
try:
f = open(fn,'w')
if not expire:
expire = 86400
expire = time.time()+expire
f.write(value)
f.close()
os.chmod(fn, 0600)
os.utime(fn, (expire, expire))
except:
raise
return 1
def get(self, key):
fn = self.fn(key)
try:
f = open(fn,'r')
value = f.read()
f.close()
if time.time() > os.stat(fn).st_mtime:
os.unlink(fn)
return ''
return value
except:
pass
return ''
def delete(self, key):
fn = self.fn(key)
try:
os.unlink(fn)
except:
pass
class GlobalAuthClient:
wd = { 0 : 'Mon', 1 : 'Tue', 2 : 'Wed', 3 : 'Thu', 4 : 'Fri', 5 : 'Sat', 6 : 'Sun' }
ms = { 1 : 'Jan', 2 : 'Feb', 3 : 'Mar', 4 : 'Apr', 5 : 'May', 6 : 'Jun', 7 : 'Jul', 8 : 'Aug', 9 : 'Sep', 10 : 'Oct', 11 : 'Nov', 12 : 'Dec' }
def __init__(self, server):
self.server = server
self.v = {}
for name, values in server.params().items():
self.v[name] = values[0]
fs = server.FieldStorage()
for name in fs:
self.v[name] = fs[name].value
self.cookies = Cookie.SimpleCookie()
# '' default value is needed here - else we die here under WSGI without any exception O_o
self.cookies.load(self.server.getenv('HTTP_COOKIE', ''))
self.user_name = ''
self.user_url = ''
if not ga_config.gac.get('globalauth_server', '') and not ga_config.gac.get('fof_sudo_server', ''):
raise Exception('ga_config.gac must contain at least globalauth_server="URL" or fof_sudo_server="URL"')
self.gac = {
'cookie_name' : 'simple_global_auth',
'cookie_expire' : 86400*7,
'cookie_path' : '/',
'cookie_domain' : '',
'globalauth_server' : '',
'cache_dir' : os.path.abspath(os.path.dirname(__file__))+'/cache',
'cut_email_at' : 0,
'ga_always_require' : 0,
'fof_sudo_server' : '',
'fof_sudo_cookie' : 'fof_sudo_id',
'gc_probability' : 20,
}
for i in self.gac:
if ga_config.gac.get(i, None) is not None:
self.gac[i] = ga_config.gac[i]
self.cache = FileCache(self.gac['cache_dir'])
def auth(self):
if self.gac['fof_sudo_server']:
self.auth_fof_sudo()
if not self.user_name and self.gac['globalauth_server']:
self.auth_ga()
def auth_ga(self):
i = random.randint(1, self.gac['gc_probability'])
if i == 1:
self.cache.clean()
r_id = self.cookies.get(self.gac['cookie_name'], '')
if r_id:
r_id = r_id.value
ga_id = self.v.get('ga_id', '')
if self.v.get('ga_client', ''):
self.ga_client(r_id, ga_id)
return
r_data = ''
if r_id == 'nologin':
r_data = 'nologin'
elif r_id != '':
r_data = self.cache.get('D'+r_id)
if r_data != 'nologin':
try: r_data = anyjson.deserialize(r_data)
except: r_data = ''
is_browser = re.match('opera|firefox|chrome|safari', self.server.getenv('HTTP_USER_AGENT'), re.I)
if not r_data and (is_browser or self.gac['ga_always_require']) or self.v.get('ga_require', None):
self.ga_begin()
elif r_data and r_data != 'nologin':
self.set_user(r_data)
def ga_client(self, r_id, ga_id):
ga_key = self.v.get('ga_key', '')
if ga_key and ga_key == self.cache.get('K'+ga_id):
# Server-to-server request
self.cache.delete('K'+ga_id)
data = ''
if self.v.get('ga_nologin','') != '':
data = 'nologin'
else:
try: data = anyjson.deserialize(self.v.get('ga_data',''))
except: raise
if data != '':
if data != 'nologin':
data = anyjson.serialize(data)
self.cache.set('D'+ga_id, data)
self.server.header('text/plain')
self.server.write('1')
sys.exit()
elif ga_key == '' and r_id != ga_id:
# User redirect with different key
d = self.cache.get('D'+ga_id)
if d != 'nologin' and d != '':
try: d = anyjson.deserialize(d)
except: d = ''
if d != '':
self.setcookie(ga_id)
self.redirect(self.clean_uri())
self.server.header('text/plain', status=404)
self.server.write('GlobalAuth key doesn\'t match')
sys.exit()
def ga_begin(self):
ga_id = binascii.hexlify(os.urandom(16))
ga_key = binascii.hexlify(os.urandom(16))
url = self.add_param(self.gac['globalauth_server'], '')
try:
resp = urllib2.urlopen(url+'ga_id='+urllib2.quote(ga_id)+'&ga_key='+urllib2.quote(ga_key))
resp.read()
if resp.code != 200:
raise Exception(resp)
except:
self.setcookie('nologin')
self.redirect(self.clean_uri())
return_uri = 'http://'+self.server.getenv('HTTP_HOST')+self.server.getenv('REQUEST_URI')
return_uri = self.add_param(return_uri, 'ga_client=1')
self.cache.set('K'+ga_id, ga_key)
url = url+'ga_id='+urllib2.quote(ga_id)+'&ga_url='+urllib2.quote(return_uri)
if self.v.get('ga_require', '') == '' and not self.gac['ga_always_require']:
url = url+'&ga_check=1'
self.redirect(url)
def add_param(self, url, param):
if url.find('?') != -1:
url = url+'&'
else:
url = url+'?'
return url+param
def auth_fof_sudo(self):
sudo_id = self.cookies.get(self.gac['fof_sudo_cookie'], '')
if sudo_id:
sudo_id = sudo_id.value
if sudo_id != '':
url = self.gac['fof_sudo_server']
if url.find('?') != -1:
url = url+'&'
else:
url = url+'?'
try:
resp = urllib2.urlopen(url+'id='+urllib2.quote(sudo_id))
d = resp.read()
if resp.code != 200:
raise Exception(resp)
d = anyjson.deserialize(d)
self.set_user(d)
except:
pass
def log(self, s):
sys.stderr.write(s+"\n")
sys.stderr.flush()
def redirect(self, url):
self.server.addheader('Location', url)
self.server.header(status='302 Moved Temporarily')
self.server.write('This document is located <a href="%s">here</a>.' % url)
sys.exit()
def setcookie(self, value):
dom = self.gac['cookie_domain']
if not dom:
dom = self.server.getenv('HTTP_HOST')
exp = ''
if self.gac['cookie_expire'] > 0:
tm = int(time.time()+self.gac['cookie_expire'])
tm = datetime.datetime.utcfromtimestamp(tm)
tm = "%s, %02d-%s-%04d %02d:%02d:%02d GMT" % (self.wd[tm.weekday()], tm.day, self.ms[tm.month], tm.year, tm.hour, tm.minute, tm.second)
exp = '; expires='+tm
self.server.addheader('Set-Cookie', "%s=%s; path=%s; domain=%s%s" % (self.gac['cookie_name'], value, self.gac['cookie_path'], dom, exp))
def clean_uri(self):
uriargs = self.v.copy()
for i in [ 'ga_id', 'ga_res', 'ga_key', 'ga_client', 'ga_nologin', 'ga_require' ]:
uriargs.pop(i, None)
uri = self.server.getenv('REQUEST_URI')
p = uri.find('?')
if p != -1:
uri = uri[0:p]
uri = 'http://'+self.server.getenv('HTTP_HOST')+uri+'?'+urllib.urlencode(uriargs)
return uri
def set_user(self, r_data):
r_email = r_data.get('user_email', '').encode('utf-8')
r_url = r_data.get('user_url', '').encode('utf-8')
if self.gac['cut_email_at']:
p = r_email.find('@')
if p != -1:
r_email = r_email[0:p]
self.user_name = r_email
self.user_url = r_url

199
lib/idiff.py Normal file
View File

@@ -0,0 +1,199 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# idiff: display differences between files highlighting intraline changes
#
# -----------------------------------------------------------------------
from __future__ import generators
import difflib
import sys
import re
from common import _item, _RCSDIFF_NO_CHANGES
import ezt
import sapi
def sidebyside(fromlines, tolines, context):
"""Generate side by side diff"""
### for some reason mdiff chokes on \n's in input lines
line_strip = lambda line: line.rstrip("\n")
fromlines = map(line_strip, fromlines)
tolines = map(line_strip, tolines)
had_changes = 0
gap = False
for fromdata, todata, flag in difflib._mdiff(fromlines, tolines, context):
if fromdata is None and todata is None and flag is None:
gap = True
else:
from_item = _mdiff_split(flag, fromdata)
to_item = _mdiff_split(flag, todata)
had_changes = 1
yield _item(gap=ezt.boolean(gap), columns=(from_item, to_item), type="intraline")
gap = False
if not had_changes:
yield _item(type=_RCSDIFF_NO_CHANGES)
_re_mdiff = re.compile("\0([+-^])(.*?)\1")
def _mdiff_split(flag, (line_number, text)):
"""Break up row from mdiff output into segments"""
segments = []
pos = 0
while True:
m = _re_mdiff.search(text, pos)
if not m:
segments.append(_item(text=sapi.escape(text[pos:]), type=None))
break
if m.start() > pos:
segments.append(_item(text=sapi.escape(text[pos:m.start()]), type=None))
if m.group(1) == "+":
segments.append(_item(text=sapi.escape(m.group(2)), type="add"))
elif m.group(1) == "-":
segments.append(_item(text=sapi.escape(m.group(2)), type="remove"))
elif m.group(1) == "^":
segments.append(_item(text=sapi.escape(m.group(2)), type="change"))
pos = m.end()
return _item(segments=segments, line_number=line_number)
def unified(fromlines, tolines, context):
"""Generate unified diff"""
diff = difflib.Differ().compare(fromlines, tolines)
lastrow = None
had_changes = 0
for row in _trim_context(diff, context):
if row[0].startswith("? "):
had_changes = 1
yield _differ_split(lastrow, row[0])
lastrow = None
else:
if lastrow:
had_changes = 1
yield _differ_split(lastrow, None)
lastrow = row
if lastrow:
had_changes = 1
yield _differ_split(lastrow, None)
if not had_changes:
yield _item(type=_RCSDIFF_NO_CHANGES)
def _trim_context(lines, context_size):
"""Trim context lines that don't surround changes from Differ results
yields (line, leftnum, rightnum, gap) tuples"""
# circular buffer to hold context lines
context_buffer = [None] * (context_size or 0)
context_start = context_len = 0
# number of context lines left to print after encountering a change
context_owed = 0
# current line numbers
leftnum = rightnum = 0
# whether context lines have been dropped
gap = False
for line in lines:
row = save = None
if line.startswith("- "):
leftnum = leftnum + 1
row = line, leftnum, None
context_owed = context_size
elif line.startswith("+ "):
rightnum = rightnum + 1
row = line, None, rightnum
context_owed = context_size
else:
if line.startswith(" "):
leftnum = leftnum = leftnum + 1
rightnum = rightnum = rightnum + 1
if context_owed > 0:
context_owed = context_owed - 1
elif context_size is not None:
save = True
row = line, leftnum, rightnum
if save:
# don't yield row right away, store it in buffer
context_buffer[(context_start + context_len) % context_size] = row
if context_len == context_size:
context_start = (context_start + 1) % context_size
gap = True
else:
context_len = context_len + 1
else:
# yield row, but first drain stuff in buffer
context_len == context_size
while context_len:
yield context_buffer[context_start] + (gap,)
gap = False
context_start = (context_start + 1) % context_size
context_len = context_len - 1
yield row + (gap,)
gap = False
_re_differ = re.compile(r"[+-^]+")
def _differ_split(row, guide):
"""Break row into segments using guide line"""
line, left_number, right_number, gap = row
if left_number and right_number:
type = ""
elif left_number:
type = "remove"
elif right_number:
type = "add"
segments = []
pos = 2
if guide:
assert guide.startswith("? ")
for m in _re_differ.finditer(guide, pos):
if m.start() > pos:
segments.append(_item(text=sapi.escape(line[pos:m.start()]), type=None))
segments.append(_item(text=sapi.escape(line[m.start():m.end()]),
type="change"))
pos = m.end()
segments.append(_item(text=sapi.escape(line[pos:]), type=None))
return _item(gap=ezt.boolean(gap), type=type, segments=segments,
left_number=left_number, right_number=right_number)
try:
### Using difflib._mdiff function here was the easiest way of obtaining
### intraline diffs for use in ViewVC, but it doesn't exist prior to
### Python 2.4 and is not part of the public difflib API, so for now
### fall back if it doesn't exist.
difflib._mdiff
except AttributeError:
sidebyside = None

View File

@@ -1,13 +1,12 @@
# -*-python-*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
@@ -19,12 +18,62 @@
# the arguments.
#
# -----------------------------------------------------------------------
#
import os
import sys
import sapi
import threading
if sys.platform == "win32":
import win32popen
import win32event
import win32process
import debug
import StringIO
def popen(cmd, args, mode, capture_err=1):
if sys.platform == "win32":
command = win32popen.CommandLine(cmd, args)
if mode.find('r') >= 0:
hStdIn = None
if debug.SHOW_CHILD_PROCESSES:
dbgIn, dbgOut = None, StringIO.StringIO()
handle, hStdOut = win32popen.MakeSpyPipe(0, 1, (dbgOut,))
if capture_err:
hStdErr = hStdOut
dbgErr = dbgOut
else:
dbgErr = StringIO.StringIO()
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
else:
handle, hStdOut = win32popen.CreatePipe(0, 1)
if capture_err:
hStdErr = hStdOut
else:
hStdErr = win32popen.NullFile(1)
else:
if debug.SHOW_CHILD_PROCESSES:
dbgIn, dbgOut, dbgErr = StringIO.StringIO(), StringIO.StringIO(), StringIO.StringIO()
hStdIn, handle = win32popen.MakeSpyPipe(1, 0, (dbgIn,))
x, hStdOut = win32popen.MakeSpyPipe(None, 1, (dbgOut,))
x, hStdErr = win32popen.MakeSpyPipe(None, 1, (dbgErr,))
else:
hStdIn, handle = win32popen.CreatePipe(0, 1)
hStdOut = None
hStdErr = None
phandle, pid, thandle, tid = win32popen.CreateProcess(command, hStdIn, hStdOut, hStdErr)
if debug.SHOW_CHILD_PROCESSES:
debug.Process(command, dbgIn, dbgOut, dbgErr)
return _pipe(win32popen.File2FileObject(handle, mode), phandle)
# flush the stdio buffers since we are about to change the FD under them
sys.stdout.flush()
sys.stderr.flush()
@@ -35,18 +84,18 @@ def popen(cmd, args, mode, capture_err=1):
# in the parent
# close the descriptor that we don't need and return the other one.
if mode == 'r':
if mode.find('r') >= 0:
os.close(w)
return _pipe(os.fdopen(r, 'r'), pid)
return _pipe(os.fdopen(r, mode), pid)
os.close(r)
return _pipe(os.fdopen(w, 'w'), pid)
return _pipe(os.fdopen(w, mode), pid)
# in the child
# we'll need /dev/null for the discarded I/O
null = os.open('/dev/null', os.O_RDWR)
if mode == 'r':
if mode.find('r') >= 0:
# hook stdout/stderr to the "write" channel
os.dup2(w, 1)
# "close" stdin; the child shouldn't use it
@@ -75,99 +124,40 @@ def popen(cmd, args, mode, capture_err=1):
os.execvp(cmd, (cmd,) + tuple(args))
except:
# aid debugging, if the os.execvp above fails for some reason:
import string
print "<h2>exec failed:</h2><pre>", cmd, string.join(args), "</pre>"
print "<h2>exec failed:</h2><pre>", cmd, ' '.join(args), "</pre>"
raise
# crap. shouldn't be here.
sys.exit(127)
def pipe_cmds(cmds):
# flush the stdio buffers since we are about to change the FD under them
sys.stdout.flush()
sys.stderr.flush()
prev_r, parent_w = os.pipe()
null = os.open('/dev/null', os.O_RDWR)
for cmd in cmds[:-1]:
r, w = os.pipe()
pid = os.fork()
if not pid:
# in the child
# hook up stdin to the "read" channel
os.dup2(prev_r, 0)
# hook up stdout to the output channel
os.dup2(w, 1)
# toss errors
os.dup2(null, 2)
# close these extra descriptors
os.close(prev_r)
os.close(parent_w)
os.close(null)
os.close(r)
os.close(w)
# time to run the command
try:
os.execvp(cmd[0], cmd)
except:
pass
sys.exit(127)
# in the parent
# we don't need these any more
os.close(prev_r)
os.close(w)
# the read channel of this pipe will feed into to the next command
prev_r = r
# no longer needed
os.close(null)
# done with most of the commands. set up the last command to write to stdout
pid = os.fork()
if not pid:
# in the child (the last command)
# hook up stdin to the "read" channel
os.dup2(prev_r, 0)
# close these extra descriptors
os.close(prev_r)
os.close(parent_w)
# run the last command
try:
os.execvp(cmds[-1][0], cmds[-1])
except:
pass
sys.exit(127)
# not needed any more
os.close(prev_r)
# write into the first pipe, wait on the final process
return _pipe(os.fdopen(parent_w, 'w'), pid)
class _pipe:
"Wrapper for a file which can wait() on a child process at close time."
def __init__(self, file, child_pid):
def __init__(self, file, child_pid, done_event = None, thread = None):
self.file = file
self.child_pid = child_pid
if sys.platform == "win32":
if done_event:
self.wait_for = (child_pid, done_event)
else:
self.wait_for = (child_pid,)
else:
self.thread = thread
def eof(self):
### should be calling file.eof() here instead of file.close(), there
### may be data in the pipe or buffer after the process exits
if sys.platform == "win32":
r = win32event.WaitForMultipleObjects(self.wait_for, 1, 0)
if r == win32event.WAIT_OBJECT_0:
self.file.close()
self.file = None
return win32process.GetExitCodeProcess(self.child_pid)
return None
if self.thread and self.thread.isAlive():
return None
pid, status = os.waitpid(self.child_pid, os.WNOHANG)
if pid:
self.file.close()
@@ -179,12 +169,22 @@ class _pipe:
if self.file:
self.file.close()
self.file = None
return os.waitpid(self.child_pid, 0)[1]
if sys.platform == "win32":
win32event.WaitForMultipleObjects(self.wait_for, 1, win32event.INFINITE)
return win32process.GetExitCodeProcess(self.child_pid)
else:
if self.thread:
self.thread.join()
if type(self.child_pid) == type([]):
for pid in self.child_pid:
exit = os.waitpid(pid, 0)[1]
return exit
else:
return os.waitpid(self.child_pid, 0)[1]
return None
def __getattr__(self, name):
return getattr(self.file, name)
def __del__(self):
if self.file:
self.close()
self.close()

View File

@@ -1,489 +0,0 @@
#!/usr/local/bin/python -u
""" Python Highlighter for HTML Version: 0.5
py2html.py [options] files...
options:
-h print help
- read from stdin, write to stdout
-stdout read from files, write to stdout
-files read from files, write to filename+'.html' (default)
-format:
html output HTML page (default)
rawhtml output pure HTML (without headers, titles, etc.)
-mode:
color output in color (default)
mono output b/w (for printing)
-title:Title use 'Title' as title of the generated page
-bgcolor:color use color as background-color for page
-header:file use contents of file as header
-footer:file use contents of file as footer
-URL replace all occurances of 'URL: link' with
'<A HREF="link">link</A>'; this is always enabled
in CGI mode
-v verbose
Takes the input, assuming it is Python code and formats it into
colored HTML. When called without parameters the script tries to
work in CGI mode. It looks for a field 'script=URL' and tries to
use that URL as input file. If it can't find this field, the path
info (the part of the URL following the CGI script name) is
tried. In case no host is given, the host where the CGI script
lives and HTTP are used.
* Uses Just van Rossum's PyFontify version 0.3 to tag Python scripts.
You can get it via his homepage on starship:
URL: http://starship.skyport.net/crew/just
"""
__comments__ = """
The following snippet is a small shell script I use for viewing
Python scripts per less on Unix:
#!/bin/sh
# Browse pretty printed Python code using ANSI codes for highlighting
py2html -stdout -format:ansi -mode:mono $* | less -r
History:
0.5: Added a few suggestions by Kevin Ng to make the CGI version
a little more robust.
"""
__copyright__ = """
-----------------------------------------------------------------------------
(c) Copyright by Marc-Andre Lemburg, 1998 (mailto:mal@lemburg.com)
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee or royalty is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation or portions thereof, including modifications,
that you make.
THE AUTHOR MARC-ANDRE LEMBURG DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
"""
__version__ = '0.5'
__cgifooter__ = ('\n<PRE># code highlighted using <A HREF='
'"http://starship.skyport.net/~lemburg/">py2html.py</A> '
'version %s</PRE>\n' % __version__)
import sys,string,re
# Adjust path so that PyFontify is found...
sys.path.append('.')
### Constants
# URL of the input form the user is redirected to in case no script=xxx
# form field is given. The URL *must* be absolute. Leave blank to
# have the script issue an error instead.
INPUT_FORM = 'http://starship.skyport.net/~lemburg/SoftwareDescriptions.html#py2html.py'
### Helpers
def fileio(file, mode='rb', data=None, close=0):
if type(file) == type(''):
f = open(file,mode)
close = 1
else:
f = file
if data:
f.write(data)
else:
data = f.read()
if close: f.close()
return data
### Converter class
class PrettyPrint:
""" generic Pretty Printer class
* supports tagging Python scripts in the following ways:
# format/mode | color mono
# --------------------------
# rawhtml | x x (HTML without headers, etc.)
# html | x x (a HTML page with HEAD&BODY:)
# ansi | x (with Ansi-escape sequences)
* interfaces:
file_filter -- takes two files: input & output (may be stdin/stdout)
filter -- takes a string and returns the highlighted version
* to create an instance use:
c = PrettyPrint(tagfct,format,mode)
where format and mode must be strings according to the
above table if you plan to use PyFontify.fontify as
tagfct
* the tagfct has to take one argument, text, and return a taglist
(format: [(id,left,right,sublist),...], where id is the
"name" given to the slice left:right in text and sublist is a
taglist for tags inside the slice or None)
"""
# misc settings
title = ''
bgcolor = '#FFFFFF'
header = ''
footer = ''
replace_URLs = 0
# formats to be used
formats = {}
def __init__(self,tagfct=None,format='html',mode='color'):
self.tag = tagfct
self.set_mode = getattr(self,'set_mode_'+format+'_'+mode)
self.filter = getattr(self,'filter_'+format)
self.set_mode()
def file_filter(self,infile,outfile):
text = fileio(infile,'r')
if type(infile) == type('') and self.title == '':
self.title = infile
fileio(outfile,'w',self.filter(text))
### set pre- and postfixes for formats & modes
#
# These methods must set self.formats to a dictionary having
# an entry for every tag returned by the tagging function.
#
# The format used is simple:
# tag:(prefix,postfix)
# where prefix and postfix are either strings or callable objects,
# that return a string (they are called with the matching tag text
# as only parameter). prefix is inserted in front of the tag, postfix
# is inserted right after the tag.
def set_mode_html_color(self):
self.formats = {
'all':('<PRE>','</PRE>'),
'comment':('<FONT COLOR=#1111CC>','</FONT>'),
'keyword':('<FONT COLOR=#3333CC><B>','</B></FONT>'),
'parameter':('<FONT COLOR=#000066>','</FONT>'),
'identifier':( lambda x,strip=string.strip:
'<A NAME="%s"><FONT COLOR=#CC0000><B>' % (strip(x)),
'</B></FONT></A>'),
'string':('<FONT COLOR=#115511>','</FONT>')
}
set_mode_rawhtml_color = set_mode_html_color
def set_mode_html_mono(self):
self.formats = {
'all':('<PRE>','</PRE>'),
'comment':('',''),
'keyword':( '<U>','</U>'),
'parameter':('',''),
'identifier':( lambda x,strip=string.strip:
'<A NAME="%s"><B>' % (strip(x)),
'</B>'),
'string':('','')
}
set_mode_rawhtml_mono = set_mode_html_mono
def set_mode_ansi_mono(self):
self.formats = {
'all':('',''),
'comment':('\033[2m','\033[m'),
'keyword':('\033[4m','\033[m'),
'parameter':('',''),
'identifier':('\033[1m','\033[m'),
'string':('','')
}
### filter for Python scripts given as string
def escape_html(self,text):
t = (('<','&lt;'),('>','&gt;'))
for x,y in t:
text = string.join(string.split(text,x),y)
return text
def filter_html(self,text):
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<A HREF="\\2">\\2</A>',output)
html = """<HTML><HEAD><TITLE>%s</TITLE></HEAD>
<BODY BGCOLOR=%s>
<!--header-->%s
<!--script-->%s
<!--footer-->%s
</BODY>\n"""%(self.title,self.bgcolor,self.header,output,self.footer)
return html
def filter_rawhtml(self,text):
output = self.fontify(self.escape_html(text))
if self.replace_URLs:
output = re.sub('URL:([ \t]+)([^ \n\r<]+)',
'URL:\\1<A HREF="\\2">\\2</A>',output)
return self.header+output+self.footer
def filter_ansi(self,text):
output = self.fontify(text)
return self.header+output+self.footer
### fontify engine
def fontify(self,pytext):
# parse
taglist = self.tag(pytext)
# prepend special 'all' tag:
taglist[:0] = [('all',0,len(pytext),None)]
# prepare splitting
splits = []
addsplits(splits,pytext,self.formats,taglist)
# do splitting & inserting
splits.sort()
l = []
li = 0
for ri,dummy,insert in splits:
if ri > li: l.append(pytext[li:ri])
l.append(insert)
li = ri
if li < len(pytext): l.append(pytext[li:])
return string.join(l,'')
def addsplits(splits,text,formats,taglist):
# helper for fontify()
for id,left,right,sublist in taglist:
try:
pre,post = formats[id]
except KeyError:
# sys.stderr.write('Warning: no format for %s specified\n'%repr(id))
pre,post = '',''
if type(pre) != type(''):
pre = pre(text[left:right])
if type(post) != type(''):
post = post(text[left:right])
# len(splits) is a dummy used to make sorting stable
splits.append((left,len(splits),pre))
if sublist:
addsplits(splits,text,formats,sublist)
splits.append((right,len(splits),post))
def write_html_error(titel,text):
print """\
<HTML><HEADER><TITLE>%s</TITLE></HEADER>
<BODY>
<H2>%s</H2>
%s
</BODY></HTML>
""" % (titel,titel,text)
def redirect_to(url):
sys.stdout.write('Content-Type: text/html\r\n')
sys.stdout.write('Status: 302\r\n')
sys.stdout.write('Location: %s\r\n\r\n' % url)
print """
<HTML><HEAD>
<TITLE>302 Moved Temporarily</TITLE>
</HEAD><BODY>
<H1>302 Moved Temporarily</H1>
The document has moved to <A HREF="%s">%s</A>.<P>
</BODY></HTML>
""" % (url,url)
def main(cmdline):
""" main(cmdline) -- process cmdline as if it were sys.argv
"""
# parse options/files
options = []
optvalues = {}
for o in cmdline[1:]:
if o[0] == '-':
if ':' in o:
k,v = tuple(string.split(o,':'))
optvalues[k] = v
options.append(k)
else:
options.append(o)
else:
break
files = cmdline[len(options)+1:]
# create converting object
# load fontifier
if '-marcs' in options:
# use mxTextTool's tagging engine
from mxTextTools import tag
from mxTextTools.Examples.Python import python_script
tagfct = lambda text,tag=tag,pytable=python_script: \
tag(text,pytable)[1]
print "Py2HTML: using Marc's tagging engine"
else:
# load Just's
try:
import PyFontify
if PyFontify.__version__ < '0.3': raise ValueError
tagfct = PyFontify.fontify
except:
print """
Sorry, but this script needs the PyFontify.py module version 0.3;
You can download it from Just's homepage at
URL: http://starship.skyport.net/crew/just
"""
sys.exit()
if '-format' in options:
format = optvalues['-format']
else:
# use default
format = 'html'
if '-mode' in options:
mode = optvalues['-mode']
else:
# use default
mode = 'color'
c = PrettyPrint(tagfct,format,mode)
convert = c.file_filter
# start working
if '-title' in options:
c.title = optvalues['-title']
if '-bgcolor' in options:
c.bgcolor = optvalues['-bgcolor']
if '-header' in options:
try:
f = open(optvalues['-header'])
c.header = f.read()
f.close()
except IOError:
if verbose: print 'IOError: header file not found'
if '-footer' in options:
try:
f = open(optvalues['-footer'])
c.footer = f.read()
f.close()
except IOError:
if verbose: print 'IOError: footer file not found'
if '-URL' in options:
c.replace_URLs = 1
if '-' in options:
convert(sys.stdin,sys.stdout)
sys.exit()
if '-h' in options:
print __doc__
sys.exit()
if len(files) == 0:
# Turn URL processing on
c.replace_URLs = 1
# Try CGI processing...
import cgi,urllib,urlparse,os
form = cgi.FieldStorage()
if not form.has_key('script'):
# Ok, then try pathinfo
if not os.environ.has_key('PATH_INFO'):
if INPUT_FORM:
redirect_to(INPUT_FORM)
else:
sys.stdout.write('Content-Type: text/html\r\n\r\n')
write_html_error('Missing Parameter',
'Missing script=URL field in request')
sys.exit(1)
url = os.environ['PATH_INFO'][1:] # skip the leading slash
else:
url = form['script'].value
sys.stdout.write('Content-Type: text/html\r\n\r\n')
scheme, host, path, params, query, frag = urlparse.urlparse(url)
if not host:
scheme = 'http'
if os.environ.has_key('HTTP_HOST'):
host = os.environ['HTTP_HOST']
else:
host = 'localhost'
url = urlparse.urlunparse((scheme, host, path, params, query, frag))
#print url; sys.exit()
network = urllib.URLopener()
try:
tempfile,headers = network.retrieve(url)
except IOError,reason:
write_html_error('Error opening "%s"' % url,
'The given URL could not be opened. Reason: %s' %\
str(reason))
sys.exit(1)
f = open(tempfile,'rb')
c.title = url
c.footer = __cgifooter__
convert(f,sys.stdout)
f.close()
network.close()
sys.exit()
if '-stdout' in options:
filebreak = '-'*72
for f in files:
try:
if len(files) > 1:
print filebreak
print 'File:',f
print filebreak
convert(f,sys.stdout)
except IOError:
pass
else:
verbose = ('-v' in options)
if verbose:
print 'Py2HTML: working on',
for f in files:
try:
if verbose: print f,
convert(f,f+'.html')
except IOError:
if verbose: print '(IOError!)',
if verbose:
print
print 'Done.'
if __name__=='__main__':
main(sys.argv)

154
lib/pygments/lexers/sp4.py Executable file
View File

@@ -0,0 +1,154 @@
# -*- coding: utf-8 -*-
"""
pygments.lexers.sp4
~~~~~~~~~~~~~~~~~~~~~
Lexer for CustIS m4-preprocessed PL/SQL.
:copyright: 2009+ by Vitaliy Filippov <vitalif@mail.ru>.
:license: BSD, see LICENSE for more details.
,
'Sp4Lexer': ('pygments.lexers.sp4', 'SP4', ('sp4',), ('*.sp4'), ('text/x-sp4',))
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, this, \
do_insertions
from pygments.token import Error, Punctuation, \
Text, Comment, Operator, Keyword, Name, String, Number, Generic
from pygments.util import shebang_matches
__all__ = ['Sp4Lexer']
line_re = re.compile('.*?\n')
class Sp4Lexer(RegexLexer):
name = 'SP4'
aliases = ['sp4']
filenames = ['*.sp4']
mimetypes = ['text/x-sp4']
flags = re.IGNORECASE
tokens = {
'root': [
(r'\s+', Text),
(r'--.*?\n', Comment.Single),
(r'/\*', Comment.Multiline, 'multiline-comments'),
(r'(ABORT|ABS|ABSOLUTE|ACCESS|ADA|ADD|ADMIN|AFTER|AGGREGATE|'
r'ALIAS|ALL|ALLOCATE|ALTER|ANALYSE|ANALYZE|AND|ANY|ARE|AS|'
r'ASC|ASENSITIVE|ASSERTION|ASSIGNMENT|ASYMMETRIC|AT|ATOMIC|'
r'AUTHORIZATION|AVG|BACKWARD|BEFORE|BEGIN|BETWEEN|BITVAR|'
r'BIT_LENGTH|BOTH|BREADTH|BY|C|CACHE|CALL|CALLED|CARDINALITY|'
r'CASCADE|CASCADED|CASE|CAST|CATALOG|CATALOG_NAME|CHAIN|'
r'CHARACTERISTICS|CHARACTER_LENGTH|CHARACTER_SET_CATALOG|'
r'CHARACTER_SET_NAME|CHARACTER_SET_SCHEMA|CHAR_LENGTH|CHECK|'
r'CHECKED|CHECKPOINT|CLASS|CLASS_ORIGIN|CLOB|CLOSE|CLUSTER|'
r'COALSECE|COBOL|COLLATE|COLLATION|COLLATION_CATALOG|'
r'COLLATION_NAME|COLLATION_SCHEMA|COLUMN|COLUMN_NAME|'
r'COMMAND_FUNCTION|COMMAND_FUNCTION_CODE|COMMENT|COMMIT|'
r'COMMITTED|COMPLETION|CONDITION_NUMBER|CONNECT|CONNECTION|'
r'CONNECTION_NAME|CONSTRAINT|CONSTRAINTS|CONSTRAINT_CATALOG|'
r'CONSTRAINT_NAME|CONSTRAINT_SCHEMA|CONSTRUCTOR|CONTAINS|'
r'CONTINUE|CONVERSION|CONVERT|COPY|CORRESPONTING|COUNT|'
r'CREATE|CREATEDB|CREATEUSER|CROSS|CUBE|CURRENT|CURRENT_DATE|'
r'CURRENT_PATH|CURRENT_ROLE|CURRENT_TIME|CURRENT_TIMESTAMP|'
r'CURRENT_USER|CURSOR|CURSOR_NAME|CYCLE|DATA|DATABASE|'
r'DATETIME_INTERVAL_CODE|DATETIME_INTERVAL_PRECISION|DAY|'
r'DEALLOCATE|DECLARE|DEFAULT|DEFAULTS|DEFERRABLE|DEFERRED|'
r'DEFINED|DEFINER|DELETE|DELIMITER|DELIMITERS|DEREF|DESC|'
r'DESCRIBE|DESCRIPTOR|DESTROY|DESTRUCTOR|DETERMINISTIC|'
r'DIAGNOSTICS|DICTIONARY|DISCONNECT|DISPATCH|DISTINCT|DO|'
r'DOMAIN|DROP|DYNAMIC|DYNAMIC_FUNCTION|DYNAMIC_FUNCTION_CODE|'
r'EACH|ELSE|ENCODING|ENCRYPTED|END|END-EXEC|EQUALS|ESCAPE|EVERY|'
r'EXCEPT|ESCEPTION|EXCLUDING|EXCLUSIVE|EXEC|EXECUTE|EXISTING|'
r'EXISTS|EXPLAIN|EXTERNAL|EXTRACT|FALSE|FETCH|FINAL|FIRST|FOR|'
r'FORCE|FOREIGN|FORTRAN|FORWARD|FOUND|FREE|FREEZE|FROM|FULL|'
r'FUNCTION|G|GENERAL|GENERATED|GET|GLOBAL|GO|GOTO|GRANT|GRANTED|'
r'GROUP|GROUPING|HANDLER|HAVING|HIERARCHY|HOLD|HOST|IDENTITY|'
r'IGNORE|ILIKE|IMMEDIATE|IMMUTABLE|IMPLEMENTATION|IMPLICIT|IN|'
r'INCLUDING|INCREMENT|INDEX|INDITCATOR|INFIX|INHERITS|INITIALIZE|'
r'INITIALLY|INNER|INOUT|INPUT|INSENSITIVE|INSERT|INSTANTIABLE|'
r'INSTEAD|INTERSECT|INTO|INVOKER|IS|ISNULL|ISOLATION|ITERATE|JOIN|'
r'K|KEY|KEY_MEMBER|KEY_TYPE|LANCOMPILER|LANGUAGE|LARGE|LAST|'
r'LATERAL|LEADING|LEFT|LENGTH|LESS|LEVEL|LIKE|LILMIT|LISTEN|LOAD|'
r'LOCAL|LOCALTIME|LOCALTIMESTAMP|LOCATION|LOCATOR|LOCK|LOWER|M|'
r'MAP|MATCH|MAX|MAXVALUE|MESSAGE_LENGTH|MESSAGE_OCTET_LENGTH|'
r'MESSAGE_TEXT|METHOD|MIN|MINUTE|MINVALUE|MOD|MODE|MODIFIES|'
r'MODIFY|MONTH|MORE|MOVE|MUMPS|NAMES|NATIONAL|NATURAL|NCHAR|'
r'NCLOB|NEW|NEXT|NO|NOCREATEDB|NOCREATEUSER|NONE|NOT|NOTHING|'
r'NOTIFY|NOTNULL|NULL|NULLABLE|NULLIF|OBJECT|OCTET_LENGTH|OF|OFF|'
r'OFFSET|OIDS|OLD|ON|ONLY|OPEN|OPERATION|OPERATOR|OPTION|OPTIONS|'
r'OR|ORDER|ORDINALITY|OUT|OUTER|OUTPUT|OVERLAPS|OVERLAY|OVERRIDING|'
r'OWNER|PAD|PARAMETER|PARAMETERS|PARAMETER_MODE|PARAMATER_NAME|'
r'PARAMATER_ORDINAL_POSITION|PARAMETER_SPECIFIC_CATALOG|'
r'PARAMETER_SPECIFIC_NAME|PARAMATER_SPECIFIC_SCHEMA|PARTIAL|'
r'PASCAL|PENDANT|PLACING|PLI|POSITION|POSTFIX|PRECISION|PREFIX|'
r'PREORDER|PREPARE|PRESERVE|PRIMARY|PRIOR|PRIVILEGES|PROCEDURAL|'
r'PROCEDURE|PUBLIC|READ|READS|RECHECK|RECURSIVE|REF|REFERENCES|'
r'REFERENCING|REINDEX|RELATIVE|RENAME|REPEATABLE|REPLACE|RESET|'
r'RESTART|RESTRICT|RESULT|RETURN|RETURNED_LENGTH|'
r'RETURNED_OCTET_LENGTH|RETURNED_SQLSTATE|RETURNS|REVOKE|RIGHT|'
r'ROLE|ROLLBACK|ROLLUP|ROUTINE|ROUTINE_CATALOG|ROUTINE_NAME|'
r'ROUTINE_SCHEMA|ROW|ROWS|ROW_COUNT|RULE|SAVE_POINT|SCALE|SCHEMA|'
r'SCHEMA_NAME|SCOPE|SCROLL|SEARCH|SECOND|SECURITY|SELECT|SELF|'
r'SENSITIVE|SERIALIZABLE|SERVER_NAME|SESSION|SESSION_USER|SET|'
r'SETOF|SETS|SHARE|SHOW|SIMILAR|SIMPLE|SIZE|SOME|SOURCE|SPACE|'
r'SPECIFIC|SPECIFICTYPE|SPECIFIC_NAME|SQL|SQLCODE|SQLERROR|'
r'SQLEXCEPTION|SQLSTATE|SQLWARNINIG|STABLE|START|STATE|STATEMENT|'
r'STATIC|STATISTICS|STDIN|STDOUT|STORAGE|STRICT|STRUCTURE|STYPE|'
r'SUBCLASS_ORIGIN|SUBLIST|SUBSTRING|SUM|SYMMETRIC|SYSID|SYSTEM|'
r'SYSTEM_USER|TABLE|TABLE_NAME| TEMP|TEMPLATE|TEMPORARY|TERMINATE|'
r'THAN|THEN|TIMESTAMP|TIMEZONE_HOUR|TIMEZONE_MINUTE|TO|TOAST|'
r'TRAILING|TRANSATION|TRANSACTIONS_COMMITTED|'
r'TRANSACTIONS_ROLLED_BACK|TRANSATION_ACTIVE|TRANSFORM|'
r'TRANSFORMS|TRANSLATE|TRANSLATION|TREAT|TRIGGER|TRIGGER_CATALOG|'
r'TRIGGER_NAME|TRIGGER_SCHEMA|TRIM|TRUE|TRUNCATE|TRUSTED|TYPE|'
r'UNCOMMITTED|UNDER|UNENCRYPTED|UNION|UNIQUE|UNKNOWN|UNLISTEN|'
r'UNNAMED|UNNEST|UNTIL|UPDATE|UPPER|USAGE|USER|'
r'USER_DEFINED_TYPE_CATALOG|USER_DEFINED_TYPE_NAME|'
r'USER_DEFINED_TYPE_SCHEMA|USING|VACUUM|VALID|VALIDATOR|VALUES|'
r'VARIABLE|VERBOSE|VERSION|VIEW|VOLATILE|WHEN|WHENEVER|WHERE|'
r'WITH|WITHOUT|WORK|WRITE|YEAR|ZONE|BINARY_INTEGER|BODY|BREAK|'
r'CONSTANT|DEFINITION|DELETING|DLOB|DUMMY|ELSIF|ERRLVL|ERROR|'
r'EXCEPTION|EXIT|IF|INSERTING|ISOPEN|LOOP|NO_DATA_FOUND|NOTFOUND|'
r'OTHERS|PACKAGE|PRAGMA|RAISE|RECORD|RESTRICT_REFERENCES|RETURNING|'
r'RNDS|RNPS|ROWCOUNT|ROWNUM|ROWTYPE|SAVEPOINT|SQLERRM|TOO_MANY_ROWS|'
r'UPDATING|WHILE|WNDS|WNPS|BULK|CHR|COLLECT|GREATEST|INSTR|LEAST|'
r'LENGTHB|NOCOPY|NOWAIT|NVL|RPAD|SUBST|SUBSTB|SUBSTR|SYSDATE|'
r'TABLESPACE|TO_CHAR|TO_DATE|TO_NUMBER|TRUNC)\b', Keyword),
(r'(ARRAY|BIGINT|BINARY|BIT|BLOB|BOOLEAN|CHAR|CHARACTER|DATE|'
r'DEC|DECIMAL|FLOAT|INT|INTEGER|INTERVAL|NUMBER|NUMERIC|REAL|'
r'SERIAL|SMALLINT|VARCHAR|VARCHAR2|VARYING|INT8|SERIAL8|TEXT)\b',
Name.Builtin),
(r'(_5date_args|_actual_area|_ASSERT|_doc_code|_doc_var|_doc_var_list|'
r'_enforce|_ent|_enum|_enums_define|_enums_member_define|_field|'
r'_fields|_first|_FMT|_in_list|_index|_index_unique|_indexes'
r'_MAX_STRLEN|_MID_STRLEN|_param|_package|_pk|_plsql_param|_plsql_return|'
r'_private_function|_private_procedure|_private_type|_private_var|'
r'_protected_function|_protected_procedure|_protected_type|_protected_var|'
r'_public_function|_public_procedure|_public_type|_public_var|_quote|_RAISE|'
r'_RAISEW|_reference|_references|_request_arg|_request_define|'
r'_request_res|_STR_CONST|_substr|_table|_tail|builtin|cdr|changecom|'
r'changequote|changeword|debugfile|decr|define|divert|dummy_list|dumpdef|'
r'errprint|eval|foreach|forloop|GetNth|ifelse|include|incr|index|indir|'
r'len|lowcase|maketemp|Nth|patsubst|popdef|pushdef|regexp|'
r'remove_prefix|shift|sinclude|Size|syscmd|TRACE|traceoff|traceon|'
r'translit|undefine|undivert|upcase)\b',
Name.Function),
(r'[+*/<>=~!@#%^&|`?^-]', Operator),
(r'[0-9]+', Number.Integer),
(r"'(''|[^'\\]|\\\'|\\\\)*'", String.Single),
(r'"(""|[^"\\]|\\\"|\\\\)*"', String.Symbol),
(r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
(r'[;:()\[\],\.]', Punctuation)
],
'multiline-comments': [
(r'/\*', Comment.Multiline, 'multiline-comments'),
(r'\*/', Comment.Multiline, '#pop'),
(r'[^/\*]+', Comment.Multiline),
(r'[/*]', Comment.Multiline)
]
}

View File

@@ -1,47 +1,35 @@
#!/usr/bin/python
# -*- Mode: python -*-
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 2000 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://www.lyra.org/viewcvs/license-1.html.
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://www.lyra.org/viewcvs/
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# CGI script to process and display queries to CVSdb
#
# This script is part of the ViewCVS package. More information can be
# found at http://www.lyra.org/viewcvs/.
# This script is part of the ViewVC package. More information can be
# found at http://viewvc.org
#
# -----------------------------------------------------------------------
#
#########################################################################
#
# INSTALL-TIME CONFIGURATION
#
# These values will be set during the installation process. During
# development, they will remain None.
#
CONF_PATHNAME = None
#########################################################################
import os
import sys
import string
import cgi
import time
from common import _item, TemplateData
import cvsdb
import viewcvs
import viewvc
import ezt
import debug
import urllib
import fnmatch
class FormData:
def __init__(self, form):
@@ -53,6 +41,7 @@ class FormData:
self.file = ""
self.who = ""
self.sortby = ""
self.textquery = ""
self.date = ""
self.hours = 0
@@ -60,7 +49,7 @@ class FormData:
def decode_thyself(self, form):
try:
self.repository = string.strip(form["repository"].value)
self.textquery = string.strip(form["textquery"].value)
except KeyError:
pass
except TypeError:
@@ -69,7 +58,16 @@ class FormData:
self.valid = 1
try:
self.branch = string.strip(form["branch"].value)
self.repository = form["repository"].value.strip()
except KeyError:
pass
except TypeError:
pass
else:
self.valid = 1
try:
self.branch = form["branch"].value.strip()
except KeyError:
pass
except TypeError:
@@ -78,7 +76,7 @@ class FormData:
self.valid = 1
try:
self.directory = string.strip(form["directory"].value)
self.directory = form["directory"].value.strip()
except KeyError:
pass
except TypeError:
@@ -87,7 +85,7 @@ class FormData:
self.valid = 1
try:
self.file = string.strip(form["file"].value)
self.file = form["file"].value.strip()
except KeyError:
pass
except TypeError:
@@ -96,7 +94,7 @@ class FormData:
self.valid = 1
try:
self.who = string.strip(form["who"].value)
self.who = form["who"].value.strip()
except KeyError:
pass
except TypeError:
@@ -105,14 +103,14 @@ class FormData:
self.valid = 1
try:
self.sortby = string.strip(form["sortby"].value)
self.sortby = form["sortby"].value.strip()
except KeyError:
pass
except TypeError:
pass
try:
self.date = string.strip(form["date"].value)
self.date = form["date"].value.strip()
except KeyError:
pass
except TypeError:
@@ -171,7 +169,7 @@ def listparse_string(str):
## command; add the command and start over
elif c == ",":
## strip ending whitespace on un-quoted data
temp = string.rstrip(temp)
temp = temp.rstrip()
return_list.append( ("", temp) )
temp = ""
state = "eat leading whitespace"
@@ -230,8 +228,9 @@ def decode_command(cmd):
else:
return "exact"
def form_to_cvsdb_query(form_data):
def form_to_cvsdb_query(cfg, form_data):
query = cvsdb.CreateCheckinQuery()
query.SetLimit(cfg.cvsdb.row_limit)
if form_data.repository:
for cmd, str in listparse_string(form_data.repository):
@@ -258,10 +257,15 @@ def form_to_cvsdb_query(form_data):
cmd = decode_command(cmd)
query.SetAuthor(str, cmd)
if form_data.textquery:
query.SetTextQuery(form_data.textquery)
if form_data.sortby == "author":
query.SetSortMethod("author")
elif form_data.sortby == "file":
query.SetSortMethod("file")
elif form_data.sortby == "relevance" and form_data.textquery:
query.SetSortMethod("relevance")
else:
query.SetSortMethod("date")
@@ -277,43 +281,107 @@ def form_to_cvsdb_query(form_data):
return query
def cvsroot_name_from_path(cvsroot):
## we need to resolve the cvsroot path from the database
## to the name given to it in the viewcvs.conf file
for key, value in cfg.general.cvs_roots.items():
if value == cvsroot:
return key
def prev_rev(rev):
'''Returns a string representing the previous revision of the argument.'''
r = rev.split('.')
# decrement final revision component
r[-1] = str(int(r[-1]) - 1)
# prune if we pass the beginning of the branch
if len(r) > 2 and r[-1] == '0':
r = r[:-2]
return '.'.join(r)
return None
def is_forbidden(cfg, cvsroot_name, module):
'''Return 1 if MODULE in CVSROOT_NAME is forbidden; return 0 otherwise.'''
def build_commit(desc, files):
ob = _item(num_files=len(files), files=[])
# CVSROOT_NAME might be None here if the data comes from an
# unconfigured root. This interfaces doesn't care that the root
# isn't configured, but if that's the case, it will consult only
# the base and per-vhost configuration for authorizer and
# authorizer parameters.
if cvsroot_name:
cfg = cfg.get_root_config(cvsroot_name)
authorizer = cfg.options.authorizer
params = cfg.get_authorizer_params()
# If CVSROOT_NAME isn't configured to use an authorizer, nothing
# is forbidden. If it's configured to use something other than
# the 'forbidden' authorizer, complain. Otherwise, check for
# forbiddenness per the PARAMS as expected.
if not authorizer:
return 0
if authorizer != 'forbidden':
raise Exception("The 'forbidden' authorizer is the only one supported "
"by this interface. The '%s' root is configured to "
"use a different one." % (cvsroot_name))
forbidden = params.get('forbidden', '')
forbidden = map(lambda x: x.strip(), filter(None, forbidden.split(',')))
default = 0
for pat in forbidden:
if pat[0] == '!':
default = 1
if fnmatch.fnmatchcase(module, pat[1:]):
return 0
elif fnmatch.fnmatchcase(module, pat):
return 1
return default
if desc:
ob.desc = string.replace(cgi.escape(desc), '\n', '<br>')
else:
ob.desc = '&nbsp;'
def build_commit(server, cfg, desc, files, cvsroots, viewvc_link):
ob = _item(num_files=len(files), files=[])
ob.log = desc and server.escape(desc).replace('\n', '<br />') or '&nbsp;'
for commit in files:
repository = commit.GetRepository()
directory = commit.GetDirectory()
cvsroot_name = cvsroots.get(repository)
## find the module name (if any)
try:
module = filter(None, directory.split('/'))[0]
except IndexError:
module = None
## skip commits we aren't supposed to show
if module and ((module == 'CVSROOT' and cfg.options.hide_cvsroot) \
or is_forbidden(cfg, cvsroot_name, module)):
continue
ctime = commit.GetTime()
if not ctime:
ctime = "&nbsp";
ctime = "&nbsp;"
else:
ctime = time.strftime("%y/%m/%d %H:%M", time.localtime(ctime))
if (cfg.options.use_localtime):
ctime = time.strftime("%y/%m/%d %H:%M %Z", time.localtime(ctime))
else:
ctime = time.strftime("%y/%m/%d %H:%M", time.gmtime(ctime)) \
+ ' UTC'
## make the file link
file = os.path.join(commit.GetDirectory(), commit.GetFile())
file_full_path = os.path.join(commit.GetRepository(), file)
try:
file = (directory and directory + "/") + commit.GetFile()
except:
raise Exception, str([directory, commit.GetFile()])
## if we couldn't find the cvsroot path configured in the
## viewcvs.conf file, then don't make the link
cvsroot_name = cvsroot_name_from_path(commit.GetRepository())
if cvsroot_name:
flink = '<a href="viewcvs.cgi/%s?cvsroot=%s">%s</a>' \
% (file, cvsroot_name, file_full_path)
## If we couldn't find the cvsroot path configured in the
## viewvc.conf file, or we don't have a VIEWVC_LINK, then
## don't make the link.
if cvsroot_name and viewvc_link:
flink = '[%s] <a href="%s/%s?root=%s">%s</a>' % (
cvsroot_name, viewvc_link, urllib.quote(file),
cvsroot_name, file)
if commit.GetType() == commit.CHANGE:
dlink = '%s/%s?root=%s&amp;view=diff&amp;r1=%s&amp;r2=%s' % (
viewvc_link, urllib.quote(file), cvsroot_name,
prev_rev(commit.GetRevision()), commit.GetRevision())
else:
dlink = None
else:
flink = file_full_path
flink = '[%s] %s' % (repository, file)
dlink = None
ob.relevance = commit.GetRelevance()
ob.plus += int(commit.GetPlusCount())
ob.minus += int(commit.GetMinusCount())
ob.files.append(_item(date=ctime,
author=commit.GetAuthor(),
link=flink,
@@ -321,111 +389,106 @@ def build_commit(desc, files):
branch=commit.GetBranch(),
plus=int(commit.GetPlusCount()),
minus=int(commit.GetMinusCount()),
type=commit.GetTypeString(),
difflink=dlink,
))
return ob
def run_query(form_data):
query = form_to_cvsdb_query(form_data)
db = cvsdb.ConnectDatabaseReadOnly()
def run_query(server, cfg, db, form_data, viewvc_link):
query = form_to_cvsdb_query(cfg, form_data)
db.RunQuery(query)
if not query.commit_list:
return [ ]
commit_list = query.GetCommitList()
if not commit_list:
return [ ], 0
row_limit_reached = query.GetLimitReached()
commits = [ ]
files = [ ]
current_desc = query.commit_list[0].GetDescription()
for commit in query.commit_list:
cvsroots = {}
viewvc.expand_root_parents(cfg)
rootitems = cfg.general.svn_roots.items() + cfg.general.cvs_roots.items()
for key, value in rootitems:
cvsroots[cvsdb.CleanRepository(value)] = key
current_desc = commit_list[0].GetDescription()
for commit in commit_list:
desc = commit.GetDescription()
if current_desc == desc:
files.append(commit)
continue
commits.append(build_commit(current_desc, files))
commits.append(build_commit(server, cfg, current_desc, files,
cvsroots, viewvc_link))
files = [ commit ]
current_desc = desc
## add the last file group to the commit list
commits.append(build_commit(current_desc, files))
commits.append(build_commit(server, cfg, current_desc, files,
cvsroots, viewvc_link))
return commits
# Strip out commits that don't have any files attached to them. The
# files probably aren't present because they've been blocked via
# forbiddenness.
def _only_with_files(commit):
return len(commit.files) > 0
commits = filter(_only_with_files, commits)
return commits, row_limit_reached
def handle_config():
viewcvs.handle_config()
global cfg
cfg = viewcvs.cfg
def main(server, cfg, viewvc_link):
try:
def main():
handle_config()
form = cgi.FieldStorage()
form = server.FieldStorage()
form_data = FormData(form)
db = cvsdb.ConnectDatabaseReadOnly(cfg, None)
if form_data.valid:
commits = run_query(form_data)
commits, row_limit_reached = run_query(server, cfg, db, form_data, viewvc_link)
query = None
else:
commits = [ ]
row_limit_reached = 0
query = 'skipped'
data = {
docroot = cfg.options.docroot
if docroot is None and viewvc_link:
docroot = viewvc_link + '/' + viewvc.docroot_magic_path
data = TemplateData({
'cfg' : cfg,
'address' : cfg.general.address,
'vsn' : viewcvs.__version__,
'repository' : cgi.escape(form_data.repository, 1),
'branch' : cgi.escape(form_data.branch, 1),
'directory' : cgi.escape(form_data.directory, 1),
'file' : cgi.escape(form_data.file, 1),
'who' : cgi.escape(form_data.who, 1),
'vsn' : viewvc.__version__,
'textquery' : server.escape(form_data.textquery),
'repository' : server.escape(form_data.repository),
'branch' : server.escape(form_data.branch),
'directory' : server.escape(form_data.directory),
'file' : server.escape(form_data.file),
'who' : server.escape(form_data.who),
'docroot' : docroot,
'sortby' : form_data.sortby,
'date' : form_data.date,
'query' : query,
'row_limit_reached' : ezt.boolean(row_limit_reached),
'commits' : commits,
'num_commits' : len(commits),
}
if form_data.hours:
data['hours'] = form_data.hours
else:
data['hours'] = 2
template = ezt.Template()
template.parse_file(os.path.join(viewcvs.g_install_dir,
cfg.templates.query))
viewcvs.http_header()
'rss_href' : None,
'repositories' : db.GetRepositoryList(),
'hours' : form_data.hours and form_data.hours or 2,
})
# generate the page
template.generate(sys.stdout, data)
server.header()
template = viewvc.get_view_template(cfg, "query")
template.generate(server.file(), data)
def run_cgi():
### be nice to share all this logic with viewcvs.run_cgi
try:
main()
except SystemExit, e:
# don't catch SystemExit (caused by sys.exit()). propagate the exit code
sys.exit(e[0])
pass
except:
info = sys.exc_info()
viewcvs.http_header()
print '<html><head><title>Python Exception Occurred</title></head>'
print '<body bgcolor=white><h1>Python Exception Occurred</h1>'
import traceback
lines = apply(traceback.format_exception, info)
print '<pre>'
print cgi.escape(string.join(lines, ''))
print '</pre>'
viewcvs.html_footer()
class _item:
def __init__(self, **kw):
vars(self).update(kw)
exc_info = debug.GetExceptionData()
server.header(status=exc_info['status'])
debug.PrintException(server, exc_info)

View File

@@ -1,441 +0,0 @@
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
# This software is being maintained as part of the ViewCVS project.
# Information is available at:
# http://viewcvs.sourceforge.net/
#
# This file was originally based on portions of the blame.py script by
# Curt Hagenlocher.
#
# -----------------------------------------------------------------------
import string
import time
class _TokenStream:
token_term = string.whitespace + ';'
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
CHUNK_SIZE = 100000
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.idx = 0
self.buf = self.rcsfile.read(self.CHUNK_SIZE)
if self.buf == '':
raise RuntimeError, 'EOF'
def get(self):
"Get the next token from the RCS file."
# Note: we can afford to loop within Python, examining individual
# characters. For the whitespace and tokens, the number of iterations
# is typically quite small. Thus, a simple iterative loop will beat
# out more complex solutions.
buf = self.buf
idx = self.idx
while 1:
if idx == len(buf):
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
# signal EOF by returning None as the token
del self.buf # so we fail if get() is called again
return None
idx = 0
if buf[idx] not in string.whitespace:
break
idx = idx + 1
if buf[idx] == ';':
self.buf = buf
self.idx = idx + 1
return ';'
if buf[idx] != '@':
end = idx + 1
token = ''
while 1:
# find token characters in the current buffer
while end < len(buf) and buf[end] not in self.token_term:
end = end + 1
token = token + buf[idx:end]
if end < len(buf):
# we stopped before the end, so we have a full token
idx = end
break
# we stopped at the end of the buffer, so we may have a partial token
buf = self.rcsfile.read(self.CHUNK_SIZE)
idx = end = 0
self.buf = buf
self.idx = idx
return token
# a "string" which starts with the "@" character. we'll skip it when we
# search for content.
idx = idx + 1
chunks = [ ]
while 1:
if idx == len(buf):
idx = 0
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
raise RuntimeError, 'EOF'
i = string.find(buf, '@', idx)
if i == -1:
chunks.append(buf[idx:])
idx = len(buf)
continue
if i == len(buf) - 1:
chunks.append(buf[idx:i])
idx = 0
buf = '@' + self.rcsfile.read(self.CHUNK_SIZE)
if buf == '@':
raise RuntimeError, 'EOF'
continue
if buf[i + 1] == '@':
chunks.append(buf[idx:i+1])
idx = i + 2
continue
chunks.append(buf[idx:i])
self.buf = buf
self.idx = i + 1
return string.join(chunks, '')
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
"Try to match the next token from the input buffer."
token = self.get()
if token != match:
raise RuntimeError, ('Unexpected parsing error in RCS file.\n' +
'Expected token: %s, but saw: %s' % (match, token))
def unget(self, token):
"Put this token back, for the next get() to return."
# Override the class' .get method with a function which clears the
# overridden method then returns the pushed token. Since this function
# will not be looked up via the class mechanism, it should be a "normal"
# function, meaning it won't have "self" automatically inserted.
# Therefore, we need to pass both self and the token thru via defaults.
# note: we don't put this into the input buffer because it may have been
# @-unescaped already.
def give_it_back(self=self, token=token):
del self.get
return token
self.get = give_it_back
class Parser:
def parse_rcs_admin(self):
while 1:
# Read initial token at beginning of line
token = self.ts.get()
# We're done once we reach the description of the RCS tree
if token[0] in string.digits:
self.ts.unget(token)
return
if token == "head":
self.sink.set_head_revision(self.ts.get())
self.ts.match(';')
elif token == "branch":
self.sink.set_principal_branch(self.ts.get())
self.ts.match(';')
elif token == "symbols":
while 1:
tag = self.ts.get()
if tag == ';':
break
(tag_name, tag_rev) = string.split(tag, ':')
self.sink.define_tag(tag_name, tag_rev)
elif token == "comment":
self.sink.set_comment(self.ts.get())
self.ts.match(';')
# Ignore all these other fields - We don't care about them. Also chews
# up "newphrase".
elif token in ("locks", "strict", "expand", "access"):
while 1:
tag = self.ts.get()
if tag == ';':
break
else:
pass
# warn("Unexpected RCS token: $token\n")
raise RuntimeError, "Unexpected EOF";
def parse_rcs_tree(self):
while 1:
revision = self.ts.get()
# End of RCS tree description ?
if revision == 'desc':
self.ts.unget(revision)
return
# Parse date
self.ts.match('date')
date = self.ts.get()
self.ts.match(';')
# Convert date into timestamp
date_fields = string.split(date, '.') + ['0', '0', '0']
date_fields = map(string.atoi, date_fields)
if date_fields[0] < 100:
date_fields[0] = date_fields[0] + 1900
timestamp = time.mktime(tuple(date_fields))
# Parse author
self.ts.match('author')
author = self.ts.get()
self.ts.match(';')
# Parse state
self.ts.match('state')
state = ''
while 1:
token = self.ts.get()
if token == ';':
break
state = state + token + ' '
state = state[:-1] # toss the trailing space
# Parse branches
self.ts.match('branches')
branches = [ ]
while 1:
token = self.ts.get()
if token == ';':
break
branches.append(token)
# Parse revision of next delta in chain
self.ts.match('next')
next = self.ts.get()
if next == ';':
next = None
else:
self.ts.match(';')
# there are some files with extra tags in them. for example:
# owner 640;
# group 15;
# permissions 644;
# hardlinks @configure.in@;
# this is "newphrase" in RCSFILE(5). we just want to skip over these.
while 1:
token = self.ts.get()
if token == 'desc' or token[0] in string.digits:
self.ts.unget(token)
break
# consume everything up to the semicolon
while self.ts.get() != ';':
pass
self.sink.define_revision(revision, timestamp, author, state, branches,
next)
def parse_rcs_description(self):
self.ts.match('desc')
self.sink.set_description(self.ts.get())
def parse_rcs_deltatext(self):
while 1:
revision = self.ts.get()
if revision is None:
# EOF
break
self.ts.match('log')
log = self.ts.get()
### need to add code to chew up "newphrase"
self.ts.match('text')
text = self.ts.get()
self.sink.set_revision_info(revision, log, text)
def parse(self, file, sink):
self.ts = _TokenStream(file)
self.sink = sink
self.parse_rcs_admin()
self.parse_rcs_tree()
# many sinks want to know when the tree has been completed so they can
# do some work to prep for the arrival of the deltatext
self.sink.tree_completed()
self.parse_rcs_description()
self.parse_rcs_deltatext()
# easiest for us to tell the sink it is done, rather than worry about
# higher level software doing it.
self.sink.parse_completed()
self.ts = self.sink = None
class Sink:
def set_head_revision(self, revision):
pass
def set_principal_branch(self, branch_name):
pass
def define_tag(self, name, revision):
pass
def set_comment(self, comment):
pass
def set_description(self, description):
pass
def define_revision(self, revision, timestamp, author, state,
branches, next):
pass
def set_revision_info(self, revision, log, text):
pass
def tree_completed(self):
pass
def parse_completed(self):
pass
# --------------------------------------------------------------------------
#
# TESTING AND DEBUGGING TOOLS
#
class DebugSink:
def set_head_revision(self, revision):
print 'head:', revision
def set_principal_branch(self, branch_name):
print 'branch:', branch_name
def define_tag(self, name, revision):
print 'tag:', name, '=', revision
def set_comment(self, comment):
print 'comment:', comment
def set_description(self, description):
print 'description:', description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print 'revision:', revision
print ' timestamp:', timestamp
print ' author:', author
print ' state:', state
print ' branches:', branches
print ' next:', next
def set_revision_info(self, revision, log, text):
print 'revision:', revision
print ' log:', log
print ' text:', text[:100], '...'
class DumpSink:
"""Dump all the parse information directly to stdout.
The output is relatively unformatted and untagged. It is intended as a
raw dump of the data in the RCS file. A copy can be saved, then changes
made to the parsing engine, then a comparison of the new output against
the old output.
"""
def __init__(self):
global sha
import sha
def set_head_revision(self, revision):
print revision
def set_principal_branch(self, branch_name):
print branch_name
def define_tag(self, name, revision):
print name, revision
def set_comment(self, comment):
print comment
def set_description(self, description):
print description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print revision, timestamp, author, state, branches, next
def set_revision_info(self, revision, log, text):
print revision, sha.new(log).hexdigest(), sha.new(text).hexdigest()
def tree_completed(self):
print 'tree_completed'
def parse_completed(self):
print 'parse_completed'
def dump_file(fname):
Parser().parse(open(fname), DumpSink())
def time_file(fname):
import time
p = Parser().parse
f = open(fname)
s = Sink()
t = time.time()
p(f, s)
t = time.time() - t
print t
def _usage():
print 'This is normally a module for importing, but it has a couple'
print 'features for testing as an executable script.'
print 'USAGE: %s COMMAND filename,v' % sys.argv[0]
print ' where COMMAND is one of:'
print ' dump: filename is "dumped" to stdout'
print ' time: filename is parsed with the time written to stdout'
sys.exit(1)
if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
usage()
if sys.argv[1] == 'dump':
dump_file(sys.argv[2])
elif sys.argv[1] == 'time':
time_file(sys.argv[2])
else:
usage()

View File

@@ -1,339 +0,0 @@
# -*- Mode: python -*-
#
# Copyright (C) 2000-2001 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewCVS
# distribution or at http://viewcvs.sourceforge.net/license-1.html.
#
# Contact information:
# Greg Stein, PO Box 760, Palo Alto, CA, 94302
# gstein@lyra.org, http://viewcvs.sourceforge.net/
#
# -----------------------------------------------------------------------
#
import os
import string
import re
import time
## RLogOutputParser uses the output of rlog to build a list of Commit
## objects describing all the checkins from a given RCS file; this
## parser is fairly optimized, and therefore can be delicate if the
## rlog output varies between versions of rlog; I don't know if it does;
## to make really fast, I should wrap the C rcslib
## there's definately not much error checking here; I'll assume things
## will go smoothly, and trap errors via exception handlers above this
## function
## exception for this class
error = 'rlog error'
class RLogData:
"Container object for all data parsed from a 'rlog' output."
def __init__(self, filename):
self.filename = filename
self.symbolic_name_hash = {}
self.rlog_entry_list = []
def LookupBranch(self, rlog_entry):
index = string.rfind(rlog_entry.revision, '.')
branch_revision = rlog_entry.revision[:index]
try:
branch = self.symbolic_name_hash[branch_revision]
except KeyError:
branch = ''
return branch
class RLogEntry:
## static constants for type of log entry; this will be changed
## to strings I guess -JMP
CHANGE = 0
ADD = 1
REMOVE = 2
## Here's the init function, which isn't needed since this class
## is fully initalized by RLogParser when creating a new log entry.
## Let's keep this initializer as a description of what is held in
## the class, but keep it commented out since it only makes things
## slow.
##
## def __init__(self):
## self.revision = ''
## self.author = ''
## self.branch = ''
## self.pluscount = ''
## self.minuscount = ''
## self.description = ''
## self.time = None
## self.type = RLogEntry.CHANGE
class RLog:
"Provides a alternative file-like interface for running 'rlog'."
def __init__(self, cfg, filename, revision, date):
self.filename = self.fix_filename(filename)
self.checkout_filename = self.create_checkout_filename(self.filename)
self.revision = revision
self.date = date
arg_list = []
if self.revision:
arg_list.append('-r%s' % (self.revision))
if self.date:
arg_list.append('-d%s' % (self.date))
temp = os.path.join(cfg.general.rcs_path, "rlog")
self.cmd = '%s %s "%s"' % (temp, string.join(arg_list), self.filename)
self.rlog = os.popen(self.cmd, 'r')
def fix_filename(self, filename):
## all RCS files have the ",v" ending
if filename[-2:] != ",v":
filename = "%s,v" % (filename)
if os.path.isfile(filename):
return filename
## check the Attic for the RCS file
path, basename = os.path.split(filename)
filename = os.path.join(path, "Attic", basename)
if os.path.isfile(filename):
return filename
raise error, "rlog file not found: %s" % (filename)
def create_checkout_filename(self, filename):
## cut off the ",v"
checkout_filename = filename[:-2]
## check if the file is in the Attic
path, basename = os.path.split(checkout_filename)
if path[-6:] != '/Attic':
return checkout_filename
## remove the "Attic" part of the path
checkout_filename = os.path.join(path[:-6], basename)
return checkout_filename
def readline(self):
try:
line = self.rlog.readline()
except AttributeError:
self.error()
if line:
return line
status = self.close()
if status:
self.error()
return None
def close(self):
status = self.rlog.close()
self.rlog = None
return status
def error(self):
raise error, "unexpected rlog exit: %s" % (self.cmd)
## constants used in the output parser
_rlog_commit_sep = '----------------------------\n'
_rlog_end = '=============================================================================\n'
## regular expression used in the output parser
_re_symbolic_name = re.compile("\s+([^:]+):\s+(.+)$")
_re_revision = re.compile("^revision\s+([0-9.]+).*")
_re_data_line = re.compile(
"^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+"\
"author:\s+([^;]+);\s+"\
"state:\s+([^;]+);\s+"\
"lines:\s+\+(\d+)\s+\-(\d+)$")
_re_data_line_add = re.compile(
"^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+"\
"author:\s+([^;]+);\s+"\
"state:\s+([^;]+);$")
class RLogOutputParser:
def __init__(self, rlog):
self.rlog = rlog
self.rlog_data = RLogData(rlog.checkout_filename)
## run the parser
self.parse_to_symbolic_names()
self.parse_symbolic_names()
self.parse_to_description()
self.parse_rlog_entries()
def parse_to_symbolic_names(self):
while 1:
line = self.rlog.readline()
if line[:15] == 'symbolic names:':
break
def parse_symbolic_names(self):
## parse all the tags int the branch_hash, it's used later to get
## the text names of non-head branches
while 1:
line = self.rlog.readline()
match = _re_symbolic_name.match(line)
if not match:
break
(tag, revision) = match.groups()
## check if the tag represents a branch, in RCS this means
## the second-to-last number is a zero
index = string.rfind(revision, '.')
if revision[index-2:index] == '.0':
revision = revision[:index-2] + revision[index:]
self.rlog_data.symbolic_name_hash[revision] = tag
def parse_to_description(self):
while 1:
line = self.rlog.readline()
if line[:12] == 'description:':
break
## eat all lines until we reach '-----' seperator
while 1:
line = self.rlog.readline()
if line == _rlog_commit_sep:
break
def parse_rlog_entries(self):
while 1:
rlog_entry = self.parse_one_rlog_entry()
if not rlog_entry:
break
self.rlog_data.rlog_entry_list.append(rlog_entry)
def parse_one_rlog_entry(self):
## revision line/first line
line = self.rlog.readline()
# Since FreeBSD's rlog outputs extra "---...---\n" before
# "===...===\n", _rlog_end may be occured here.
if not line or line == _rlog_end:
return None
## revision
match = _re_revision.match(line)
(revision,) = match.groups()
## data line
line = self.rlog.readline()
match = _re_data_line.match(line)
if not match:
match = _re_data_line_add.match(line)
if not match:
raise error, "bad rlog parser, no cookie!"
## retrieve the matched grops as a tuple in hopes
## this will be faster (ala profiler)
groups = match.groups()
year = string.atoi(groups[0])
month = string.atoi(groups[1])
day = string.atoi(groups[2])
hour = string.atoi(groups[3])
minute = string.atoi(groups[4])
second = string.atoi(groups[5])
author = groups[6]
state = groups[7]
## very strange; here's the deal: if this is a newly added file,
## then there is no plus/minus count count of lines; if there
## is, then this could be a "CHANGE" or "REMOVE", you can tell
## if the file has been removed by looking if state == 'dead'
try:
pluscount = groups[8]
minuscount = groups[9]
except IndexError:
pluscount = ''
minuscount = ''
cmit_type = RLogEntry.ADD
else:
if state == 'dead':
cmit_type = RLogEntry.REMOVE
else:
cmit_type = RLogEntry.CHANGE
## branch line: pretty much ignored if it's there
desc_line_list = []
line = self.rlog.readline()
if not line[:10] == 'branches: ':
desc_line_list.append(string.rstrip(line))
## suck up description
while 1:
line = self.rlog.readline()
## the last line printed out by rlog is '===='...
## or '------'... between entries
if line == _rlog_commit_sep or line == _rlog_end:
break
## append line to the descripton list
desc_line_list.append(string.rstrip(line))
## compute time using time routines in seconds from epoc GMT
## NOTE: mktime's arguments are in local time, and we have
## them in GMT from RCS; therefore, we have to manually
## subtract out the timezone correction
##
## XXX: Linux glib2.0.7 bug: it looks like mktime doesn't honor
## the '0' flag to force no timezone correction, so we look
## at the correction ourself and do the right thing after
## mktime mangles the date
gmt_time = \
time.mktime((year, month, day, hour, minute, second, 0, 0, -1))
if time.localtime(gmt_time)[8] == 1:
# dst time active?
# XXX: This is still wrong in those both nights,
# where the switch between DST and normal time occurs.
gmt_time = gmt_time - time.altzone
else:
gmt_time = gmt_time - time.timezone
## now create and return the RLogEntry
rlog_entry = RLogEntry()
rlog_entry.type = cmit_type
rlog_entry.revision = revision
rlog_entry.author = author
rlog_entry.description = string.join(desc_line_list, '\n')
rlog_entry.time = gmt_time
rlog_entry.pluscount = pluscount
rlog_entry.minuscount = minuscount
return rlog_entry
## entrypoints
def GetRLogData(cfg, path, revision = '', date = ''):
rlog = RLog(cfg, path, revision, date)
rlog_parser = RLogOutputParser(rlog)
return rlog_parser.rlog_data

445
lib/sapi.py Normal file
View File

@@ -0,0 +1,445 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# generic server api - currently supports normal cgi, mod_python, and
# active server pages
#
# -----------------------------------------------------------------------
import types
import os
import sys
import re
import cgi
# global server object. It will be either a CgiServer, a WsgiServer,
# or a proxy to an AspServer or ModPythonServer object.
server = None
# Simple HTML string escaping. Note that we always escape the
# double-quote character -- ViewVC shouldn't ever need to preserve
# that character as-is, and sometimes needs to embed escaped values
# into HTML attributes.
def escape(s):
try: s = s.encode('utf8')
except: pass
s = str(s)
s = s.replace('&', '&amp;')
s = s.replace('>', '&gt;')
s = s.replace('<', '&lt;')
s = s.replace('"', "&quot;")
return s
class Server:
def __init__(self):
self.pageGlobals = {}
def self(self):
return self
def escape(self, s):
return escape(s)
def close(self):
pass
class ThreadedServer(Server):
def __init__(self):
Server.__init__(self)
self.inheritableOut = 0
global server
if not isinstance(server, ThreadedServerProxy):
server = ThreadedServerProxy()
if not isinstance(sys.stdout, File):
sys.stdout = File(server)
server.registerThread(self)
def file(self):
return File(self)
def close(self):
server.unregisterThread()
class ThreadedServerProxy:
"""In a multithreaded server environment, ThreadedServerProxy stores the
different server objects being used to display pages and transparently
forwards access to them based on the current thread id."""
def __init__(self):
self.__dict__['servers'] = { }
global thread
import thread
def registerThread(self, server):
self.__dict__['servers'][thread.get_ident()] = server
def unregisterThread(self):
del self.__dict__['servers'][thread.get_ident()]
def self(self):
"""This function bypasses the getattr and setattr trickery and returns
the actual server object."""
return self.__dict__['servers'][thread.get_ident()]
def __getattr__(self, key):
return getattr(self.self(), key)
def __setattr__(self, key, value):
setattr(self.self(), key, value)
def __delattr__(self, key):
delattr(self.self(), key)
class File:
def __init__(self, server):
self.closed = 0
self.mode = 'w'
self.name = "<AspFile file>"
self.softspace = 0
self.server = server
def write(self, s):
self.server.write(s)
def writelines(self, list):
for s in list:
self.server.write(s)
def flush(self):
self.server.flush()
def truncate(self, size):
pass
def close(self):
pass
class CgiServer(Server):
def __init__(self, inheritableOut = 1):
Server.__init__(self)
self.headerSent = 0
self.headers = []
self.inheritableOut = inheritableOut
self.iis = os.environ.get('SERVER_SOFTWARE', '')[:13] == 'Microsoft-IIS'
if sys.platform == "win32" and inheritableOut:
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
global server
server = self
def addheader(self, name, value):
self.headers.append((name, value))
def header(self, content_type='text/html; charset=UTF-8', status=None):
if not self.headerSent:
self.headerSent = 1
extraheaders = ''
for (name, value) in self.headers:
extraheaders = extraheaders + '%s: %s\r\n' % (name, value)
# The only way ViewVC pages and error messages are visible under
# IIS is if a 200 error code is returned. Otherwise IIS instead
# sends the static error page corresponding to the code number.
if status is None or (status[:3] != '304' and self.iis):
status = ''
else:
status = 'Status: %s\r\n' % status
sys.stdout.write('%sContent-Type: %s\r\n%s\r\n'
% (status, content_type, extraheaders))
def redirect(self, url):
if self.iis: url = fix_iis_url(self, url)
self.addheader('Location', url)
self.header(status='301 Moved')
sys.stdout.write('This document is located <a href="%s">here</a>.\n' % url)
def getenv(self, name, value=None):
ret = os.environ.get(name, value)
if self.iis and name == 'PATH_INFO' and ret:
ret = fix_iis_path_info(self, ret)
return ret
def params(self):
return cgi.parse()
def FieldStorage(fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
return cgi.FieldStorage(fp, headers, outerboundary, environ,
keep_blank_values, strict_parsing)
def write(self, s):
sys.stdout.write(s)
def flush(self):
sys.stdout.flush()
def file(self):
return sys.stdout
class WsgiServer(Server):
def __init__(self, environ, start_response):
Server.__init__(self)
self._environ = environ
self._start_response = start_response;
self._headers = []
self._wsgi_write = None
self.headerSent = False
global server
server = self
def addheader(self, name, value):
self._headers.append((name, value))
def header(self, content_type='text/html; charset=UTF-8', status=None):
if not status:
status = "200 OK"
if not self.headerSent:
self.headerSent = True
self._headers.insert(0, ("Content-Type", content_type),)
self._wsgi_write = self._start_response("%s" % status, self._headers)
def redirect(self, url):
"""Redirect client to url. This discards any data that has been queued
to be sent to the user. But there should never by any anyway.
"""
self.addheader('Location', url)
self.header(status='301 Moved')
self._wsgi_write('This document is located <a href="%s">here</a>.' % url)
def getenv(self, name, value=None):
return self._environ.get(name, value)
def params(self):
return cgi.parse(environ=self._environ, fp=self._environ["wsgi.input"])
def FieldStorage(self, fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
return cgi.FieldStorage(self._environ["wsgi.input"], headers,
outerboundary, self._environ, keep_blank_values,
strict_parsing)
def write(self, s):
self._wsgi_write(s)
def flush(self):
pass
def file(self):
return File(self)
class AspServer(ThreadedServer):
def __init__(self, Server, Request, Response, Application):
ThreadedServer.__init__(self)
self.headerSent = 0
self.server = Server
self.request = Request
self.response = Response
self.application = Application
def addheader(self, name, value):
self.response.AddHeader(name, value)
def header(self, content_type=None, status=None):
# Normally, setting self.response.ContentType after headers have already
# been sent simply results in an AttributeError exception, but sometimes
# it leads to a fatal ASP error. For this reason I'm keeping the
# self.headerSent member and only checking for the exception as a
# secondary measure
if not self.headerSent:
try:
self.headerSent = 1
if content_type is None:
self.response.ContentType = 'text/html; charset=UTF-8'
else:
self.response.ContentType = content_type
if status is not None: self.response.Status = status
except AttributeError:
pass
def redirect(self, url):
self.response.Redirect(url)
def getenv(self, name, value = None):
ret = self.request.ServerVariables(name)()
if not type(ret) is types.UnicodeType:
return value
ret = str(ret)
if name == 'PATH_INFO':
ret = fix_iis_path_info(self, ret)
return ret
def params(self):
p = {}
for i in self.request.Form:
p[str(i)] = map(str, self.request.Form[i])
for i in self.request.QueryString:
p[str(i)] = map(str, self.request.QueryString[i])
return p
def FieldStorage(self, fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
# Code based on a very helpful usenet post by "Max M" (maxm@mxm.dk)
# Subject "Re: Help! IIS and Python"
# http://groups.google.com/groups?selm=3C7C0AB6.2090307%40mxm.dk
from StringIO import StringIO
from cgi import FieldStorage
environ = {}
for i in self.request.ServerVariables:
environ[str(i)] = str(self.request.ServerVariables(i)())
# this would be bad for uploaded files, could use a lot of memory
binaryContent, size = self.request.BinaryRead(int(environ['CONTENT_LENGTH']))
fp = StringIO(str(binaryContent))
fs = FieldStorage(fp, None, "", environ, keep_blank_values, strict_parsing)
fp.close()
return fs
def write(self, s):
t = type(s)
if t is types.StringType:
s = buffer(s)
elif not t is types.BufferType:
s = buffer(str(s))
self.response.BinaryWrite(s)
def flush(self):
self.response.Flush()
_re_status = re.compile("\\d+")
class ModPythonServer(ThreadedServer):
def __init__(self, request):
ThreadedServer.__init__(self)
self.request = request
self.headerSent = 0
def addheader(self, name, value):
self.request.headers_out.add(name, value)
def header(self, content_type=None, status=None):
if content_type is None:
self.request.content_type = 'text/html; charset=UTF-8'
else:
self.request.content_type = content_type
self.headerSent = 1
if status is not None:
m = _re_status.match(status)
if not m is None:
self.request.status = int(m.group())
def redirect(self, url):
import mod_python.apache
self.request.headers_out['Location'] = url
self.request.status = mod_python.apache.HTTP_MOVED_TEMPORARILY
self.request.write("You are being redirected to <a href=\"%s\">%s</a>"
% (url, url))
def getenv(self, name, value = None):
try:
return self.request.subprocess_env[name]
except KeyError:
return value
def params(self):
import mod_python.util
if self.request.args is None:
return {}
else:
return mod_python.util.parse_qs(self.request.args)
def FieldStorage(self, fp=None, headers=None, outerboundary="",
environ=os.environ, keep_blank_values=0, strict_parsing=0):
import mod_python.util
return mod_python.util.FieldStorage(self.request, keep_blank_values, strict_parsing)
def write(self, s):
self.request.write(s)
def flush(self):
pass
def fix_iis_url(server, url):
"""When a CGI application under IIS outputs a "Location" header with a url
beginning with a forward slash, IIS tries to optimise the redirect by not
returning any output from the original CGI script at all and instead just
returning the new page in its place. Because of this, the browser does
not know it is getting a different page than it requested. As a result,
The address bar that appears in the browser window shows the wrong location
and if the new page is in a different folder than the old one, any relative
links on it will be broken.
This function can be used to circumvent the IIS "optimization" of local
redirects. If it is passed a location that begins with a forward slash it
will return a URL constructed with the information in CGI environment.
If it is passed a URL or any location that doens't begin with a forward slash
it will return just argument unaltered.
"""
if url[0] == '/':
if server.getenv('HTTPS') == 'on':
dport = "443"
prefix = "https://"
else:
dport = "80"
prefix = "http://"
prefix = prefix + server.getenv('HTTP_HOST')
if server.getenv('SERVER_PORT') != dport:
prefix = prefix + ":" + server.getenv('SERVER_PORT')
return prefix + url
return url
def fix_iis_path_info(server, path_info):
"""Fix the PATH_INFO value in IIS"""
# If the viewvc cgi's are in the /viewvc/ folder on the web server and a
# request looks like
#
# /viewvc/viewvc.cgi/myproject/?someoption
#
# The CGI environment variables on IIS will look like this:
#
# SCRIPT_NAME = /viewvc/viewvc.cgi
# PATH_INFO = /viewvc/viewvc.cgi/myproject/
#
# Whereas on Apache they look like:
#
# SCRIPT_NAME = /viewvc/viewvc.cgi
# PATH_INFO = /myproject/
#
# This function converts the IIS PATH_INFO into the nonredundant form
# expected by ViewVC
return path_info[len(server.getenv('SCRIPT_NAME', '')):]

56
lib/vcauth/__init__.py Normal file
View File

@@ -0,0 +1,56 @@
# -*-python-*-
#
# Copyright (C) 2006-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""Generic API for implementing authorization checks employed by ViewVC."""
class GenericViewVCAuthorizer:
"""Abstract class encapsulating version control authorization routines."""
def __init__(self, username=None, params={}):
"""Create a GenericViewVCAuthorizer object which will be used to
validate that USERNAME has the permissions needed to view version
control repositories (in whole or in part). PARAMS is a
dictionary of custom parameters for the authorizer."""
pass
def check_root_access(self, rootname):
"""Return 1 iff the associated username is permitted to read ROOTNAME."""
pass
def check_universal_access(self, rootname):
"""Return 1 if the associated username is permitted to read every
path in the repository at every revision, 0 if the associated
username is prohibited from reading any path in the repository, or
None if no such determination can be made (perhaps because the
cost of making it is too great)."""
pass
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
"""Return 1 iff the associated username is permitted to read
revision REV of the path PATH_PARTS (of type PATHTYPE) in
repository ROOTNAME."""
pass
##############################################################################
class ViewVCAuthorizer(GenericViewVCAuthorizer):
"""The uber-permissive authorizer."""
def check_root_access(self, rootname):
return 1
def check_universal_access(self, rootname):
return 1
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
return 1

View File

@@ -0,0 +1,92 @@
# -*-python-*-
#
# Copyright (C) 2009 Vitaliy Filippov.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import vcauth
import vclib
import string
from xml.dom.minidom import parse
class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
"""An authorizer which uses CVSnt access control lists (which are in form
of XML files in CVS/ subdirectories in the repository)."""
def __init__(self, username, params={}):
self.username = username
self.params = params
self.cfg = params['__config']
self.default = params.get('default', 0)
self.cached = {}
self.xmlcache = {}
def dom_rights(self, doc, rightname, filename, username):
result = None
if filename:
for node in doc.getElementsByTagName('file'):
if node.getAttribute('name') == filename:
for acl in node.getElementsByTagName('acl'):
if not acl.getAttribute('branch'):
u = acl.getAttribute('user')
if result is None and (not u or u == 'anonymous') or u == username:
for r in acl.getElementsByTag(rightname):
result = not r.getAttribute('deny')
break
if result is None:
for node in doc.getElementsByTagName('directory'):
for acl in node.getElementsByTagName('acl'):
if not acl.getAttribute('branch'):
u = acl.getAttribute('user')
if result is None and (not u or u == 'anonymous') or u == username:
for r in acl.getElementsByTag(rightname):
result = not r.getAttribute('deny')
return result
def check(self, rootname, path_parts, filename):
d = self.cfg.general.cvs_roots.get(rootname,None)
if not d:
return self.default
i = len(path_parts)
r = None
while i >= 0:
try:
xml = d
if len(path_parts):
xml = xml + '/' + string.join(path_parts, '/')
xml = xml + '/CVS/fileattr.xml'
if self.cached.get(xml, None) is not None:
return self.cached.get(xml, None)
doc = self.xmlcache.get(xml, None)
if doc is None:
doc = parse(xml)
self.xmlcache[xml] = doc
r = self.dom_rights(doc, 'read', filename, self.username)
if r is not None:
self.cached[xml] = r
return r
raise Exception(None)
except:
if len(path_parts) > 0:
path_parts = path_parts[:-1]
filename = ''
i = i-1
return self.default
def check_root_access(self, rootname):
return self.check(rootname, [], '')
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
if not path_parts:
return self.check(rootname, [], '')
if pathtype == vclib.DIR:
return self.check(rootname, path_parts, '')
f = path_parts[-1]
path_parts = path_parts[:-1]
return self.check(rootname, path_parts, f)

View File

@@ -0,0 +1,52 @@
# -*-python-*-
#
# Copyright (C) 2006-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import vcauth
import vclib
import fnmatch
class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
"""A simple top-level module authorizer."""
def __init__(self, username, params={}):
forbidden = params.get('forbidden', '')
self.forbidden = map(lambda x: x.strip(),
filter(None, forbidden.split(',')))
def check_root_access(self, rootname):
return 1
def check_universal_access(self, rootname):
# If there aren't any forbidden paths, we can grant universal read
# access. Otherwise, we make no claim.
if not self.forbidden:
return 1
return None
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
# No path? No problem.
if not path_parts:
return 1
# Not a directory? We aren't interested.
if pathtype != vclib.DIR:
return 1
# At this point we're looking at a directory path.
module = path_parts[0]
default = 1
for pat in self.forbidden:
if pat[0] == '!':
default = 0
if fnmatch.fnmatchcase(module, pat[1:]):
return 1
elif fnmatch.fnmatchcase(module, pat):
return 0
return default

View File

@@ -0,0 +1,64 @@
# -*-python-*-
#
# Copyright (C) 2008-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import vcauth
import vclib
import fnmatch
import re
def _split_regexp(restr):
"""Return a 2-tuple consisting of a compiled regular expression
object and a boolean flag indicating if that object should be
interpreted inversely."""
if restr[0] == '!':
return re.compile(restr[1:]), 1
return re.compile(restr), 0
class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
"""A simple regular-expression-based authorizer."""
def __init__(self, username, params={}):
forbidden = params.get('forbiddenre', '')
self.forbidden = map(lambda x: _split_regexp(x.strip()),
filter(None, forbidden.split(',')))
def _check_root_path_access(self, root_path):
default = 1
for forbidden, negated in self.forbidden:
if negated:
default = 0
if forbidden.search(root_path):
return 1
elif forbidden.search(root_path):
return 0
return default
def check_root_access(self, rootname):
return self._check_root_path_access(rootname)
def check_universal_access(self, rootname):
# If there aren't any forbidden regexps, we can grant universal
# read access. Otherwise, we make no claim.
if not self.forbidden:
return 1
return None
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
root_path = rootname
if path_parts:
root_path = root_path + '/' + '/'.join(path_parts)
if pathtype == vclib.DIR:
root_path = root_path + '/'
else:
root_path = root_path + '/'
return self._check_root_path_access(root_path)

View File

@@ -0,0 +1,62 @@
# -*-python-*-
#
# Copyright (C) 2009 Vitaliy Filippov.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import vcauth
import vclib
import string
import grp
import re
class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
"""A simple authorizer checking system group membership for every
repository and every user."""
def __init__(self, username, params={}):
self.username = username
self.params = params
self.cfg = params['__config']
self.cached = {}
self.grp = {}
self.byroot = {}
self.fmt = map(lambda l: l.strip(), params.get('group_name_format', 'svn.%s|svn.%s.ro').split('|'))
byr = params.get('by_root', '')
for i in byr.split(','):
if i.find(':') < 0:
continue
(root, auth) = i.split(':', 2)
self.byroot[root.strip()] = map(lambda l: l.strip(), auth.split('|'))
def check_root_access(self, rootname):
r = self.cached.get(rootname, None)
if r is not None:
return r
grent = self.grp.get(rootname, None)
if grent is None:
grent = map(lambda grn: self.getgrnam(grn, rootname), self.byroot.get(rootname, self.fmt))
self.grp[rootname] = grent
r = 0
for i in grent:
if i and i.gr_mem and len(i.gr_mem) and self.username in i.gr_mem:
r = 1
break
self.cached[rootname] = r
return r
def getgrnam(self, grn, rootname):
try:
r = grp.getgrnam(grn.replace('%s', re.sub('[^\w\.\-]+', '', rootname)))
except KeyError:
r = None
return r
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
return self.check_root_access(rootname)

View File

@@ -0,0 +1,269 @@
# -*-python-*-
#
# Copyright (C) 2006-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
# (c) 2006 Sergey Lapin <slapin@dataart.com>
import vcauth
import os.path
import debug
from ConfigParser import ConfigParser
class ViewVCAuthorizer(vcauth.GenericViewVCAuthorizer):
"""Subversion authz authorizer module"""
def __init__(self, username, params={}):
self.rootpaths = { } # {root -> { paths -> access boolean for USERNAME }}
# Get the authz file location from a passed-in parameter.
self.authz_file = params.get('authzfile')
if not self.authz_file:
raise debug.ViewVCException("No authzfile configured")
if not os.path.exists(self.authz_file):
raise debug.ViewVCException("Configured authzfile file not found")
# See if the admin wants us to do case normalization of usernames.
self.force_username_case = params.get('force_username_case')
if self.force_username_case == "upper":
self.username = username and username.upper() or username
elif self.force_username_case == "lower":
self.username = username and username.lower() or username
elif not self.force_username_case:
self.username = username
else:
raise debug.ViewVCException("Invalid value for force_username_case "
"option")
def _get_paths_for_root(self, rootname):
if self.rootpaths.has_key(rootname):
return self.rootpaths[rootname]
paths_for_root = { }
# Parse the authz file, replacing ConfigParser's optionxform()
# method with something that won't futz with the case of the
# option names.
cp = ConfigParser()
cp.optionxform = lambda x: x
try:
cp.read(self.authz_file)
except:
raise debug.ViewVCException("Unable to parse configured authzfile file")
# Figure out if there are any aliases for the current username
aliases = []
if cp.has_section('aliases'):
for alias in cp.options('aliases'):
entry = cp.get('aliases', alias)
if entry == self.username:
aliases.append(alias)
# Figure out which groups USERNAME has a part of.
groups = []
if cp.has_section('groups'):
all_groups = []
def _process_group(groupname):
"""Inline function to handle groups within groups.
For a group to be within another group in SVN, the group
definitions must be in the correct order in the config file.
ie. If group A is a member of group B then group A must be
defined before group B in the [groups] section.
Unfortunately, the ConfigParser class provides no way of
finding the order in which groups were defined so, for reasons
of practicality, this function lets you get away with them
being defined in the wrong order. Recursion is guarded
against though."""
# If we already know the user is part of this already-
# processed group, return that fact.
if groupname in groups:
return 1
# Otherwise, ensure we don't process a group twice.
if groupname in all_groups:
return 0
# Store the group name in a global list so it won't be processed again
all_groups.append(groupname)
group_member = 0
groupname = groupname.strip()
entries = cp.get('groups', groupname).split(',')
for entry in entries:
entry = entry.strip()
if entry == self.username:
group_member = 1
break
elif entry[0:1] == "@" and _process_group(entry[1:]):
group_member = 1
break
elif entry[0:1] == "&" and entry[1:] in aliases:
group_member = 1
break
if group_member:
groups.append(groupname)
return group_member
# Process the groups
for group in cp.options('groups'):
_process_group(group)
def _userspec_matches_user(userspec):
# If there is an inversion character, recurse and return the
# opposite result.
if userspec[0:1] == '~':
return not _userspec_matches_user(userspec[1:])
# See if the userspec applies to our current user.
return userspec == '*' \
or userspec == self.username \
or (self.username is not None and userspec == "$authenticated") \
or (self.username is None and userspec == "$anonymous") \
or (userspec[0:1] == "@" and userspec[1:] in groups) \
or (userspec[0:1] == "&" and userspec[1:] in aliases)
def _process_access_section(section):
"""Inline function for determining user access in a single
config secction. Return a two-tuple (ALLOW, DENY) containing
the access determination for USERNAME in a given authz file
SECTION (if any)."""
# Figure if this path is explicitly allowed or denied to USERNAME.
allow = deny = 0
for user in cp.options(section):
user = user.strip()
if _userspec_matches_user(user):
# See if the 'r' permission is among the ones granted to
# USER. If so, we can stop looking. (Entry order is not
# relevant -- we'll use the most permissive entry, meaning
# one 'allow' is all we need.)
allow = cp.get(section, user).find('r') != -1
deny = not allow
if allow:
break
return allow, deny
# Read the other (non-"groups") sections, and figure out in which
# repositories USERNAME or his groups have read rights. We'll
# first check groups that have no specific repository designation,
# then superimpose those that have a repository designation which
# matches the one we're asking about.
root_sections = []
for section in cp.sections():
# Skip the "groups" section -- we handled that already.
if section == 'groups':
continue
if section == 'aliases':
continue
# Process root-agnostic access sections; skip (but remember)
# root-specific ones that match our root; ignore altogether
# root-specific ones that don't match our root. While we're at
# it, go ahead and figure out the repository path we're talking
# about.
if section.find(':') == -1:
path = section
else:
name, path = section.split(':', 1)
if name == rootname:
root_sections.append(section)
continue
# Check for a specific access determination.
allow, deny = _process_access_section(section)
# If we got an explicit access determination for this path and this
# USERNAME, record it.
if allow or deny:
if path != '/':
path = '/' + '/'.join(filter(None, path.split('/')))
paths_for_root[path] = allow
# Okay. Superimpose those root-specific values now.
for section in root_sections:
# Get the path again.
name, path = section.split(':', 1)
# Check for a specific access determination.
allow, deny = _process_access_section(section)
# If we got an explicit access determination for this path and this
# USERNAME, record it.
if allow or deny:
if path != '/':
path = '/' + '/'.join(filter(None, path.split('/')))
paths_for_root[path] = allow
# If the root isn't readable, there's no point in caring about all
# the specific paths the user can't see. Just point the rootname
# to a None paths dictionary.
root_is_readable = 0
for path in paths_for_root.keys():
if paths_for_root[path]:
root_is_readable = 1
break
if not root_is_readable:
paths_for_root = None
self.rootpaths[rootname] = paths_for_root
return paths_for_root
def check_root_access(self, rootname):
paths = self._get_paths_for_root(rootname)
return (paths is not None) and 1 or 0
def check_universal_access(self, rootname):
paths = self._get_paths_for_root(rootname)
if not paths: # None or empty.
return 0
# Search the access determinations. If there's a mix, we can't
# claim a universal access determination.
found_allow = 0
found_deny = 0
for access in paths.values():
if access:
found_allow = 1
else:
found_deny = 1
if found_allow and found_deny:
return None
# We didn't find both allowances and denials, so we must have
# found one or the other. Denials only is a universal denial.
if found_deny:
return 0
# ... but allowances only is only a universal allowance if read
# access is granted to the root directory.
if found_allow and paths.has_key('/'):
return 1
# Anything else is indeterminable.
return None
def check_path_access(self, rootname, path_parts, pathtype, rev=None):
# Crawl upward from the path represented by PATH_PARTS toward to
# the root of the repository, looking for an explicitly grant or
# denial of access.
paths = self._get_paths_for_root(rootname)
if paths is None:
return 0
parts = path_parts[:]
while parts:
path = '/' + '/'.join(parts)
if paths.has_key(path):
return paths[path]
del parts[-1]
return paths.get('/', 0)

457
lib/vclib/__init__.py Normal file
View File

@@ -0,0 +1,457 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""Version Control lib is an abstract API to access versioning systems
such as CVS.
"""
import types
# item types returned by Repository.itemtype().
FILE = 'FILE'
DIR = 'DIR'
# diff types recognized by Repository.rawdiff().
UNIFIED = 1
CONTEXT = 2
SIDE_BY_SIDE = 3
# root types returned by Repository.roottype().
CVS = 'cvs'
SVN = 'svn'
# action kinds found in ChangedPath.action
ADDED = 'added'
DELETED = 'deleted'
REPLACED = 'replaced'
MODIFIED = 'modified'
# log sort keys
SORTBY_DEFAULT = 0 # default/no sorting
SORTBY_DATE = 1 # sorted by date, youngest first
SORTBY_REV = 2 # sorted by revision, youngest first
# ======================================================================
#
class Repository:
"""Abstract class representing a repository."""
def rootname(self):
"""Return the name of this repository."""
def roottype(self):
"""Return the type of this repository (vclib.CVS, vclib.SVN, ...)."""
def rootpath(self):
"""Return the location of this repository."""
def authorizer(self):
"""Return the vcauth.Authorizer object associated with this
repository, or None if no such association has been made."""
def open(self):
"""Open a connection to the repository."""
def itemtype(self, path_parts, rev):
"""Return the type of the item (file or dir) at the given path and revision
The result will be vclib.DIR or vclib.FILE
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to check
"""
pass
def openfile(self, path_parts, rev, options):
"""Open a file object to read file contents at a given path and revision.
The return value is a 2-tuple of containg the file object and revision
number in canonical form.
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the file to check out
options is a dictionary of implementation specific options
"""
def listdir(self, path_parts, rev, options):
"""Return list of files in a directory
The result is a list of DirEntry objects
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the directory to list
options is a dictionary of implementation specific options
"""
def dirlogs(self, path_parts, rev, entries, options):
"""Augment directory entries with log information
New properties will be set on all of the DirEntry objects in the entries
list. At the very least, a "rev" property will be set to a revision
number or None if the entry doesn't have a number. Other properties that
may be set include "date", "author", "log", "size", and "lockinfo".
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the directory listing and will effect which log
messages are returned
entries is a list of DirEntry objects returned from a previous call to
the listdir() method
options is a dictionary of implementation specific options
"""
def itemlog(self, path_parts, rev, sortby, first, limit, options):
"""Retrieve an item's log information
The result is a list of Revision objects
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about
sortby indicates the way in which the returned list should be
sorted (SORTBY_DEFAULT, SORTBY_DATE, SORTBY_REV)
first is the 0-based index of the first Revision returned (after
sorting, if any, has occured)
limit is the maximum number of returned Revisions, or 0 to return
all available data
options is a dictionary of implementation specific options
"""
def itemprops(self, path_parts, rev):
"""Return a dictionary mapping property names to property values
for properties stored on an item.
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about.
"""
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
"""Return a diff (in GNU diff format) of two file revisions
type is the requested diff type (UNIFIED, CONTEXT, etc)
options is a dictionary that can contain the following options plus
implementation-specific options
context - integer, number of context lines to include
funout - boolean, include C function names
ignore_white - boolean, ignore whitespace
Return value is a python file object
"""
def annotate(self, path_parts, rev, include_text=False):
"""Return a list of Annotation object, sorted by their
"line_number" components, which describe the lines of given
version of a file.
The file path is specified as a list of components, relative to
the root of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about.
If include_text is true, populate the Annotation objects' "text"
members with the corresponding line of file content; otherwise,
leave that member set to None."""
def revinfo(self, rev):
"""Return information about a global revision
rev is the revision of the item to return information about
Return value is a 5-tuple containing: the date, author, log
message, a list of ChangedPath items representing paths changed,
and a dictionary mapping property names to property values for
properties stored on an item.
Raise vclib.UnsupportedFeature if the version control system
doesn't support a global revision concept.
"""
def isexecutable(self, path_parts, rev):
"""Return true iff a given revision of a versioned file is to be
considered an executable program or script.
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about
"""
def filesize(self, path_parts, rev):
"""Return the size of a versioned file's contents if it can be
obtained without a brute force measurement; -1 otherwise.
NOTE: Callers that require a filesize answer when this function
returns -1 may obtain it by measuring the data returned via
openfile().
The path is specified as a list of components, relative to the root
of the repository. e.g. ["subdir1", "subdir2", "filename"]
rev is the revision of the item to return information about
"""
# ======================================================================
class DirEntry:
"""Instances represent items in a directory listing"""
def __init__(self, name, kind, errors=[]):
"""Create a new DirEntry() item:
NAME: The name of the directory entry
KIND: The path kind of the entry (vclib.DIR, vclib.FILE)
ERRORS: A list of error strings representing problems encountered
while determining the other info about this entry
"""
self.name = name
self.kind = kind
self.errors = errors
class Revision:
"""Instances holds information about revisions of versioned resources"""
def __init__(self, number, string, date, author, changed, log, size, lockinfo):
"""Create a new Revision() item:
NUMBER: Revision in an integer-based, sortable format
STRING: Revision as a string
DATE: Seconds since Epoch (GMT) that this revision was created
AUTHOR: Author of the revision
CHANGED: Lines-changed (contextual diff) information
LOG: Log message associated with the creation of this revision
SIZE: Size (in bytes) of this revision's fulltext (files only)
LOCKINFO: Information about locks held on this revision
"""
self.number = number
self.string = string
self.date = date
self.author = author
self.changed = changed
self.log = log
self.size = size
self.lockinfo = lockinfo
def __cmp__(self, other):
return cmp(self.number, other.number)
class Annotation:
"""Instances represent per-line file annotation information"""
def __init__(self, text, line_number, rev, prev_rev, author, date):
"""Create a new Annotation() item:
TEXT: Raw text of a line of file contents
LINE_NUMBER: Line number on which the line is found
REV: Revision in which the line was last modified
PREV_REV: Revision prior to 'rev'
AUTHOR: Author who last modified the line
DATE: Date on which the line was last modified, in seconds since
the epoch, GMT
"""
self.text = text
self.line_number = line_number
self.rev = rev
self.prev_rev = prev_rev
self.author = author
self.date = date
class ChangedPath:
"""Instances represent changes to paths"""
def __init__(self, path_parts, rev, pathtype, base_path_parts,
base_rev, action, copied, text_changed, props_changed):
"""Create a new ChangedPath() item:
PATH_PARTS: Path that was changed
REV: Revision represented by this change
PATHTYPE: Type of this path (vclib.DIR, vclib.FILE, ...)
BASE_PATH_PARTS: Previous path for this changed item
BASE_REV: Previous revision for this changed item
ACTION: Kind of change (vclib.ADDED, vclib.DELETED, ...)
COPIED: Boolean -- was this path copied from elsewhere?
TEXT_CHANGED: Boolean -- did the file's text change?
PROPS_CHANGED: Boolean -- did the item's metadata change?
"""
self.path_parts = path_parts
self.rev = rev
self.pathtype = pathtype
self.base_path_parts = base_path_parts
self.base_rev = base_rev
self.action = action
self.copied = copied
self.text_changed = text_changed
self.props_changed = props_changed
# ======================================================================
class Error(Exception):
pass
class ReposNotFound(Error):
pass
class UnsupportedFeature(Error):
pass
class ItemNotFound(Error):
def __init__(self, path):
# use '/' rather than os.sep because this is for user consumption, and
# it was defined using URL separators
if type(path) in (types.TupleType, types.ListType):
path = '/'.join(path)
Error.__init__(self, path)
class InvalidRevision(Error):
def __init__(self, revision=None):
if revision is None:
Error.__init__(self, "Invalid revision")
else:
Error.__init__(self, "Invalid revision " + str(revision))
class NonTextualFileContents(Error):
pass
# ======================================================================
# Implementation code used by multiple vclib modules
import tempfile
import os
import time
def _diff_args(type, options):
"""generate argument list to pass to diff or rcsdiff"""
args = []
if type == CONTEXT:
if options.has_key('context'):
if options['context'] is None:
args.append('--context=%i' % 0x01ffffff)
else:
args.append('--context=%i' % options['context'])
else:
args.append('-c')
elif type == UNIFIED:
if options.has_key('context'):
if options['context'] is None:
args.append('--unified=%i' % 0x01ffffff)
else:
args.append('--unified=%i' % options['context'])
else:
args.append('-u')
elif type == SIDE_BY_SIDE:
args.append('--side-by-side')
args.append('--width=164')
else:
raise NotImplementedError
if options.get('funout', 0):
args.append('-p')
if options.get('ignore_white', 0):
args.append('-w')
return args
class _diff_fp:
"""File object reading a diff between temporary files, cleaning up
on close"""
def __init__(self, temp1, temp2, info1=None, info2=None, diff_cmd='diff', diff_opts=[]):
self.temp1 = temp1
self.temp2 = temp2
self.temp3 = tempfile.mktemp()
args = diff_opts[:]
if info1 and info2:
args.extend(["-L", self._label(info1), "-L", self._label(info2)])
args.extend([temp1, temp2])
args.insert(0, diff_cmd)
os.system("'"+"' '".join(args)+"' > '"+self.temp3+"' 2> '"+self.temp3+"'")
self.fp = open(self.temp3, 'rb')
self.fp.seek(0)
def read(self, bytes):
return self.fp.read(bytes)
def readline(self):
return self.fp.readline()
def readlines(self):
return self.fp.readlines()
def close(self):
try:
if self.fp:
self.fp.close()
self.fp = None
finally:
try:
if self.temp1 and self.temp1 != '/dev/null':
os.remove(self.temp1)
self.temp1 = None
finally:
if self.temp2 and self.temp2 != '/dev/null':
os.remove(self.temp2)
self.temp2 = None
try:
os.remove(self.temp3)
finally:
self.temp3 = None
def __del__(self):
self.close()
def _label(self, (path, date, rev)):
date = date and time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date))
return "%s\t%s\t%s" % (path, date, rev)
def check_root_access(repos):
"""Return 1 iff the associated username is permitted to read REPOS,
as determined by consulting REPOS's Authorizer object (if any)."""
auth = repos.authorizer()
if not auth:
return 1
return auth.check_root_access(repos.rootname())
def check_path_access(repos, path_parts, pathtype=None, rev=None):
"""Return 1 iff the associated username is permitted to read
revision REV of the path PATH_PARTS (of type PATHTYPE) in repository
REPOS, as determined by consulting REPOS's Authorizer object (if any)."""
auth = repos.authorizer()
if not auth:
return 1
if not pathtype:
pathtype = repos.itemtype(path_parts, rev)
if not path_parts:
return auth.check_root_access(repos.rootname())
return auth.check_path_access(repos.rootname(), path_parts, pathtype, rev)

View File

@@ -0,0 +1,67 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import os
import os.path
import time
def cvs_strptime(timestr):
return time.strptime(timestr, '%Y/%m/%d %H:%M:%S')[:-1] + (0,)
def canonicalize_rootpath(rootpath):
assert os.path.isabs(rootpath)
return os.path.normpath(rootpath)
def _is_cvsroot(path):
return os.path.exists(os.path.join(path, "CVSROOT", "config"))
def expand_root_parent(parent_path):
# Each subdirectory of PARENT_PATH that contains a child
# "CVSROOT/config" is added the set of returned roots. Or, if the
# PARENT_PATH itself contains a child "CVSROOT/config", then all its
# subdirectories are returned as roots.
assert os.path.isabs(parent_path)
roots = {}
subpaths = os.listdir(parent_path)
for rootname in subpaths:
rootpath = os.path.join(parent_path, rootname)
if _is_cvsroot(parent_path) or _is_cvsroot(rootpath):
roots[rootname] = canonicalize_rootpath(rootpath)
return roots
def find_root_in_parent(parent_path, rootname):
"""Search PARENT_PATH for a root named ROOTNAME, returning the
canonicalized ROOTPATH of the root if found; return None if no such
root is found."""
# Is PARENT_PATH itself a CVS repository? If so, we allow ROOTNAME
# to be any subdir within it. Otherwise, we expect
# PARENT_PATH/ROOTNAME to be a CVS repository.
assert os.path.isabs(parent_path)
rootpath = os.path.join(parent_path, rootname)
if (_is_cvsroot(parent_path) and os.path.exists(rootpath)) \
or _is_cvsroot(rootpath):
return canonicalize_rootpath(rootpath)
return None
def CVSRepository(name, rootpath, authorizer, utilities, use_rcsparse, charset_guesser = None):
rootpath = canonicalize_rootpath(rootpath)
if use_rcsparse:
import ccvs
return ccvs.CCVSRepository(name, rootpath, authorizer, utilities, charset_guesser)
else:
import bincvs
return bincvs.BinCVSRepository(name, rootpath, authorizer, utilities, charset_guesser)

1247
lib/vclib/ccvs/bincvs.py Normal file

File diff suppressed because it is too large Load Diff

467
lib/vclib/ccvs/blame.py Normal file
View File

@@ -0,0 +1,467 @@
#!/usr/bin/env python
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
# Copyright (C) 2000 Curt Hagenlocher <curt@hagenlocher.org>
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# blame.py: Annotate each line of a CVS file with its author,
# revision #, date, etc.
#
# -----------------------------------------------------------------------
#
# This file is based on the cvsblame.pl portion of the Bonsai CVS tool,
# developed by Steve Lamm for Netscape Communications Corporation. More
# information about Bonsai can be found at
# http://www.mozilla.org/bonsai.html
#
# cvsblame.pl, in turn, was based on Scott Furman's cvsblame script
#
# -----------------------------------------------------------------------
import re
import time
import math
import rcsparse
import vclib
import cvsdb
class CVSParser(rcsparse.Sink):
# Precompiled regular expressions
trunk_rev = re.compile('^[0-9]+\\.[0-9]+$')
last_branch = re.compile('(.*)\\.[0-9]+')
is_branch = re.compile('^(.*)\\.0\\.([0-9]+)$')
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
SECONDS_PER_DAY = 86400
def __init__(self):
self.Reset()
def Reset(self):
self.last_revision = {}
self.prev_revision = {}
self.revision_date = {}
self.revision_author = {}
self.revision_branches = {}
self.next_delta = {}
self.prev_delta = {}
self.tag_revision = {}
self.timestamp = {}
self.revision_ctime = {}
self.revision_age = {}
self.revision_log = {}
self.revision_deltatext = {}
self.revision_map = [] # map line numbers to revisions
self.lines_added = {}
self.lines_removed = {}
# Map a tag to a numerical revision number. The tag can be a symbolic
# branch tag, a symbolic revision tag, or an ordinary numerical
# revision number.
def map_tag_to_revision(self, tag_or_revision):
try:
revision = self.tag_revision[tag_or_revision]
match = self.is_branch.match(revision)
if match:
branch = match.group(1) + '.' + match.group(2)
if self.last_revision.get(branch):
return self.last_revision[branch]
else:
return match.group(1)
else:
return revision
except:
return ''
# Construct an ordered list of ancestor revisions to the given
# revision, starting with the immediate ancestor and going back
# to the primordial revision (1.1).
#
# Note: The generated path does not traverse the tree the same way
# that the individual revision deltas do. In particular,
# the path traverses the tree "backwards" on branches.
def ancestor_revisions(self, revision):
ancestors = []
revision = self.prev_revision.get(revision)
while revision:
ancestors.append(revision)
revision = self.prev_revision.get(revision)
return ancestors
# Split deltatext specified by rev to each line.
def deltatext_split(self, rev):
lines = self.revision_deltatext[rev].split('\n')
if lines[-1] == '':
del lines[-1]
return lines
# Extract the given revision from the digested RCS file.
# (Essentially the equivalent of cvs up -rXXX)
def extract_revision(self, revision):
path = []
add_lines_remaining = 0
start_line = 0
count = 0
while revision:
path.append(revision)
revision = self.prev_delta.get(revision)
path.reverse()
path = path[1:] # Get rid of head revision
text = self.deltatext_split(self.head_revision)
# Iterate, applying deltas to previous revision
for revision in path:
adjust = 0
diffs = self.deltatext_split(revision)
self.lines_added[revision] = 0
self.lines_removed[revision] = 0
lines_added_now = 0
lines_removed_now = 0
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
elif dmatch:
# "d" - Delete command
start_line = int(dmatch.group(1))
count = int(dmatch.group(2))
begin = start_line + adjust - 1
del text[begin:begin + count]
adjust = adjust - count
lines_removed_now = lines_removed_now + count
elif amatch:
# "a" - Add command
start_line = int(amatch.group(1))
count = int(amatch.group(2))
add_lines_remaining = count
lines_added_now = lines_added_now + count
else:
raise RuntimeError, 'Error parsing diff commands'
self.lines_added[revision] = self.lines_added[revision] + lines_added_now
self.lines_removed[revision] = self.lines_removed[revision] + lines_removed_now
return text
def set_head_revision(self, revision):
self.head_revision = revision
def set_principal_branch(self, branch_name):
self.principal_branch = branch_name
def define_tag(self, name, revision):
# Create an associate array that maps from tag name to
# revision number and vice-versa.
self.tag_revision[name] = revision
def set_comment(self, comment):
self.file_description = comment
def set_description(self, description):
self.rcs_file_description = description
# Construct dicts that represent the topology of the RCS tree
# and other arrays that contain info about individual revisions.
#
# The following dicts are created, keyed by revision number:
# self.revision_date -- e.g. "96.02.23.00.21.52"
# self.timestamp -- seconds since 12:00 AM, Jan 1, 1970 GMT
# self.revision_author -- e.g. "tom"
# self.revision_branches -- descendant branch revisions, separated by spaces,
# e.g. "1.21.4.1 1.21.2.6.1"
# self.prev_revision -- revision number of previous *ancestor* in RCS tree.
# Traversal of this array occurs in the direction
# of the primordial (1.1) revision.
# self.prev_delta -- revision number of previous revision which forms
# the basis for the edit commands in this revision.
# This causes the tree to be traversed towards the
# trunk when on a branch, and towards the latest trunk
# revision when on the trunk.
# self.next_delta -- revision number of next "delta". Inverts prev_delta.
#
# Also creates self.last_revision, keyed by a branch revision number, which
# indicates the latest revision on a given branch,
# e.g. self.last_revision{"1.2.8"} == 1.2.8.5
def define_revision(self, revision, timestamp, author, state,
branches, next):
self.tag_revision[revision] = revision
branch = self.last_branch.match(revision).group(1)
self.last_revision[branch] = revision
#self.revision_date[revision] = date
self.timestamp[revision] = timestamp
# Pretty print the date string
ltime = time.localtime(self.timestamp[revision])
formatted_date = time.strftime("%d %b %Y %H:%M", ltime)
self.revision_ctime[revision] = formatted_date
# Save age
self.revision_age[revision] = ((time.time() - self.timestamp[revision])
/ self.SECONDS_PER_DAY)
# save author
self.revision_author[revision] = author
# ignore the state
# process the branch information
branch_text = ''
for branch in branches:
self.prev_revision[branch] = revision
self.next_delta[revision] = branch
self.prev_delta[branch] = revision
branch_text = branch_text + branch + ''
self.revision_branches[revision] = branch_text
# process the "next revision" information
if next:
self.next_delta[revision] = next
self.prev_delta[next] = revision
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
self.prev_revision[revision] = next
else:
self.prev_revision[next] = revision
# Construct associative arrays containing info about individual revisions.
#
# The following associative arrays are created, keyed by revision number:
# revision_log -- log message
# revision_deltatext -- Either the complete text of the revision,
# in the case of the head revision, or the
# encoded delta between this revision and another.
# The delta is either with respect to the successor
# revision if this revision is on the trunk or
# relative to its immediate predecessor if this
# revision is on a branch.
def set_revision_info(self, revision, log, text):
self.revision_log[revision] = log
self.revision_deltatext[revision] = text
def parse_cvs_file(self, rcs_pathname, opt_rev = None, opt_m_timestamp = None):
# Args in: opt_rev - requested revision
# opt_m - time since modified
# Args out: revision_map
# timestamp
# revision_deltatext
# CheckHidden(rcs_pathname)
try:
rcsfile = open(rcs_pathname, 'rb')
except:
raise RuntimeError, ('error: %s appeared to be under CVS control, ' +
'but the RCS file is inaccessible.') % rcs_pathname
rcsparse.parse(rcsfile, self)
rcsfile.close()
if opt_rev in [None, '', 'HEAD']:
# Explicitly specified topmost revision in tree
revision = self.head_revision
else:
# Symbolic tag or specific revision number specified.
revision = self.map_tag_to_revision(opt_rev)
if revision == '':
raise RuntimeError, 'error: -r: No such revision: ' + opt_rev
# The primordial revision is not always 1.1! Go find it.
primordial = revision
while self.prev_revision.get(primordial):
primordial = self.prev_revision[primordial]
# Don't display file at all, if -m option is specified and no
# changes have been made in the specified file.
if opt_m_timestamp and self.timestamp[revision] < opt_m_timestamp:
return ''
# Figure out how many lines were in the primordial, i.e. version 1.1,
# check-in by moving backward in time from the head revision to the
# first revision.
line_count = 0
if self.revision_deltatext.get(self.head_revision):
tmp_array = self.deltatext_split(self.head_revision)
line_count = len(tmp_array)
skip = 0
rev = self.prev_revision.get(self.head_revision)
while rev:
diffs = self.deltatext_split(rev)
for command in diffs:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if skip > 0:
# Skip insertion lines from a prior "a" command
skip = skip - 1
elif dmatch:
# "d" - Delete command
start_line = int(dmatch.group(1))
count = int(dmatch.group(2))
line_count = line_count - count
elif amatch:
# "a" - Add command
start_line = int(amatch.group(1))
count = int(amatch.group(2))
skip = count
line_count = line_count + count
else:
raise RuntimeError, 'error: illegal RCS file'
rev = self.prev_revision.get(rev)
# Now, play the delta edit commands *backwards* from the primordial
# revision forward, but rather than applying the deltas to the text of
# each revision, apply the changes to an array of revision numbers.
# This creates a "revision map" -- an array where each element
# represents a line of text in the given revision but contains only
# the revision number in which the line was introduced rather than
# the line text itself.
#
# Note: These are backward deltas for revisions on the trunk and
# forward deltas for branch revisions.
# Create initial revision map for primordial version.
self.revision_map = [primordial] * line_count
ancestors = [revision, ] + self.ancestor_revisions(revision)
ancestors = ancestors[:-1] # Remove "1.1"
last_revision = primordial
ancestors.reverse()
for revision in ancestors:
is_trunk_revision = self.trunk_rev.match(revision) is not None
if is_trunk_revision:
diffs = self.deltatext_split(last_revision)
# Revisions on the trunk specify deltas that transform a
# revision into an earlier revision, so invert the translation
# of the 'diff' commands.
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = int(dmatch.group(1))
count = int(dmatch.group(2))
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line - 1] +
temp + self.revision_map[start_line - 1:])
elif amatch:
start_line = int(amatch.group(1))
count = int(amatch.group(2))
del self.revision_map[start_line:start_line + count]
skip = count
else:
raise RuntimeError, 'Error parsing diff commands'
else:
# Revisions on a branch are arranged backwards from those on
# the trunk. They specify deltas that transform a revision
# into a later revision.
adjust = 0
diffs = self.deltatext_split(revision)
for command in diffs:
if skip > 0:
skip = skip - 1
else:
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
start_line = int(dmatch.group(1))
count = int(dmatch.group(2))
adj_begin = start_line + adjust - 1
adj_end = start_line + adjust - 1 + count
del self.revision_map[adj_begin:adj_end]
adjust = adjust - count
elif amatch:
start_line = int(amatch.group(1))
count = int(amatch.group(2))
skip = count
temp = []
while count > 0:
temp.append(revision)
count = count - 1
self.revision_map = (self.revision_map[:start_line + adjust] +
temp + self.revision_map[start_line + adjust:])
adjust = adjust + skip
else:
raise RuntimeError, 'Error parsing diff commands'
last_revision = revision
return revision
class BlameSource:
def __init__(self, rcs_file, opt_rev=None, charset_guesser=None, include_text=False):
# Parse the CVS file
parser = CVSParser()
revision = parser.parse_cvs_file(rcs_file, opt_rev)
count = len(parser.revision_map)
lines = parser.extract_revision(revision)
if len(lines) != count:
raise RuntimeError, 'Internal consistency error'
# set up some state variables
self.revision = revision
self.lines = lines
self.num_lines = count
self.parser = parser
self.guesser = charset_guesser
self.include_text = include_text
# keep track of where we are during an iteration
self.idx = -1
self.last = None
def __getitem__(self, idx):
if idx == self.idx:
return self.last
if idx >= self.num_lines:
raise IndexError("No more annotations")
if idx != self.idx + 1:
raise BlameSequencingError()
# Get the line and metadata for it.
rev = self.parser.revision_map[idx]
prev_rev = self.parser.prev_revision.get(rev)
line_number = idx + 1
author = self.parser.revision_author[rev]
if not self.include_text:
thisline = None
elif self.guesser:
thisline = self.guesser.utf8(self.lines[idx])
else:
thisline = self.lines[idx]
### TODO: Put a real date in here.
item = vclib.Annotation(thisline, line_number, rev, prev_rev, author, None)
self.last = item
self.idx = idx
return item
class BlameSequencingError(Exception):
pass

417
lib/vclib/ccvs/ccvs.py Normal file
View File

@@ -0,0 +1,417 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import os
import re
import cStringIO
import tempfile
import vclib
import rcsparse
import blame
import cvsdb
### The functionality shared with bincvs should probably be moved to a
### separate module
from bincvs import BaseCVSRepository, Revision, Tag, _file_log, _log_path, _logsort_date_cmp, _logsort_rev_cmp, _path_join
class CCVSRepository(BaseCVSRepository):
def dirlogs(self, path_parts, rev, entries, options):
"""see vclib.Repository.dirlogs docstring
rev can be a tag name or None. if set only information from revisions
matching the tag will be retrieved
Option values recognized by this implementation:
cvs_subdirs
boolean. true to fetch logs of the most recently modified file in each
subdirectory
Option values returned by this implementation:
cvs_tags, cvs_branches
lists of tag and branch names encountered in the directory
"""
if self.itemtype(path_parts, rev) != vclib.DIR: # does auth-check
raise vclib.Error("Path '%s' is not a directory."
% (part2path(path_parts)))
entries_to_fetch = []
for entry in entries:
if vclib.check_path_access(self, path_parts + [entry.name], None, rev):
entries_to_fetch.append(entry)
subdirs = options.get('cvs_subdirs', 0)
dirpath = self._getpath(path_parts)
alltags = { # all the tags seen in the files of this dir
'MAIN' : '',
'HEAD' : '1.1'
}
for entry in entries_to_fetch:
entry.rev = entry.date = entry.author = None
entry.dead = entry.absent = entry.log = entry.lockinfo = None
path = _log_path(entry, dirpath, subdirs)
if path:
entry.path = path
try:
rcsparse.parse(open(path, 'rb'), InfoSink(entry, rev, alltags))
if self.guesser:
entry.log = self.guesser.utf8(entry.log)
except IOError, e:
entry.errors.append("rcsparse error: %s" % e)
except RuntimeError, e:
entry.errors.append("rcsparse error: %s" % e)
except rcsparse.RCSStopParser:
pass
branches = options['cvs_branches'] = []
tags = options['cvs_tags'] = []
for name, rev in alltags.items():
if Tag(None, rev).is_branch:
branches.append(name)
else:
tags.append(name)
def itemlog(self, path_parts, rev, sortby, first, limit, options):
"""see vclib.Repository.itemlog docstring
rev parameter can be a revision number, a branch number, a tag name,
or None. If None, will return information about all revisions, otherwise,
will only return information about the specified revision or branch.
Option values returned by this implementation:
cvs_tags
dictionary of Tag objects for all tags encountered
"""
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % (_path_join(path_parts)))
path = self.rcsfile(path_parts, 1)
sink = TreeSink()
rcsparse.parse(open(path, 'rb'), sink)
filtered_revs = _file_log(sink.revs.values(), sink.tags, sink.lockinfo,
sink.default_branch, rev)
for rev in filtered_revs:
if rev.prev and len(rev.number) == 2:
rev.changed = rev.prev.next_changed
options['cvs_tags'] = sink.tags
if sortby == vclib.SORTBY_DATE:
filtered_revs.sort(_logsort_date_cmp)
elif sortby == vclib.SORTBY_REV:
filtered_revs.sort(_logsort_rev_cmp)
if len(filtered_revs) < first:
return []
if limit:
return filtered_revs[first:first+limit]
return filtered_revs
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
if path_parts1 and self.itemtype(path_parts1, rev1) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % (_path_join(path_parts1)))
if path_parts2 and self.itemtype(path_parts2, rev2) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % (_path_join(path_parts2)))
if not path_parts1 and not path_parts2:
raise vclib.Error("Nothing to diff.")
if path_parts1:
temp1 = tempfile.mktemp()
open(temp1, 'wb').write(self.openfile(path_parts1, rev1, {})[0].getvalue())
r1 = self.itemlog(path_parts1, rev1, vclib.SORTBY_DEFAULT, 0, 0, {})[-1]
info1 = (self.rcsfile(path_parts1, root=1, v=0), r1.date, r1.string)
else:
temp1 = '/dev/null'
info1 = ('/dev/null', '', '')
if path_parts2:
temp2 = tempfile.mktemp()
open(temp2, 'wb').write(self.openfile(path_parts2, rev2, {})[0].getvalue())
r2 = self.itemlog(path_parts2, rev2, vclib.SORTBY_DEFAULT, 0, 0, {})[-1]
info2 = (self.rcsfile(path_parts2, root=1, v=0), r2.date, r2.string)
else:
temp2 = '/dev/null'
info2 = ('/dev/null', '', '')
diff_args = vclib._diff_args(type, options)
return vclib._diff_fp(temp1, temp2, info1, info2,
self.utilities.diff or 'diff', diff_args)
def annotate(self, path_parts, rev=None, include_text=False):
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % (_path_join(path_parts)))
source = blame.BlameSource(self.rcsfile(path_parts, 1), rev, self.guesser, include_text)
return source, source.revision
def revinfo(self, rev):
raise vclib.UnsupportedFeature
def openfile(self, path_parts, rev, options):
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % (_path_join(path_parts)))
path = self.rcsfile(path_parts, 1)
sink = COSink(rev)
rcsparse.parse(open(path, 'rb'), sink)
revision = sink.last and sink.last.string
return cStringIO.StringIO('\n'.join(sink.sstext.text)), revision
class MatchingSink(rcsparse.Sink):
"""Superclass for sinks that search for revisions based on tag or number"""
def __init__(self, find):
"""Initialize with tag name or revision number string to match against"""
if not find or find == 'MAIN' or find == 'HEAD':
self.find = None
else:
self.find = find
self.find_tag = None
def set_principal_branch(self, branch_number):
if self.find is None:
self.find_tag = Tag(None, branch_number)
def define_tag(self, name, revision):
if name == self.find:
self.find_tag = Tag(None, revision)
def admin_completed(self):
if self.find_tag is None:
if self.find is None:
self.find_tag = Tag(None, '')
else:
try:
self.find_tag = Tag(None, self.find)
except ValueError:
pass
class InfoSink(MatchingSink):
def __init__(self, entry, tag, alltags):
MatchingSink.__init__(self, tag)
self.entry = entry
self.alltags = alltags
self.matching_rev = None
self.perfect_match = 0
self.lockinfo = { }
self.saw_revision = False
def define_tag(self, name, revision):
MatchingSink.define_tag(self, name, revision)
self.alltags[name] = revision
def admin_completed(self):
MatchingSink.admin_completed(self)
if self.find_tag is None:
# tag we're looking for doesn't exist
if self.entry.kind == vclib.FILE:
self.entry.absent = 1
raise rcsparse.RCSStopParser
def parse_completed(self):
if not self.saw_revision:
#self.entry.errors.append("No revisions exist on %s" % (view_tag or "MAIN"))
self.entry.absent = 1
def set_locker(self, rev, locker):
self.lockinfo[rev] = locker
def define_revision(self, revision, date, author, state, branches, next):
self.saw_revision = True
if self.perfect_match:
return
tag = self.find_tag
rev = Revision(revision, date, author, state == "dead")
rev.lockinfo = self.lockinfo.get(revision)
# perfect match if revision number matches tag number or if
# revision is on trunk and tag points to trunk. imperfect match
# if tag refers to a branch and either a) this revision is the
# highest revision so far found on that branch, or b) this
# revision is the branchpoint.
perfect = ((rev.number == tag.number) or
(not tag.number and len(rev.number) == 2))
if perfect or (tag.is_branch and \
((tag.number == rev.number[:-1] and
(not self.matching_rev or
rev.number > self.matching_rev.number)) or
(rev.number == tag.number[:-1]))):
self.matching_rev = rev
self.perfect_match = perfect
def set_revision_info(self, revision, log, text):
if self.matching_rev:
if revision == self.matching_rev.string:
self.entry.rev = self.matching_rev.string
self.entry.date = self.matching_rev.date
self.entry.author = self.matching_rev.author
self.entry.dead = self.matching_rev.dead
self.entry.lockinfo = self.matching_rev.lockinfo
self.entry.absent = 0
self.entry.log = log
raise rcsparse.RCSStopParser
else:
raise rcsparse.RCSStopParser
class TreeSink(rcsparse.Sink):
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
def __init__(self):
self.revs = { }
self.tags = { }
self.head = None
self.default_branch = None
self.lockinfo = { }
def set_head_revision(self, revision):
self.head = revision
def set_principal_branch(self, branch_number):
self.default_branch = branch_number
def set_locker(self, rev, locker):
self.lockinfo[rev] = locker
def define_tag(self, name, revision):
# check !tags.has_key(tag_name)
self.tags[name] = revision
def define_revision(self, revision, date, author, state, branches, next):
# check !revs.has_key(revision)
self.revs[revision] = Revision(revision, date, author, state == "dead")
def set_revision_info(self, revision, log, text):
# check revs.has_key(revision)
rev = self.revs[revision]
rev.log = log
changed = None
added = 0
deled = 0
if self.head != revision:
changed = 1
lines = text.split('\n')
idx = 0
while idx < len(lines):
command = lines[idx]
dmatch = self.d_command.match(command)
idx = idx + 1
if dmatch:
deled = deled + int(dmatch.group(2))
else:
amatch = self.a_command.match(command)
if amatch:
count = int(amatch.group(2))
added = added + count
idx = idx + count
elif command:
raise "error while parsing deltatext: %s" % command
if len(rev.number) == 2:
rev.next_changed = changed and "+%i -%i" % (deled, added)
else:
rev.changed = changed and "+%i -%i" % (added, deled)
class StreamText:
d_command = re.compile('^d(\d+)\\s(\\d+)')
a_command = re.compile('^a(\d+)\\s(\\d+)')
def __init__(self, text):
self.text = text.split('\n')
def command(self, cmd):
adjust = 0
add_lines_remaining = 0
diffs = cmd.split('\n')
if diffs[-1] == "":
del diffs[-1]
if len(diffs) == 0:
return
if diffs[0] == "":
del diffs[0]
for command in diffs:
if add_lines_remaining > 0:
# Insertion lines from a prior "a" command
self.text.insert(start_line + adjust, command)
add_lines_remaining = add_lines_remaining - 1
adjust = adjust + 1
continue
dmatch = self.d_command.match(command)
amatch = self.a_command.match(command)
if dmatch:
# "d" - Delete command
start_line = int(dmatch.group(1))
count = int(dmatch.group(2))
begin = start_line + adjust - 1
del self.text[begin:begin + count]
adjust = adjust - count
elif amatch:
# "a" - Add command
start_line = int(amatch.group(1))
count = int(amatch.group(2))
add_lines_remaining = count
else:
raise RuntimeError, 'Error parsing diff commands'
def secondnextdot(s, start):
# find the position the second dot after the start index.
return s.find('.', s.find('.', start) + 1)
class COSink(MatchingSink):
def __init__(self, rev):
MatchingSink.__init__(self, rev)
def set_head_revision(self, revision):
self.head = Revision(revision)
self.last = None
self.sstext = None
def admin_completed(self):
MatchingSink.admin_completed(self)
if self.find_tag is None:
raise vclib.InvalidRevision(self.find)
def set_revision_info(self, revision, log, text):
tag = self.find_tag
rev = Revision(revision)
if rev.number == tag.number:
self.log = log
depth = len(rev.number)
if rev.number == self.head.number:
assert self.sstext is None
self.sstext = StreamText(text)
elif (depth == 2 and tag.number and rev.number >= tag.number[:depth]):
assert len(self.last.number) == 2
assert rev.number < self.last.number
self.sstext.command(text)
elif (depth > 2 and rev.number[:depth-1] == tag.number[:depth-1] and
(rev.number <= tag.number or len(tag.number) == depth-1)):
assert len(rev.number) - len(self.last.number) in (0, 2)
assert rev.number > self.last.number
self.sstext.command(text)
else:
rev = None
if rev:
#print "tag =", tag.number, "rev =", rev.number, "<br>"
self.last = rev

View File

@@ -0,0 +1,44 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""This package provides parsing tools for RCS files.
To use this package, first create a subclass of Sink. This should
declare all the callback methods you care about. Create an instance
of your class, and open() the RCS file you want to read. Then call
parse() to parse the file.
"""
# Make the "Sink" class and the various exception classes visible in this
# scope. That way, applications never need to import any of the
# sub-packages.
from common import *
try:
from tparse import parse
except ImportError:
try:
from texttools import Parser
except ImportError:
from default import Parser
def parse(file, sink):
"""Parse an RCS file.
Parameters: FILE is the file object to parse. (I.e. an object of the
built-in Python type "file", usually created using Python's built-in
"open()" function). It should be opened in binary mode.
SINK is an instance of (some subclass of) Sink. It's methods will be
called as the file is parsed; see the definition of Sink for the
details.
"""
return Parser().parse(file, sink)

View File

@@ -0,0 +1,485 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""common.py: common classes and functions for the RCS parsing tools."""
import calendar
import string
class Sink:
"""Interface to be implemented by clients. The RCS parser calls this as
it parses the RCS file.
All these methods have stub implementations that do nothing, so you only
have to override the callbacks that you care about.
"""
def set_head_revision(self, revision):
"""Reports the head revision for this RCS file.
This is the value of the 'head' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameter: REVISION is a string containing a revision number. This is
an actual revision number, not a branch number.
"""
pass
def set_principal_branch(self, branch_name):
"""Reports the principal branch for this RCS file. This is only called
if the principal branch is not trunk.
This is the value of the 'branch' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameter: BRANCH_NAME is a string containing a branch number. If this
function is called, the parameter is typically "1.1.1", indicating the
vendor branch.
"""
pass
def set_access(self, accessors):
"""Reports the access control list for this RCS file. This function is
only called if the ACL is set. If this function is not called then
there is no ACL and all users are allowed access.
This is the value of the 'access' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameter: ACCESSORS is a list of strings. Each string is a username.
The user is allowed access if and only if their username is in the list,
OR the user owns the RCS file on disk, OR the user is root.
Note that CVS typically doesn't use this field.
"""
pass
def define_tag(self, name, revision):
"""Reports a tag or branch definition. This function will be called
once for each tag or branch.
This is taken from the 'symbols' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameters: NAME is a string containing the tag or branch name.
REVISION is a string containing a revision number. This may be
an actual revision number (for a tag) or a branch number.
The revision number consists of a number of decimal components separated
by dots. There are three common forms. If there are an odd number of
components, it's a branch. Otherwise, if the next-to-last component is
zero, it's a branch (and the next-to-last component is an artifact of
CVS and should not be shown to the user). Otherwise, it's a tag.
This function is called in the order that the tags appear in the RCS
file header. For CVS, this appears to be in reverse chronological
order of tag/branch creation.
"""
pass
def set_locker(self, revision, locker):
"""Reports a lock on this RCS file. This function will be called once
for each lock.
This is taken from the 'locks' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameters: REVISION is a string containing a revision number. This is
an actual revision number, not a branch number.
LOCKER is a string containing a username.
"""
pass
def set_locking(self, mode):
"""Signals strict locking mode. This function will be called if and
only if the RCS file is in strict locking mode.
This is taken from the 'strict' header in the admin section of the RCS
file. This function can only be called before admin_completed().
Parameters: MODE is always the string 'strict'.
"""
pass
def set_comment(self, comment):
"""Reports the comment for this RCS file.
This is the value of the 'comment' header in the admin section of the
RCS file. This function can only be called before admin_completed().
Parameter: COMMENT is a string containing the comment. This may be
multi-line.
This field does not seem to be used by CVS.
"""
pass
def set_expansion(self, mode):
"""Reports the keyword expansion mode for this RCS file.
This is the value of the 'expand' header in the admin section of the
RCS file. This function can only be called before admin_completed().
Parameter: MODE is a string containing the keyword expansion mode.
Possible values include 'o' and 'b', amongst others.
"""
pass
def admin_completed(self):
"""Reports that the initial RCS header has been parsed. This function is
called exactly once.
"""
pass
def define_revision(self, revision, timestamp, author, state,
branches, next):
"""Reports metadata about a single revision.
This function is called for each revision. It is called later than
admin_completed() and earlier than tree_completed().
Parameter: REVISION is a revision number, as a string. This is an
actual revision number, not a branch number.
TIMESTAMP is the date and time that the revision was created, as an
integer number of seconds since the epoch. (I.e. "UNIX time" format).
AUTHOR is the author name, as a string.
STATE is the state of the revision, as a string. Common values are
"Exp" and "dead".
BRANCHES is a list of strings, with each string being an actual
revision number (not a branch number). For each branch which is based
on this revision and has commits, the revision number of the first
branch commit is listed here.
NEXT is either None or a string representing an actual revision number
(not a branch number).
When on trunk, NEXT points to what humans might consider to be the
'previous' revision number. For example, 1.3's NEXT is 1.2.
However, on a branch, NEXT really does point to what humans would
consider to be the 'next' revision number. For example, 1.1.2.1's
NEXT would be 1.1.2.2.
In other words, NEXT always means "where to find the next deltatext
that you need this revision to retrieve".
"""
pass
def tree_completed(self):
"""Reports that the RCS revision tree has been parsed. This function is
called exactly once. This function will be called later than
admin_completed().
"""
pass
def set_description(self, description):
"""Reports the description from the RCS file. This is set using the
"-m" flag to "cvs add". However, many CVS users don't use that option,
so this is often empty.
This function is called once, after tree_completed().
Parameter: DESCRIPTION is a string containing the description. This may
be multi-line.
"""
pass
def set_revision_info(self, revision, log, text):
"""Reports the log message and contents of a CVS revision.
This function is called for each revision. It is called later than
set_description().
Parameters: REVISION is a string containing the actual revision number.
LOG is a string containing the log message. This may be multi-line.
TEXT is the contents of the file in this revision, either as full-text or
as a diff. This is usually multi-line, and often quite large and/or
binary.
"""
pass
def parse_completed(self):
"""Reports that parsing an RCS file is complete.
This function is called once. After it is called, no more calls will be
made via this interface.
"""
pass
# --------------------------------------------------------------------------
#
# EXCEPTIONS USED BY RCSPARSE
#
class RCSParseError(Exception):
pass
class RCSIllegalCharacter(RCSParseError):
pass
class RCSExpected(RCSParseError):
def __init__(self, got, wanted):
RCSParseError.__init__(
self,
'Unexpected parsing error in RCS file.\n'
'Expected token: %s, but saw: %s'
% (wanted, got)
)
class RCSStopParser(Exception):
pass
# --------------------------------------------------------------------------
#
# STANDARD TOKEN STREAM-BASED PARSER
#
class _Parser:
stream_class = None # subclasses need to define this
def _read_until_semicolon(self):
"""Read all tokens up to and including the next semicolon token.
Return the tokens (not including the semicolon) as a list."""
tokens = []
while 1:
token = self.ts.get()
if token == ';':
break
tokens.append(token)
return tokens
def _parse_admin_head(self, token):
rev = self.ts.get()
if rev == ';':
# The head revision is not specified. Just drop the semicolon
# on the floor.
pass
else:
self.sink.set_head_revision(rev)
self.ts.match(';')
def _parse_admin_branch(self, token):
branch = self.ts.get()
if branch != ';':
self.sink.set_principal_branch(branch)
self.ts.match(';')
def _parse_admin_access(self, token):
accessors = self._read_until_semicolon()
if accessors:
self.sink.set_access(accessors)
def _parse_admin_symbols(self, token):
while 1:
tag_name = self.ts.get()
if tag_name == ';':
break
self.ts.match(':')
tag_rev = self.ts.get()
self.sink.define_tag(tag_name, tag_rev)
def _parse_admin_locks(self, token):
while 1:
locker = self.ts.get()
if locker == ';':
break
self.ts.match(':')
rev = self.ts.get()
self.sink.set_locker(rev, locker)
def _parse_admin_strict(self, token):
self.sink.set_locking("strict")
self.ts.match(';')
def _parse_admin_comment(self, token):
self.sink.set_comment(self.ts.get())
self.ts.match(';')
def _parse_admin_expand(self, token):
expand_mode = self.ts.get()
self.sink.set_expansion(expand_mode)
self.ts.match(';')
admin_token_map = {
'head' : _parse_admin_head,
'branch' : _parse_admin_branch,
'access' : _parse_admin_access,
'symbols' : _parse_admin_symbols,
'locks' : _parse_admin_locks,
'strict' : _parse_admin_strict,
'comment' : _parse_admin_comment,
'expand' : _parse_admin_expand,
'desc' : None,
}
def parse_rcs_admin(self):
while 1:
# Read initial token at beginning of line
token = self.ts.get()
try:
f = self.admin_token_map[token]
except KeyError:
# We're done once we reach the description of the RCS tree
if token[0] in string.digits:
self.ts.unget(token)
return
else:
# Chew up "newphrase"
# warn("Unexpected RCS token: $token\n")
while self.ts.get() != ';':
pass
else:
if f is None:
self.ts.unget(token)
return
else:
f(self, token)
def _parse_rcs_tree_entry(self, revision):
# Parse date
self.ts.match('date')
date = self.ts.get()
self.ts.match(';')
# Convert date into standard UNIX time format (seconds since epoch)
date_fields = string.split(date, '.')
# According to rcsfile(5): the year "contains just the last two
# digits of the year for years from 1900 through 1999, and all the
# digits of years thereafter".
if len(date_fields[0]) == 2:
date_fields[0] = '19' + date_fields[0]
date_fields = map(string.atoi, date_fields)
EPOCH = 1970
if date_fields[0] < EPOCH:
raise ValueError, 'invalid year for revision %s' % (revision,)
try:
timestamp = calendar.timegm(tuple(date_fields) + (0, 0, 0,))
except ValueError, e:
raise ValueError, 'invalid date for revision %s: %s' % (revision, e,)
# Parse author
### NOTE: authors containing whitespace are violations of the
### RCS specification. We are making an allowance here because
### CVSNT is known to produce these sorts of authors.
self.ts.match('author')
author = ' '.join(self._read_until_semicolon())
# Parse state
self.ts.match('state')
state = ''
while 1:
token = self.ts.get()
if token == ';':
break
state = state + token + ' '
state = state[:-1] # toss the trailing space
# Parse branches
self.ts.match('branches')
branches = self._read_until_semicolon()
# Parse revision of next delta in chain
self.ts.match('next')
next = self.ts.get()
if next == ';':
next = None
else:
self.ts.match(';')
# there are some files with extra tags in them. for example:
# owner 640;
# group 15;
# permissions 644;
# hardlinks @configure.in@;
# commitid mLiHw3bulRjnTDGr;
# this is "newphrase" in RCSFILE(5). we just want to skip over these.
while 1:
token = self.ts.get()
if token == 'desc' or token[0] in string.digits:
self.ts.unget(token)
break
# consume everything up to the semicolon
self._read_until_semicolon()
self.sink.define_revision(revision, timestamp, author, state, branches,
next)
def parse_rcs_tree(self):
while 1:
revision = self.ts.get()
# End of RCS tree description ?
if revision == 'desc':
self.ts.unget(revision)
return
self._parse_rcs_tree_entry(revision)
def parse_rcs_description(self):
self.ts.match('desc')
self.sink.set_description(self.ts.get())
def parse_rcs_deltatext(self):
while 1:
revision = self.ts.get()
if revision is None:
# EOF
break
text, sym2, log, sym1 = self.ts.mget(4)
if sym1 != 'log':
print `text[:100], sym2[:100], log[:100], sym1[:100]`
raise RCSExpected(sym1, 'log')
if sym2 != 'text':
raise RCSExpected(sym2, 'text')
### need to add code to chew up "newphrase"
self.sink.set_revision_info(revision, log, text)
def parse(self, file, sink):
"""Parse an RCS file.
Parameters: FILE is the file object to parse. (I.e. an object of the
built-in Python type "file", usually created using Python's built-in
"open()" function).
SINK is an instance of (some subclass of) Sink. It's methods will be
called as the file is parsed; see the definition of Sink for the
details.
"""
self.ts = self.stream_class(file)
self.sink = sink
self.parse_rcs_admin()
# let sink know when the admin section has been completed
self.sink.admin_completed()
self.parse_rcs_tree()
# many sinks want to know when the tree has been completed so they can
# do some work to prep for the arrival of the deltatext
self.sink.tree_completed()
self.parse_rcs_description()
self.parse_rcs_deltatext()
# easiest for us to tell the sink it is done, rather than worry about
# higher level software doing it.
self.sink.parse_completed()
self.ts = self.sink = None
# --------------------------------------------------------------------------

View File

@@ -0,0 +1,122 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"""debug.py: various debugging tools for the rcsparse package."""
import time
from __init__ import parse
import common
class DebugSink(common.Sink):
def set_head_revision(self, revision):
print 'head:', revision
def set_principal_branch(self, branch_name):
print 'branch:', branch_name
def define_tag(self, name, revision):
print 'tag:', name, '=', revision
def set_comment(self, comment):
print 'comment:', comment
def set_description(self, description):
print 'description:', description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print 'revision:', revision
print ' timestamp:', timestamp
print ' author:', author
print ' state:', state
print ' branches:', branches
print ' next:', next
def set_revision_info(self, revision, log, text):
print 'revision:', revision
print ' log:', log
print ' text:', text[:100], '...'
class DumpSink(common.Sink):
"""Dump all the parse information directly to stdout.
The output is relatively unformatted and untagged. It is intended as a
raw dump of the data in the RCS file. A copy can be saved, then changes
made to the parsing engine, then a comparison of the new output against
the old output.
"""
def __init__(self):
global sha
import sha
def set_head_revision(self, revision):
print revision
def set_principal_branch(self, branch_name):
print branch_name
def define_tag(self, name, revision):
print name, revision
def set_comment(self, comment):
print comment
def set_description(self, description):
print description
def define_revision(self, revision, timestamp, author, state,
branches, next):
print revision, timestamp, author, state, branches, next
def set_revision_info(self, revision, log, text):
print revision, sha.new(log).hexdigest(), sha.new(text).hexdigest()
def tree_completed(self):
print 'tree_completed'
def parse_completed(self):
print 'parse_completed'
def dump_file(fname):
parse(open(fname, 'rb'), DumpSink())
def time_file(fname):
f = open(fname, 'rb')
s = common.Sink()
t = time.time()
parse(f, s)
t = time.time() - t
print t
def _usage():
print 'This is normally a module for importing, but it has a couple'
print 'features for testing as an executable script.'
print 'USAGE: %s COMMAND filename,v' % sys.argv[0]
print ' where COMMAND is one of:'
print ' dump: filename is "dumped" to stdout'
print ' time: filename is parsed with the time written to stdout'
sys.exit(1)
if __name__ == '__main__':
import sys
if len(sys.argv) != 3:
_usage()
if sys.argv[1] == 'dump':
dump_file(sys.argv[2])
elif sys.argv[1] == 'time':
time_file(sys.argv[2])
else:
_usage()

View File

@@ -0,0 +1,176 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# This file was originally based on portions of the blame.py script by
# Curt Hagenlocher.
#
# -----------------------------------------------------------------------
import string
import common
class _TokenStream:
token_term = string.whitespace + ";:"
try:
token_term = frozenset(token_term)
except NameError:
pass
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
# note: we use a multiple of a standard block size
CHUNK_SIZE = 192 * 512 # about 100k
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.idx = 0
self.buf = self.rcsfile.read(self.CHUNK_SIZE)
if self.buf == '':
raise RuntimeError, 'EOF'
def get(self):
"Get the next token from the RCS file."
# Note: we can afford to loop within Python, examining individual
# characters. For the whitespace and tokens, the number of iterations
# is typically quite small. Thus, a simple iterative loop will beat
# out more complex solutions.
buf = self.buf
lbuf = len(buf)
idx = self.idx
while 1:
if idx == lbuf:
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
# signal EOF by returning None as the token
del self.buf # so we fail if get() is called again
return None
lbuf = len(buf)
idx = 0
if buf[idx] not in string.whitespace:
break
idx = idx + 1
if buf[idx] in ';:':
self.buf = buf
self.idx = idx + 1
return buf[idx]
if buf[idx] != '@':
end = idx + 1
token = ''
while 1:
# find token characters in the current buffer
while end < lbuf and buf[end] not in self.token_term:
end = end + 1
token = token + buf[idx:end]
if end < lbuf:
# we stopped before the end, so we have a full token
idx = end
break
# we stopped at the end of the buffer, so we may have a partial token
buf = self.rcsfile.read(self.CHUNK_SIZE)
lbuf = len(buf)
idx = end = 0
self.buf = buf
self.idx = idx
return token
# a "string" which starts with the "@" character. we'll skip it when we
# search for content.
idx = idx + 1
chunks = [ ]
while 1:
if idx == lbuf:
idx = 0
buf = self.rcsfile.read(self.CHUNK_SIZE)
if buf == '':
raise RuntimeError, 'EOF'
lbuf = len(buf)
i = string.find(buf, '@', idx)
if i == -1:
chunks.append(buf[idx:])
idx = lbuf
continue
if i == lbuf - 1:
chunks.append(buf[idx:i])
idx = 0
buf = '@' + self.rcsfile.read(self.CHUNK_SIZE)
if buf == '@':
raise RuntimeError, 'EOF'
lbuf = len(buf)
continue
if buf[i + 1] == '@':
chunks.append(buf[idx:i+1])
idx = i + 2
continue
chunks.append(buf[idx:i])
self.buf = buf
self.idx = i + 1
return string.join(chunks, '')
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
"Try to match the next token from the input buffer."
token = self.get()
if token != match:
raise common.RCSExpected(token, match)
def unget(self, token):
"Put this token back, for the next get() to return."
# Override the class' .get method with a function which clears the
# overridden method then returns the pushed token. Since this function
# will not be looked up via the class mechanism, it should be a "normal"
# function, meaning it won't have "self" automatically inserted.
# Therefore, we need to pass both self and the token thru via defaults.
# note: we don't put this into the input buffer because it may have been
# @-unescaped already.
def give_it_back(self=self, token=token):
del self.get
return token
self.get = give_it_back
def mget(self, count):
"Return multiple tokens. 'next' is at the end."
result = [ ]
for i in range(count):
result.append(self.get())
result.reverse()
return result
class Parser(common._Parser):
stream_class = _TokenStream

View File

@@ -0,0 +1,73 @@
#! /usr/bin/python
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2006-2007 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
#
# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision
# history and logs, available at http://cvs2svn.tigris.org/.
# ====================================================================
"""Parse an RCS file, showing the rcsparse callbacks that are called.
This program is useful to see whether an RCS file has a problem (in
the sense of not being parseable by rcsparse) and also to illuminate
the correspondence between RCS file contents and rcsparse callbacks.
The output of this program can also be considered to be a kind of
'canonical' format for RCS files, at least in so far as rcsparse
returns all relevant information in the file and provided that the
order of callbacks is always the same."""
import sys
import os
class Logger:
def __init__(self, f, name):
self.f = f
self.name = name
def __call__(self, *args):
self.f.write(
'%s(%s)\n' % (self.name, ', '.join(['%r' % arg for arg in args]),)
)
class LoggingSink:
def __init__(self, f):
self.f = f
def __getattr__(self, name):
return Logger(self.f, name)
if __name__ == '__main__':
# Since there is nontrivial logic in __init__.py, we have to import
# parse() via that file. First make sure that the directory
# containing this script is in the path:
sys.path.insert(0, os.path.dirname(sys.argv[0]))
from __init__ import parse
if sys.argv[1:]:
for path in sys.argv[1:]:
if os.path.isfile(path) and path.endswith(',v'):
parse(
open(path, 'rb'), LoggingSink(sys.stdout)
)
else:
sys.stderr.write('%r is being ignored.\n' % path)
else:
parse(sys.stdin, LoggingSink(sys.stdout))

View File

@@ -0,0 +1,73 @@
#! /usr/bin/python
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2007 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
#
# This software consists of voluntary contributions made by many
# individuals. For exact contribution history, see the revision
# history and logs, available at http://viewvc.tigris.org/.
# ====================================================================
"""Run tests of rcsparse code."""
import sys
import os
import glob
from cStringIO import StringIO
from difflib import Differ
# Since there is nontrivial logic in __init__.py, we have to import
# parse() via that file. First make sure that the directory
# containing this script is in the path:
script_dir = os.path.dirname(sys.argv[0])
sys.path.insert(0, script_dir)
from __init__ import parse
from parse_rcs_file import LoggingSink
test_dir = os.path.join(script_dir, 'test-data')
filelist = glob.glob(os.path.join(test_dir, '*,v'))
filelist.sort()
all_tests_ok = 1
for filename in filelist:
sys.stderr.write('%s: ' % (filename,))
f = StringIO()
try:
parse(open(filename, 'rb'), LoggingSink(f))
except Exception, e:
sys.stderr.write('Error parsing file: %s!\n' % (e,))
all_tests_ok = 0
else:
output = f.getvalue()
expected_output_filename = filename[:-2] + '.out'
expected_output = open(expected_output_filename, 'rb').read()
if output == expected_output:
sys.stderr.write('OK\n')
else:
sys.stderr.write('Output does not match expected output!\n')
differ = Differ()
for diffline in differ.compare(
expected_output.splitlines(1), output.splitlines(1)
):
sys.stderr.write(diffline)
all_tests_ok = 0
if all_tests_ok:
sys.exit(0)
else:
sys.exit(1)

View File

@@ -0,0 +1,102 @@
head 1.2;
access;
symbols
B_SPLIT:1.2.0.4
B_MIXED:1.2.0.2
T_MIXED:1.2
B_FROM_INITIALS_BUT_ONE:1.1.1.1.0.4
B_FROM_INITIALS:1.1.1.1.0.2
T_ALL_INITIAL_FILES_BUT_ONE:1.1.1.1
T_ALL_INITIAL_FILES:1.1.1.1
vendortag:1.1.1.1
vendorbranch:1.1.1;
locks; strict;
comment @# @;
1.2
date 2003.05.23.00.17.53; author jrandom; state Exp;
branches
1.2.2.1
1.2.4.1;
next 1.1;
1.1
date 98.05.22.23.20.19; author jrandom; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 98.05.22.23.20.19; author jrandom; state Exp;
branches;
next ;
1.2.2.1
date 2003.05.23.00.31.36; author jrandom; state Exp;
branches;
next ;
1.2.4.1
date 2003.06.03.03.20.31; author jrandom; state Exp;
branches;
next ;
desc
@@
1.2
log
@Second commit to proj, affecting all 7 files.
@
text
@This is the file `default' in the top level of the project.
Every directory in the `proj' project has a file named `default'.
This line was added in the second commit (affecting all 7 files).
@
1.2.4.1
log
@First change on branch B_SPLIT.
This change excludes sub3/default, because it was not part of this
commit, and sub1/subsubB/default, which is not even on the branch yet.
@
text
@a5 2
First change on branch B_SPLIT.
@
1.2.2.1
log
@Modify three files, on branch B_MIXED.
@
text
@a5 2
This line was added on branch B_MIXED only (affecting 3 files).
@
1.1
log
@Initial revision
@
text
@d4 2
@
1.1.1.1
log
@Initial import.
@
text
@@

View File

@@ -0,0 +1,26 @@
set_head_revision('1.2')
define_tag('B_SPLIT', '1.2.0.4')
define_tag('B_MIXED', '1.2.0.2')
define_tag('T_MIXED', '1.2')
define_tag('B_FROM_INITIALS_BUT_ONE', '1.1.1.1.0.4')
define_tag('B_FROM_INITIALS', '1.1.1.1.0.2')
define_tag('T_ALL_INITIAL_FILES_BUT_ONE', '1.1.1.1')
define_tag('T_ALL_INITIAL_FILES', '1.1.1.1')
define_tag('vendortag', '1.1.1.1')
define_tag('vendorbranch', '1.1.1')
set_locking('strict')
set_comment('# ')
admin_completed()
define_revision('1.2', 1053649073, 'jrandom', 'Exp', ['1.2.2.1', '1.2.4.1'], '1.1')
define_revision('1.1', 895879219, 'jrandom', 'Exp', ['1.1.1.1'], None)
define_revision('1.1.1.1', 895879219, 'jrandom', 'Exp', [], None)
define_revision('1.2.2.1', 1053649896, 'jrandom', 'Exp', [], None)
define_revision('1.2.4.1', 1054610431, 'jrandom', 'Exp', [], None)
tree_completed()
set_description('')
set_revision_info('1.2', 'Second commit to proj, affecting all 7 files.\n', "This is the file `default' in the top level of the project.\n\nEvery directory in the `proj' project has a file named `default'.\n\nThis line was added in the second commit (affecting all 7 files).\n")
set_revision_info('1.2.4.1', 'First change on branch B_SPLIT.\n\nThis change excludes sub3/default, because it was not part of this\ncommit, and sub1/subsubB/default, which is not even on the branch yet.\n', 'a5 2\n\nFirst change on branch B_SPLIT.\n')
set_revision_info('1.2.2.1', 'Modify three files, on branch B_MIXED.\n', 'a5 2\n\nThis line was added on branch B_MIXED only (affecting 3 files).\n')
set_revision_info('1.1', 'Initial revision\n', 'd4 2\n')
set_revision_info('1.1.1.1', 'Initial import.\n', '')
parse_completed()

View File

@@ -0,0 +1,10 @@
head ;
access;
symbols;
locks; strict;
comment @# @;
desc
@@

View File

@@ -0,0 +1,6 @@
set_locking('strict')
set_comment('# ')
admin_completed()
tree_completed()
set_description('')
parse_completed()

View File

@@ -0,0 +1,348 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
import string
# note: this will raise an ImportError if it isn't available. the rcsparse
# package will recognize this and switch over to the default parser.
from mx import TextTools
import common
# for convenience
_tt = TextTools
_idchar_list = map(chr, range(33, 127)) + map(chr, range(160, 256))
_idchar_list.remove('$')
_idchar_list.remove(',')
#_idchar_list.remove('.') # leave as part of 'num' symbol
_idchar_list.remove(':')
_idchar_list.remove(';')
_idchar_list.remove('@')
_idchar = string.join(_idchar_list, '')
_idchar_set = _tt.set(_idchar)
_onechar_token_set = _tt.set(':;')
_not_at_set = _tt.invset('@')
_T_TOKEN = 30
_T_STRING_START = 40
_T_STRING_SPAN = 60
_T_STRING_END = 70
_E_COMPLETE = 100 # ended on a complete token
_E_TOKEN = 110 # ended mid-token
_E_STRING_SPAN = 130 # ended within a string
_E_STRING_END = 140 # ended with string-end ('@') (could be mid-@@)
_SUCCESS = +100
_EOF = 'EOF'
_CONTINUE = 'CONTINUE'
_UNUSED = 'UNUSED'
# continuation of a token over a chunk boundary
_c_token_table = (
(_T_TOKEN, _tt.AllInSet, _idchar_set),
)
class _mxTokenStream:
# the algorithm is about the same speed for any CHUNK_SIZE chosen.
# grab a good-sized chunk, but not too large to overwhelm memory.
# note: we use a multiple of a standard block size
CHUNK_SIZE = 192 * 512 # about 100k
# CHUNK_SIZE = 5 # for debugging, make the function grind...
def __init__(self, file):
self.rcsfile = file
self.tokens = [ ]
self.partial = None
self.string_end = None
def _parse_chunk(self, buf, start=0):
"Get the next token from the RCS file."
buflen = len(buf)
assert start < buflen
# construct a tag table which refers to the buffer we need to parse.
table = (
#1: ignore whitespace. with or without whitespace, move to the next rule.
(None, _tt.AllInSet, _tt.whitespace_set, +1),
#2
(_E_COMPLETE, _tt.EOF + _tt.AppendTagobj, _tt.Here, +1, _SUCCESS),
#3: accumulate token text and exit, or move to the next rule.
(_UNUSED, _tt.AllInSet + _tt.AppendMatch, _idchar_set, +2),
#4
(_E_TOKEN, _tt.EOF + _tt.AppendTagobj, _tt.Here, -3, _SUCCESS),
#5: single character tokens exit immediately, or move to the next rule
(_UNUSED, _tt.IsInSet + _tt.AppendMatch, _onechar_token_set, +2),
#6
(_E_COMPLETE, _tt.EOF + _tt.AppendTagobj, _tt.Here, -5, _SUCCESS),
#7: if this isn't an '@' symbol, then we have a syntax error (go to a
# negative index to indicate that condition). otherwise, suck it up
# and move to the next rule.
(_T_STRING_START, _tt.Is + _tt.AppendTagobj, '@'),
#8
(None, _tt.Is, '@', +4, +1),
#9
(buf, _tt.Is, '@', +1, -1),
#10
(_T_STRING_END, _tt.Skip + _tt.AppendTagobj, 0, 0, +1),
#11
(_E_STRING_END, _tt.EOF + _tt.AppendTagobj, _tt.Here, -10, _SUCCESS),
#12
(_E_STRING_SPAN, _tt.EOF + _tt.AppendTagobj, _tt.Here, +1, _SUCCESS),
#13: suck up everything that isn't an AT. go to next rule to look for EOF
(buf, _tt.AllInSet, _not_at_set, 0, +1),
#14: go back to look for double AT if we aren't at the end of the string
(_E_STRING_SPAN, _tt.EOF + _tt.AppendTagobj, _tt.Here, -6, _SUCCESS),
)
# Fast, texttools may be, but it's somewhat lacking in clarity.
# Here's an attempt to document the logic encoded in the table above:
#
# Flowchart:
# _____
# / /\
# 1 -> 2 -> 3 -> 5 -> 7 -> 8 -> 9 -> 10 -> 11
# | \/ \/ \/ /\ \/
# \ 4 6 12 14 /
# \_______/_____/ \ / /
# \ 13 /
# \__________________________________________/
#
# #1: Skip over any whitespace.
# #2: If now EOF, exit with code _E_COMPLETE.
# #3: If we have a series of characters in _idchar_set, then:
# #4: Output them as a token, and go back to #1.
# #5: If we have a character in _onechar_token_set, then:
# #6: Output it as a token, and go back to #1.
# #7: If we do not have an '@', then error.
# If we do, then log a _T_STRING_START and continue.
# #8: If we have another '@', continue on to #9. Otherwise:
# #12: If now EOF, exit with code _E_STRING_SPAN.
# #13: Record the slice up to the next '@' (or EOF).
# #14: If now EOF, exit with code _E_STRING_SPAN.
# Otherwise, go back to #8.
# #9: If we have another '@', then we've just seen an escaped
# (by doubling) '@' within an @-string. Record a slice including
# just one '@' character, and jump back to #8.
# Otherwise, we've *either* seen the terminating '@' of an @-string,
# *or* we've seen one half of an escaped @@ sequence that just
# happened to be split over a chunk boundary - in either case,
# we continue on to #10.
# #10: Log a _T_STRING_END.
# #11: If now EOF, exit with _E_STRING_END. Otherwise, go back to #1.
success, taglist, idx = _tt.tag(buf, table, start)
if not success:
### need a better way to report this error
raise common.RCSIllegalCharacter()
assert idx == buflen
# pop off the last item
last_which = taglist.pop()
i = 0
tlen = len(taglist)
while i < tlen:
if taglist[i] == _T_STRING_START:
j = i + 1
while j < tlen:
if taglist[j] == _T_STRING_END:
s = _tt.join(taglist, '', i+1, j)
del taglist[i:j]
tlen = len(taglist)
taglist[i] = s
break
j = j + 1
else:
assert last_which == _E_STRING_SPAN
s = _tt.join(taglist, '', i+1)
del taglist[i:]
self.partial = (_T_STRING_SPAN, [ s ])
break
i = i + 1
# figure out whether we have a partial last-token
if last_which == _E_TOKEN:
self.partial = (_T_TOKEN, [ taglist.pop() ])
elif last_which == _E_COMPLETE:
pass
elif last_which == _E_STRING_SPAN:
assert self.partial
else:
assert last_which == _E_STRING_END
self.partial = (_T_STRING_END, [ taglist.pop() ])
taglist.reverse()
taglist.extend(self.tokens)
self.tokens = taglist
def _set_end(self, taglist, text, l, r, subtags):
self.string_end = l
def _handle_partial(self, buf):
which, chunks = self.partial
if which == _T_TOKEN:
success, taglist, idx = _tt.tag(buf, _c_token_table)
if not success:
# The start of this buffer was not a token. So the end of the
# prior buffer was a complete token.
self.tokens.insert(0, string.join(chunks, ''))
else:
assert len(taglist) == 1 and taglist[0][0] == _T_TOKEN \
and taglist[0][1] == 0 and taglist[0][2] == idx
if idx == len(buf):
#
# The whole buffer was one huge token, so we may have a
# partial token again.
#
# Note: this modifies the list of chunks in self.partial
#
chunks.append(buf)
# consumed the whole buffer
return len(buf)
# got the rest of the token.
chunks.append(buf[:idx])
self.tokens.insert(0, string.join(chunks, ''))
# no more partial token
self.partial = None
return idx
if which == _T_STRING_END:
if buf[0] != '@':
self.tokens.insert(0, string.join(chunks, ''))
return 0
chunks.append('@')
start = 1
else:
start = 0
self.string_end = None
string_table = (
(None, _tt.Is, '@', +3, +1),
(_UNUSED, _tt.Is + _tt.AppendMatch, '@', +1, -1),
(self._set_end, _tt.Skip + _tt.CallTag, 0, 0, _SUCCESS),
(None, _tt.EOF, _tt.Here, +1, _SUCCESS),
# suck up everything that isn't an AT. move to next rule to look
# for EOF
(_UNUSED, _tt.AllInSet + _tt.AppendMatch, _not_at_set, 0, +1),
# go back to look for double AT if we aren't at the end of the string
(None, _tt.EOF, _tt.Here, -5, _SUCCESS),
)
success, unused, idx = _tt.tag(buf, string_table,
start, len(buf), chunks)
# must have matched at least one item
assert success
if self.string_end is None:
assert idx == len(buf)
self.partial = (_T_STRING_SPAN, chunks)
elif self.string_end < len(buf):
self.partial = None
self.tokens.insert(0, string.join(chunks, ''))
else:
self.partial = (_T_STRING_END, chunks)
return idx
def _parse_more(self):
buf = self.rcsfile.read(self.CHUNK_SIZE)
if not buf:
return _EOF
if self.partial:
idx = self._handle_partial(buf)
if idx is None:
return _CONTINUE
if idx < len(buf):
self._parse_chunk(buf, idx)
else:
self._parse_chunk(buf)
return _CONTINUE
def get(self):
try:
return self.tokens.pop()
except IndexError:
pass
while not self.tokens:
action = self._parse_more()
if action == _EOF:
return None
return self.tokens.pop()
# _get = get
# def get(self):
token = self._get()
print 'T:', `token`
return token
def match(self, match):
if self.tokens:
token = self.tokens.pop()
else:
token = self.get()
if token != match:
raise common.RCSExpected(token, match)
def unget(self, token):
self.tokens.append(token)
def mget(self, count):
"Return multiple tokens. 'next' is at the end."
while len(self.tokens) < count:
action = self._parse_more()
if action == _EOF:
### fix this
raise RuntimeError, 'EOF hit while expecting tokens'
result = self.tokens[-count:]
del self.tokens[-count:]
return result
class Parser(common._Parser):
stream_class = _mxTokenStream

103
lib/vclib/svn/__init__.py Normal file
View File

@@ -0,0 +1,103 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"Version Control lib driver for Subversion repositories"
import os
import os.path
import re
import urllib
_re_url = re.compile('^(http|https|file|svn|svn\+[^:]+)://')
def _canonicalize_path(path):
import svn.core
try:
return svn.core.svn_path_canonicalize(path)
except AttributeError: # svn_path_canonicalize() appeared in 1.4.0 bindings
# There's so much more that we *could* do here, but if we're
# here at all its because there's a really old Subversion in
# place, and those older Subversion versions cared quite a bit
# less about the specifics of path canonicalization.
if re.search(_re_url, path):
return path.rstrip('/')
else:
return os.path.normpath(path)
def canonicalize_rootpath(rootpath):
# Try to canonicalize the rootpath using Subversion semantics.
rootpath = _canonicalize_path(rootpath)
# ViewVC's support for local repositories is more complete and more
# performant than its support for remote ones, so if we're on a
# Unix-y system and we have a file:/// URL, convert it to a local
# path instead.
if os.name == 'posix':
rootpath_lower = rootpath.lower()
if rootpath_lower in ['file://localhost',
'file://localhost/',
'file://',
'file:///'
]:
return '/'
if rootpath_lower.startswith('file://localhost/'):
rootpath = os.path.normpath(urllib.unquote(rootpath[16:]))
elif rootpath_lower.startswith('file:///'):
rootpath = os.path.normpath(urllib.unquote(rootpath[7:]))
# Ensure that we have an absolute path (or URL), and return.
if not re.search(_re_url, rootpath):
assert os.path.isabs(rootpath)
return rootpath
def expand_root_parent(parent_path):
roots = {}
if re.search(_re_url, parent_path):
pass
else:
# Any subdirectories of PARENT_PATH which themselves have a child
# "format" are returned as roots.
assert os.path.isabs(parent_path)
subpaths = os.listdir(parent_path)
for rootname in subpaths:
rootpath = os.path.join(parent_path, rootname)
if os.path.exists(os.path.join(rootpath, "format")):
roots[rootname] = canonicalize_rootpath(rootpath)
return roots
def find_root_in_parent(parent_path, rootname):
"""Search PARENT_PATH for a root named ROOTNAME, returning the
canonicalized ROOTPATH of the root if found; return None if no such
root is found."""
if not re.search(_re_url, parent_path):
assert os.path.isabs(parent_path)
rootpath = os.path.join(parent_path, rootname)
format_path = os.path.join(rootpath, "format")
if os.path.exists(format_path):
return canonicalize_rootpath(rootpath)
return None
def SubversionRepository(name, rootpath, authorizer, utilities, config_dir):
rootpath = canonicalize_rootpath(rootpath)
if re.search(_re_url, rootpath):
import svn_ra
return svn_ra.RemoteSubversionRepository(name, rootpath, authorizer,
utilities, config_dir)
else:
import svn_repos
return svn_repos.LocalSubversionRepository(name, rootpath, authorizer,
utilities, config_dir)

812
lib/vclib/svn/svn_ra.py Normal file
View File

@@ -0,0 +1,812 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"Version Control lib driver for remotely accessible Subversion repositories."
import vclib
import sys
import os
import re
import tempfile
import time
import urllib
from svn_repos import Revision, SVNChangedPath, _datestr_to_date, \
_compare_paths, _path_parts, _cleanup_path, \
_rev2optrev, _fix_subversion_exception, \
_split_revprops, _canonicalize_path
from svn import core, delta, client, wc, ra
### Require Subversion 1.3.1 or better. (for svn_ra_get_locations support)
if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH) < (1, 3, 1):
raise Exception, "Version requirement not met (needs 1.3.1 or better)"
### BEGIN COMPATABILITY CODE ###
try:
SVN_INVALID_REVNUM = core.SVN_INVALID_REVNUM
except AttributeError: # The 1.4.x bindings are missing core.SVN_INVALID_REVNUM
SVN_INVALID_REVNUM = -1
def list_directory(url, peg_rev, rev, flag, ctx):
try:
dirents, locks = client.svn_client_ls3(url, peg_rev, rev, flag, ctx)
except TypeError: # 1.4.x bindings are goofed
dirents = client.svn_client_ls3(None, url, peg_rev, rev, flag, ctx)
locks = {}
return dirents, locks
def get_directory_props(ra_session, path, rev):
try:
dirents, fetched_rev, props = ra.svn_ra_get_dir(ra_session, path, rev)
except ValueError: # older bindings are goofed
props = ra.svn_ra_get_dir(ra_session, path, rev)
return props
def client_log(url, start_rev, end_rev, log_limit, include_changes,
cross_copies, cb_func, ctx):
include_changes = include_changes and 1 or 0
cross_copies = cross_copies and 1 or 0
try:
client.svn_client_log4([url], start_rev, start_rev, end_rev,
log_limit, include_changes, not cross_copies,
0, None, cb_func, ctx)
except AttributeError:
# Wrap old svn_log_message_receiver_t interface with a
# svn_log_entry_t one.
def cb_convert(paths, revision, author, date, message, pool):
class svn_log_entry_t:
pass
log_entry = svn_log_entry_t()
log_entry.changed_paths = paths
log_entry.revision = revision
log_entry.revprops = { core.SVN_PROP_REVISION_LOG : message,
core.SVN_PROP_REVISION_AUTHOR : author,
core.SVN_PROP_REVISION_DATE : date,
}
cb_func(log_entry, pool)
client.svn_client_log2([url], start_rev, end_rev, log_limit,
include_changes, not cross_copies, cb_convert, ctx)
def setup_client_ctx(config_dir):
# Ensure that the configuration directory exists.
core.svn_config_ensure(config_dir)
# Fetch the configuration (and 'config' bit thereof).
cfg = core.svn_config_get_config(config_dir)
config = cfg.get(core.SVN_CONFIG_CATEGORY_CONFIG)
# Here's the compat-sensitive part: try to use
# svn_cmdline_create_auth_baton(), and fall back to making our own
# if that fails.
try:
auth_baton = core.svn_cmdline_create_auth_baton(1, None, None, config_dir,
1, 1, config, None)
except AttributeError:
auth_baton = core.svn_auth_open([
client.svn_client_get_simple_provider(),
client.svn_client_get_username_provider(),
client.svn_client_get_ssl_server_trust_file_provider(),
client.svn_client_get_ssl_client_cert_file_provider(),
client.svn_client_get_ssl_client_cert_pw_file_provider(),
])
if config_dir is not None:
core.svn_auth_set_parameter(auth_baton,
core.SVN_AUTH_PARAM_CONFIG_DIR,
config_dir)
# Create, setup, and return the client context baton.
ctx = client.svn_client_create_context()
ctx.config = cfg
ctx.auth_baton = auth_baton
return ctx
### END COMPATABILITY CODE ###
class LogCollector:
def __init__(self, path, show_all_logs, lockinfo, access_check_func):
# This class uses leading slashes for paths internally
if not path:
self.path = '/'
else:
self.path = path[0] == '/' and path or '/' + path
self.logs = []
self.show_all_logs = show_all_logs
self.lockinfo = lockinfo
self.access_check_func = access_check_func
self.done = False
def add_log(self, log_entry, pool):
if self.done:
return
paths = log_entry.changed_paths
revision = log_entry.revision
msg, author, date, revprops = _split_revprops(log_entry.revprops)
# Changed paths have leading slashes
changed_paths = paths.keys()
changed_paths.sort(lambda a, b: _compare_paths(a, b))
this_path = None
if self.path in changed_paths:
this_path = self.path
change = paths[self.path]
if change.copyfrom_path:
this_path = change.copyfrom_path
for changed_path in changed_paths:
if changed_path != self.path:
# If a parent of our path was copied, our "next previous"
# (huh?) path will exist elsewhere (under the copy source).
if (self.path.rfind(changed_path) == 0) and \
self.path[len(changed_path)] == '/':
change = paths[changed_path]
if change.copyfrom_path:
this_path = change.copyfrom_path + self.path[len(changed_path):]
if self.show_all_logs or this_path:
if self.access_check_func is None \
or self.access_check_func(self.path[1:], revision):
entry = Revision(revision, date, author, msg, None, self.lockinfo,
self.path[1:], None, None)
self.logs.append(entry)
else:
self.done = True
if this_path:
self.path = this_path
def cat_to_tempfile(svnrepos, path, rev):
"""Check out file revision to temporary file"""
temp = tempfile.mktemp()
stream = core.svn_stream_from_aprfile(temp)
url = svnrepos._geturl(path)
client.svn_client_cat(core.Stream(stream), url, _rev2optrev(rev),
svnrepos.ctx)
core.svn_stream_close(stream)
return temp
class SelfCleanFP:
def __init__(self, path):
self._fp = open(path, 'r')
self._path = path
self._eof = 0
def read(self, len=None):
if len:
chunk = self._fp.read(len)
else:
chunk = self._fp.read()
if chunk == '':
self._eof = 1
return chunk
def readline(self):
chunk = self._fp.readline()
if chunk == '':
self._eof = 1
return chunk
def readlines(self):
lines = self._fp.readlines()
self._eof = 1
return lines
def close(self):
self._fp.close()
os.remove(self._path)
def __del__(self):
self.close()
def eof(self):
return self._eof
class RemoteSubversionRepository(vclib.Repository):
def __init__(self, name, rootpath, authorizer, utilities, config_dir):
self.name = name
self.rootpath = rootpath
self.auth = authorizer
self.diff_cmd = utilities.diff or 'diff'
self.config_dir = config_dir or None
# See if this repository is even viewable, authz-wise.
if not vclib.check_root_access(self):
raise vclib.ReposNotFound(name)
def open(self):
# Setup the client context baton, complete with non-prompting authstuffs.
self.ctx = setup_client_ctx(self.config_dir)
ra_callbacks = ra.svn_ra_callbacks_t()
ra_callbacks.auth_baton = self.ctx.auth_baton
self.ra_session = ra.svn_ra_open(self.rootpath, ra_callbacks, None,
self.ctx.config)
self.youngest = ra.svn_ra_get_latest_revnum(self.ra_session)
self._dirent_cache = { }
self._revinfo_cache = { }
# See if a universal read access determination can be made.
if self.auth and self.auth.check_universal_access(self.name) == 1:
self.auth = None
def rootname(self):
return self.name
def rootpath(self):
return self.rootpath
def roottype(self):
return vclib.SVN
def authorizer(self):
return self.auth
def itemtype(self, path_parts, rev):
pathtype = None
if not len(path_parts):
pathtype = vclib.DIR
else:
path = self._getpath(path_parts)
rev = self._getrev(rev)
try:
kind = ra.svn_ra_check_path(self.ra_session, path, rev)
if kind == core.svn_node_file:
pathtype = vclib.FILE
elif kind == core.svn_node_dir:
pathtype = vclib.DIR
except:
pass
if pathtype is None:
raise vclib.ItemNotFound(path_parts)
if not vclib.check_path_access(self, path_parts, pathtype, rev):
raise vclib.ItemNotFound(path_parts)
return pathtype
def openfile(self, path_parts, rev, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % path)
rev = self._getrev(rev)
url = self._geturl(path)
### rev here should be the last history revision of the URL
fp = SelfCleanFP(cat_to_tempfile(self, path, rev))
lh_rev, c_rev = self._get_last_history_rev(path_parts, rev)
return fp, lh_rev
def listdir(self, path_parts, rev, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.DIR: # does auth-check
raise vclib.Error("Path '%s' is not a directory." % path)
rev = self._getrev(rev)
entries = []
dirents, locks = self._get_dirents(path, rev)
for name in dirents.keys():
entry = dirents[name]
if entry.kind == core.svn_node_dir:
kind = vclib.DIR
elif entry.kind == core.svn_node_file:
kind = vclib.FILE
else:
kind = None
entries.append(vclib.DirEntry(name, kind))
return entries
def dirlogs(self, path_parts, rev, entries, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.DIR: # does auth-check
raise vclib.Error("Path '%s' is not a directory." % path)
rev = self._getrev(rev)
dirents, locks = self._get_dirents(path, rev)
for entry in entries:
entry_path_parts = path_parts + [entry.name]
dirent = dirents.get(entry.name, None)
# dirents is authz-sanitized, so ensure the entry is found therein.
if dirent is None:
continue
# Get authz-sanitized revision metadata.
entry.date, entry.author, entry.log, revprops, changes = \
self._revinfo(dirent.created_rev)
entry.rev = str(dirent.created_rev)
entry.size = dirent.size
entry.lockinfo = None
if locks.has_key(entry.name):
entry.lockinfo = locks[entry.name].owner
def itemlog(self, path_parts, rev, sortby, first, limit, options):
assert sortby == vclib.SORTBY_DEFAULT or sortby == vclib.SORTBY_REV
path_type = self.itemtype(path_parts, rev) # does auth-check
path = self._getpath(path_parts)
rev = self._getrev(rev)
url = self._geturl(path)
# If this is a file, fetch the lock status and size (as of REV)
# for this item.
lockinfo = size_in_rev = None
if path_type == vclib.FILE:
basename = path_parts[-1]
list_url = self._geturl(self._getpath(path_parts[:-1]))
dirents, locks = list_directory(list_url, _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
if locks.has_key(basename):
lockinfo = locks[basename].owner
if dirents.has_key(basename):
size_in_rev = dirents[basename].size
# Special handling for the 'svn_latest_log' scenario.
### FIXME: Don't like this hack. We should just introduce
### something more direct in the vclib API.
if options.get('svn_latest_log', 0):
dir_lh_rev, dir_c_rev = self._get_last_history_rev(path_parts, rev)
date, author, log, revprops, changes = self._revinfo(dir_lh_rev)
return [vclib.Revision(dir_lh_rev, str(dir_lh_rev), date, author,
None, log, size_in_rev, lockinfo)]
def _access_checker(check_path, check_rev):
return vclib.check_path_access(self, _path_parts(check_path),
path_type, check_rev)
# It's okay if we're told to not show all logs on a file -- all
# the revisions should match correctly anyway.
lc = LogCollector(path, options.get('svn_show_all_dir_logs', 0),
lockinfo, _access_checker)
cross_copies = options.get('svn_cross_copies', 0)
log_limit = 0
if limit:
log_limit = first + limit
client_log(url, _rev2optrev(rev), _rev2optrev(1), log_limit, 1,
cross_copies, lc.add_log, self.ctx)
revs = lc.logs
revs.sort()
prev = None
for rev in revs:
# Swap out revision info with stuff from the cache (which is
# authz-sanitized).
rev.date, rev.author, rev.log, revprops, changes \
= self._revinfo(rev.number)
rev.prev = prev
prev = rev
revs.reverse()
if len(revs) < first:
return []
if limit:
return revs[first:first+limit]
return revs
def itemprops(self, path_parts, rev):
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
rev = self._getrev(rev)
url = self._geturl(path)
pairs = client.svn_client_proplist2(url, _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
return pairs and pairs[0][1] or {}
def annotate(self, path_parts, rev, include_text=False):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % path)
rev = self._getrev(rev)
url = self._geturl(path)
# Examine logs for the file to determine the oldest revision we are
# permitted to see.
log_options = {
'svn_cross_copies' : 1,
'svn_show_all_dir_logs' : 1,
}
revs = self.itemlog(path_parts, rev, vclib.SORTBY_REV, 0, 0, log_options)
oldest_rev = revs[-1].number
# Now calculate the annotation data. Note that we'll not
# inherently trust the provided author and date, because authz
# rules might necessitate that we strip that information out.
blame_data = []
def _blame_cb(line_no, revision, author, date,
line, pool, blame_data=blame_data):
prev_rev = None
if revision > 1:
prev_rev = revision - 1
# If we have an invalid revision, clear the date and author
# values. Otherwise, if we have authz filtering to do, use the
# revinfo cache to do so.
if revision < 0:
date = author = None
elif self.auth:
date, author, msg, revprops, changes = self._revinfo(revision)
# Strip text if the caller doesn't want it.
if not include_text:
line = None
blame_data.append(vclib.Annotation(line, line_no + 1, revision, prev_rev,
author, date))
client.blame2(url, _rev2optrev(rev), _rev2optrev(oldest_rev),
_rev2optrev(rev), _blame_cb, self.ctx)
return blame_data, rev
def revinfo(self, rev):
return self._revinfo(rev, 1)
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
if path_parts1 is not None:
p1 = self._getpath(path_parts1)
r1 = self._getrev(rev1)
if not vclib.check_path_access(self, path_parts1, vclib.FILE, rev1):
raise vclib.ItemNotFound(path_parts1)
else:
p1 = None
if path_parts2 is not None:
if not p1:
raise vclib.ItemNotFound(parh_parts2)
p2 = self._getpath(path_parts2)
r2 = self._getrev(rev2)
if not vclib.check_path_access(self, path_parts2, vclib.FILE, rev2):
raise vclib.ItemNotFound(path_parts2)
else:
p2 = None
args = vclib._diff_args(type, options)
def _date_from_rev(rev):
date, author, msg, revprops, changes = self._revinfo(rev)
return date
try:
info1 = p1, _date_from_rev(r1), r1
info2 = p2, _date_from_rev(r2), r2
if p1:
temp1 = cat_to_tempfile(self, p1, r1)
else:
temp1 = '/dev/null'
if p2:
temp2 = cat_to_tempfile(self, p2, r2)
else:
temp2 = '/dev/null'
return vclib._diff_fp(temp1, temp2, info1, info2, self.diff_cmd, args)
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.InvalidRevision
raise
def isexecutable(self, path_parts, rev):
props = self.itemprops(path_parts, rev) # does authz-check
return props.has_key(core.SVN_PROP_EXECUTABLE)
def filesize(self, path_parts, rev):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % path)
rev = self._getrev(rev)
dirents, locks = self._get_dirents(self._getpath(path_parts[:-1]), rev)
dirent = dirents.get(path_parts[-1], None)
return dirent.size
def _getpath(self, path_parts):
return '/'.join(path_parts)
def _getrev(self, rev):
if rev is None or rev == 'HEAD':
return self.youngest
try:
if type(rev) == type(''):
while rev[0] == 'r':
rev = rev[1:]
rev = int(rev)
except:
raise vclib.InvalidRevision(rev)
if (rev < 0) or (rev > self.youngest):
raise vclib.InvalidRevision(rev)
return rev
def _geturl(self, path=None):
if not path:
return self.rootpath
path = self.rootpath + '/' + urllib.quote(path)
return _canonicalize_path(path)
def _get_dirents(self, path, rev):
"""Return a 2-type of dirents and locks, possibly reading/writing
from a local cache of that information. This functions performs
authz checks, stripping out unreadable dirents."""
dir_url = self._geturl(path)
path_parts = _path_parts(path)
if path:
key = str(rev) + '/' + path
else:
key = str(rev)
# Ensure that the cache gets filled...
dirents_locks = self._dirent_cache.get(key)
if not dirents_locks:
tmp_dirents, locks = list_directory(dir_url, _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
dirents = {}
for name, dirent in tmp_dirents.items():
dirent_parts = path_parts + [name]
kind = dirent.kind
if (kind == core.svn_node_dir or kind == core.svn_node_file) \
and vclib.check_path_access(self, dirent_parts,
kind == core.svn_node_dir \
and vclib.DIR or vclib.FILE, rev):
lh_rev, c_rev = self._get_last_history_rev(dirent_parts, rev)
dirent.created_rev = lh_rev
dirents[name] = dirent
dirents_locks = [dirents, locks]
self._dirent_cache[key] = dirents_locks
# ...then return the goodies from the cache.
return dirents_locks[0], dirents_locks[1]
def _get_last_history_rev(self, path_parts, rev):
"""Return the a 2-tuple which contains:
- the last interesting revision equal to or older than REV in
the history of PATH_PARTS.
- the created_rev of of PATH_PARTS as of REV."""
path = self._getpath(path_parts)
url = self._geturl(self._getpath(path_parts))
optrev = _rev2optrev(rev)
# Get the last-changed-rev.
revisions = []
def _info_cb(path, info, pool, retval=revisions):
revisions.append(info.last_changed_rev)
client.svn_client_info(url, optrev, optrev, _info_cb, 0, self.ctx)
last_changed_rev = revisions[0]
# Now, this object might not have been directly edited since the
# last-changed-rev, but it might have been the child of a copy.
# To determine this, we'll run a potentially no-op log between
# LAST_CHANGED_REV and REV.
lc = LogCollector(path, 1, None, None)
client_log(url, optrev, _rev2optrev(last_changed_rev), 1, 1, 0,
lc.add_log, self.ctx)
revs = lc.logs
if revs:
revs.sort()
return revs[0].number, last_changed_rev
else:
return last_changed_rev, last_changed_rev
def _revinfo_fetch(self, rev, include_changed_paths=0):
need_changes = include_changed_paths or self.auth
revs = []
def _log_cb(log_entry, pool, retval=revs):
# If Subversion happens to call us more than once, we choose not
# to care.
if retval:
return
revision = log_entry.revision
msg, author, date, revprops = _split_revprops(log_entry.revprops)
action_map = { 'D' : vclib.DELETED,
'A' : vclib.ADDED,
'R' : vclib.REPLACED,
'M' : vclib.MODIFIED,
}
# Easy out: if we won't use the changed-path info, just return a
# changes-less tuple.
if not need_changes:
return revs.append([date, author, msg, revprops, None])
# Subversion 1.5 and earlier didn't offer the 'changed_paths2'
# hash, and in Subversion 1.6, it's offered but broken.
try:
changed_paths = log_entry.changed_paths2
paths = (changed_paths or {}).keys()
except:
changed_paths = log_entry.changed_paths
paths = (changed_paths or {}).keys()
paths.sort(lambda a, b: _compare_paths(a, b))
# If we get this far, our caller needs changed-paths, or we need
# them for authz-related sanitization.
changes = []
found_readable = found_unreadable = 0
for path in paths:
change = changed_paths[path]
# svn_log_changed_path_t (which we might get instead of the
# svn_log_changed_path2_t we'd prefer) doesn't have the
# 'node_kind' member.
pathtype = None
if hasattr(change, 'node_kind'):
if change.node_kind == core.svn_node_dir:
pathtype = vclib.DIR
elif change.node_kind == core.svn_node_file:
pathtype = vclib.FILE
# svn_log_changed_path2_t only has the 'text_modified' and
# 'props_modified' bits in Subversion 1.7 and beyond. And
# svn_log_changed_path_t is without.
text_modified = props_modified = 0
if hasattr(change, 'text_modified'):
if change.text_modified == core.svn_tristate_true:
text_modified = 1
if hasattr(change, 'props_modified'):
if change.props_modified == core.svn_tristate_true:
props_modified = 1
# Wrong, diddily wrong wrong wrong. Can you say,
# "Manufacturing data left and right because it hurts to
# figure out the right stuff?"
action = action_map.get(change.action, vclib.MODIFIED)
if change.copyfrom_path and change.copyfrom_rev:
is_copy = 1
base_path = change.copyfrom_path
base_rev = change.copyfrom_rev
elif action == vclib.ADDED or action == vclib.REPLACED:
is_copy = 0
base_path = base_rev = None
else:
is_copy = 0
base_path = path
base_rev = revision - 1
# Check authz rules (sadly, we have to lie about the path type)
parts = _path_parts(path)
if vclib.check_path_access(self, parts, vclib.FILE, revision):
if is_copy and base_path and (base_path != path):
parts = _path_parts(base_path)
if not vclib.check_path_access(self, parts, vclib.FILE, base_rev):
is_copy = 0
base_path = None
base_rev = None
found_unreadable = 1
changes.append(SVNChangedPath(path, revision, pathtype, base_path,
base_rev, action, is_copy,
text_modified, props_modified))
found_readable = 1
else:
found_unreadable = 1
# If our caller doesn't want changed-path stuff, and we have
# the info we need to make an authz determination already,
# quit this loop and get on with it.
if (not include_changed_paths) and found_unreadable and found_readable:
break
# Filter unreadable information.
if found_unreadable:
msg = None
if not found_readable:
author = None
date = None
# Drop unrequested changes.
if not include_changed_paths:
changes = None
# Add this revision information to the "return" array.
retval.append([date, author, msg, revprops, changes])
optrev = _rev2optrev(rev)
client_log(self.rootpath, optrev, optrev, 1, need_changes, 0,
_log_cb, self.ctx)
return tuple(revs[0])
def _revinfo(self, rev, include_changed_paths=0):
"""Internal-use, cache-friendly revision information harvester."""
# Consult the revinfo cache first. If we don't have cached info,
# or our caller wants changed paths and we don't have those for
# this revision, go do the real work.
rev = self._getrev(rev)
cached_info = self._revinfo_cache.get(rev)
if not cached_info \
or (include_changed_paths and cached_info[4] is None):
cached_info = self._revinfo_fetch(rev, include_changed_paths)
self._revinfo_cache[rev] = cached_info
return cached_info
##--- custom --##
def get_youngest_revision(self):
return self.youngest
def get_location(self, path, rev, old_rev):
try:
results = ra.get_locations(self.ra_session, path, rev, [old_rev])
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.ItemNotFound(path)
raise
try:
old_path = results[old_rev]
except KeyError:
raise vclib.ItemNotFound(path)
old_path = _cleanup_path(old_path)
old_path_parts = _path_parts(old_path)
# Check access (lying about path types)
if not vclib.check_path_access(self, old_path_parts, vclib.FILE, old_rev):
raise vclib.ItemNotFound(path)
return old_path
def created_rev(self, path, rev):
lh_rev, c_rev = self._get_last_history_rev(_path_parts(path), rev)
return lh_rev
def last_rev(self, path, peg_revision, limit_revision=None):
"""Given PATH, known to exist in PEG_REVISION, find the youngest
revision older than, or equal to, LIMIT_REVISION in which path
exists. Return that revision, and the path at which PATH exists in
that revision."""
# Here's the plan, man. In the trivial case (where PEG_REVISION is
# the same as LIMIT_REVISION), this is a no-brainer. If
# LIMIT_REVISION is older than PEG_REVISION, we can use Subversion's
# history tracing code to find the right location. If, however,
# LIMIT_REVISION is younger than PEG_REVISION, we suffer from
# Subversion's lack of forward history searching. Our workaround,
# ugly as it may be, involves a binary search through the revisions
# between PEG_REVISION and LIMIT_REVISION to find our last live
# revision.
peg_revision = self._getrev(peg_revision)
limit_revision = self._getrev(limit_revision)
if peg_revision == limit_revision:
return peg_revision, path
elif peg_revision > limit_revision:
path = self.get_location(path, peg_revision, limit_revision)
return limit_revision, path
else:
direction = 1
while peg_revision != limit_revision:
mid = (peg_revision + 1 + limit_revision) / 2
try:
path = self.get_location(path, peg_revision, mid)
except vclib.ItemNotFound:
limit_revision = mid - 1
else:
peg_revision = mid
return peg_revision, path
def get_symlink_target(self, path_parts, rev):
"""Return the target of the symbolic link versioned at PATH_PARTS
in REV, or None if that object is not a symlink."""
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
rev = self._getrev(rev)
url = self._geturl(path)
# Symlinks must be files with the svn:special property set on them
# and with file contents which read "link SOME_PATH".
if path_type != vclib.FILE:
return None
pairs = client.svn_client_proplist2(url, _rev2optrev(rev),
_rev2optrev(rev), 0, self.ctx)
props = pairs and pairs[0][1] or {}
if not props.has_key(core.SVN_PROP_SPECIAL):
return None
pathspec = ''
### FIXME: We're being a touch sloppy here, first by grabbing the
### whole file and then by checking only the first line
### of it.
fp = SelfCleanFP(cat_to_tempfile(self, path, rev))
pathspec = fp.readline()
fp.close()
if pathspec[:5] != 'link ':
return None
return pathspec[5:]

979
lib/vclib/svn/svn_repos.py Normal file
View File

@@ -0,0 +1,979 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
"Version Control lib driver for locally accessible Subversion repositories"
import vclib
import os
import os.path
import cStringIO
import time
import tempfile
import popen
import re
import urllib
from svn import fs, repos, core, client, delta, diff
### Require Subversion 1.3.1 or better.
if (core.SVN_VER_MAJOR, core.SVN_VER_MINOR, core.SVN_VER_PATCH) < (1, 3, 1):
raise Exception, "Version requirement not met (needs 1.3.1 or better)"
### Pre-1.5 Subversion doesn't have SVN_ERR_CEASE_INVOCATION
try:
_SVN_ERR_CEASE_INVOCATION = core.SVN_ERR_CEASE_INVOCATION
except:
_SVN_ERR_CEASE_INVOCATION = core.SVN_ERR_CANCELLED
### Pre-1.5 SubversionException's might not have the .msg and .apr_err members
def _fix_subversion_exception(e):
if not hasattr(e, 'apr_err'):
e.apr_err = e[1]
if not hasattr(e, 'message'):
e.message = e[0]
### Pre-1.4 Subversion doesn't have svn_path_canonicalize()
def _canonicalize_path(path):
try:
return core.svn_path_canonicalize(path)
except AttributeError:
return path
def _allow_all(root, path, pool):
"""Generic authz_read_func that permits access to all paths"""
return 1
def _path_parts(path):
return filter(None, path.split('/'))
def _cleanup_path(path):
"""Return a cleaned-up Subversion filesystem path"""
return '/'.join(_path_parts(path))
def _fs_path_join(base, relative):
return _cleanup_path(base + '/' + relative)
def _compare_paths(path1, path2):
path1_len = len (path1);
path2_len = len (path2);
min_len = min(path1_len, path2_len)
i = 0
# Are the paths exactly the same?
if path1 == path2:
return 0
# Skip past common prefix
while (i < min_len) and (path1[i] == path2[i]):
i = i + 1
# Children of paths are greater than their parents, but less than
# greater siblings of their parents
char1 = '\0'
char2 = '\0'
if (i < path1_len):
char1 = path1[i]
if (i < path2_len):
char2 = path2[i]
if (char1 == '/') and (i == path2_len):
return 1
if (char2 == '/') and (i == path1_len):
return -1
if (i < path1_len) and (char1 == '/'):
return -1
if (i < path2_len) and (char2 == '/'):
return 1
# Common prefix was skipped above, next character is compared to
# determine order
return cmp(char1, char2)
def _rev2optrev(rev):
assert type(rev) is int
rt = core.svn_opt_revision_t()
rt.kind = core.svn_opt_revision_number
rt.value.number = rev
return rt
def _rootpath2url(rootpath, path):
rootpath = os.path.abspath(rootpath)
drive, rootpath = os.path.splitdrive(rootpath)
if os.sep != '/':
rootpath = rootpath.replace(os.sep, '/')
rootpath = urllib.quote(rootpath)
path = urllib.quote(path)
if drive:
url = 'file:///' + drive + rootpath + '/' + path
else:
url = 'file://' + rootpath + '/' + path
return _canonicalize_path(url)
# Given a dictionary REVPROPS of revision properties, pull special
# ones out of them and return a 4-tuple containing the log message,
# the author, the date (converted from the date string property), and
# a dictionary of any/all other revprops.
def _split_revprops(revprops):
if not revprops:
return None, None, None, {}
special_props = []
for prop in core.SVN_PROP_REVISION_LOG, \
core.SVN_PROP_REVISION_AUTHOR, \
core.SVN_PROP_REVISION_DATE:
if revprops.has_key(prop):
special_props.append(revprops[prop])
del(revprops[prop])
else:
special_props.append(None)
msg, author, datestr = tuple(special_props)
date = _datestr_to_date(datestr)
return msg, author, date, revprops
def _datestr_to_date(datestr):
try:
return core.svn_time_from_cstring(datestr) / 1000000
except:
return None
class Revision(vclib.Revision):
"Hold state for each revision's log entry."
def __init__(self, rev, date, author, msg, size, lockinfo,
filename, copy_path, copy_rev):
vclib.Revision.__init__(self, rev, str(rev), date, author, None,
msg, size, lockinfo)
self.filename = filename
self.copy_path = copy_path
self.copy_rev = copy_rev
class NodeHistory:
"""An iterable object that returns 2-tuples of (revision, path)
locations along a node's change history, ordered from youngest to
oldest."""
def __init__(self, fs_ptr, show_all_logs, limit=0):
self.histories = []
self.fs_ptr = fs_ptr
self.show_all_logs = show_all_logs
self.oldest_rev = None
self.limit = limit
def add_history(self, path, revision, pool):
# If filtering, only add the path and revision to the histories
# list if they were actually changed in this revision (where
# change means the path itself was changed, or one of its parents
# was copied). This is useful for omitting bubble-up directory
# changes.
if not self.oldest_rev:
self.oldest_rev = revision
else:
assert(revision < self.oldest_rev)
if not self.show_all_logs:
rev_root = fs.revision_root(self.fs_ptr, revision)
changed_paths = fs.paths_changed(rev_root)
paths = changed_paths.keys()
if path not in paths:
# Look for a copied parent
test_path = path
found = 0
while 1:
off = test_path.rfind('/')
if off < 0:
break
test_path = test_path[0:off]
if test_path in paths:
copyfrom_rev, copyfrom_path = fs.copied_from(rev_root, test_path)
if copyfrom_rev >= 0 and copyfrom_path:
found = 1
break
if not found:
return
self.histories.append([revision, _cleanup_path(path)])
if self.limit and len(self.histories) == self.limit:
raise core.SubversionException("", _SVN_ERR_CEASE_INVOCATION)
def __getitem__(self, idx):
return self.histories[idx]
def _get_last_history_rev(fsroot, path):
history = fs.node_history(fsroot, path)
history = fs.history_prev(history, 0)
history_path, history_rev = fs.history_location(history)
return history_rev
def temp_checkout(svnrepos, path, rev):
"""Check out file revision to temporary file"""
temp = tempfile.mktemp()
fp = open(temp, 'wb')
try:
root = svnrepos._getroot(rev)
stream = fs.file_contents(root, path)
try:
while 1:
chunk = core.svn_stream_read(stream, core.SVN_STREAM_CHUNK_SIZE)
if not chunk:
break
fp.write(chunk)
finally:
core.svn_stream_close(stream)
finally:
fp.close()
return temp
class FileContentsPipe:
def __init__(self, root, path):
self._stream = fs.file_contents(root, path)
self._eof = 0
def read(self, len=None):
chunk = None
if not self._eof:
if len is None:
buffer = cStringIO.StringIO()
try:
while 1:
hunk = core.svn_stream_read(self._stream, 8192)
if not hunk:
break
buffer.write(hunk)
chunk = buffer.getvalue()
finally:
buffer.close()
else:
chunk = core.svn_stream_read(self._stream, len)
if not chunk:
self._eof = 1
return chunk
def readline(self):
chunk = None
if not self._eof:
chunk, self._eof = core.svn_stream_readline(self._stream, '\n')
if not self._eof:
chunk = chunk + '\n'
if not chunk:
self._eof = 1
return chunk
def readlines(self):
lines = []
while True:
line = self.readline()
if not line:
break
lines.append(line)
return lines
def close(self):
return core.svn_stream_close(self._stream)
def eof(self):
return self._eof
class BlameSource:
def __init__(self, local_url, rev, first_rev, include_text, config_dir):
self.idx = -1
self.first_rev = first_rev
self.blame_data = []
self.include_text = include_text
ctx = client.svn_client_create_context()
core.svn_config_ensure(config_dir)
ctx.config = core.svn_config_get_config(config_dir)
ctx.auth_baton = core.svn_auth_open([])
try:
### TODO: Is this use of FIRST_REV always what we want? Should we
### pass 1 here instead and do filtering later?
client.blame3(local_url, _rev2optrev(rev), _rev2optrev(first_rev),
_rev2optrev(rev), diff.svn_diff_file_options_t(), True, self._blame_cb, ctx)
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_CLIENT_IS_BINARY_FILE:
raise vclib.NonTextualFileContents
raise
def _blame_cb(self, line_no, rev, author, date, text, pool):
prev_rev = None
if rev > self.first_rev:
prev_rev = rev - 1
if not self.include_text:
text = None
self.blame_data.append(vclib.Annotation(text, line_no + 1, rev,
prev_rev, author, None))
def __getitem__(self, idx):
if idx != self.idx + 1:
raise BlameSequencingError()
self.idx = idx
return self.blame_data[idx]
class BlameSequencingError(Exception):
pass
class SVNChangedPath(vclib.ChangedPath):
"""Wrapper around vclib.ChangedPath which handles path splitting."""
def __init__(self, path, rev, pathtype, base_path, base_rev,
action, copied, text_changed, props_changed):
path_parts = _path_parts(path or '')
base_path_parts = _path_parts(base_path or '')
vclib.ChangedPath.__init__(self, path_parts, rev, pathtype,
base_path_parts, base_rev, action,
copied, text_changed, props_changed)
class LocalSubversionRepository(vclib.Repository):
def __init__(self, name, rootpath, authorizer, utilities, config_dir):
if not (os.path.isdir(rootpath) \
and os.path.isfile(os.path.join(rootpath, 'format'))):
raise vclib.ReposNotFound(name)
# Initialize some stuff.
self.rootpath = rootpath
self.name = name
self.auth = authorizer
self.diff_cmd = utilities.diff or 'diff'
self.config_dir = config_dir or None
# See if this repository is even viewable, authz-wise.
if not vclib.check_root_access(self):
raise vclib.ReposNotFound(name)
def open(self):
# Open the repository and init some other variables.
self.repos = repos.svn_repos_open(self.rootpath)
self.fs_ptr = repos.svn_repos_fs(self.repos)
self.youngest = fs.youngest_rev(self.fs_ptr)
self._fsroots = {}
self._revinfo_cache = {}
# See if a universal read access determination can be made.
if self.auth and self.auth.check_universal_access(self.name) == 1:
self.auth = None
def rootname(self):
return self.name
def rootpath(self):
return self.rootpath
def roottype(self):
return vclib.SVN
def authorizer(self):
return self.auth
def itemtype(self, path_parts, rev):
rev = self._getrev(rev)
basepath = self._getpath(path_parts)
pathtype = self._gettype(basepath, rev)
if pathtype is None:
raise vclib.ItemNotFound(path_parts)
if not vclib.check_path_access(self, path_parts, pathtype, rev):
raise vclib.ItemNotFound(path_parts)
return pathtype
def openfile(self, path_parts, rev, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % path)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
revision = str(_get_last_history_rev(fsroot, path))
fp = FileContentsPipe(fsroot, path)
return fp, revision
def listdir(self, path_parts, rev, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.DIR: # does auth-check
raise vclib.Error("Path '%s' is not a directory." % path)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
dirents = fs.dir_entries(fsroot, path)
entries = [ ]
for entry in dirents.values():
if entry.kind == core.svn_node_dir:
kind = vclib.DIR
elif entry.kind == core.svn_node_file:
kind = vclib.FILE
if vclib.check_path_access(self, path_parts + [entry.name], kind, rev):
entries.append(vclib.DirEntry(entry.name, kind))
return entries
def dirlogs(self, path_parts, rev, entries, options):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.DIR: # does auth-check
raise vclib.Error("Path '%s' is not a directory." % path)
fsroot = self._getroot(self._getrev(rev))
rev = self._getrev(rev)
for entry in entries:
entry_path_parts = path_parts + [entry.name]
if not vclib.check_path_access(self, entry_path_parts, entry.kind, rev):
continue
path = self._getpath(entry_path_parts)
entry_rev = _get_last_history_rev(fsroot, path)
date, author, msg, revprops, changes = self._revinfo(entry_rev)
entry.rev = str(entry_rev)
entry.date = date
entry.author = author
entry.log = msg
if entry.kind == vclib.FILE:
entry.size = fs.file_length(fsroot, path)
lock = fs.get_lock(self.fs_ptr, path)
entry.lockinfo = lock and lock.owner or None
def itemlog(self, path_parts, rev, sortby, first, limit, options):
"""see vclib.Repository.itemlog docstring
Option values recognized by this implementation
svn_show_all_dir_logs
boolean, default false. if set for a directory path, will include
revisions where files underneath the directory have changed
svn_cross_copies
boolean, default false. if set for a path created by a copy, will
include revisions from before the copy
svn_latest_log
boolean, default false. if set will return only newest single log
entry
"""
assert sortby == vclib.SORTBY_DEFAULT or sortby == vclib.SORTBY_REV
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
rev = self._getrev(rev)
revs = []
lockinfo = None
# See if this path is locked.
try:
lock = fs.get_lock(self.fs_ptr, path)
if lock:
lockinfo = lock.owner
except NameError:
pass
# If our caller only wants the latest log, we'll invoke
# _log_helper for just the one revision. Otherwise, we go off
# into history-fetching mode. ### TODO: we could stand to have a
# 'limit' parameter here as numeric cut-off for the depth of our
# history search.
if options.get('svn_latest_log', 0):
revision = self._log_helper(path, rev, lockinfo)
if revision:
revision.prev = None
revs.append(revision)
else:
history = self._get_history(path, rev, path_type, first + limit, options)
if len(history) < first:
history = []
if limit:
history = history[first:first+limit]
for hist_rev, hist_path in history:
revision = self._log_helper(hist_path, hist_rev, lockinfo)
if revision:
# If we have unreadable copyfrom data, obscure it.
if revision.copy_path is not None:
cp_parts = _path_parts(revision.copy_path)
if not vclib.check_path_access(self, cp_parts, path_type,
revision.copy_rev):
revision.copy_path = revision.copy_rev = None
revision.prev = None
if len(revs):
revs[-1].prev = revision
revs.append(revision)
return revs
def itemprops(self, path_parts, rev):
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
rev = self._getrev(rev)
fsroot = self._getroot(rev)
return fs.node_proplist(fsroot, path)
def annotate(self, path_parts, rev, include_text=False):
path = self._getpath(path_parts)
path_type = self.itemtype(path_parts, rev) # does auth-check
if path_type != vclib.FILE:
raise vclib.Error("Path '%s' is not a file." % path)
rev = self._getrev(rev)
fsroot = self._getroot(rev)
history = self._get_history(path, rev, path_type, 0,
{'svn_cross_copies': 1})
youngest_rev, youngest_path = history[0]
oldest_rev, oldest_path = history[-1]
source = BlameSource(_rootpath2url(self.rootpath, path), youngest_rev,
oldest_rev, include_text, self.config_dir)
return source, youngest_rev
def revinfo(self, rev):
return self._revinfo(rev, 1)
def rawdiff(self, path_parts1, rev1, path_parts2, rev2, type, options={}):
if path_parts1:
p1 = self._getpath(path_parts1)
r1 = self._getrev(rev1)
if not vclib.check_path_access(self, path_parts1, vclib.FILE, rev1):
raise vclib.ItemNotFound(path_parts1)
else:
p1 = None
if path_parts2:
p2 = self._getpath(path_parts2)
r2 = self._getrev(rev2)
if not vclib.check_path_access(self, path_parts2, vclib.FILE, rev2):
raise vclib.ItemNotFound(path_parts2)
else:
if not p1:
raise vclib.ItemNotFound(path_parts2)
p2 = None
args = vclib._diff_args(type, options)
def _date_from_rev(rev):
date, author, msg, revprops, changes = self._revinfo(rev)
return date
try:
if p1:
temp1 = temp_checkout(self, p1, r1)
info1 = p1, _date_from_rev(r1), r1
else:
temp1 = '/dev/null'
info1 = '/dev/null', _date_from_rev(rev1), rev1
if p2:
temp2 = temp_checkout(self, p2, r2)
info2 = p2, _date_from_rev(r2), r2
else:
temp2 = '/dev/null'
info2 = '/dev/null', _date_from_rev(rev2), rev2
return vclib._diff_fp(temp1, temp2, info1, info2, self.diff_cmd, args)
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.InvalidRevision
if e.apr_err != _SVN_ERR_CEASE_INVOCATION:
raise
def isexecutable(self, path_parts, rev):
props = self.itemprops(path_parts, rev) # does authz-check
return props.has_key(core.SVN_PROP_EXECUTABLE)
def filesize(self, path_parts, rev):
path = self._getpath(path_parts)
if self.itemtype(path_parts, rev) != vclib.FILE: # does auth-check
raise vclib.Error("Path '%s' is not a file." % path)
fsroot = self._getroot(self._getrev(rev))
return fs.file_length(fsroot, path)
##--- helpers ---##
def _revinfo(self, rev, include_changed_paths=0):
"""Internal-use, cache-friendly revision information harvester."""
def _get_changed_paths(fsroot):
"""Return a 3-tuple: found_readable, found_unreadable, changed_paths."""
editor = repos.ChangeCollector(self.fs_ptr, fsroot)
e_ptr, e_baton = delta.make_editor(editor)
repos.svn_repos_replay(fsroot, e_ptr, e_baton)
changedpaths = {}
changes = editor.get_changes()
# Copy the Subversion changes into a new hash, checking
# authorization and converting them into ChangedPath objects.
found_readable = found_unreadable = 0
for path in changes.keys():
change = changes[path]
if change.path:
change.path = _cleanup_path(change.path)
if change.base_path:
change.base_path = _cleanup_path(change.base_path)
is_copy = 0
if not hasattr(change, 'action'): # new to subversion 1.4.0
action = vclib.MODIFIED
if not change.path:
action = vclib.DELETED
elif change.added:
action = vclib.ADDED
replace_check_path = path
if change.base_path and change.base_rev:
replace_check_path = change.base_path
if changedpaths.has_key(replace_check_path) \
and changedpaths[replace_check_path].action == vclib.DELETED:
action = vclib.REPLACED
else:
if change.action == repos.CHANGE_ACTION_ADD:
action = vclib.ADDED
elif change.action == repos.CHANGE_ACTION_DELETE:
action = vclib.DELETED
elif change.action == repos.CHANGE_ACTION_REPLACE:
action = vclib.REPLACED
else:
action = vclib.MODIFIED
if (action == vclib.ADDED or action == vclib.REPLACED) \
and change.base_path \
and change.base_rev:
is_copy = 1
if change.item_kind == core.svn_node_dir:
pathtype = vclib.DIR
elif change.item_kind == core.svn_node_file:
pathtype = vclib.FILE
else:
pathtype = None
parts = _path_parts(path)
if vclib.check_path_access(self, parts, pathtype, rev):
if is_copy and change.base_path and (change.base_path != path):
parts = _path_parts(change.base_path)
if not vclib.check_path_access(self, parts, pathtype,
change.base_rev):
is_copy = 0
change.base_path = None
change.base_rev = None
found_unreadable = 1
changedpaths[path] = SVNChangedPath(path, rev, pathtype,
change.base_path,
change.base_rev, action,
is_copy, change.text_changed,
change.prop_changes)
found_readable = 1
else:
found_unreadable = 1
return found_readable, found_unreadable, changedpaths.values()
def _get_change_copyinfo(fsroot, path, change):
# If we know the copyfrom info, return it...
if hasattr(change, 'copyfrom_known') and change.copyfrom_known:
copyfrom_path = change.copyfrom_path
copyfrom_rev = change.copyfrom_rev
# ...otherwise, if this change could be a copy (that is, it
# contains an add action), query the copyfrom info ...
elif (change.change_kind == fs.path_change_add or
change.change_kind == fs.path_change_replace):
copyfrom_rev, copyfrom_path = fs.copied_from(fsroot, path)
# ...else, there's no copyfrom info.
else:
copyfrom_rev = core.SVN_INVALID_REVNUM
copyfrom_path = None
return copyfrom_path, copyfrom_rev
def _simple_auth_check(fsroot):
"""Return a 2-tuple: found_readable, found_unreadable."""
found_unreadable = found_readable = 0
if hasattr(fs, 'paths_changed2'):
changes = fs.paths_changed2(fsroot)
else:
changes = fs.paths_changed(fsroot)
paths = changes.keys()
for path in paths:
change = changes[path]
pathtype = None
if hasattr(change, 'node_kind'):
if change.node_kind == core.svn_node_file:
pathtype = vclib.FILE
elif change.node_kind == core.svn_node_dir:
pathtype = vclib.DIR
parts = _path_parts(path)
if pathtype is None:
# Figure out the pathtype so we can query the authz subsystem.
if change.change_kind == fs.path_change_delete:
# Deletions are annoying, because they might be underneath
# copies (make their previous location non-trivial).
prev_parts = parts
prev_rev = rev - 1
parent_parts = parts[:-1]
while parent_parts:
parent_path = '/' + self._getpath(parent_parts)
parent_change = changes.get(parent_path)
if not (parent_change and \
(parent_change.change_kind == fs.path_change_add or
parent_change.change_kind == fs.path_change_replace)):
del(parent_parts[-1])
continue
copyfrom_path, copyfrom_rev = \
_get_change_copyinfo(fsroot, parent_path, parent_change)
if copyfrom_path:
prev_rev = copyfrom_rev
prev_parts = _path_parts(copyfrom_path) + \
parts[len(parent_parts):]
break
del(parent_parts[-1])
pathtype = self._gettype(self._getpath(prev_parts), prev_rev)
else:
pathtype = self._gettype(self._getpath(parts), rev)
if vclib.check_path_access(self, parts, pathtype, rev):
found_readable = 1
copyfrom_path, copyfrom_rev = \
_get_change_copyinfo(fsroot, path, change)
if copyfrom_path and copyfrom_path != path:
parts = _path_parts(copyfrom_path)
if not vclib.check_path_access(self, parts, pathtype,
copyfrom_rev):
found_unreadable = 1
else:
found_unreadable = 1
if found_readable and found_unreadable:
break
return found_readable, found_unreadable
def _revinfo_helper(rev, include_changed_paths):
# Get the revision property info. (Would use
# editor.get_root_props(), but something is broken there...)
revprops = fs.revision_proplist(self.fs_ptr, rev)
msg, author, date, revprops = _split_revprops(revprops)
# Optimization: If our caller doesn't care about the changed
# paths, and we don't need them to do authz determinations, let's
# get outta here.
if self.auth is None and not include_changed_paths:
return date, author, msg, revprops, None
# If we get here, then we either need the changed paths because we
# were asked for them, or we need them to do authorization checks.
#
# If we only need them for authorization checks, though, we
# won't bother generating fully populated ChangedPath items (the
# cost is too great).
fsroot = self._getroot(rev)
if include_changed_paths:
found_readable, found_unreadable, changedpaths = \
_get_changed_paths(fsroot)
else:
changedpaths = None
found_readable, found_unreadable = _simple_auth_check(fsroot)
# Filter our metadata where necessary, and return the requested data.
if found_unreadable:
msg = None
if not found_readable:
author = None
date = None
return date, author, msg, revprops, changedpaths
# Consult the revinfo cache first. If we don't have cached info,
# or our caller wants changed paths and we don't have those for
# this revision, go do the real work.
rev = self._getrev(rev)
cached_info = self._revinfo_cache.get(rev)
if not cached_info \
or (include_changed_paths and cached_info[4] is None):
cached_info = _revinfo_helper(rev, include_changed_paths)
self._revinfo_cache[rev] = cached_info
return tuple(cached_info)
def _log_helper(self, path, rev, lockinfo):
rev_root = fs.revision_root(self.fs_ptr, rev)
copyfrom_rev, copyfrom_path = fs.copied_from(rev_root, path)
date, author, msg, revprops, changes = self._revinfo(rev)
if fs.is_file(rev_root, path):
size = fs.file_length(rev_root, path)
else:
size = None
return Revision(rev, date, author, msg, size, lockinfo, path,
copyfrom_path and _cleanup_path(copyfrom_path),
copyfrom_rev)
def _get_history(self, path, rev, path_type, limit=0, options={}):
if self.youngest == 0:
return []
rev_paths = []
fsroot = self._getroot(rev)
show_all_logs = options.get('svn_show_all_dir_logs', 0)
if not show_all_logs:
# See if the path is a file or directory.
kind = fs.check_path(fsroot, path)
if kind is core.svn_node_file:
show_all_logs = 1
# Instantiate a NodeHistory collector object, and use it to collect
# history items for PATH@REV.
history = NodeHistory(self.fs_ptr, show_all_logs, limit)
try:
repos.svn_repos_history(self.fs_ptr, path, history.add_history,
1, rev, options.get('svn_cross_copies', 0))
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err != _SVN_ERR_CEASE_INVOCATION:
raise
# Now, iterate over those history items, checking for changes of
# location, pruning as necessitated by authz rules.
for hist_rev, hist_path in history:
path_parts = _path_parts(hist_path)
if not vclib.check_path_access(self, path_parts, path_type, hist_rev):
break
rev_paths.append([hist_rev, hist_path])
return rev_paths
def _getpath(self, path_parts):
return '/'.join(path_parts)
def _getrev(self, rev):
if rev is None or rev == 'HEAD':
return self.youngest
try:
if type(rev) == type(''):
while rev[0] == 'r':
rev = rev[1:]
rev = int(rev)
except:
raise vclib.InvalidRevision(rev)
if (rev < 0) or (rev > self.youngest):
raise vclib.InvalidRevision(rev)
return rev
def _getroot(self, rev):
try:
return self._fsroots[rev]
except KeyError:
r = self._fsroots[rev] = fs.revision_root(self.fs_ptr, rev)
return r
def _gettype(self, path, rev):
# Similar to itemtype(), but without the authz check. Returns
# None for missing paths.
try:
kind = fs.check_path(self._getroot(rev), path)
except:
return None
if kind == core.svn_node_dir:
return vclib.DIR
if kind == core.svn_node_file:
return vclib.FILE
return None
##--- custom ---##
def get_youngest_revision(self):
return self.youngest
def get_location(self, path, rev, old_rev):
try:
results = repos.svn_repos_trace_node_locations(self.fs_ptr, path,
rev, [old_rev], _allow_all)
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
raise vclib.ItemNotFound(path)
raise
try:
old_path = results[old_rev]
except KeyError:
raise vclib.ItemNotFound(path)
return _cleanup_path(old_path)
def created_rev(self, full_name, rev):
return fs.node_created_rev(self._getroot(rev), full_name)
def last_rev(self, path, peg_revision, limit_revision=None):
"""Given PATH, known to exist in PEG_REVISION, find the youngest
revision older than, or equal to, LIMIT_REVISION in which path
exists. Return that revision, and the path at which PATH exists in
that revision."""
# Here's the plan, man. In the trivial case (where PEG_REVISION is
# the same as LIMIT_REVISION), this is a no-brainer. If
# LIMIT_REVISION is older than PEG_REVISION, we can use Subversion's
# history tracing code to find the right location. If, however,
# LIMIT_REVISION is younger than PEG_REVISION, we suffer from
# Subversion's lack of forward history searching. Our workaround,
# ugly as it may be, involves a binary search through the revisions
# between PEG_REVISION and LIMIT_REVISION to find our last live
# revision.
peg_revision = self._getrev(peg_revision)
limit_revision = self._getrev(limit_revision)
try:
if peg_revision == limit_revision:
return peg_revision, path
elif peg_revision > limit_revision:
fsroot = self._getroot(peg_revision)
history = fs.node_history(fsroot, path)
while history:
path, peg_revision = fs.history_location(history)
if peg_revision <= limit_revision:
return peg_revision, _cleanup_path(path)
history = fs.history_prev(history, 1)
return peg_revision, _cleanup_path(path)
else:
orig_id = fs.node_id(self._getroot(peg_revision), path)
while peg_revision != limit_revision:
mid = (peg_revision + 1 + limit_revision) / 2
try:
mid_id = fs.node_id(self._getroot(mid), path)
except core.SubversionException, e:
_fix_subversion_exception(e)
if e.apr_err == core.SVN_ERR_FS_NOT_FOUND:
cmp = -1
else:
raise
else:
### Not quite right. Need a comparison function that only returns
### true when the two nodes are the same copy, not just related.
cmp = fs.compare_ids(orig_id, mid_id)
if cmp in (0, 1):
peg_revision = mid
else:
limit_revision = mid - 1
return peg_revision, path
finally:
pass
def get_symlink_target(self, path_parts, rev):
"""Return the target of the symbolic link versioned at PATH_PARTS
in REV, or None if that object is not a symlink."""
path = self._getpath(path_parts)
rev = self._getrev(rev)
path_type = self.itemtype(path_parts, rev) # does auth-check
fsroot = self._getroot(rev)
# Symlinks must be files with the svn:special property set on them
# and with file contents which read "link SOME_PATH".
if path_type != vclib.FILE:
return None
props = fs.node_proplist(fsroot, path)
if not props.has_key(core.SVN_PROP_SPECIAL):
return None
pathspec = ''
### FIXME: We're being a touch sloppy here, only checking the first line
### of the file.
stream = fs.file_contents(fsroot, path)
try:
pathspec, eof = core.svn_stream_readline(stream, '\n')
finally:
core.svn_stream_close(stream)
if pathspec[:5] != 'link ':
return None
return pathspec[5:]

File diff suppressed because it is too large Load Diff

5420
lib/viewvc.py Normal file

File diff suppressed because it is too large Load Diff

75
lib/viewvcmagic.py Normal file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/python
import mimetypes
import magic
have_chardet = 0
try:
import chardet
have_chardet = 1
except: pass
class ContentMagic:
def __init__(self, encodings):
self.encodings = encodings.split(':')
self.mime_magic = None
self.errors = []
# Try to load magic
self.mime_magic = magic.open(magic.MAGIC_MIME_TYPE)
self.mime_magic.load()
# returns MIME type
def guess_mime(self, mime, filename, tempfile):
if mime == 'application/octet-stream':
mime = ''
if not mime and filename:
mime = mimetypes.guess_type(filename)[0]
if not mime and tempfile and self.mime_magic:
if type(tempfile) == type(''):
mime = self.mime_magic.file(tempfile)
else:
c = tempfile.read(4096)
mime = self.mime_magic.buffer(c)
return mime
# returns (utf8_content, charset)
def guess_charset(self, content):
# Try UTF-8
charset = 'utf-8'
try: content = content.decode('utf-8')
except: charset = None
if charset is None and have_chardet and len(content) > 64:
# Try to guess with chardet
try:
# Only detect on first 256KB if content is longer
if len(content) > 256*1024:
charset = chardet.detect(content[0:256*1024])
else:
charset = chardet.detect(content)
if charset and charset['encoding']:
charset = charset['encoding']
if charset == 'MacCyrillic':
# Silly MacCyr, try cp1251
try:
content = content.decode('windows-1251')
charset = 'windows-1251'
except: content = content.decode(charset)
else:
content = content.decode(charset)
except: charset = None
# Then try to guess primitively
if charset is None:
for charset in self.encodings:
try:
content = content.decode(charset)
break
except: charset = None
return (content, charset)
# guess and encode return value into UTF-8
def utf8(self, content):
(uni, charset) = self.guess_charset(content)
if charset:
return uni.encode('utf-8')
return content

235
lib/win32popen.py Normal file
View File

@@ -0,0 +1,235 @@
# -*-python-*-
#
# Copyright (C) 1999-2013 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit http://viewvc.org/
#
# -----------------------------------------------------------------------
#
# Utilities for controlling processes and pipes on win32
#
# -----------------------------------------------------------------------
import os, sys, traceback, thread
try:
import win32api
except ImportError, e:
raise ImportError, str(e) + """
Did you install the Python for Windows Extensions?
http://sourceforge.net/projects/pywin32/
"""
import win32process, win32pipe, win32con
import win32event, win32file, winerror
import pywintypes, msvcrt
# Buffer size for spooling
SPOOL_BYTES = 4096
# File object to write error messages
SPOOL_ERROR = sys.stderr
#SPOOL_ERROR = open("m:/temp/error.txt", "wt")
def CommandLine(command, args):
"""Convert an executable path and a sequence of arguments into a command
line that can be passed to CreateProcess"""
cmd = "\"" + command.replace("\"", "\"\"") + "\""
for arg in args:
cmd = cmd + " \"" + arg.replace("\"", "\"\"") + "\""
return cmd
def CreateProcess(cmd, hStdInput, hStdOutput, hStdError):
"""Creates a new process which uses the specified handles for its standard
input, output, and error. The handles must be inheritable. 0 can be passed
as a special handle indicating that the process should inherit the current
process's input, output, or error streams, and None can be passed to discard
the child process's output or to prevent it from reading any input."""
# initialize new process's startup info
si = win32process.STARTUPINFO()
si.dwFlags = win32process.STARTF_USESTDHANDLES
if hStdInput == 0:
si.hStdInput = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE)
else:
si.hStdInput = hStdInput
if hStdOutput == 0:
si.hStdOutput = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE)
else:
si.hStdOutput = hStdOutput
if hStdError == 0:
si.hStdError = win32api.GetStdHandle(win32api.STD_ERROR_HANDLE)
else:
si.hStdError = hStdError
# create the process
phandle, pid, thandle, tid = win32process.CreateProcess \
( None, # appName
cmd, # commandLine
None, # processAttributes
None, # threadAttributes
1, # bInheritHandles
win32con.NORMAL_PRIORITY_CLASS, # dwCreationFlags
None, # newEnvironment
None, # currentDirectory
si # startupinfo
)
if hStdInput and hasattr(hStdInput, 'Close'):
hStdInput.Close()
if hStdOutput and hasattr(hStdOutput, 'Close'):
hStdOutput.Close()
if hStdError and hasattr(hStdError, 'Close'):
hStdError.Close()
return phandle, pid, thandle, tid
def CreatePipe(readInheritable, writeInheritable):
"""Create a new pipe specifying whether the read and write ends are
inheritable and whether they should be created for blocking or nonblocking
I/O."""
r, w = win32pipe.CreatePipe(None, SPOOL_BYTES)
if readInheritable:
r = MakeInheritedHandle(r)
if writeInheritable:
w = MakeInheritedHandle(w)
return r, w
def File2FileObject(pipe, mode):
"""Make a C stdio file object out of a win32 file handle"""
if mode.find('r') >= 0:
wmode = os.O_RDONLY
elif mode.find('w') >= 0:
wmode = os.O_WRONLY
if mode.find('b') >= 0:
wmode = wmode | os.O_BINARY
if mode.find('t') >= 0:
wmode = wmode | os.O_TEXT
return os.fdopen(msvcrt.open_osfhandle(pipe.Detach(),wmode),mode)
def FileObject2File(fileObject):
"""Get the win32 file handle from a C stdio file object"""
return win32file._get_osfhandle(fileObject.fileno())
def DuplicateHandle(handle):
"""Duplicates a win32 handle."""
proc = win32api.GetCurrentProcess()
return win32api.DuplicateHandle(proc,handle,proc,0,0,win32con.DUPLICATE_SAME_ACCESS)
def MakePrivateHandle(handle, replace = 1):
"""Turn an inherited handle into a non inherited one. This avoids the
handle duplication that occurs on CreateProcess calls which can create
uncloseable pipes."""
### Could change implementation to use SetHandleInformation()...
flags = win32con.DUPLICATE_SAME_ACCESS
proc = win32api.GetCurrentProcess()
if replace: flags = flags | win32con.DUPLICATE_CLOSE_SOURCE
newhandle = win32api.DuplicateHandle(proc,handle,proc,0,0,flags)
if replace: handle.Detach() # handle was already deleted by the last call
return newhandle
def MakeInheritedHandle(handle, replace = 1):
"""Turn a private handle into an inherited one."""
### Could change implementation to use SetHandleInformation()...
flags = win32con.DUPLICATE_SAME_ACCESS
proc = win32api.GetCurrentProcess()
if replace: flags = flags | win32con.DUPLICATE_CLOSE_SOURCE
newhandle = win32api.DuplicateHandle(proc,handle,proc,0,1,flags)
if replace: handle.Detach() # handle was deleted by the last call
return newhandle
def MakeSpyPipe(readInheritable, writeInheritable, outFiles = None, doneEvent = None):
"""Return read and write handles to a pipe that asynchronously writes all of
its input to the files in the outFiles sequence. doneEvent can be None, or a
a win32 event handle that will be set when the write end of pipe is closed.
"""
if outFiles is None:
return CreatePipe(readInheritable, writeInheritable)
r, writeHandle = CreatePipe(0, writeInheritable)
if readInheritable is None:
readHandle, w = None, None
else:
readHandle, w = CreatePipe(readInheritable, 0)
thread.start_new_thread(SpoolWorker, (r, w, outFiles, doneEvent))
return readHandle, writeHandle
def SpoolWorker(srcHandle, destHandle, outFiles, doneEvent):
"""Thread entry point for implementation of MakeSpyPipe"""
try:
buffer = win32file.AllocateReadBuffer(SPOOL_BYTES)
while 1:
try:
#print >> SPOOL_ERROR, "Calling ReadFile..."; SPOOL_ERROR.flush()
hr, data = win32file.ReadFile(srcHandle, buffer)
#print >> SPOOL_ERROR, "ReadFile returned '%s', '%s'" % (str(hr), str(data)); SPOOL_ERROR.flush()
if hr != 0:
raise "win32file.ReadFile returned %i, '%s'" % (hr, data)
elif len(data) == 0:
break
except pywintypes.error, e:
#print >> SPOOL_ERROR, "ReadFile threw '%s'" % str(e); SPOOL_ERROR.flush()
if e.args[0] == winerror.ERROR_BROKEN_PIPE:
break
else:
raise e
#print >> SPOOL_ERROR, "Writing to %i file objects..." % len(outFiles); SPOOL_ERROR.flush()
for f in outFiles:
f.write(data)
#print >> SPOOL_ERROR, "Done writing to file objects."; SPOOL_ERROR.flush()
#print >> SPOOL_ERROR, "Writing to destination %s" % str(destHandle); SPOOL_ERROR.flush()
if destHandle:
#print >> SPOOL_ERROR, "Calling WriteFile..."; SPOOL_ERROR.flush()
hr, bytes = win32file.WriteFile(destHandle, data)
#print >> SPOOL_ERROR, "WriteFile() passed %i bytes and returned %i, %i" % (len(data), hr, bytes); SPOOL_ERROR.flush()
if hr != 0 or bytes != len(data):
raise "win32file.WriteFile() passed %i bytes and returned %i, %i" % (len(data), hr, bytes)
srcHandle.Close()
if doneEvent:
win32event.SetEvent(doneEvent)
if destHandle:
destHandle.Close()
except:
info = sys.exc_info()
SPOOL_ERROR.writelines(apply(traceback.format_exception, info), '')
SPOOL_ERROR.flush()
del info
def NullFile(inheritable):
"""Create a null file handle."""
if inheritable:
sa = pywintypes.SECURITY_ATTRIBUTES()
sa.bInheritHandle = 1
else:
sa = None
return win32file.CreateFile("nul",
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
win32file.FILE_SHARE_READ | win32file.FILE_SHARE_WRITE,
sa, win32file.OPEN_EXISTING, 0, None)

170
misc/PyFontify.py Normal file
View File

@@ -0,0 +1,170 @@
"""Module to analyze Python source code; for syntax coloring tools.
Interface:
tags = fontify(pytext, searchfrom, searchto)
The PYTEXT argument is a string containing Python source code. The
(optional) arguments SEARCHFROM and SEARCHTO may contain a slice in
PYTEXT.
The returned value is a list of tuples, formatted like this:
[('keyword', 0, 6, None),
('keyword', 11, 17, None),
('comment', 23, 53, None),
...
]
The tuple contents are always like this:
(tag, startindex, endindex, sublist)
TAG is one of 'keyword', 'string', 'comment' or 'identifier'
SUBLIST is not used, hence always None.
"""
# Based on FontText.py by Mitchell S. Chapman,
# which was modified by Zachary Roadhouse,
# then un-Tk'd by Just van Rossum.
# Many thanks for regular expression debugging & authoring are due to:
# Tim (the-incredib-ly y'rs) Peters and Cristian Tismer
# So, who owns the copyright? ;-) How about this:
# Copyright 1996-1997:
# Mitchell S. Chapman,
# Zachary Roadhouse,
# Tim Peters,
# Just van Rossum
__version__ = "0.3.1"
import string, re
# This list of keywords is taken from ref/node13.html of the
# Python 1.3 HTML documentation. ("access" is intentionally omitted.)
keywordsList = ["and", "assert", "break", "class", "continue", "def",
"del", "elif", "else", "except", "exec", "finally",
"for", "from", "global", "if", "import", "in", "is",
"lambda", "not", "or", "pass", "print", "raise",
"return", "try", "while",
]
# A regexp for matching Python comments.
commentPat = "#.*"
# A regexp for matching simple quoted strings.
pat = "q[^q\\n]*(\\[\000-\377][^q\\n]*)*q"
quotePat = string.replace(pat, "q", "'") + "|" + string.replace(pat, 'q', '"')
# A regexp for matching multi-line tripled-quoted strings. (Way to go, Tim!)
pat = """
qqq
[^q]*
(
( \\[\000-\377]
| q
( \\[\000-\377]
| [^q]
| q
( \\[\000-\377]
| [^q]
)
)
)
[^q]*
)*
qqq
"""
pat = string.join(string.split(pat), '') # get rid of whitespace
tripleQuotePat = string.replace(pat, "q", "'") + "|" \
+ string.replace(pat, 'q', '"')
# A regexp which matches all and only Python keywords. This will let
# us skip the uninteresting identifier references.
nonKeyPat = "(^|[^a-zA-Z0-9_.\"'])" # legal keyword-preceding characters
keyPat = nonKeyPat + "(" + string.join(keywordsList, "|") + ")" + nonKeyPat
# Our final syntax-matching regexp is the concatation of the regexp's we
# constructed above.
syntaxPat = keyPat + \
"|" + commentPat + \
"|" + tripleQuotePat + \
"|" + quotePat
syntaxRE = re.compile(syntaxPat)
# Finally, we construct a regexp for matching indentifiers (with
# optional leading whitespace).
idKeyPat = "[ \t]*[A-Za-z_][A-Za-z_0-9.]*"
idRE = re.compile(idKeyPat)
def fontify(pytext, searchfrom=0, searchto=None):
if searchto is None:
searchto = len(pytext)
tags = []
commentTag = 'comment'
stringTag = 'string'
keywordTag = 'keyword'
identifierTag = 'identifier'
start = 0
end = searchfrom
while 1:
# Look for some syntax token we're interested in. If find
# nothing, we're done.
matchobj = syntaxRE.search(pytext, end)
if not matchobj:
break
# If we found something outside our search area, it doesn't
# count (and we're done).
start = matchobj.start()
if start >= searchto:
break
match = matchobj.group(0)
end = start + len(match)
c = match[0]
if c == '#':
# We matched a comment.
tags.append((commentTag, start, end, None))
elif c == '"' or c == '\'':
# We matched a string.
tags.append((stringTag, start, end, None))
else:
# We matched a keyword.
if start != searchfrom:
# there's still a redundant char before and after it, strip!
match = match[1:-1]
start = start + 1
else:
# This is the first keyword in the text.
# Only a space at the end.
match = match[:-1]
end = end - 1
tags.append((keywordTag, start, end, None))
# If this was a defining keyword, look ahead to the
# following identifier.
if match in ["def", "class"]:
matchobj = idRE.search(pytext, end)
if matchobj:
start = matchobj.start()
if start == end and start < searchto:
end = start + len(matchobj.group(0))
tags.append((identifierTag, start, end, None))
return tags
def test(path):
f = open(path)
text = f.read()
f.close()
tags = fontify(text)
for tag, start, end, sublist in tags:
print tag, `text[start:end]`
if __name__ == "__main__":
import sys
test(sys.argv[0])

54
misc/elemx/Makefile Normal file
View File

@@ -0,0 +1,54 @@
TARGETS = python/elx-python java/elx-java
all : $(TARGETS)
CFLAGS = -g -Wpointer-arith -Wwrite-strings -Wshadow -Wall
CPPFLAGS = -Ipython -Ijava -I.
# the scanner depends on tokens generated from python.y
python/scanner.c : python/python.c
# the keywords also need the tokens in python.h
python/py_keywords.c : python/python.c
# we need the scanner tokens in py_scan.h and keywords in py_keywords.h
python/elx-python.o : python/elx-python.c python/py_keywords.c
# we need java.[ch] generated first to get the tokens in java.h
java/j_scan.c : java/java.c java/j_keywords.c
# the keywords also need the tokens in java.h
java/j_keywords.c : java/java.c
# we need the scanner tokens in j_scan.h and keywords in j_keywords.h
java/elx-java.o : java/elx-java.c java/j_keywords.c java/java.c
python/elx-python : python/elx-python.o python/scanner.o python/python.o \
python/py_keywords.o elx-common.o
$(CC) -o $@ $^
java/elx-java : java/elx-java.o java/j_scan.o java/java.o java/j_keywords.o \
elx-common.o
$(CC) -o $@ $^
clean :
rm -f *.o
rm -f python/*.o python/python.[ch] python/py_keywords.[ch]
rm -f java/*.o java/java.[ch] java/j_keywords.[ch] java/j_scan.[ch]
rm -f python/*.output java/*.output
rm -f $(TARGETS)
.SUFFIXES:
.SUFFIXES: .c .y .shilka .o
%.c : %.y
@d="`echo $@ | sed 's/\.c//'`" ; \
echo msta -d -enum -v -o $$d $< ; \
msta -d -enum -v -o $$d $<
%.c : %.shilka
@d="`echo $@ | sed 's,/[^/]*$$,,'`" ; \
f="`echo $< | sed 's,.*/,,'`" ; \
echo shilka -length -no-definitions -interface $$f ; \
(cd $$d && shilka -length -no-definitions -interface $$f)

110
misc/elemx/elx-common.c Normal file
View File

@@ -0,0 +1,110 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "elx.h"
#define ELX_ELEMS_EXT ".elx"
#define ELX_SYMBOLS_EXT ".els"
static void usage(const char *progname)
{
fprintf(stderr, "USAGE: %s FILENAME\n", progname);
exit(1);
}
static const char * build_one(const char *base, int len, const char *suffix)
{
int slen = strlen(suffix);
char *fn;
fn = malloc(len + slen + 1);
memcpy(fn, base, len);
memcpy(fn + len, suffix, slen);
fn[len + slen] = '\0';
return fn;
}
elx_context_t *elx_process_args(int argc, const char **argv)
{
elx_context_t *ec;
const char *input_fn;
const char *p;
int len;
/* ### in the future, we can expand this for more options */
if (argc != 2)
{
usage(argv[0]);
/* NOTREACHED */
}
input_fn = argv[1];
p = strrchr(input_fn, '.');
if (p == NULL)
len = strlen(input_fn);
else
len = p - argv[1];
ec = malloc(sizeof(*ec));
ec->input_fn = input_fn;
ec->elx_fn = build_one(input_fn, len, ELX_ELEMS_EXT);
ec->sym_fn = build_one(input_fn, len, ELX_SYMBOLS_EXT);
return ec;
}
void elx_open_files(elx_context_t *ec)
{
const char *fn;
const char *op;
if ((ec->input_fp = fopen(ec->input_fn, "r")) == NULL)
{
fn = ec->input_fn;
op = "reading";
goto error;
}
if ((ec->elx_fp = fopen(ec->elx_fn, "w")) == NULL)
{
fn = ec->elx_fn;
op = "writing";
goto error;
}
if ((ec->sym_fp = fopen(ec->sym_fn, "w")) == NULL)
{
fn = ec->sym_fn;
op = "writing";
goto error;
}
return;
error:
fprintf(stderr, "ERROR: file \"%s\" could not be opened for %s.\n %s\n",
fn, op, strerror(errno));
exit(2);
}
void elx_close_files(elx_context_t *ec)
{
fclose(ec->input_fp);
fclose(ec->elx_fp);
fclose(ec->sym_fp);
}
void elx_issue_token(elx_context_t *ec,
char which, int start, int len,
const char *symbol)
{
fprintf(ec->elx_fp, "%c %d %d\n", which, start, len);
if (ELX_DEFINES_SYM(which))
{
fprintf(ec->sym_fp, "%s %d %s\n", symbol, start, ec->input_fn);
}
}

54
misc/elemx/elx.h Normal file
View File

@@ -0,0 +1,54 @@
#ifndef ELX_H
#define ELX_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define ELX_COMMENT 'C' /* a comment */
#define ELX_STRING 'S' /* a string constant */
#define ELX_KEYWORD 'K' /* a language keyword */
#define ELX_GLOBAL_FDEF 'F' /* function defn in global (visible) scope */
#define ELX_LOCAL_FDEF 'L' /* function defn in local (hidden) scope */
#define ELX_METHOD_DEF 'M' /* method definition */
#define ELX_FUNC_REF 'R' /* function reference / call */
#define ELX_DEFINES_SYM(c) ((c) == ELX_GLOBAL_FDEF || (c) == ELX_LOCAL_FDEF \
|| (c) == ELX_METHOD_DEF)
typedef struct
{
/* input filename */
const char *input_fn;
/* output filenames: element extractions, and symbols */
const char *elx_fn;
const char *sym_fn;
/* file pointers for each of the input/output files */
FILE *input_fp;
FILE *elx_fp;
FILE *sym_fp;
} elx_context_t;
elx_context_t *elx_process_args(int argc, const char **argv);
void elx_open_files(elx_context_t *ec);
void elx_close_files(elx_context_t *ec);
void elx_issue_token(elx_context_t *ec,
char which, int start, int len,
const char *symbol);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ELX_H */

121
misc/elemx/elx_html.py Normal file
View File

@@ -0,0 +1,121 @@
#!/usr/bin/env python
#
# generate HTML given an input file and an element file
#
import re
import string
import cgi
import struct
_re_elem = re.compile('([a-zA-Z]) ([0-9]+) ([0-9]+)\n')
CHUNK_SIZE = 98304 # 4096*24
class ElemParser:
"Parse an elements file, extracting the token type, start, and length."
def __init__(self, efile):
self.efile = efile
def get(self):
line = self.efile.readline()
if not line:
return None, None, None
t, s, e = string.split(line)
return t, int(s)-1, int(e)
def unused_get(self):
record = self.efile.read(9)
if not record:
return None, None, None
return struct.unpack('>cii', record)
class Writer:
"Generate output, including copying from another input."
def __init__(self, ifile, ofile):
self.ifile = ifile
self.ofile = ofile
self.buf = ifile.read(CHUNK_SIZE)
self.offset = 0
def write(self, data):
self.ofile.write(data)
def copy(self, pos, amt):
"Copy 'amt' bytes from position 'pos' of input to output."
idx = pos - self.offset
self.ofile.write(cgi.escape(buffer(self.buf, idx, amt)))
amt = amt - (len(self.buf) - idx)
while amt > 0:
self._more()
self.ofile.write(cgi.escape(buffer(self.buf, 0, amt)))
amt = amt - len(self.buf)
def flush(self, pos):
"Flush the rest of the input to the output."
idx = pos - self.offset
self.ofile.write(cgi.escape(buffer(self.buf, idx)))
while 1:
buf = self.ifile.read(CHUNK_SIZE)
if not buf:
break
self.ofile.write(cgi.escape(buf))
def _more(self):
self.offset = self.offset + len(self.buf)
self.buf = self.ifile.read(CHUNK_SIZE)
def generate(input, elems, output, genpage=0):
ep = ElemParser(elems)
w = Writer(input, output)
cur = 0
if genpage:
w.write('''\
<html><head><title>ELX Output Page</title>
<style type="text/css">
.elx_C { color: firebrick; font-style: italic; }
.elx_S { color: #bc8f8f; font-weight: bold; }
.elx_K { color: purple; font-weight: bold }
.elx_F { color: blue; font-weight: bold; }
.elx_L { color: blue; font-weight: bold; }
.elx_M { color: blue; font-weight: bold; }
.elx_R { color: blue; font-weight: bold; }
</style>
</head>
<body>
''')
w.write('<pre>')
while 1:
type, start, length = ep.get()
if type is None:
break
if cur < start:
# print out some plain text up to 'cur'
w.copy(cur, start - cur)
# wrap a bit o' formatting here
w.write('<span class="elx_%s">' % type)
# copy over the token
w.copy(start, length)
# and close up the formatting
w.write('</span>')
cur = start + length
# all done.
w.flush(cur)
w.write('</pre>')
if genpage:
w.write('</body></html>\n')
if __name__ == '__main__':
import sys
generate(open(sys.argv[1]), open(sys.argv[2]), sys.stdout, 1)

26
misc/elemx/elx_page.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
if test "$#" != 2; then
echo "USAGE: $0 SOURCE-FILE ELX-FILE"
exit 1
fi
cat <<EOF
<html><head><title>ELX Output Page</title>
<style type="text/css">
.elx_C { color: firebrick; font-style: italic; }
.elx_S { color: #bc8f8f; font-weight: bold; }
.elx_K { color: purple; font-weight: bold }
.elx_F { color: blue; font-weight: bold; }
.elx_L { color: blue; font-weight: bold; }
.elx_M { color: blue; font-weight: bold; }
.elx_R { color: blue; font-weight: bold; }
</style>
</head>
<body>
EOF
dirname="`dirname $0`"
python2 $dirname/elx_html.py $1 $2
echo "</body></html>"

Some files were not shown because too many files have changed in this diff Show More