aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
Commit message (Collapse)AuthorAgeFilesLines
* 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 default to settings_object.versioned_property's change_hook_property.W. Trevor King2009-07-272-13/+8
| | | | | | | | | | Now change_hook properties handle defaults, which allows them to avoid an initial None -> default save hook trigger. Removed the now-redundant read-only mode business in becommands/diff.py.
* Added cmp functions to libbe.comment, and fleshed them out in libbe.bug.W. Trevor King2009-07-273-7/+78
| | | | | | | | | | 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.
* Cache data strings in libbe.diff.DiffTree.W. Trevor King2009-07-271-0/+3
| | | | | This makes repeated .report() generation from the same tree more efficient.
* Major rewrite of libbe.diff introduces DiffTree and Diff classes.W. Trevor King2009-07-271-94/+368
| | | | | | | | | | | | | To make the interface proposed by becommands/subscribers.py easier to implement, I've moved the libbe.diff functionality into classes. Now it should be easy two tweak the output as desired by subclassing these classes. The basic idea is that Diff.report_tree() generates a diff_tree tree of changes between two bugdirs, where diff_tree is some subclass of DiffTree. Each type of change has a default .*_string() method producing a string summary of the change. DiffTree.report() moves through and generates a report by joining all those summary strings to a single root, and DiffTree.report_string() serialized the report to produce e.g. the output of becommands/diff.py.
* .sync_with_disk fixes for libbe.bugdir and .comment.W. Trevor King2009-07-272-4/+8
| | | | | | | | | | 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-262-98/+144
|
* BugDir._in_memory was a stupid idea. Took it back out.W. Trevor King2009-07-261-103/+147
| | | | | | | | | | | | | | | | | | | | | | | | It was too confusing having three memory access levels: 1) syncronized 2) explicit 3) memory-only with .sync_with_disk selecting between 1 and 2/3 and ._in_memory selecting between 2/3. Now there are only two: 1) syncronized 2) memory-only excepting explicit BugDir.save() calls. I avoid the problem of non-syncronized loading of on-disk bugs in simple_bug_dir by restricting .list_uuids() to in-memory bugs when .sync_with_disk==True. Beyond that, I shifted the order of the BugDir methods around a bit so that they were better grouped according to general idea. Note that the DiskAccessRequired exceptions on filesystem access when .sync_with_disk==False should be propogated to the Bug and Comment methods, but I haven't done that yet.
* Added in_memory to BugDir.__init__ to disable saving/loading completely.W. Trevor King2009-07-251-17/+77
| | | | | | | The previous simple_bug_dir(on_disk==False) supprised me by loading my BE bugdir when called from the BE directory. This functionality could probably move out to Bug and Comment as well, but I have avoided that for now.
* Added on_disk option to libbe.bugdir.simple_bug_dir().W. Trevor King2009-07-251-6/+14
| | | | Now you can easily generate simple_bug_dirs that live only in memory.
* 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.
* Added .revision_id() to all the VCSs.W. Trevor King2009-07-236-24/+114
| | | | | This makes it easier to compare recent revisions without a human around to give you revision numbers.
* Merged libbe.diff upgrades and libbe.tree.Tree.has_descendant from be.wtk-rr.W. Trevor King2009-07-233-28/+73
|\ | | | | | | Also pulls "show referenced text" fix to "be comment".
| * Added bugdir setting comparision to libbe.diff.W. Trevor King2009-07-231-20/+29
| | | | | | | | | | | | | | | | | | | | | | Renamed libbe.diff.diff -> bug_diffs, since it doesn't compare bugdirs. Load comments before bug comparision so cmp_comments will see them. Use .settings_properties rather than static lists to create attribute lists for change_lines(). Removed trailing endline from becommands/diff.py output.
| * Added libbe.bug.cmp_comments(), and added that to default bug comparison.W. Trevor King2009-07-231-1/+18
| |
| * Added libbe.tree.Tree.has_descendant().W. Trevor King2009-07-231-0/+19
| | | | | | | | | | | | Tree equality is now based on instance id. It had previously used the default list "equal if all elements are equal", which meant that all the leaves matched each other.
| * libbe/tree.Tree.traverse(depthFirst)->depth_first & stripped trailing spaces.W. Trevor King2009-07-231-7/+7
| |
* | Merged assorted changes from be.wtk-rr for BugDir.extra_strings.W. Trevor King2009-07-217-85/+216
|\| | | | | | | | | | | | | Other highlights: * be show --no-comments * Improved *.sync_with_disk. * Improved be-mbox-to-xml.
| * I'll add Comment.extra_strings too, while I'm at it.W. Trevor King2009-07-211-0/+14
| |
| * Added BugDir.extra_strings.W. Trevor King2009-07-211-0/+14
| |
| * Bug._extra_strings_check_fn() guts now utility.iterable_full_of_strings().W. Trevor King2009-07-212-10/+22
| |
| * libbe.properties unittest changes due to "extra change-hook save" fix.W. Trevor King2009-07-211-4/+8
| | | | | | | | Missed these earlier.
| * Fixed extra change-hook save in testChangeHookMutableProperty.W. Trevor King2009-07-212-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The actual fix was @@ -339,7 +355,10 @@ fset = funcs.get("fset") name = funcs.get("name", "<unknown>") def _fget(self, new_value=None, from_fset=False): # only used if mutable == True - value = fget(self) + if from_fset == True: + value = new_value # compare new value with cached + else: + value = fget(self) # compare current value with cached if _cmp_cached_mutable_property(self, "change hook property", name, value) != 0: # there has been a change, cache new value old_value = _get_cached_mutable_property(self, "change hook property", name) The reason for the double-save was: >>> print t.settings["List-type"]==EMPTY True (the cached value here is EMPTY) >>> t.list_type = [] (old fget compares cached EMPTY to current EMPTY, no change, so no cache. fset notices change and saves EMPTY->[]) >>> t.list_type.append(5) (now fget notices the change EMPTY->[], caches [], and calls extra save) The new way: >>> print t.settings["List-type"]==EMPTY True (the cached value here is EMPTY) >>> t.list_type = [] (fget compares cached EMPTY to new [] and saves EMPTY->[]) >>> t.list_type.append(5) (fget sees no change ([]->[]), which is correct) In addition to the fix and the related corrections to testChangeHookMutableProperty, I added details about mutables to all relevant docstrings and stripped trailing whitespace from both files.
| * Cleaned up saving/sync_with_disk.W. Trevor King2009-07-214-37/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-204-11/+10
| | | | | | | | | | | | | | | | From back before commit wking@drexel.edu-20090619184215-nfx205yaj02sqrqx cleaned up the versioned_property implementation. Also a few style fixes and typos.
* | Merged "be commit --allow-empty from be.wtk-rr"W. Trevor King2009-07-197-47/+101
|\|
| * Added --allow-empty to "be commit"W. Trevor King2009-07-197-46/+100
| | | | | | | | | | | | | | Previously many backends would silently add an empty commit. Not very useful. When the new --allow-empty flag and related allow_empty options are false, every versioning backend is guaranteed to raise the EmptyCommit exception in the case of an attempted empty commit.
* | Merged becommands/commit.py addition from be.wtk-rr.W. Trevor King2009-07-193-4/+5
|\|
| * Added becommands/commit.py and minor fixes.W. Trevor King2009-07-193-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we can commit changes from the command line with a unified interface. The interface is much less flexible than using your particular version control system's commit command directly, so this command is mostly intended for user-interfaces and other tools that don't want to be bothered with the extra flexibility. Normalized spacing in rcs.RCS.commit to produce: summary <BLANKLINE> body <TRAILING-ENDLINE> messages regardless of the input string format. Also fixed a "--complete" handline bug in cmdutil, and some minor docstring typos in libbe.rcs and .editor.
* | Merged some bugfixes from be.wtk-rrW. Trevor King2009-07-181-1/+1
|\|
| * Fixed broken path in libbe.rcs.RCS._rcs_get_file_contents(binary=True).W. Trevor King2009-07-181-1/+1
| | | | | | | | | | | | I'd forgotten to prefix the directory root, so calling be show --only-raw-body COMMIT-ID would fail if you weren't executing it in the repository root.
* | Allow external override of libbe.encoding.get_encoding().W. Trevor King2009-07-181-0/+4
| | | | | | | | | | | | The previous procmail encoding fix failed, because the becommand execution checks libbe.encoding.get_encoding() on it's own, and got the procmail encoding. This one works.
* | Renamed test->manipulate_encodings in becommands.*.execute.W. Trevor King2009-07-161-2/+3
|/ | | | | | | | | | | | | | Reminder from my initial libbe/encoding.py commit: Because of the stdout replacement, the doctests executes now need an optional 'test' argument to turn off replacement during the doctests, otherwise doctest flips out (since it had set up stdout to catch output, and then we clobbered it's setup). I'm also trying to catch stdout/stderr from be-handle-mail, and I ran into the same problem. It took me a bit to remember exactly what "test" was supposed to do, so I thought I'd make the argument name more specific. If you need other changes when running in "test" mode, you'll have to add other kwargs.
* Updated GPLv2 to current GPLv2.W. Trevor King2009-07-1421-233/+231
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed "be --dir --complete"W. Trevor King2009-07-131-0/+8
|
* Use CmdOptionParser in "be".W. Trevor King2009-07-131-9/+14
| | | | | | All the becommands have been using cmdutil CmdOptionParser for a long time, but "be" parsed its options by hand. Now it used CmdOptionParser, which makes adding new options much easier.
* Added "be comment --xml --ignore-missing-references ID COMMENT".W. Trevor King2009-07-122-4/+23
| | | | Now you don't have to edit them out by hand.
* Added timezone handling to libbe.utility.str_to_time.W. Trevor King2009-07-121-2/+20
|
* Minor fixes to get unittests working again.W. Trevor King2009-07-121-2/+1
|
* Added be-mbox-to-xml.W. Trevor King2009-07-122-7/+21
| | | | | | | | | | | | | | | | | | | | | | | 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 ;).
* Updating "be set --help" and "be status --help".W. Trevor King2009-07-112-4/+4
| | | | | | | | | I don't really like the "defaults to None" for the settings that have funky initialization procedures (most of them :p), but I'm not sure how to handle that cleanly yet. Perhaps be set --current I also need to find a method of adding complicated settings like the nested lists for severities, etc from the "be set" commandline.
* Removed <abentley@panoramicfeedback.com> from copyright blurbs.W. Trevor King2009-07-1114-14/+0
| | | | | | | | | | | These didn't work with my update_copyright.sh. I went with Aaron Bentley and Panometrics, Inc. instead of Aaron Bentley <abentley@panoramicfeedback.com> and Panometrics, Inc. just because of line length, but I'm open to convincing if people prefer the latter...
* "be comment --xml" now translates comment uuids to alt_ids.W. Trevor King2009-07-111-1/+1
|
* Adjustments to new versioned_property behavior.W. Trevor King2009-07-112-17/+38
| | | | | Also adjusted libbe/comment.py to move to user-specified alt_ids, rather than uuids.
* Fixed versioned_property(default=None, generator=None) defaults.W. Trevor King2009-07-111-10/+10
| | | | | | Now the behavior conforms to the docstring: If both default and generator are None, then the property will be a defaulting property which defaults to None.
* Fixed minor doctest failure in cmdutil.pyW. Trevor King2009-07-111-1/+1
|
* seems to work ;)W. Trevor King2009-07-102-22/+72
|
* Simplified error handling in ./beW. Trevor King2009-07-101-6/+6
| | | | | | | | | | Removed superfluous nesting in ./be's error catching. Also replaced KeyErrors due to unknown commands with the more specific cmdutil.UnknownCommand, since all sorts of programming errors can raise KeyErrors. Untested, since my working tree is a mess at the moment, but what could go wrong? ;)