# HG changeset patch # User cmlenz # Date 1153518209 0 # Node ID 58f580798628d509cd7dbed23503e68ec232b6f1 # Parent 44af12832c5a6fef9e56defc9db8d1fa3479dd5e Trac port is now in the Trac repository (http://trac.edgewall.org/browser/sandbox/markup). diff --git a/examples/trac/AUTHORS b/examples/trac/AUTHORS deleted file mode 100644 --- a/examples/trac/AUTHORS +++ /dev/null @@ -1,12 +0,0 @@ - * Jonas Borgstrm - * Daniel Lundin - * Rocky Burt - * Christopher Lenz - * Francois Harvey - * Mark Rowe - * Matthew Good - * Christian Boos - * Emmanual Blot - * Alec Thomas - -See also THANKS for people who have contributed to the project. diff --git a/examples/trac/COPYING b/examples/trac/COPYING deleted file mode 100644 --- a/examples/trac/COPYING +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (C) 2003-2006 Edgewall Software -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. 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. - 3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. diff --git a/examples/trac/ChangeLog b/examples/trac/ChangeLog deleted file mode 100644 --- a/examples/trac/ChangeLog +++ /dev/null @@ -1,297 +0,0 @@ -Trac 0.9.5 (Apr 18, 2006) -http://svn.edgewall.com/repos/trac/tags/trac-0.9.5 - - * Fixed wiki macro XSS vulnerability found by Mr. Kazuhiro Nishiyama: - http://jvn.jp/jp/JVN%2384091359/index.html - * Smaller memory usage when accessing subversion history. - * Fixed issue with incorrectly generated urls when installed behind a web - proxy (#2531). - * Fixed bugs: #2531, #2777, #3020. - -Trac 0.9.4 (Feb 15, 2006) -http://svn.edgewall.com/repos/trac/tags/trac-0.9.4 - - * Deletion of reports has been fixed. - * Various encoding issues with the timeline RSS feed have been fixed. - * Fixed a memory leak when syncing with the repository. - * Milestones in the roadmap are now ordered more intelligently. - * Fixed bugs: #1064, #1150, #2006, #2253, #2324, #2330, #2408, #2430, - #2431, #2459, #2544, #2459, #2481, #2485, #2536, #2544, #2553, - #2580, #2583, #2606, #2613, #2621, #2664, #2666, #2680, #2706, - #2707, #2735 - -Trac 0.9.3 (Jan 8, 2006) -http://svn.edgewall.com/repos/trac/tags/trac-0.9.3 - - * Fixed XSS vulnerabilities. - * Timeline RSS feed validity issue resolved. - * "trac-admin initenv" now handles empty repositories. - * Textile unicode support. - * Fixed bugs: #1158, #2290, #2337, #2416, #2440, #2468, #2473, #2484, - #2490, #2493, #2512, #2517, #2519, #2527, #2548, #2558, #2558 - -Trac 0.9.2 (Dec 5, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.9.2 - - * Fixed SQL injection vulnerability in ticket search module. - * Fixed broken ticket email notifications. - -Trac 0.9.1 (Dec 1, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.9.1 - - * Fixed SQL injection vulnerability in ticket query module. - * Fixed bugs: #1633, #2167, #2283, #2284, #2285, #2291, #2292, #2300, - #2318, #2329, #2366, #2369, #2373, #2383, #2416, #2457 - - -Trac 0.9 (Oct 31, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.9 - - * Support for a global trac.ini configuration file. - * Changed logic for enabling plugins/components. - * Improved support for handling repository subsets. - * Fixes problems with Trac links when using multiple environments in the - same Python interpreter. - * Improvements to email notification layout and encoding. - * Fixes for database locking with SQLite, in particular in a multi-threaded - environment. - * PostgreSQL compatibility fixes. - * Fixed bugs: #804, #861, #927, #1044, #1051, #1123, #1153, #1169, - #1239, #1344, #1463, #1562, #1881, #1886, #1895, #1909, #1921, #1930, - #1983, #1988, #2019, #2051, #2061, #2229, #2106, #2107, #2116, #2120, - #2124, #2129, #2135, #2136, #2138, #2140, #2144, #2164, #2166, #2170, - #2172, #2191, #2192, #2196, #2201, #2202, #2203, #2208, #2215, #2218, - #2223, #2230, #2232, #2239, #2240, #2241, #2243, #2251, - - -Trac 0.9-beta2 (Sept 25, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.9b2 - - * Support for setuptools 0.6. - * Allow insertion of a custom HTML snippet above the new ticket form - to explain site-specific policies and/or guidelines. - * Much improved Bugzilla import script. - * Fixed a bug where deleting a wiki page version would sometimes delete - the entire page. - * Fixes for the rendering of diffs and patches. - * Fixes for the Subversion authz support. - * Fixed bugs: #2008, #2032, #2034, #1801, #1893, #1040, #2040, - #1036, #1944, #1081, #1863, #2052, #2066, #2016, #2090, #1985, - #2012, #2089, #2079, #1999, #2029, #2079, #1960, #2080, #2021, - #2042, #2088, #1345, #2011, #2100, #2103, #2113, #2116, #2109 - - -Trac 0.9-beta1 (Sept 5, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.9b1 - - Trac 0.9 contains a great number of new features, improvements and - bug fixes. The following list contains only a few highlights: - - * License changed from GPL to modified BSD (See the file COPYING). - * Improved modularity and extendibility (plugin support). - * Support for both pysqlite 1.x and pysqlite 2.x. - * Postgresql database support (with psycopg or pyPgSQL). - * Repository subsets. Multiple Trac environments can share a single - repository. - * Version control abstraction layer making it possible to support - other version control systems besides subversion in the future. - * FastCGI frontend support. - * Python version >= 2.3 is now required. - - The complete list of closed tickets can be found here: - http://projects.edgewall.com/trac/query?status=closed&milestone=0.9 - - -Trac 0.8.3 (Jun 15, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.8.3 - - * Fix compatibility of 'trac-admin resync' with Subversion >= 1.2. - * Settings page now works correctly when Trac is deployed at the - root of a host. - * Windows packaging issues resolved. - * Fixed bugs: #1282, #1500, #1648 - - -Trac 0.8.2 (Jun 1, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.8.2 - - * Compatibility with Subversion >= 1.2 fixed. - * Compatibility with Docutils >= 0.3.7 fixed. - * Fixed bugs: #1020, #1302, #1500, #1182, #1339, #1518 - #1525, #1618 - - -Trac 0.8.1 (Feb 28, 2005) -http://svn.edgewall.com/repos/trac/tags/trac-0.8.1 - - * Improved Python 2.1 compatibility. - * Layout of navigation bar in Opera fixed. - * Execution of Javascript through event handler attributes - in HTML code is now forbidden. - * Fixed bugs: #157, #371, #556, #683, #970, #971, #972, - #974, #979, #983, #1001, #1003, #1007, #1008, #1011, - #1020, #1026, #1030, #1045, #1054, #1070, #1072, #1074, - #1076, #1087, #1090, #1103, #1108, #1111, #1136, #1159, - #1164, #1190, #1195, #1220 - - -Trac 0.8 'Qualia' (Nov 15, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.8 - - * Roadmap module. - * Support for custom ticket properties. - * Wiki administration features. - * Advanced ticket queries. - * Improved diff display. - * User preferences. - * Wiki editing (near-wysiwyg) aids a la wikipedia. - * Improved email notification. - * Fixed bugs: #13, #63, #99, #100, #158, #164, #203, #210, - #225, #264, #304, #306, #326, #346, #347, #351, - #352, #364, #373, #375, #405, #411, #416, #431, - #433, #434, #436, #438, #443, #445, #446, #447, - #450, #452, #453, #455, #458, #460, #465, #468, - #471, #472, #473, #474, #477, #478, #479, #480, - #482, #483, #486, #487, #489, #491, #492, #494, - #496, #501, #503, #506, #510, #512, #513, #514, - #516, #522, #524, #526, #527, #528, #530, #532, - #536, #537, #538, #539, #542, #543, #545, #546, - #550, #551, #552, #553, #555, #556, #557, #558, - #559, #560, #565, #567, #568, #570, #572, #574, - #577, #578, #580, #581, #583, #587, #589, #591, - #593, #594, #597, #598, #599, #600, #601, #602, - #606, #609, #610, #612, #613, #616, #618, #619, - #620, #622, #623, #626, #627, #628, #630, #631, - #634, #644, #647, #648, #651, #652, #657, #658, - #660, #664, #668, #669, #670, #671, #674, #675, - #676, #677, #678, #680, #690, #692, #696, #698, - #699, #703, #705, #706, #708, #709, #713, #714, - #715, #716, #718, #720, #721, #722, #726, #727, - #730, #732, #734, #735, #736, #737, #738, #741, - #742, #743, #744, #745, #748, #749, #750, #751, - #752, #759, #762, #764, #768, #769, #770, #771, - #774, #775, #776, #778, #779, #780, #785, #789, - #793, #798, #800, #806, #807, #815, #816, #817, - #818, #829, #830, #831, #833, #836, #844, #846, - #848, #850, #851, #852, #872, #873, #877, #878, - #885, #888, #889, #892, #901, #903, #907, #912, - #916, #923, #929, #931, #932, #935 - - -Trac 0.7.1 'Argento' (Jun, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.7.1 - - * Bugfixes for 0.7 - * Fixes security hole in auth.py - * Experimental support for mod_python - * Improved MIME-types - * Fixed bugs: #93, #202, #307, #312, #342, #345, #350, #353, #355, #391, - #393, #401, #404, #406, #415, #417, #419, #420, #421, #422, #424, - #425, #428, #429, #432, #435, #437, #441, #442, #448, #451, #452, - #456, #457, #461, #463, #466, #467, #470, #497, #498, #502, #504 - - -Trac 0.7 'Fulci' (May 18, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.7 - - * Revised database format (requires manual upgrade). - * Trac standalone daemon, tracd (Experimental). - * Greatly improved browser. - * Many usability improvements. - * Clean-up of CSS and templates. - * UTF-8 character encoding support. - * Wiki page attachments. - * Syntax coloring supporting >35 languages, using SilverCity or GNU Enscript. - * Better support for ReStructuredText. - * Logging support, including syslog and windows eventlog. - * Ticket attachments. - * Import tickets from Bugzilla (contributed by Mark Rowe). - * Import tickets from SourceForge (contributed by Dmitry Yusupov). - * New ticket field: keywords - * Ticket email notification. - * Localized date and time display. - * Viewable SQL for reports. - * Improved search facilities. - * Windows installer package. - * More documentation. - * Fixed bugs: #14, #19, #27, #62, #87, #96, #106, #111, #115, #127, #146, - #161, #166, #171, #180, #182, #183, #188, #190, #191, #192, #193, - #195, #196, #197, #201, #205, #207, #211, #212, #213, #220, #224, - #227, #228, #231, #233, #235, #236, #240, #241, #243, #244, #246, - #247, #248, #249, #251, #252, #253, #254, #255, #258, #259, #261, - #262, #263, #265, #270, #271, #273, #275, #277, #278, #281, #284, - #285, #88, #289, #292, #293, #294, #296, #300, #302, #310, #313, - #314, #315, #316, #320, #322, #328, #332, #333, #337, #338, #339, - #340, #341, #344, #348, #349, #358, #361, #362, #363, #368, #370, - #371, #372, #376, #377, #378, #381, #384, #385, #386, #387, #388, - #392, #394, #396, #397, #398, #399, #402, #403, #410 - - -Trac 0.6.1 '245 Trioxin (April 12, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.6.1 - - * RSS now escapes entities in summary. - * Search results won't highlight dates anymore. - * RPM for SuSE Linux. - * Preliminary Windows Installer. - * More documentation. - * Fixed bugs: #163, #165, #189, #198, #200, #206, #209, #214, #223 - - -Trac 0.6 'Solanum' (March 23, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.6 - - * View diffs between wiki page edits. - * Improved Search module. - * Support for tables in the wiki. (Thanks to Stephen Hansen) - * Colored reports. Use colors to show priority, etc. - * Support for custom wiki processor macros. - * ReStructuredText markup support (through a processor macro) - * HTML markup support (through a processor macro) - * Report groups. Group results by a column. - * Multi-line report rows. - * Download report in CSV (Comma Separated Value) and tab-separated format - * RSS 2.0 content syndication support in Timeline, Reports and Log/Browser - * Better, locale-based date and time formatting. - * Wiki RecentChanges support. - * Overall usability, consistency and cosmetic improvements. - * More documentation. - * Fixed bugs: #16, #68, #81, #88, #98, #101, #102, #103, #104, #105, - #110, #112, #113, #114, #117, #119, #120, #131, #132, #134, - #135, #136, #138, #142, #145, #147, #151, #155, #170, #173, - #174, #175, #177, #179 - - -Trac 0.5.2 'Nameless' (March 2, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.5.2 - - * Performance improvements. - * Better unicode support in commit-messages. - * TRAC_ADMIN is now a real "meta-permission" containing all other permissions. - * Wiki-links of the svn:/path format can now also link to directories. - * Handle subversion changesets without any "author" specified. - * "view" checkboxes in the timeline view now reflect the current state. - * The subversion repository is now indexed by "svnadmin initdb" instead of - trac.cgi at first execution. - * trac-admin now has a 'wiki dump' and 'wiki load' commands to - export/import all pages to/from a directory. - * Most of the inline css is removed. - * IE6 navbar problem fixed. - * Fixed bugs: #69, #73, #77, #78, #79, #80, #84, #85, #86, #89, #90, - #91, #93, #97 - - -Trac 0.5.1 'Unnamed' (February 25, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.5.1 - - * Navbar now works properly on error pages. - * Cleaned up source code. Removed ugly tabs. - * Added missing COPYING, AUTHORS etc. Cleaned up package. - * trac-admin now works with python 2.1. - * Fixed bugs: #74, #75, #76, #77 - - -Trac 0.5 'Incognito' (February 23, 2004) -http://svn.edgewall.com/repos/trac/tags/trac-0.5 - - * First release. diff --git a/examples/trac/INSTALL b/examples/trac/INSTALL deleted file mode 100644 --- a/examples/trac/INSTALL +++ /dev/null @@ -1,114 +0,0 @@ -Trac Installation Guide -======================= -Trac is a lightweight project management tool that is implemented as a -web-based application. Trac is written in the Python programming language and -can use SQLite or PostgreSQL as database. For HTML rendering, Trac uses the -Clearsilver templating system. - - -Requirements ------------- -To install Trac, the following software packages must be installed: - - * Python, version >= 2.3. - + Please keep in mind, that for RPM-based systems you will also need - python-devel and python-xml packages. - * Subversion, version >= 1.0. (>= 1.1.x recommended) - * Subversion SWIG Python bindings (not PySVN). - * PySQLite, version >= 0.5 (1.1.6 recommended) - * Clearsilver, version >= 0.9.3 (0.9.14 recommended) - * A web server capable of executing CGI/FastCGI scripts, or Apache HTTPD with - mod_python. (Trac also comes with a standalone server, but its use is not - recommended for use in a production environment.) - - -Installing Trac ---------------- -The command: - - $ python ./setup.py install - -will byte-compile the python source code and install it in the -site-packages directory of your python installation. The directories cgi-bin, -templates, htdocs and wiki-default are all copied to ``$prefix/share/trac/``. - -The script will also install the trac-admin command-line tool, used to create -and maintain project environments. Trac-admin is the command center of Trac. - -Note: you'll need root permissions or equivalent for this step. - -To install Trac in a different location, or use other advanced installation -options, run: - - $ python ./setup.py --help - - -Installing Trac on Windows --------------------------- -If you downloaded the Trac installer (the .exe file), installing is simply a -matter of running the installer. After running the installer, configuration -and installation is the same as for other platforms. - - -Creating a Project Environment ------------------------------- -A Trac environment is the backend storage format where Trac stores information -like wiki pages, tickets, reports, settings, etc. A Trac environment consists -of the environment configuration file (trac.ini), custom templates, log files, -and more. - -A new Trac environment is created with trac-admin: - - $ trac-admin /path/to/projectenv initenv - -Note: The user account under which the web server is run needs write permission -to the environment directory and all the files inside. - -trac-admin will prompt you for the name of the project, where your subversion -repository is located, what database you want to use, etc. - - -Running the Standalone Server ------------------------------ -After having created a Trac environment, you can easily try the web interface -by running the standalone server tracd: - - $ tracd --port 8000 /path/to/projectenv - -Then, fire up a browser and visit http://localhost:8000/. You should get a -simple listing of all environments that tracd knows about. Follow the link -to the environment you just created, and you should see Trac in action. - - -Running Trac on a Web Server ----------------------------- -Trac provides three options for connecting to a "real" web server: CGI, FastCGI -and mod_python. For decent performance, it is recommended that you use either -FastCGI or mod_python. - -Please refer to the TracInstall page for details on these setups. You can find -it either in the wiki of the Trac project you just created, or on the main Trac -site. - - -Using Trac ----------- -Once you have your Trac site up and running, you should be able to browse your -subversion repository, create tickets, view the timeline, etc. - -Keep in mind that anonymous (not logged in) users can by default access most -but not all of the features. You will need to configure authentication and -grant additional permissions to authenticated users to see the full set of -features. - -For further documentation, see the TracGuide wiki page. - -Enjoy! - -/The Trac Team - -Please also consider joining the mailing list at -. - - -Visit the Trac open source project at diff --git a/examples/trac/MANIFEST.in b/examples/trac/MANIFEST.in deleted file mode 100644 --- a/examples/trac/MANIFEST.in +++ /dev/null @@ -1,35 +0,0 @@ -include AUTHORS ChangeLog COPYING INSTALL MANIFEST.in README README.tracd RELEASE setup.cfg THANKS UPGRADE -include scripts/trac-admin -include scripts/tracd -include scripts/tracdb2env -include scripts/trac-postinstall.py -include scripts/*.1 -include scripts/rpm-install.sh -include cgi-bin/trac.cgi -include cgi-bin/trac.fcgi -include trac/tests/*.py -include trac/web/tests/*.py -include trac/wiki/tests/*.py -include trac/wiki/tests/wiki-tests.txt -include trac/ticket/tests/*.py -include trac/scripts/tests/*.py -include trac/scripts/tests/admin-tests.txt -include trac/versioncontrol/tests/*.py -include trac/versioncontrol/tests/svnrepos.dump -recursive-include htdocs *.png *.gif *.ico *.js *README -recursive-include htdocs/css *.css -recursive-include htdocs/js *.js -recursive-include doc *trac_logo.* *README -recursive-include wiki-default * -recursive-include wiki-macros *.py -recursive-include templates *.cs *README -recursive-include contrib * -global-exclude *~ -global-exclude *.tmp -global-exclude *.bak -global-exclude *.old -global-exclude .svn -global-exclude .svn/* -global-exclude .svn/*/* -global-exclude .svn/*/*/* -exclude wiki-default/checkwiki.py* diff --git a/examples/trac/README b/examples/trac/README deleted file mode 100644 --- a/examples/trac/README +++ /dev/null @@ -1,24 +0,0 @@ -About Trac -========== - -Trac is a minimalistic web-based software project management and bug/issue -tracking system. It provides an interface to the Subversion revision control -systems, an integrated wiki, flexible issue tracking and convenient report -facilities. - -Trac is distributed using the modified BSD License. - - * For installation instructions, please see the INSTALL. * - * If you are upgrading from a previous Trac version, please read UPGRADE. * - -You might also want to take a look at the RELEASE and ChangeLog files for more -information. - -Otherwise, the primary source of information is the main Trac web site: - - - -We hope you enjoy it, - -/The Trac Team - diff --git a/examples/trac/README.tracd b/examples/trac/README.tracd deleted file mode 100644 --- a/examples/trac/README.tracd +++ /dev/null @@ -1,50 +0,0 @@ -Trac in stand-alone mode -======================== - -Trac 0.7 introduced among many other important features, the capability to run -Trac as a stand-alone server (daemon), without a web server. - -Tracd supports all features of the CGI version (trac.cgi), -and can serve multiple projects from a single server instance. - -Running tracd -------------- - - tracd [options] [database] ... - - Options: - --a, --auth Per-project authentication information --p, --port Port number to use (default: 80) --b, --hostname IP to bind to (default: '') - - -Example 1: Single Project (non-authenticated) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - $ tracd -p 9090 /var/trac/myproject - -Example 2: Multiple Projects (authenticated) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - $ tracd -p 9090 \ - -a projectA,/var/trac/htdigest.ALPHA,ALPHA \ - -a projectB,/var/trac/htdigest.ALPHA,ALPHA \ - /var/trac/projectA \ - /var/trac/projectB - -The file ``htdigest.ALPHA`` can be generated using the Apache2 tool ``htdigest`` -(be carefull *NOT* to use ``htpasswd`` here). - -Feedback and bug reports ------------------------- - -Please provide feedback on tracd using the issue tracker or the mailing list. - - Submit a bug report: http://projects.edgewall.com/trac/newticket?component=tracd - Mailing list info: http://projects.edgewall.com/trac/wiki/MailingList - - -Thanks, - -/The Trac Team (http://trac.edgewall.com/) \ No newline at end of file diff --git a/examples/trac/RELEASE b/examples/trac/RELEASE deleted file mode 100644 --- a/examples/trac/RELEASE +++ /dev/null @@ -1,66 +0,0 @@ -Trac 0.9.5 Release Notes -============================ -April 18, 2006 - -We're proud to present our latest release - Trac 0.9.5. - -Trac is an enhanced wiki and issue tracking system, integrated with -Subversion, for software development projects. Trac uses a minimalistic -approach to web-based software project management. Our mission is simple; to -help developers write great software while staying out of the way. Trac should -impose as little as possible on a team's established development process and -policies. - -Trac allows wiki markup in issue descriptions and commit messages, creating -links and useful structure between bugs, tasks, changesets, files and wiki -pages. A timeline view presents all project events in chronological order, -making tracking progress or getting an overview of a project easy. - -For more information, please visit the main Trac web site: - - - -The software, published under the modified BSD License, is -available at: - - - -Please report problems and provide feedback in the project issue tracker: - - - -For questions, comments and user discussions, please use the Trac mailing list. -List information, subscription and archive available at: - - - - -What's New ----------- -A brief summary of major changes for version 0.9.5: - - * Fixed wiki macro XSS vulnerability. - * Smaller memory usage when accessing subversion history. - * Fixed issue with incorrectly generated urls when installed behind a web - proxy. - -For a more complete list of improvements, see the ChangeLog at: - - - - -Acknowledgements ----------------- -Many thanks to the growing number of people who have, and continue to, -support the project. Also our thanks to all people providing feedback and bug -reports that helps us make Trac better, easier to use and more effective. - -Without your invaluable help, Trac would not evolve. Thank you all. - -Finally, we offer hope that Trac will prove itself useful to like-minded -programmers around the world, and that this release will prove an improvement -over the last version. - -Please let us know. :-) - -/The Trac Team diff --git a/examples/trac/THANKS b/examples/trac/THANKS deleted file mode 100644 --- a/examples/trac/THANKS +++ /dev/null @@ -1,68 +0,0 @@ - * Brad Anderson brad@dsource.org - * Christopher Armstrong radix - * Jani Averbach jaa@jaa.iki.fi - * Juanma Barranquero lektu@terra.es - * Christian Boos cboos@bct-technology.com - * Rocky Burt rocky.burt@myrealbox.com - * Toni Brkic toni.brkic@switchcore.com - * Felix Colins felix@keyghost.com - * Wesley Crucius wcrucius@sandc.com - * dju' - * Daragh Fitzpatrick Daragh@i2i-Tech.com - * Markus Fuchs - * Eric Gillespie epg@netbsd.org - * Matthew Good trac@matt-good.net - * Shun-ichi Goto gotoh@taiyo.co.jp - * Chris Green cmgreen@uab.edu - * Mikael Hallendal micke@imendio.com - * Stephen Hansen shansen@advpubtech.com - * Laurie Harper zodiac@holoweb.net - * Francois Harvey fharvey@securiweb.net - * Tim Hatch trac@timhatch.com - * Michael Hope michael.hope@hamjet.co.nz - * Richard Hult richard@imendio.com - * Nuutti Kotivuori naked@iki.fi - * Ian Leader ian.leader@line.co.uk - * Christopher Lenz cmlenz@gmx.de - * Ivo Looser ivo.looser@gmail.com - * Rui Lopes rgl ruilopes com - * Angel Marin anmar@gmx.net - * Keir Mierle keir@cs.utoronto.ca - * James Moger jamesm@transonic.com - * Tim Moloney moloney@mrsl.com - * Jennifer Murtell jen@jmurtell.com - * Jacob Norda jacobnorda@gmail.com - * Jeroen Ruigrok van der Werven asmodai@in-nomine.org - * Juracy Filho juracy@gmail.com - * Cap Petschulat cap@cdres.com - * Nicholas Riley sabi - * Manuzhai manuzhai@gmail.com - * Mark Rowe mark.rowe@bdash.net.nz - * Olliver Rutherfurd ollie - * pkou pkou@ua.fm - * Andres Salomon dilinger@athenacr.com - * Michael Scherer misc@mandrake.org - * Andreas Schrattenecker vittorio - * Emmeran Seehuber rototor@rototor.de - * Noah Slater nslater@gmail.com - * Bill Soudan bill@soudan.net - * Ludvig Strigeus - * Alec Thomas alec@swapoff.org - * Jani Tiainen redetin@luukku.com - * Zilvinas Valinskas zilvinas@gemtek.lt - * Jason Vasquez jason@mugfu.com - * Jeff Weiss trac@jeffweiss.org - * Dmitry Yusupov dmitry_yus@yahoo.com - -The ever so elusive Anonymous. - -`Diggs and Lula`_ (official pawprint contributors) - -And everyone who keeps sending feedback, helping us improve Trac. - ----- - -Our apologies to everyone we forgot to mention, but without whose invaluable -help, Trac would not continue to rapidly evolve. - -.. _Diggs and Lula: http://people.edgewall.com/~daniel/lula_diggs.jpg diff --git a/examples/trac/UPGRADE b/examples/trac/UPGRADE deleted file mode 100644 --- a/examples/trac/UPGRADE +++ /dev/null @@ -1,168 +0,0 @@ -Upgrade Instructions -==================== - -A Trac environment sometimes needs to be upgraded before it can be used with -a new version of Trac. This document describes the steps necessary to upgrade -an environment. - -Note that Environment upgrades are not necessary for minor version releases -unless otherwise noted. For example, there's no need to upgrade a Trac -environment created with (or upgraded) 0.8.0 when installing 0.8.4 (or any -other 0.8.x release). - -General Instructions --------------------- -Typically, there are four steps involved in upgrading to a newer version of -Trac: - -1. Update the Trac Code - -Get the new version of Trac, either by downloading an offical release package -or by checking it out from the Subversion repository. - -If you have a source distribution, you need to run - - python setup.py install - -to install the new version. If you've downloaded the Windows installer, you -execute it, and so on. - -In any case, if you're doing a major version upgrade (such as from 0.8 to -0.9), it is highly recommended that you first remove the existing Trac code. -To do this, you need to delete the `trac` directory from the Python -`lib/site-packages` directory. You may also want to remove the Trac `cgi-bin`, -`htdocs` and `templates` directories that are commonly found in a directory -called `share/trac` (the exact location depends on your platform). - -2. Upgrade the Trac Environment - -Unless noted otherwise, upgrading between major versions (such as 0.8 and -0.9) involves changes to the database schema, and possibly the layout of the -environment. Fortunately, Trac provides automated upgrade scripts to ease the -pain. These scripts are run via `trac-admin`: - - trac-admin /path/to/projenv upgrade - -This command will do nothing if the environment is already up-to-date. - -3. Update the Trac Documentation - -Every Trac environment includes a copy of the Trac documentation for the -installed version. As you probably want to keep the included documentation in -sync with the installed version of Trac, `trac-admin` provides a command to -upgrade the documentation: - - trac-admin /path/to/projenv wiki upgrade - -Note that this procedure will of course leave your `WikiStart` page intact. - -4. Restart the Web Server - -In order to reload the new Trac code you will need to restart your web -server (note this is not necessary for CGI). - - -The following sections discuss any extra actions that may need to be taken -to upgrade to specific versions of Trac. - - -From 0.9-beta to 0.9 --------------------- - -If inclusion of the static resources (style sheets, javascript, images) is not -working, check the value of the `htdocs_location` in trac.ini. For mod_python, -Tracd and FastCGI, you can simply remove the option altogether. For CGI, you -should fix it to point to the URL you mapped the Trac `htdocs` directory to. - -If you've been using plugins with a beta release of Trac 0.9, or have -disabled some of the built-in components, you might have to update the rules -for disabling/enabling components in trac.ini. In particular, globally -installed plugins now need to be enabled explicitly. See the TracPlugins and -TracIni wiki pages for more information. - -If you want to enable the display of all ticket changes in the timeline (the -Ticket Details option), you now have to explicitly enable that in trac.ini, -too: - - [timeline] - ticket_show_details = true - - -From 0.8.x to 0.9 ------------------ - -mod_python users will need to change the name of the mod_python handler in -the Apache HTTPD configuration: - - from: PythonHandler trac.ModPythonHandler - to: PythonHandler trac.web.modpython_frontend - -If you have PySQLite 2.x installed, Trac will now try to open your SQLite -database using the SQLite 3.x file format. The database formats used by -SQLite 2.8.x and SQLite 3.x are incompatible. If you get an error like "file -is encrypted or is not a database" after upgrading, then you must convert -your database file. - -To do this, you need to have both SQLite 2.8.x and SQLite 3.x installed (they -have different filenames so can coexist on the same system). Then use the -following commands: - - mv trac.db trac2.db - sqlite trac2.db .dump | sqlite3 trac.db - -After testing that the conversion was successful, the `trac2.db` file can be -deleted. For more information on the SQLite upgrade see -http://www.sqlite.org/version3.html. - - -From 0.7.x to 0.8 ------------------ - -0.8 adds a new roadmap feature which requires additional permissions. While a -fresh installation will by default grant `ROADMAP_VIEW` and `MILESTONE_VIEW` -permissions to anonymous, these permissions have to be granted manually when -upgrading: - - trac-admin /path/to/projectenv permission add anonymous MILESTONE_VIEW - trac-admin /path/to/projectenv permission add anonymous ROADMAP_VIEW - - -From 0.6.x to 0.7 ------------------ -Trac 0.7 introduced a new database format, requiring manual upgrade. - -Previous versions of Trac stored wiki pages, ticket, reports, settings, -etc. in a single SQLite database file. Trac 0.7 replaces this file -with a new backend storage format; the 'Trac Environment', which is a -directory containing an SQLite database, a human-readable configuration file, -log-files and attachments. - -Fear not though, old-style Trac databases can easily be converted to -Environments using the included `tracdb2env` program as follows: - - tracdb2env /path/to/old/project.db /path/to/new/projectenv - -`tracdb2env` will create a new environment and copy the information from the -old database to the new environment. The existing database will not be -modified. - -You also need to update your apache configuration: - -Change the line: - - SetEnv TRAC_DB "/path/to/old/project.db" - -to: - - SetEnv TRAC_ENV "/path/to/new/projectenv" - - ----- - -If you have trouble upgrading Trac, please ask questions on the mailing list: - - - -Or for other support options, see: - - diff --git a/examples/trac/cgi-bin/trac.cgi b/examples/trac/cgi-bin/trac.cgi deleted file mode 100755 --- a/examples/trac/cgi-bin/trac.cgi +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python -# -*- coding: iso8859-1 -*- -# -# Copyright (C) 2003-2004 Edgewall Software -# Copyright (C) 2003-2004 Jonas Borgstrm -# 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://trac.edgewall.com/license.html. -# -# This software consists of voluntary contributions made by many -# individuals. For the exact contribution history, see the revision -# history and logs, available at http://projects.edgewall.com/trac/. -# -# Author: Jonas Borgstrm - -try: - from trac.web import cgi_frontend - cgi_frontend.run() - -except Exception, e: - import sys - import traceback - - print>>sys.stderr, e - traceback.print_exc(file=sys.stderr) - - print 'Status: 500 Internal Server Error' - print 'Content-Type: text/plain' - print - print 'Oops...' - print - print 'Trac detected an internal error:', e - print - traceback.print_exc(file=sys.stdout) diff --git a/examples/trac/cgi-bin/trac.fcgi b/examples/trac/cgi-bin/trac.fcgi deleted file mode 100755 --- a/examples/trac/cgi-bin/trac.fcgi +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python -# -*- coding: iso8859-1 -*- -# -# Copyright (C) 2003-2004 Edgewall Software -# Copyright (C) 2003-2004 Jonas Borgstrm -# 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://trac.edgewall.com/license.html. -# -# This software consists of voluntary contributions made by many -# individuals. For the exact contribution history, see the revision -# history and logs, available at http://projects.edgewall.com/trac/. -# -# Author: Jonas Borgstrm - -try: - from trac.web import fcgi_frontend - fcgi_frontend.run() -except Exception, e: - print 'Content-Type: text/plain\r\n\r\n', - print 'Oops...' - print - print 'Trac detected an internal error:' - print - print e - print - import traceback - import StringIO - tb = StringIO.StringIO() - traceback.print_exc(file=tb) - print tb.getvalue() diff --git a/examples/trac/contrib/README b/examples/trac/contrib/README deleted file mode 100644 --- a/examples/trac/contrib/README +++ /dev/null @@ -1,7 +0,0 @@ -This directory contains useful contributed scripts and programs for Trac. - -Please note that these scripts are provided AS-IS are NOT tested to the same -extent as the main sources. They are usually maintained by the original -author, typically listed at the top of the source file. - -See ../THANKS for a list of contributors. \ No newline at end of file diff --git a/examples/trac/contrib/bugzilla2trac.py b/examples/trac/contrib/bugzilla2trac.py deleted file mode 100644 --- a/examples/trac/contrib/bugzilla2trac.py +++ /dev/null @@ -1,883 +0,0 @@ -#!/usr/bin/env python - -""" -Import a Bugzilla items into a Trac database. - -Requires: Trac 0.9b1 from http://trac.edgewall.com/ - Python 2.3 from http://www.python.org/ - MySQL >= 3.23 from http://www.mysql.org/ - -Thanks: Mark Rowe - for original TracDatabase class - -Copyright 2004, Dmitry Yusupov - -Many enhancements, Bill Soudan -Other enhancements, Florent Guillaume -Reworked, Jeroen Ruigrok van der Werven - -$Id$ -""" - -import re - -### -### Conversion Settings -- edit these before running if desired -### - -# Bugzilla version. You can find this in Bugzilla's globals.pl file. -# -# Currently, the following bugzilla versions are known to work: -# 2.11 (2110), 2.16.5 (2165), 2.18.3 (2183), 2.19.1 (2191) -# -# If you run this script on a version not listed here and it is successful, -# please report it to the Trac mailing list and drop a note to -# asmodai@tendra.org so we can update the list. -BZ_VERSION = 2180 - -# MySQL connection parameters for the Bugzilla database. These can also -# be specified on the command line. -BZ_DB = "" -BZ_HOST = "" -BZ_USER = "" -BZ_PASSWORD = "" - -# Path to the Trac environment. -TRAC_ENV = "/usr/local/trac" - -# If true, all existing Trac tickets and attachments will be removed -# prior to import. -TRAC_CLEAN = True - -# Enclose imported ticket description and comments in a {{{ }}} -# preformat block? This formats the text in a fixed-point font. -PREFORMAT_COMMENTS = False - -# Replace bug numbers in comments with #xyz -REPLACE_BUG_NO = False - -# Severities -SEVERITIES = [ - ("blocker", "1"), - ("critical", "2"), - ("major", "3"), - ("normal", "4"), - ("minor", "5"), - ("trivial", "6") -] - -# Priorities -# If using the default Bugzilla priorities of P1 - P5, do not change anything -# here. -# If you have other priorities defined please change the P1 - P5 mapping to -# the order you want. You can also collapse multiple priorities on bugzilla's -# side into the same priority on Trac's side, simply adjust PRIORITIES_MAP. -PRIORITIES = [ - ("highest", "1"), - ("high", "2"), - ("normal", "3"), - ("low", "4"), - ("lowest", "5") -] - -# Bugzilla: Trac -# NOTE: Use lowercase. -PRIORITIES_MAP = { - "p1": "highest", - "p2": "high", - "p3": "normal", - "p4": "low", - "p5": "lowest" -} - -# By default, all bugs are imported from Bugzilla. If you add a list -# of products here, only bugs from those products will be imported. -PRODUCTS = [] -# These Bugzilla products will be ignored during import. -IGNORE_PRODUCTS = [] - -# These milestones are ignored -IGNORE_MILESTONES = ["---"] - -# These logins are converted to these user ids -LOGIN_MAP = { - #'some.user@example.com': 'someuser', -} - -# These emails are removed from CC list -IGNORE_CC = [ - #'loser@example.com', -] - -# The 'component' field in Trac can come either from the Product or -# or from the Component field of Bugzilla. COMPONENTS_FROM_PRODUCTS -# switches the behavior. -# If COMPONENTS_FROM_PRODUCTS is True: -# - Bugzilla Product -> Trac Component -# - Bugzilla Component -> Trac Keyword -# IF COMPONENTS_FROM_PRODUCTS is False: -# - Bugzilla Product -> Trac Keyword -# - Bugzilla Component -> Trac Component -COMPONENTS_FROM_PRODUCTS = False - -# If COMPONENTS_FROM_PRODUCTS is True, the default owner for each -# Trac component is inferred from a default Bugzilla component. -DEFAULT_COMPONENTS = ["default", "misc", "main"] - -# This mapping can assign keywords in the ticket entry to represent -# products or components (depending on COMPONENTS_FROM_PRODUCTS). -# The keyword will be ignored if empty. -KEYWORDS_MAPPING = { - #'Bugzilla_product_or_component': 'Keyword', - "default": "", - "misc": "", - } - -# If this is True, products or components are all set as keywords -# even if not mentionned in KEYWORDS_MAPPING. -MAP_ALL_KEYWORDS = True - - -# Bug comments that should not be imported. Each entry in list should -# be a regular expression. -IGNORE_COMMENTS = [ - "^Created an attachment \(id=" -] - -########################################################################### -### You probably don't need to change any configuration past this line. ### -########################################################################### - -# Bugzilla status to Trac status translation map. -# -# NOTE: bug activity is translated as well, which may cause bug -# activity to be deleted (e.g. resolved -> closed in Bugzilla -# would translate into closed -> closed in Trac, so we just ignore the -# change). -# -# There is some special magic for open in the code: if there is no -# Bugzilla owner, open is mapped to 'new' instead. -STATUS_TRANSLATE = { - "unconfirmed": "new", - "open": "assigned", - "resolved": "closed", - "verified": "closed", - "released": "closed" -} - -# Translate Bugzilla statuses into Trac keywords. This provides a way -# to retain the Bugzilla statuses in Trac. e.g. when a bug is marked -# 'verified' in Bugzilla it will be assigned a VERIFIED keyword. -STATUS_KEYWORDS = { - "verified": "VERIFIED", - "released": "RELEASED" -} - -# Some fields in Bugzilla do not have equivalents in Trac. Changes in -# fields listed here will not be imported into the ticket change history, -# otherwise you'd see changes for fields that don't exist in Trac. -IGNORED_ACTIVITY_FIELDS = ["everconfirmed"] - -# Regular expression and its replacement -BUG_NO_RE = re.compile(r"\b(bug #?)([0-9])") -BUG_NO_REPL = r"#\2" - -### -### Script begins here -### - -import os -import sys -import string -import StringIO - -import MySQLdb -import MySQLdb.cursors -try: - from trac.env import Environment -except: - from trac.Environment import Environment -from trac.attachment import Attachment - -if not hasattr(sys, 'setdefaultencoding'): - reload(sys) - -sys.setdefaultencoding('latin1') - -# simulated Attachment class for trac.add -#class Attachment: -# def __init__(self, name, data): -# self.filename = name -# self.file = StringIO.StringIO(data.tostring()) - -# simple field translation mapping. if string not in -# mapping, just return string, otherwise return value -class FieldTranslator(dict): - def __getitem__(self, item): - if not dict.has_key(self, item): - return item - - return dict.__getitem__(self, item) - -statusXlator = FieldTranslator(STATUS_TRANSLATE) - -class TracDatabase(object): - def __init__(self, path): - self.env = Environment(path) - self._db = self.env.get_db_cnx() - self._db.autocommit = False - self.loginNameCache = {} - self.fieldNameCache = {} - - def db(self): - return self._db - - def hasTickets(self): - c = self.db().cursor() - c.execute("SELECT count(*) FROM Ticket") - return int(c.fetchall()[0][0]) > 0 - - def assertNoTickets(self): - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - def setSeverityList(self, s): - """Remove all severities, set them to `s`""" - self.assertNoTickets() - - c = self.db().cursor() - c.execute("DELETE FROM enum WHERE type='severity'") - for value, i in s: - print " inserting severity '%s' - '%s'" % (value, i) - c.execute("""INSERT INTO enum (type, name, value) - VALUES (%s, %s, %s)""", - ("severity", value.encode('utf-8'), i)) - self.db().commit() - - def setPriorityList(self, s): - """Remove all priorities, set them to `s`""" - self.assertNoTickets() - - c = self.db().cursor() - c.execute("DELETE FROM enum WHERE type='priority'") - for value, i in s: - print " inserting priority '%s' - '%s'" % (value, i) - c.execute("""INSERT INTO enum (type, name, value) - VALUES (%s, %s, %s)""", - ("priority", value.encode('utf-8'), i)) - self.db().commit() - - - def setComponentList(self, l, key): - """Remove all components, set them to `l`""" - self.assertNoTickets() - - c = self.db().cursor() - c.execute("DELETE FROM component") - for comp in l: - print " inserting component '%s', owner '%s'" % \ - (comp[key], comp['owner']) - c.execute("INSERT INTO component (name, owner) VALUES (%s, %s)", - (comp[key].encode('utf-8'), - comp['owner'].encode('utf-8'))) - self.db().commit() - - def setVersionList(self, v, key): - """Remove all versions, set them to `v`""" - self.assertNoTickets() - - c = self.db().cursor() - c.execute("DELETE FROM version") - for vers in v: - print " inserting version '%s'" % (vers[key]) - c.execute("INSERT INTO version (name) VALUES (%s)", - (vers[key].encode('utf-8'),)) - self.db().commit() - - def setMilestoneList(self, m, key): - """Remove all milestones, set them to `m`""" - self.assertNoTickets() - - c = self.db().cursor() - c.execute("DELETE FROM milestone") - for ms in m: - milestone = ms[key] - print " inserting milestone '%s'" % (milestone) - c.execute("INSERT INTO milestone (name) VALUES (%s)", - (milestone.encode('utf-8'),)) - self.db().commit() - - def addTicket(self, id, time, changetime, component, severity, priority, - owner, reporter, cc, version, milestone, status, resolution, - summary, description, keywords): - c = self.db().cursor() - - desc = description.encode('utf-8') - type = "defect" - - if severity.lower() == "enhancement": - severity = "minor" - type = "enhancement" - - if PREFORMAT_COMMENTS: - desc = '{{{\n%s\n}}}' % desc - - if REPLACE_BUG_NO: - if BUG_NO_RE.search(desc): - desc = re.sub(BUG_NO_RE, BUG_NO_REPL, desc) - - if PRIORITIES_MAP.has_key(priority): - priority = PRIORITIES_MAP[priority] - - print " inserting ticket %s -- %s" % (id, summary) - - c.execute("""INSERT INTO ticket (id, type, time, changetime, component, - severity, priority, owner, reporter, - cc, version, milestone, status, - resolution, summary, description, - keywords) - VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s)""", - (id, type.encode('utf-8'), time.strftime('%s'), - changetime.strftime('%s'), component.encode('utf-8'), - severity.encode('utf-8'), priority.encode('utf-8'), owner, - reporter, cc, version, milestone.encode('utf-8'), - status.lower(), resolution, summary.encode('utf-8'), desc, - keywords)) - - self.db().commit() - return self.db().get_last_id(c, 'ticket') - - def addTicketComment(self, ticket, time, author, value): - comment = value.encode('utf-8') - - if PREFORMAT_COMMENTS: - comment = '{{{\n%s\n}}}' % comment - - if REPLACE_BUG_NO: - if BUG_NO_RE.search(comment): - comment = re.sub(BUG_NO_RE, BUG_NO_REPL, comment) - - c = self.db().cursor() - c.execute("""INSERT INTO ticket_change (ticket, time, author, field, - oldvalue, newvalue) - VALUES (%s, %s, %s, %s, %s, %s)""", - (ticket, time.strftime('%s'), author, 'comment', '', comment)) - self.db().commit() - - def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): - c = self.db().cursor() - - if field == "owner": - if LOGIN_MAP.has_key(oldvalue): - oldvalue = LOGIN_MAP[oldvalue] - if LOGIN_MAP.has_key(newvalue): - newvalue = LOGIN_MAP[newvalue] - - if field == "priority": - if PRIORITIES_MAP.has_key(oldvalue.lower()): - oldvalue = PRIORITIES_MAP[oldvalue.lower()] - if PRIORITIES_MAP.has_key(newvalue.lower()): - newvalue = PRIORITIES_MAP[newvalue.lower()] - - # Doesn't make sense if we go from highest -> highest, for example. - if oldvalue == newvalue: - return - - c.execute("""INSERT INTO ticket_change (ticket, time, author, field, - oldvalue, newvalue) - VALUES (%s, %s, %s, %s, %s, %s)""", - (ticket, time.strftime('%s'), author, field, - oldvalue.encode('utf-8'), newvalue.encode('utf-8'))) - self.db().commit() - - def addAttachment(self, author, a): - description = a['description'].encode('utf-8') - id = a['bug_id'] - filename = a['filename'].encode('utf-8') - filedata = StringIO.StringIO(a['thedata'].tostring()) - filesize = len(filedata.getvalue()) - time = a['creation_ts'] - print " ->inserting attachment '%s' for ticket %s -- %s" % \ - (filename, id, description) - - attachment = Attachment(self.env, 'ticket', id) - attachment.author = author - attachment.description = description - attachment.insert(filename, filedata, filesize, time.strftime('%s')) - del attachment - - def getLoginName(self, cursor, userid): - if userid not in self.loginNameCache: - cursor.execute("SELECT * FROM profiles WHERE userid = %s", (userid)) - loginName = cursor.fetchall() - - if loginName: - loginName = loginName[0]['login_name'] - else: - print """WARNING: unknown bugzilla userid %d, recording as - anonymous""" % (userid) - loginName = "anonymous" - - loginName = LOGIN_MAP.get(loginName, loginName) - - self.loginNameCache[userid] = loginName - - return self.loginNameCache[userid] - - def getFieldName(self, cursor, fieldid): - if fieldid not in self.fieldNameCache: - cursor.execute("SELECT * FROM fielddefs WHERE fieldid = %s", - (fieldid)) - fieldName = cursor.fetchall() - - if fieldName: - fieldName = fieldName[0]['name'].lower() - else: - print "WARNING: unknown bugzilla fieldid %d, \ - recording as unknown" % (userid) - fieldName = "unknown" - - self.fieldNameCache[fieldid] = fieldName - - return self.fieldNameCache[fieldid] - -def makeWhereClause(fieldName, values, negative=False): - if not values: - return '' - if negative: - connector, op = ' AND ', '!=' - else: - connector, op = ' OR ', '=' - clause = connector.join(["%s %s '%s'" % (fieldName, op, value) for value in values]) - return ' ' + clause - -def convert(_db, _host, _user, _password, _env, _force): - activityFields = FieldTranslator() - - # account for older versions of bugzilla - print "Using Bugzilla v%s schema." % BZ_VERSION - if BZ_VERSION == 2110: - activityFields['removed'] = "oldvalue" - activityFields['added'] = "newvalue" - - # init Bugzilla environment - print "Bugzilla MySQL('%s':'%s':'%s':'%s'): connecting..." % \ - (_db, _host, _user, ("*" * len(_password))) - mysql_con = MySQLdb.connect(host=_host, - user=_user, passwd=_password, db=_db, compress=1, - cursorclass=MySQLdb.cursors.DictCursor) - mysql_cur = mysql_con.cursor() - - # init Trac environment - print "Trac SQLite('%s'): connecting..." % (_env) - trac = TracDatabase(_env) - - # force mode... - if _force == 1: - print "\nCleaning all tickets..." - c = trac.db().cursor() - c.execute("DELETE FROM ticket_change") - trac.db().commit() - - c.execute("DELETE FROM ticket") - trac.db().commit() - - c.execute("DELETE FROM attachment") - attachments_dir = os.path.join(os.path.normpath(trac.env.path), - "attachments") - # Straight from the Python documentation. - for root, dirs, files in os.walk(attachments_dir, topdown=False): - for name in files: - os.remove(os.path.join(root, name)) - for name in dirs: - os.rmdir(os.path.join(root, name)) - if not os.stat(attachments_dir): - os.mkdir(attachments_dir) - trac.db().commit() - print "All tickets cleaned..." - - - print "\n0. Filtering products..." - mysql_cur.execute("SELECT name FROM products") - products = [] - for line in mysql_cur.fetchall(): - product = line['name'] - if PRODUCTS and product not in PRODUCTS: - continue - if product in IGNORE_PRODUCTS: - continue - products.append(product) - PRODUCTS[:] = products - print " Using products", " ".join(PRODUCTS) - - print "\n1. Import severities..." - trac.setSeverityList(SEVERITIES) - - print "\n2. Import components..." - if not COMPONENTS_FROM_PRODUCTS: - if BZ_VERSION >= 2180: - sql = """SELECT DISTINCT c.name AS name, c.initialowner AS owner - FROM components AS c, products AS p - WHERE c.product_id = p.id AND""" - sql += makeWhereClause('p.name', PRODUCTS) - else: - sql = "SELECT value AS name, initialowner AS owner FROM components" - sql += " WHERE" + makeWhereClause('program', PRODUCTS) - mysql_cur.execute(sql) - components = mysql_cur.fetchall() - for component in components: - component['owner'] = trac.getLoginName(mysql_cur, - component['owner']) - trac.setComponentList(components, 'name') - else: - sql = """SELECT program AS product, value AS comp, initialowner AS owner - FROM components""" - sql += " WHERE" + makeWhereClause('program', PRODUCTS) - mysql_cur.execute(sql) - lines = mysql_cur.fetchall() - all_components = {} # product -> components - all_owners = {} # product, component -> owner - for line in lines: - product = line['product'] - comp = line['comp'] - owner = line['owner'] - all_components.setdefault(product, []).append(comp) - all_owners[(product, comp)] = owner - component_list = [] - for product, components in all_components.items(): - # find best default owner - default = None - for comp in DEFAULT_COMPONENTS: - if comp in components: - default = comp - break - if default is None: - default = components[0] - owner = all_owners[(product, default)] - owner_name = trac.getLoginName(mysql_cur, owner) - component_list.append({'product': product, 'owner': owner_name}) - trac.setComponentList(component_list, 'product') - - print "\n3. Import priorities..." - trac.setPriorityList(PRIORITIES) - - print "\n4. Import versions..." - if BZ_VERSION >= 2180: - sql = """SELECT DISTINCTROW versions.value AS value - FROM products, versions""" - sql += " WHERE" + makeWhereClause('products.name', PRODUCTS) - else: - sql = "SELECT DISTINCTROW value FROM versions" - sql += " WHERE" + makeWhereClause('program', PRODUCTS) - mysql_cur.execute(sql) - versions = mysql_cur.fetchall() - trac.setVersionList(versions, 'value') - - print "\n5. Import milestones..." - sql = "SELECT DISTINCT value FROM milestones" - sql += " WHERE" + makeWhereClause('value', IGNORE_MILESTONES, negative=True) - mysql_cur.execute(sql) - milestones = mysql_cur.fetchall() - trac.setMilestoneList(milestones, 'value') - - print "\n6. Retrieving bugs..." - sql = """SELECT DISTINCT b.*, c.name AS component, p.name AS product - FROM bugs AS b, components AS c, products AS p """ - sql += " WHERE (" + makeWhereClause('p.name', PRODUCTS) - sql += ") AND b.product_id = p.id" - sql += " AND b.component_id = c.id" - sql += " ORDER BY b.bug_id" - mysql_cur.execute(sql) - bugs = mysql_cur.fetchall() - - - print "\n7. Import bugs and bug activity..." - for bug in bugs: - bugid = bug['bug_id'] - - ticket = {} - keywords = [] - ticket['id'] = bugid - ticket['time'] = bug['creation_ts'] - ticket['changetime'] = bug['delta_ts'] - if COMPONENTS_FROM_PRODUCTS: - ticket['component'] = bug['product'] - else: - ticket['component'] = bug['component'] - ticket['severity'] = bug['bug_severity'] - ticket['priority'] = bug['priority'].lower() - - ticket['owner'] = trac.getLoginName(mysql_cur, bug['assigned_to']) - ticket['reporter'] = trac.getLoginName(mysql_cur, bug['reporter']) - - mysql_cur.execute("SELECT * FROM cc WHERE bug_id = %s", bugid) - cc_records = mysql_cur.fetchall() - cc_list = [] - for cc in cc_records: - cc_list.append(trac.getLoginName(mysql_cur, cc['who'])) - cc_list = [cc for cc in cc_list if '@' in cc and cc not in IGNORE_CC] - ticket['cc'] = string.join(cc_list, ', ') - - ticket['version'] = bug['version'] - - target_milestone = bug['target_milestone'] - if target_milestone in IGNORE_MILESTONES: - target_milestone = '' - ticket['milestone'] = target_milestone - - bug_status = bug['bug_status'].lower() - ticket['status'] = statusXlator[bug_status] - ticket['resolution'] = bug['resolution'].lower() - - # a bit of extra work to do open tickets - if bug_status == 'open': - if owner != '': - ticket['status'] = 'assigned' - else: - ticket['status'] = 'new' - - ticket['summary'] = bug['short_desc'] - - mysql_cur.execute("SELECT * FROM longdescs WHERE bug_id = %s" % bugid) - longdescs = list(mysql_cur.fetchall()) - - # check for empty 'longdescs[0]' field... - if len(longdescs) == 0: - ticket['description'] = '' - else: - ticket['description'] = longdescs[0]['thetext'] - del longdescs[0] - - for desc in longdescs: - ignore = False - for comment in IGNORE_COMMENTS: - if re.match(comment, desc['thetext']): - ignore = True - - if ignore: - continue - - trac.addTicketComment(ticket=bugid, - time = desc['bug_when'], - author=trac.getLoginName(mysql_cur, desc['who']), - value = desc['thetext']) - - mysql_cur.execute("""SELECT * FROM bugs_activity WHERE bug_id = %s - ORDER BY bug_when""" % bugid) - bugs_activity = mysql_cur.fetchall() - resolution = '' - ticketChanges = [] - keywords = [] - for activity in bugs_activity: - field_name = trac.getFieldName(mysql_cur, activity['fieldid']).lower() - - removed = activity[activityFields['removed']] - added = activity[activityFields['added']] - - # statuses and resolutions are in lowercase in trac - if field_name == "resolution" or field_name == "bug_status": - removed = removed.lower() - added = added.lower() - - # remember most recent resolution, we need this later - if field_name == "resolution": - resolution = added.lower() - - add_keywords = [] - remove_keywords = [] - - # convert bugzilla field names... - if field_name == "bug_severity": - field_name = "severity" - elif field_name == "assigned_to": - field_name = "owner" - elif field_name == "bug_status": - field_name = "status" - if removed in STATUS_KEYWORDS: - remove_keywords.append(STATUS_KEYWORDS[removed]) - if added in STATUS_KEYWORDS: - add_keywords.append(STATUS_KEYWORDS[added]) - added = statusXlator[added] - removed = statusXlator[removed] - elif field_name == "short_desc": - field_name = "summary" - elif field_name == "product" and COMPONENTS_FROM_PRODUCTS: - field_name = "component" - elif ((field_name == "product" and not COMPONENTS_FROM_PRODUCTS) or - (field_name == "component" and COMPONENTS_FROM_PRODUCTS)): - if MAP_ALL_KEYWORDS or removed in KEYWORDS_MAPPING: - kw = KEYWORDS_MAPPING.get(removed, removed) - if kw: - remove_keywords.append(kw) - if MAP_ALL_KEYWORDS or added in KEYWORDS_MAPPING: - kw = KEYWORDS_MAPPING.get(added, added) - if kw: - add_keywords.append(kw) - if field_name == "component": - # just keep the keyword change - added = removed = "" - elif field_name == "target_milestone": - field_name = "milestone" - if added in IGNORE_MILESTONES: - added = "" - if removed in IGNORE_MILESTONES: - removed = "" - - ticketChange = {} - ticketChange['ticket'] = bugid - ticketChange['time'] = activity['bug_when'] - ticketChange['author'] = trac.getLoginName(mysql_cur, - activity['who']) - ticketChange['field'] = field_name - ticketChange['oldvalue'] = removed - ticketChange['newvalue'] = added - - if add_keywords or remove_keywords: - # ensure removed ones are in old - old_keywords = keywords + [kw for kw in remove_keywords if kw - not in keywords] - # remove from new - keywords = [kw for kw in keywords if kw not in remove_keywords] - # add to new - keywords += [kw for kw in add_keywords if kw not in keywords] - if old_keywords != keywords: - ticketChangeKw = ticketChange.copy() - ticketChangeKw['field'] = "keywords" - ticketChangeKw['oldvalue'] = ' '.join(old_keywords) - ticketChangeKw['newvalue'] = ' '.join(keywords) - ticketChanges.append(ticketChangeKw) - - if field_name in IGNORED_ACTIVITY_FIELDS: - continue - - # Skip changes that have no effect (think translation!). - if added == removed: - continue - - # Bugzilla splits large summary changes into two records. - for oldChange in ticketChanges: - if (field_name == "summary" - and oldChange['field'] == ticketChange['field'] - and oldChange['time'] == ticketChange['time'] - and oldChange['author'] == ticketChange['author']): - oldChange['oldvalue'] += " " + ticketChange['oldvalue'] - oldChange['newvalue'] += " " + ticketChange['newvalue'] - break - # cc sometime appear in different activities with same time - if (field_name == "cc" \ - and oldChange['time'] == ticketChange['time']): - oldChange['newvalue'] += ", " + ticketChange['newvalue'] - break - else: - ticketChanges.append (ticketChange) - - for ticketChange in ticketChanges: - trac.addTicketChange (**ticketChange) - - # For some reason, bugzilla v2.11 seems to clear the resolution - # when you mark a bug as closed. Let's remember it and restore - # it if the ticket is closed but there's no resolution. - if not ticket['resolution'] and ticket['status'] == "closed": - ticket['resolution'] = resolution - - bug_status = bug['bug_status'] - if bug_status in STATUS_KEYWORDS: - kw = STATUS_KEYWORDS[bug_status] - if kw not in keywords: - keywords.append(kw) - - product = bug['product'] - if product in KEYWORDS_MAPPING and not COMPONENTS_FROM_PRODUCTS: - kw = KEYWORDS_MAPPING.get(product, product) - if kw and kw not in keywords: - keywords.append(kw) - - component = bug['component'] - if (COMPONENTS_FROM_PRODUCTS and \ - (MAP_ALL_KEYWORDS or component in KEYWORDS_MAPPING)): - kw = KEYWORDS_MAPPING.get(component, component) - if kw and kw not in keywords: - keywords.append(kw) - - ticket['keywords'] = string.join(keywords) - ticketid = trac.addTicket(**ticket) - - mysql_cur.execute("SELECT * FROM attachments WHERE bug_id = %s" % bugid) - attachments = mysql_cur.fetchall() - for a in attachments: - author = trac.getLoginName(mysql_cur, a['submitter_id']) - trac.addAttachment(author, a) - - print "\n8. Importing users and passwords..." - if BZ_VERSION >= 2180: - mysql_cur.execute("SELECT login_name, cryptpassword FROM profiles") - users = mysql_cur.fetchall() - htpasswd = file("htpasswd", 'w') - for user in users: - if LOGIN_MAP.has_key(user['login_name']): - login = LOGIN_MAP[user['login_name']] - else: - login = user['login_name'] - htpasswd.write(login + ":" + user['cryptpassword'] + "\n") - - htpasswd.close() - print " Bugzilla users converted to htpasswd format, see 'htpasswd'." - - print "\nAll tickets converted." - -def log(msg): - print "DEBUG: %s" % (msg) - -def usage(): - print """bugzilla2trac - Imports a bug database from Bugzilla into Trac. - -Usage: bugzilla2trac.py [options] - -Available Options: - --db - Bugzilla's database name - --tracenv /path/to/trac/env - Full path to Trac db environment - -h | --host - Bugzilla's DNS host name - -u | --user - Effective Bugzilla's database user - -p | --passwd - Bugzilla's user password - -c | --clean - Remove current Trac tickets before - importing - --help | help - This help info - -Additional configuration options can be defined directly in the script. -""" - sys.exit(0) - -def main(): - global BZ_DB, BZ_HOST, BZ_USER, BZ_PASSWORD, TRAC_ENV, TRAC_CLEAN - if len (sys.argv) > 1: - if sys.argv[1] in ['--help','help'] or len(sys.argv) < 4: - usage() - iter = 1 - while iter < len(sys.argv): - if sys.argv[iter] in ['--db'] and iter+1 < len(sys.argv): - BZ_DB = sys.argv[iter+1] - iter = iter + 1 - elif sys.argv[iter] in ['-h', '--host'] and iter+1 < len(sys.argv): - BZ_HOST = sys.argv[iter+1] - iter = iter + 1 - elif sys.argv[iter] in ['-u', '--user'] and iter+1 < len(sys.argv): - BZ_USER = sys.argv[iter+1] - iter = iter + 1 - elif sys.argv[iter] in ['-p', '--passwd'] and iter+1 < len(sys.argv): - BZ_PASSWORD = sys.argv[iter+1] - iter = iter + 1 - elif sys.argv[iter] in ['--tracenv'] and iter+1 < len(sys.argv): - TRAC_ENV = sys.argv[iter+1] - iter = iter + 1 - elif sys.argv[iter] in ['-c', '--clean']: - TRAC_CLEAN = 1 - else: - print "Error: unknown parameter: " + sys.argv[iter] - sys.exit(0) - iter = iter + 1 - - convert(BZ_DB, BZ_HOST, BZ_USER, BZ_PASSWORD, TRAC_ENV, TRAC_CLEAN) - -if __name__ == '__main__': - main() diff --git a/examples/trac/contrib/emailfilter.py b/examples/trac/contrib/emailfilter.py deleted file mode 100644 --- a/examples/trac/contrib/emailfilter.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python -""" -emailfilter.py -- Email tickets to Trac. - -A simple MTA filter to create Trac tickets from inbound emails. - -Copyright 2005, Daniel Lundin -Copyright 2005, Edgewall Software - -The scripts reads emails from stdin and inserts directly into a Trac database. -MIME headers are mapped as follows: - - * From: => Reporter - * Subject: => Summary - * Body => Description - -How to use ----------- - * Set TRAC_ENV_PATH to the path of your project's Trac environment - * Configure script as a mail (pipe) filter with your MTA - typically, this involves adding a line like this to /etc/aliases: - somename: |/path/to/email2trac.py - Check your MTA's documentation for specifics. - -Todo ----- - * Configure target database through env variable? - * Handle/discard HTML parts - * Attachment support -""" - -TRAC_ENV_PATH = '/var/trac/test' - -import email -import sys - -from trac.env import Environment -from trac.ticket import Ticket - - -class TicketEmailParser(object): - - env = None - - def __init__(self, env): - self.env = env - - def parse(self, fp): - msg = email.message_from_file(fp) - tkt = Ticket(self.env) - tkt['status'] = 'new' - tkt['reporter'] = msg['from'] - tkt['summary'] = msg['subject'] - for part in msg.walk(): - if part.get_content_type() == 'text/plain': - tkt['description'] = part.get_payload(decode=1).strip() - - if tkt.values.get('description'): - tkt.insert() - -if __name__ == '__main__': - env = Environment(TRAC_ENV_PATH, create=0) - tktparser = TicketEmailParser(env) - tktparser.parse(sys.stdin) diff --git a/examples/trac/contrib/migrateticketmodel.py b/examples/trac/contrib/migrateticketmodel.py deleted file mode 100644 --- a/examples/trac/contrib/migrateticketmodel.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -# -# This script completely migrates a <= 0.8.x Trac environment to use the new -# default ticket model introduced in Trac 0.9. -# -# In particular, this means that the severity field is removed (or rather -# disabled by removing all possible values), and the priority values are -# changed to the more meaningful new defaults. -# -# Make sure to make a backup of the Trac environment before running this! - -import os -import sys - -from trac.env import open_environment -from trac.ticket.model import Priority, Severity - -priority_mapping = { - 'highest': 'blocker', - 'high': 'critical', - 'normal': 'major', - 'low': 'minor', - 'lowest': 'trivial' -} - -def main(): - if len(sys.argv) < 2: - print >> sys.stderr, 'usage: %s /path/to/projenv' \ - % os.path.basename(sys.argv[0]) - sys.exit(2) - - env = open_environment(sys.argv[1]) - db = env.get_db_cnx() - - for oldprio, newprio in priority_mapping.items(): - priority = Priority(env, oldprio, db) - priority.name = newprio - priority.update(db) - - for severity in list(Severity.select(env, db)): - severity.delete(db) - - db.commit() - -if __name__ == '__main__': - main() diff --git a/examples/trac/contrib/sourceforge2trac.py b/examples/trac/contrib/sourceforge2trac.py deleted file mode 100644 --- a/examples/trac/contrib/sourceforge2trac.py +++ /dev/null @@ -1,305 +0,0 @@ -""" -Import a Sourceforge project's tracker items into a Trac database. - -Requires: Development version of Trac 0.7-pre from http://trac.edgewall.com/ - ElementTree from effbot.org/zone/element.htm - Python 2.3 from http://www.python.org/ - -The Sourceforge tracker items can be exported from the 'Backup' page of the -project admin section. - -Copyright 2004, Mark Rowe -""" - -from elementtree.ElementTree import ElementTree -from datetime import datetime -import trac.env - -class FieldParser(object): - def __init__(self, e): - for field in e: - if field.get('name').endswith('date'): - setattr(self, field.get('name'), datetime.fromtimestamp(int(field.text))) - else: - setattr(self, field.get('name'), field.text) - -class ArtifactHistoryItem(FieldParser): - def __repr__(self): - return '' % ( - self.field_name, self.old_value, self.entrydate, self.mod_by) - -class ArtifactMessage(FieldParser): - def __repr__(self): - return '' % (self.adddate, self.user_name, self.body) - -class Artifact(object): - def __init__(self, e): - self._history = [] - self._messages = [] - - for field in e: - if field.get('name') == 'artifact_history': - for h in field: - self._history.append(ArtifactHistoryItem(h)) - elif field.get('name') == 'artifact_messages': - for m in field: - self._messages.append(ArtifactMessage(m)) - else: - setattr(self, field.get('name'), field.text) - - def history(self): - """Returns the history items in reverse chronological order so that the "new value" - can easily be calculated based on the final value of the field, and the old value - of the items occuring before it. - """ - history = [(h.entrydate, h) for h in self._history] - history.sort() - return [h[1] for h in history][::-1] - - def messages(self): - return self._messages[:] - - def __repr__(self): - return '' % (self.summary, self.artifact_type, self.category, self.status) - -class ExportedProjectData(object): - def __init__(self, f): - self._artifacts = [] - - root = ElementTree().parse(f) - - for artifact in root.find('artifacts'): - self._artifacts.append(Artifact(artifact)) - - def artifacts(self): - """Returns the artifacts in chronological order, so that they will be assigned numbers in sequence.""" - artifacts = [(a.open_date, a) for a in self._artifacts] - artifacts.sort() - return [a[1] for a in artifacts] - - def featureRequests(self): - return [a for a in self._artifacts if a.artifact_type == 'Feature Requests'] - - def bugs(self): - return [a for a in self._artifacts if a.artifact_type == 'Bugs'] - - def categories(self): - """Returns all the category names that are used, in alphabetical order.""" - c = {} - for a in self._artifacts: - c[a.category] = 1 - - categories = c.keys() - categories.sort() - return categories - - def groups(self): - """Returns all the group names that are used, in alphabetical order.""" - g = {} - for a in self._artifacts: - g[a.artifact_group_id] = 1 - del g['None'] - - groups = g.keys() - groups.sort() - return groups - - def artifactTypes(self): - """Returns all the artifact types that are used, in alphabetical order.""" - t = {} - for a in self._artifacts: - t[a.artifact_type] = 1 - types = t.keys() - types.sort() - return types - -class TracDatabase(object): - def __init__(self, path): - self.env = trac.env.Environment(path) - self._db = self.env.get_db_cnx() - self._db.autocommit = False - - def db(self): - return self._db - - def hasTickets(self): - c = self.db().cursor() - c.execute('''SELECT count(*) FROM Ticket''') - return int(c.fetchall()[0][0]) > 0 - - def setTypeList(self, s): - """Remove all types, set them to `s`""" - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - c = self.db().cursor() - c.execute("""DELETE FROM enum WHERE kind='ticket_type'""") - for i, value in enumerate(s): - c.execute("""INSERT INTO enum (kind, name, value) VALUES (%s, %s, %s)""", - "ticket_type", - value, - i) - self.db().commit() - - def setPriorityList(self, s): - """Remove all priorities, set them to `s`""" - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - c = self.db().cursor() - c.execute("""DELETE FROM enum WHERE kind='priority'""") - for i, value in enumerate(s): - c.execute("""INSERT INTO enum (kind, name, value) VALUES (%s, %s, %s)""", - "priority", - value, - i) - self.db().commit() - - - def setComponentList(self, l): - """Remove all components, set them to `l`""" - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - c = self.db().cursor() - c.execute("""DELETE FROM component""") - for value in l: - c.execute("""INSERT INTO component (name) VALUES (%s)""", - value) - self.db().commit() - - def setVersionList(self, v): - """Remove all versions, set them to `v`""" - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - c = self.db().cursor() - c.execute("""DELETE FROM version""") - for value in v: - c.execute("""INSERT INTO version (name) VALUES (%s)""", - value) - self.db().commit() - - def setMilestoneList(self, m): - """Remove all milestones, set them to `m`""" - if self.hasTickets(): - raise Exception("Will not modify database with existing tickets!") - - c = self.db().cursor() - c.execute("""DELETE FROM milestone""") - for value in m: - c.execute("""INSERT INTO milestone (name) VALUES (%s)""", - value) - self.db().commit() - - def addTicket(self, type, time, changetime, component, - priority, owner, reporter, cc, - version, milestone, status, resolution, - summary, description, keywords): - c = self.db().cursor() - if status.lower() == 'open': - if owner != '': - status = 'assigned' - else: - status = 'new' - - c.execute("""INSERT INTO ticket (type, time, changetime, component, - priority, owner, reporter, cc, - version, milestone, status, resolution, - summary, description, keywords) - VALUES (%s, %s, %s, - %s, %s, %s, %s, %s, - %s, %s, %s, %s, - %s, %s, %s)""", - type, time, changetime, component, - priority, owner, reporter, cc, - version, milestone, status.lower(), resolution, - summary, '{{{\n%s\n}}}' % (description, ), keywords) - self.db().commit() - return self.db().db.sqlite_last_insert_rowid() - - def addTicketComment(self, ticket, time, author, value): - c = self.db().cursor() - c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue) - VALUES (%s, %s, %s, %s, %s, %s)""", - ticket, time.strftime('%s'), author, 'comment', '', '{{{\n%s\n}}}' % (value, )) - self.db().commit() - - def addTicketChange(self, ticket, time, author, field, oldvalue, newvalue): - c = self.db().cursor() - c.execute("""INSERT INTO ticket_change (ticket, time, author, field, oldvalue, newvalue) - VALUES (%s, %s, %s, %s, %s, %s)""", - ticket, time.strftime('%s'), author, field, oldvalue, newvalue) - self.db().commit() - - -def main(): - import optparse - p = optparse.OptionParser('usage: %prog xml_export.xml /path/to/trac/environment') - opt, args = p.parse_args() - if len(args) != 2: - p.error("Incorrect number of arguments") - - try: - importData(open(args[0]), args[1]) - except Exception, e: - print 'Error:', e - -def importData(f, env): - project = ExportedProjectData(f) - - db = TracDatabase(env) - db.setTypeList(project.artifactTypes()) - db.setComponentList(project.categories()) - db.setPriorityList(range(1, 11)) - db.setVersionList(project.groups()) - db.setMilestoneList([]) - - for a in project.artifacts(): - i = db.addTicket(type=a.artifact_type, - time=a.open_date, - changetime='', - component=a.category, - priority=a.priority, - owner=a.assigned_to, - reporter=a.submitted_by, - cc='', - version=a.artifact_group_id, - milestone='', - status=a.status, - resolution=a.resolution, - summary=a.summary, - description=a.details, - keywords='') - print 'Imported %s as #%d' % (a.artifact_id, i) - for msg in a.messages(): - db.addTicketComment(ticket=i, - time=msg.adddate, - author=msg.user_name, - value=msg.body) - if a.messages(): - print ' imported %d messages for #%d' % (len(a.messages()), i) - - values = a.__dict__.copy() - field_map = {'summary': 'summary'} - for h in a.history(): - if h.field_name == 'close_date' and values.get(h.field_name, '') == '': - f = 'status' - oldvalue = 'assigned' - newvalue = 'closed' - else: - f = field_map.get(h.field_name, None) - oldvalue = h.old_value - newvalue = values.get(h.field_name, '') - - if f: - db.addTicketChange(ticket=i, - time=h.entrydate, - author=h.mod_by, - field=f, - oldvalue=oldvalue, - newvalue=newvalue) - values[h.field_name] = h.old_value - -if __name__ == '__main__': - main() diff --git a/examples/trac/contrib/trac-post-commit-hook b/examples/trac/contrib/trac-post-commit-hook deleted file mode 100755 --- a/examples/trac/contrib/trac-post-commit-hook +++ /dev/null @@ -1,196 +0,0 @@ -#!/usr/bin/env python - -# trac-post-commit-hook -# ---------------------------------------------------------------------------- -# Copyright (c) 2004 Stephen Hansen -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# ---------------------------------------------------------------------------- - -# This Subversion post-commit hook script is meant to interface to the -# Trac (http://www.edgewall.com/products/trac/) issue tracking/wiki/etc -# system. -# -# It should be called from the 'post-commit' script in Subversion, such as -# via: -# -# REPOS="$1" -# REV="$2" -# LOG=`/usr/bin/svnlook log -r $REV $REPOS` -# AUTHOR=`/usr/bin/svnlook author -r $REV $REPOS` -# TRAC_ENV='/somewhere/trac/project/' -# TRAC_URL='http://trac.mysite.com/project/' -# -# /usr/bin/python /usr/local/src/trac/contrib/trac-post-commit-hook \ -# -p "$TRAC_ENV" \ -# -r "$REV" \ -# -u "$AUTHOR" \ -# -m "$LOG" \ -# -s "$TRAC_URL" -# -# It searches commit messages for text in the form of: -# command #1 -# command #1, #2 -# command #1 & #2 -# command #1 and #2 -# -# You can have more then one command in a message. The following commands -# are supported. There is more then one spelling for each command, to make -# this as user-friendly as possible. -# -# closes, fixes -# The specified issue numbers are closed with the contents of this -# commit message being added to it. -# references, refs, addresses, re -# The specified issue numbers are left in their current status, but -# the contents of this commit message are added to their notes. -# -# A fairly complicated example of what you can do is with a commit message -# of: -# -# Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12. -# -# This will close #10 and #12, and add a note to #12. - -import re -import os -import sys -import time - -from trac.env import open_environment -from trac.ticket.notification import TicketNotifyEmail -from trac.ticket import Ticket -from trac.ticket.web_ui import TicketModule -# TODO: move grouped_changelog_entries to model.py -from trac.web.href import Href - -try: - from optparse import OptionParser -except ImportError: - try: - from optik import OptionParser - except ImportError: - raise ImportError, 'Requires Python 2.3 or the Optik option parsing library.' - -parser = OptionParser() -parser.add_option('-e', '--require-envelope', dest='env', default='', - help='Require commands to be enclosed in an envelope. If -e[], ' - 'then commands must be in the form of [closes #4]. Must ' - 'be two characters.') -parser.add_option('-p', '--project', dest='project', - help='Path to the Trac project.') -parser.add_option('-r', '--revision', dest='rev', - help='Repository revision number.') -parser.add_option('-u', '--user', dest='user', - help='The user who is responsible for this action') -parser.add_option('-m', '--msg', dest='msg', - help='The log message to search.') -parser.add_option('-s', '--siteurl', dest='url', - help='The base URL to the project\'s trac website (to which ' - '/ticket/## is appended). If this is not specified, ' - 'the project URL from trac.ini will be used.') - -(options, args) = parser.parse_args(sys.argv[1:]) - -if options.env: - leftEnv = '\\' + options.env[0] - rghtEnv = '\\' + options.env[1] -else: - leftEnv = '' - rghtEnv = '' - -commandPattern = re.compile(leftEnv + r'(?P[A-Za-z]*).?(?P#[0-9]+(?:(?:[, &]*|[ ]?and[ ]?)#[0-9]+)*)' + rghtEnv) -ticketPattern = re.compile(r'#([0-9]*)') - -class CommitHook: - _supported_cmds = {'close': '_cmdClose', - 'closed': '_cmdClose', - 'closes': '_cmdClose', - 'fix': '_cmdClose', - 'fixed': '_cmdClose', - 'fixes': '_cmdClose', - 'addresses': '_cmdRefs', - 're': '_cmdRefs', - 'references': '_cmdRefs', - 'refs': '_cmdRefs', - 'see': '_cmdRefs'} - - def __init__(self, project=options.project, author=options.user, - rev=options.rev, msg=options.msg, url=options.url): - self.author = author - self.rev = rev - self.msg = "(In [%s]) %s" % (rev, msg) - self.now = int(time.time()) - self.env = open_environment(project) - if url is None: - url = self.env.config.get('project', 'url') - class Request(object): - def __init__(self): - self.href = self.abs_href = Href(url) - - cmdGroups = commandPattern.findall(msg) - - tickets = {} - for cmd, tkts in cmdGroups: - funcname = CommitHook._supported_cmds.get(cmd.lower(), '') - if funcname: - for tkt_id in ticketPattern.findall(tkts): - func = getattr(self, funcname) - tickets.setdefault(tkt_id, []).append(func) - - for tkt_id, cmds in tickets.iteritems(): - try: - db = self.env.get_db_cnx() - - ticket = Ticket(self.env, int(tkt_id), db) - for cmd in cmds: - cmd(ticket) - - # determine sequence number... - cnum = 0 - tm = TicketModule(self.env) - for change in tm.grouped_changelog_entries(ticket, db): - if change['permanent']: - cnum += 1 - - ticket.save_changes(self.author, self.msg, self.now, db, cnum+1) - db.commit() - - tn = TicketNotifyEmail(self.env) - tn.notify(ticket, Request(), newticket=0, modtime=self.now) - except Exception, e: - # import traceback - # traceback.print_exc(file=sys.stderr) - print>>sys.stderr, 'Unexpected error while processing ticket ' \ - 'ID %s: %s' % (tkt_id, e) - - - def _cmdClose(self, ticket): - ticket['status'] = 'closed' - ticket['resolution'] = 'fixed' - - def _cmdRefs(self, ticket): - pass - - -if __name__ == "__main__": - if len(sys.argv) < 5: - print "For usage: %s --help" % (sys.argv[0]) - else: - CommitHook() diff --git a/examples/trac/contrib/trac-pre-commit-hook b/examples/trac/contrib/trac-pre-commit-hook deleted file mode 100644 --- a/examples/trac/contrib/trac-pre-commit-hook +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -*- coding: iso8859-1 -*- -# -# Author: Jonas Borgstrm -# -# This script will enforce the following policy: -# -# "A checkin must reference an open ticket." -# -# This script should be invoked from the subversion pre-commit hook like this: -# -# REPOS="$1" -# TXN="$2" -# TRAC_ENV="/somewhere/trac/project/" -# LOG=`/usr/bin/svnlook log -t "$TXN" "$REPOS"` -# /usr/bin/python /some/path/trac-pre-commit-hook "$TRAC_ENV" "$LOG" || exit 1 -# -import os -import re -import sys - -from trac.env import open_environment - -def main(): - if len(sys.argv) != 3: - print >> sys.stderr, 'Usage: %s ' % sys.argv[0] - sys.exit(1) - - env_path = sys.argv[1] - log = sys.argv[2] - - tickets = [] - for tmp in re.findall('(?:closes|fixes|addresses|references|refs|re)' - '.?(#[0-9]+(?:(?:[, &]+| *and *)#[0-9]+)*)', log): - tickets += re.findall('#([0-9]+)', tmp) - - # At least one ticket has to be mentioned in the log message - if tickets == []: - print >> sys.stderr, 'At least one open ticket must be mentioned ' \ - 'in the log message.' - sys.exit(1) - - env = open_environment(env_path) - db = env.get_db_cnx() - - cursor = db.cursor() - cursor.execute("SELECT COUNT(id) FROM ticket WHERE " - "status <> 'closed' AND id IN (%s)" % ','.join(tickets)) - row = cursor.fetchone() - # At least one of the tickets mentioned in the log messages has to - # be open - if not row or row[0] < 1: - print >> sys.stderr, 'At least one open ticket must be mentioned ' \ - 'in the log message.' - sys.exit(1) - else: - sys.exit(0) - -if __name__ == '__main__': - main() - - - diff --git a/examples/trac/doc/README b/examples/trac/doc/README deleted file mode 100644 --- a/examples/trac/doc/README +++ /dev/null @@ -1,2 +0,0 @@ -Sorry, for now the only documentation we have is what's on the project website: -http://projects.edgewall.com/trac/ diff --git a/examples/trac/doc/trac_icon_16x16.png b/examples/trac/doc/trac_icon_16x16.png deleted file mode 100644 index d946c78dd213258ecb13a38e5fffcdc2b9f02222..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@ - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/examples/trac/htdocs/README b/examples/trac/htdocs/README deleted file mode 100644 --- a/examples/trac/htdocs/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains files used by Trac's default clearsilver templates. - -Local modifications to these files might be lost during the installation of -a new Trac version. This can be avoided by making a copy of this entire -directory before beginning modifications. diff --git a/examples/trac/htdocs/asc.png b/examples/trac/htdocs/asc.png deleted file mode 100644 index 486b7315902f8bd4d7c953f4b6e65e56cb171c50..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@