aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/comment.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix broken handling of non-text/plain commentsW. Trevor King2010-01-231-2/+9
|
* Move BugDir, Bug, and Comment to new _setup_saved_settingsW. Trevor King2010-01-221-3/+3
|
* Reworked settings_object module, but command.init tests still fail:W. Trevor King2010-01-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ python test.py libbe.command.init Doctest: libbe.command.init.Init ... FAIL ... ----------------------- File ".../libbe/command/init.py", line 47, in libbe.command.init.Init Failed example: ui.run(cmd) Exception raised: Traceback (most recent call last): ... File "/tmp/be.wtk/libbe/command/init.py", line 97, in _run bd = libbe.bugdir.BugDir(storage, from_storage=False) File "/tmp/be.wtk/libbe/bugdir.py", line 185, in __init__ self.save() File "/tmp/be.wtk/libbe/bugdir.py", line 228, in save self.save_settings() File "/tmp/be.wtk/libbe/bugdir.py", line 204, in save_settings mf = mapfile.generate(self._get_saved_settings()) File "/tmp/be.wtk/libbe/storage/util/settings_object.py", line 230, in _get_saved_settings self, self._setting_name_to_attr_name(k)) File "/tmp/be.wtk/libbe/storage/util/properties.py", line 194, in _fget value = fget(self) File "/tmp/be.wtk/libbe/storage/util/properties.py", line 329, in _fget primer(self) File "/tmp/be.wtk/libbe/storage/util/settings_object.py", line 69, in prop_load_settings self.load_settings() File "/tmp/be.wtk/libbe/bugdir.py", line 194, in load_settings self.settings = mapfile.parse(settings_mapfile) File "/tmp/be.wtk/libbe/storage/util/mapfile.py", line 123, in parse c = yaml.load(contents) ... File "/usr/lib/python2.6/site-packages/yaml/reader.py", line 213, in update_raw data = self.stream.read(size) AttributeError: 'NoneType' object has no attribute 'read' ...
* Add Comment.safe_in_reply_to to improve comment xml output.W. Trevor King2010-01-211-1/+18
| | | | | | | | | | Now be show --xml ID | be-xml-to-mbox | catmutt shows appropriate linking regardless of missing references or references to alt-ids in the original comments. On the other hand, be show --xml ID | be import-xml could alter alt-ids. If that's a problem we could turn off save_in_reply_to usage via an option to the xml methods in the future.
* Updated copyright informationW. Trevor King2010-01-011-1/+1
|
* Propogate long_to_short_user() -> long_to_short_text() and inverseW. Trevor King2009-12-291-2/+2
| | | | I'd missed some calls when I made the changes.
* Restored post-colon spaces in doctestsW. Trevor King2009-12-291-9/+9
|
* Add most comments with ignore_missing_references=True.W. Trevor King2009-12-281-1/+1
|
* Fixed libbe.command.diff + ugly BugDir.duplicate_bugdir implementationW. Trevor King2009-12-151-21/+25
| | | | | | | | | | | | | | | | | | | | | duplicate_bugdir() works, but for the vcs backends, it could require shelling out for _every_ file read. This could, and probably will, be horribly slow. Still it works ;). I'm not sure what a better implementation would be. The old implementation checked out the entire earlier state into a temporary directory pros: single shell out, simple upgrade implementation cons: wouldn't work well for HTTP backens I think a good solution would run along the lines of the currently commented out code in duplicate_bugdir(), where a VersionedStorage.changed_since(revision) call would give you a list of changed files. diff could work off of that directly, without the need to generate a whole duplicate bugdir. I'm stuck on how to handle upgrades though... Also removed trailing whitespace from all python files.
* Transitioned merge to Command-formatW. Trevor King2009-12-141-1/+6
|
* Transitioned comment to Command formatW. Trevor King2009-12-141-13/+5
|
* Converted libbe.storage.vcs.base to new Storage format.W. Trevor King2009-12-131-3/+5
|
* Moved be to libbe.ui.command_line and transitioned to Command format.W. Trevor King2009-12-121-1/+1
|
* Moved bugdir, bug, and comment over to new id implementation.W. Trevor King2009-12-101-133/+54
|
* Reworked test.py to handle deeper directory structureW. Trevor King2009-12-081-1/+1
|
* Moved properties.py and settings_object.py to libbe/storage/util/W. Trevor King2009-12-081-2/+2
|
* Transitioned bugdir.py to new storage format.W. Trevor King2009-12-081-19/+38
|
* Transitioned bug.py to new storage format.W. Trevor King2009-12-081-7/+11
|
* Transitioned comment.py to new storage format.W. Trevor King2009-12-081-73/+53
|
* Added libbe.TESTING (defaults to False).W. Trevor King2009-12-031-2/+5
| | | | | | | | | | | | | | | | | | | | This flag allows us to skip unittest and testsuite declaration if we woln't need them. It speeds up simple be calls a suprising amount. With Testing=True (the old behavior): wking@thor:be.wtk$ time ./be > /dev/null real 0m0.393s user 0m0.340s sys 0m0.048s With TESTING=False (the new behavior): be.wtk$ time ./be > /dev/null real 0m0.216s user 0m0.152s sys 0m0.064s This adjustment was inspired by Jakub Wilk's Debian bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559295
* Avoid redundant Comment.alt_idsW. Trevor King2009-11-301-1/+3
|
* Changed Bug and Comment.merge() kwargs.W. Trevor King2009-11-301-9/+27
| | | | | | | | The old allow_changes and allow_new_comments didn't have separate handling for extra_strings, like import_xml will need. It also didn't have a way to specify what to do if an illegal change occurs. Sometimes you'll want to raise an exception, but sometimes you'll want to ?silently? ignore the change.
* Moved comment.list_to_root() to Bug.add_comments() with some cleanups.W. Trevor King2009-11-291-48/+3
| | | | | | | | | | | | | | | | | | | This makes Bug.add_comment simpler. Also makes Bug.from_xml() more robust, since it no longer depends on the order in which the XML file lists the comments. The previous Bug.from_xml() would have choked on <be-xml> <bug> <comment> <uuid>B</uuid> <in-reply-to>A</in-reply-to> </comment> <comment> <uuid>A</uuid> </comment> </bug> </be-xml> because when B was being added, the referenced A hadn't yet been noticed.
* Added comment import to Bug.from_xml().W. Trevor King2009-11-281-1/+4
| | | | | | | | | | | This is a pretty critical feature, dunno how I missed it before. I also added a little check to both Bug and Comment.from_xml() so that xml_string can take an ElementTree Element as well as the usual raw string/unicode. This avoids repeated string <-> Element conversions. Added Bug.add_comment() which handles the addition of a Comment instance, matching .in_reply_to, checking .uuid uniqueness, etc.
* Added Bug.merge() and Comment.merge().W. Trevor King2009-11-281-7/+75
| | | | | | | | | Added *.explicit_attrs list creation to Bug and Comment.from_xml(). Added match_alt_id keyword argumennt to .comment_from_uuid(). Removed extra enline following '</extra-string>' tag in Bug and Comment.xml().
* Broke `be comment --xml` out and extended into `be import-xml`.W. Trevor King2009-11-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | It should currently do everything that `be comment --xml` did, but it still has a way to go before it lives up to it's longhelp string, mostly figuring out bug/comment merging. The allowed XML format also changed a bit, becoming a bit more structured. cmdutil.bug_from_shortname() renamed to cmdutil.bug_from_id(). New functions cmdutil.parse_id() and cmdutil.bug_comment_from_id(). Additional doctests in libbe.comment.Comment.comment_shortnames() to show example output if bug_shortname==None. Brought be-xml-to-mbox and be-mbox-to-xml up to speed on the current <be-xml>-rooted format. * Added <extra-string> handling to their comment handling. * Moved extra strings from email bodies to X-Extra-String headers (some comment bodies are not text, and we should keep the estr location consistent between bugs and comments.)
* Added Bug.from_xml() + some .from_xml() fixups.W. Trevor King2009-11-201-49/+48
| | | | | | | | | | | | | | | | | | | | | Moved comment.InvalidXML to utility.InvalidXML, so that bug and comment can share it. Added docstring explaining the __init__ arguments. Added indent and shortname options to Bug.xml() to match Comment.xml(). Added .extra_strings export to Comment.xml(). Converted Bug.xml() from string addition to list joining, which avoids a bunch of memory allocation/deallocation. Assorted " -> ' replacements. Elaborated doctests to check UTF-8, extra_strings, ... Added new comparison cmp_extra_strings for both bug. and comment.DEFAULT_CMP_FULL_CMP_LIST.
* Ran the new update_copyright.pyW. Trevor King2009-11-191-1/+1
|
* Don't attempt to convert unicode objects to strings in *._setting_attr_string()W. Trevor King2009-11-171-1/+3
|
* Pass content_type to Comment.new_reply() to fix error adding non-text/ commentsW. Trevor King2009-10-201-1/+3
|
* os.path.isdir() -> .exists() for check for "comments" file.W. Trevor King2009-09-211-1/+1
| | | | | | | | | "comments" should always be a directory if it exists, but if it is something else, be should fail rather than return an empty comment list. This fix was inspired by some browsing around in response to Thomas Habets' version of a fix for missing "bugs" directory.
* Added docstrings to libbe submodules.W. Trevor King2009-08-311-0/+5
| | | | Also a few minor tweaks to the module imports.
* RCS -> VCS, BUGDIR_DISK_VERSION -> v1.2W. Trevor King2009-08-311-17/+17
|
* Added libbe/upgrade.py to handle upgrading on-disk bugdirs.W. Trevor King2009-08-311-3/+0
|
* Made get_path() definitions consistent between bugdirs, bugs, and comments.W. Trevor King2009-08-311-6/+6
|
* Fixed comment.cmp_attr unittest because "o" > "a" so cmp("o", "a") == 1.W. Trevor King2009-07-311-2/+2
|
* Removed debugging exception from libbe/comment.py.W. Trevor King2009-07-271-1/+0
|
* Comment.remove() now ignores .sync_with_disk when removing the root comment.W. Trevor King2009-07-271-1/+1
|
* Added cmp functions to libbe.comment, and fleshed them out in libbe.bug.W. Trevor King2009-07-271-0/+58
| | | | | | | | | | Previous comment comparison had just been the default Tree.__cmp__. Fleshed out so A == B ensures no meaningful differences between A and B. Also added first line of comments to new comment output in libbe.diff, and added a comment/"settings" node and .comment_mod_string() (to mirror bugdir and bug).
* Hack Comment.load_settings() to work around From->Author change.W. Trevor King2009-07-271-0/+3
| | | | | | "Author" -> comment.author obeys settings_object.setting_name_to_attr_name(), but all the current on-disk mapfiles talk about "From". Add a hack to accept both forms of on-disk comment files.
* .sync_with_disk fixes for libbe.bugdir and .comment.W. Trevor King2009-07-271-1/+2
| | | | | | | | | | In BugDir, only call bug.remove if bug.sync_with_disk==True. If it's just in memory, automatic garbage collection is sufficient cleanup. Comment.set_sync_with_disk() had been setting .sync_with_disk=True regardless of the value passed in. Fixed now. Also some minor textual adjustments.
* Added DiskAccessRequired errors to libbe.bug.Bug and .comment.Comment.W. Trevor King2009-07-261-74/+97
|
* Renamed Comment.From and .time_string to .author and .date respectively.W. Trevor King2009-07-251-27/+23
| | | | | | | | | | | | Now they conform to the libbe.settings_object.setting_name_to_attr_name() standard. I fixed the references I found in becommands/comment.py interfaces/xml/be-mbox-to-xml interfaces/xml/be-xml-to-mbox but there may have been some references or files that slipped through.
* I'll add Comment.extra_strings too, while I'm at it.W. Trevor King2009-07-211-0/+14
|
* Cleaned up saving/sync_with_disk.W. Trevor King2009-07-211-4/+16
| | | | | | | | | | | | | | | | | | | | | | Got rid of a whole bunch of redundant .save() calls when sync_with_disk==True. Fixed up the "File-system access" portion of the BugDir docstring so we can all remember how things are supposed to work ;). Note that some .save() calls are still required. For example in becommands/merge.py, the copied comments have their .bug changed, but that is not a versioned property, so it doesn't trigger an automatic save, and we have to force the .save() by hand. libbe.rcs.RCS.mkdir() is now recursive by default, but you can set check_parents==False if you want it to fail in the case of missing parents. Because of the recursion, we removed the .update() call on preexisting directories, since there will be at least one of these occurrences for every .mkdir(check_parents=True) call, and I don't know of any VCS that actually needs them... Also stripped trailing whitespace from some files...
* Cleaned up some outdated libbe.settings_object.EMPTY cruft.W. Trevor King2009-07-201-3/+2
| | | | | | | | From back before commit wking@drexel.edu-20090619184215-nfx205yaj02sqrqx cleaned up the versioned_property implementation. Also a few style fixes and typos.
* Updated GPLv2 to current GPLv2.W. Trevor King2009-07-141-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | Fixes Ben's bug 00f26f04-9202-4288-8744-b29abc2342d6. I also tweaked update_copyright.sh to make possible future copyright-blurb revision easier. The new algorithm is greedier, overwriting _all_ consecutive comments after a '^# Copyright' line, so do # Copyright # GPL ... GPL ... GPL # Your comment here... not # Copyright # GPL ... GPL ... GPL # # Your comment here... Without the blank line, your comment would get overwritten by the next run of update_copyright.sh. Note that catmutt is ignored by update_copyright.sh because Moritz Barsnick has only licensed his grepm code under the GPLv2 (not GPLv>=2). See the initial catmutt commit for details.
* Added "be comment --xml --ignore-missing-references ID COMMENT".W. Trevor King2009-07-121-3/+21
| | | | Now you don't have to edit them out by hand.
* Minor fixes to get unittests working again.W. Trevor King2009-07-121-2/+1
|
* Added be-mbox-to-xml.W. Trevor King2009-07-121-5/+19
| | | | | | | | | | | | | | | | | | | | | | | Reworked to allow "be comment" to handle unicode strings (see bug e4ed63f6-9000-4d0b-98c3-487269140141). The solution was to escape all the unicode to produce and ASCII string before calling ElementTree.XML, and then converting back to unicode afterwards. Added a unicode-containing comment to the end of bug f7ccd916-b5c7-4890-a2e3-8c8ace17ae3a so that there's a handy unicode comment for testing. XML headers (e.g. '<?xml version="1.0" encoding="UTF-8" ?>') are now added to all xml output from be. Switched non-text/* encoding library to base64 instead of email.encoders, which makes that code in libbe/comment.py simpler. Changed libbe/mapfile.py error encoding from string_escape to unicode_escape so it can handle unicode. Everything's still untested, and be-xml-to-mbox doesn't handle unicode yet, but I felt this commit was getting a bit unwieldy ;).