aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
Commit message (Collapse)AuthorAgeFilesLines
* Fix libbe.diff.Diff._changed_bugs() to handle subscriptions by bug shortname.W. Trevor King2009-12-051-3/+8
|
* Adjust libbe.diff.DiffTree to fix failed doctest.W. Trevor King2009-12-051-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | ====================================================================== FAIL: Doctest: libbe.diff.DiffTree ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.5/doctest.py", line 2128, in runTest raise self.failureException(self.format_failure(new.getvalue())) AssertionError: Failed doctest test for libbe.diff.DiffTree File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 136, in DiffTree ---------------------------------------------------------------------- File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 172, in libbe.diff.DiffTree Failed example: print bugdir.report_string() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.5/doctest.py", line 1228, in __run compileflags, 1) in test.globs File "<doctest libbe.diff.DiffTree[18]>", line 1, in <module> print bugdir.report_string() File "/home/wking/src/fun/be/be.diff-subscribe/libbe/diff.py", line 213, in report_string return "\n".join(self.report()) TypeError
* Use new libbe.diff.Diff.report_tree(subscriptions) in be-handle-mail.W. Trevor King2009-12-051-4/+9
| | | | | | | | | | | | | This makes Message.subscriber_emails() much cleaner. Also fix libbe.diff.Diff._sub_report() to handle missing 'bugdir/settings'. Added libbe.diff.SubscriptionType.__cmp__ so that SubscriptionType('all') == SubscriptionType('all') This is important when comparing the types returned by becommands.subscribe.get_bugdir_subscribers() with the libbe.diff.*_TYPE_* types.
* Added libbe.diff.Diff.full_report() for speed with several subscription lists.W. Trevor King2009-12-051-2/+67
| | | | | | | | | | Now report_tree() returns an appropriately .masked version of the cached full report, which is much faster than recomputing a new diff tree from scratch. Also fixed bug in libbe.diff.DiffTree.report() where .requires_children=True was exposing nodes with children, when it should (and now does) only expose nodes with _unmasked_ children.
* Created diff.subscriptions_from_string()W. Trevor King2009-12-051-0/+23
|
* Added BUGDIR_TYPE_MOD and BUGDIR_TYPE_REM to libbe.diff.W. Trevor King2009-12-051-8/+19
| | | | | | | | | Now you can subscribe to only hear about modified bugs or only about removed bugs. Kindof odd for a general subscription, but possibly useful as an argument to the upcoming `be diff --subscribe`, e.g. be diff --subscribe DIR:mod which would replace the old be diff --modified
* Adjusted diff.Subscription.__init__() to guess type_root if required.W. Trevor King2009-12-051-2/+7
|
* Added subscriptions option to diff.Diff.report_tree().W. Trevor King2009-12-051-20/+77
| | | | | | Also added diff.BUGDIR_ID to avoid lots of magic 'DIR' definitions, and added diff.Subscription class to make the old (id, type) tuples a bit more elegant.
* Moved subscription types from becommands/subscribe.py to libbe/diff.py.W. Trevor King2009-12-051-0/+46
|
* Add __eq__ and __ne__ methods to Tree.W. Trevor King2009-12-051-0/+6
| | | | | | | | | | | | | | | | | This fixes a bug introduced by revision-id: wking@drexel.edu-20091205034412-8apqxq8zqim48tf7 committer: W. Trevor King <wking@drexel.edu> timestamp: Fri 2009-12-04 22:44:12 -0500 message: Use __cmp__ instead of __eq__ for Tree comparison. When I made that commit, I'd forgotten that Tree inherits an __eq__ method from list, so it won't fall back to the __cmp__ method to determine equality. The new __eq__ and __ne__ methods use __cmp__ internally, so further subclasses (e.g. Comment) only need to override __cmp__. Of course, list also defines __ge__, __gt__, __le__, __lt__, ... which I don't bother with, so stay away from TreeA > TreeB and the like.
* Fixed removed comment listing in libbe/diff.py.W. Trevor King2009-12-041-2/+2
| | | | | Previous implementation guaranteed to raise KeyErrors, because new bug doesn't contain the uuid.
* Use __cmp__ instead of __eq__ for Tree comparison.W. Trevor King2009-12-041-2/+2
| | | | | | | | | | | | | | This ensures that __ne__ will also work, and makes it easier to subclass Tree. For example, in the previous implementation you could have >>> commA == commB False >>> cmp(commA, commB) 0 if the comments had different ids, but equivalent content. At the user-interface level, this removes some false "modified comments" from `be diff`.
* Don't necessarily initialize a new VCS in BugDir.load_settings().W. Trevor King2009-12-031-2/+3
| | | | | | | | | | We may already have the right type, in which case, don't mess with it. This speeds up bugdir loading a bit more: $ time be list > /dev/null real 0m1.245s user 0m1.116s sys 0m0.124s
* Don't get VCS version in VCS.__init__().W. Trevor King2009-12-031-2/+6
| | | | | | | | | | | | | | | | | | Often, this just causes a slow subprocess.Popen() call to get information we woln't even look at. Old benchmark: $ time be list > /dev/null real 0m2.369s user 0m1.980s sys 0m0.388s New benchmark: $ time be list > /dev/null real 0m1.472s user 0m1.304s sys 0m0.164s
* Added libbe.TESTING (defaults to False).W. Trevor King2009-12-0324-921/+1031
| | | | | | | | | | | | | | | | | | | | 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
* Added copyright blurbs to __init__.py files.W. Trevor King2009-12-031-0/+16
|
* Remove _test() functions from plugin.py and cmdutil.py.W. Trevor King2009-12-032-15/+0
| | | | | Testing should be handled through test.py, not by calling per-module _test() functions.
* Generalized doctest string in subproc.pyW. Trevor King2009-11-301-1/+1
|
* Avoid redundant Comment.alt_idsW. Trevor King2009-11-301-1/+3
|
* Changed Bug and Comment.merge() kwargs.W. Trevor King2009-11-302-25/+69
| | | | | | | | 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.
* Minor BugDir docstring typo correction.W. Trevor King2009-11-301-1/+1
|
* Moved comment.list_to_root() to Bug.add_comments() with some cleanups.W. Trevor King2009-11-292-65/+45
| | | | | | | | | | | | | | | | | | | 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-282-10/+93
| | | | | | | | | | | 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.
* BugDir.list_uuids() -> BugDir.uuids()W. Trevor King2009-11-282-7/+7
|
* Added Bug.merge() and Comment.merge().W. Trevor King2009-11-282-16/+185
| | | | | | | | | 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().
* Added restrict_file_access to becommands' execute() args.W. Trevor King2009-11-211-2/+19
| | | | | | | + associated adjustments in other files. See cmdutil.restrict_file_access.__doc__ for an explanation of the security hole this closes.
* Fix libbe.vcs.VCS.get_file_contents(allow_no_vcs=True,binary=True).W. Trevor King2009-11-211-1/+8
| | | | | | | | In it's previous form it had ignored the binary option if self._use_vcs() returned False. Also added a few more details to the docstring, explaining the arguments.
* Broke `be comment --xml` out and extended into `be import-xml`.W. Trevor King2009-11-212-3/+62
| | | | | | | | | | | | | | | | | | | | | | | 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-203-72/+152
| | | | | | | | | | | | | | | | | | | | | 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.
* Import os in libbe.subproc if _POSIX == TrueW. Trevor King2009-11-201-0/+1
|
* Import select in libbe.subproc if _POSIX == TrueW. Trevor King2009-11-201-0/+3
|
* Adjusted test.py to use an installed vcs by default.W. Trevor King2009-11-203-8/+19
| | | | | | | | | Protects agaist the off chance that the user doesn't have Arch (tla) installed ;). Changed Arch.name from "Arch" to "arch" so that each VCSs .name matches the module name. This allows us to use vcs.VCS_ORDER (a list of module names) to set up the allowed values of BugDir.vcs_name.
* Broke subprocess handling out into its own submodule libbe.subproc.W. Trevor King2009-11-204-43/+227
|
* Ran the new update_copyright.pyW. Trevor King2009-11-1921-14/+33
|
* Use unicode_output=False in some Darcs._u_invoke_client() calls.W. Trevor King2009-11-176-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids the following error: ====================================================================== ERROR: Should get file contents as committed to specified revision. ---------------------------------------------------------------------- Traceback (most recent call last): File ".../libbe/vcs.py", line 860, in test_revision_file_contents_as_committed full_path, revision) File ".../libbe/vcs.py", line 339, in get_file_contents contents = self._vcs_get_file_contents(relpath,revision,binary=binary) File ".../libbe/darcs.py", line 122, in _vcs_get_file_contents status,output,error = self._u_invoke(args, stdin=major_patch) File ".../libbe/vcs.py", line 488, in _u_invoke raise CommandError(args, status, stdout, stderr) CommandError: Command failed (2): patch: **** Only garbage was found in the patch input. while executing ['patch', '--reverse', 'a/text'] After adding the unicode_output=False lines, I adjusted the VCS._u_invoke_client() definition to pass all it's kwargs automatically through to VCS._u_invoke(). To make this simpler and more consistent, I renamed the "directory" option to "cwd", and adjusted *._u_invoke() calls appropriately in several VCS backends.
* Cleanup temp. dir. in libbe.vcs tests.W. Trevor King2009-11-171-1/+2
|
* "CommandStderr" -> "CommandError" in VCS._u_invoke()W. Trevor King2009-11-171-1/+1
| | | | | Corrects a mistake from using string replace to move output,error -> stdout,stderr a few commits ago.
* Don't attempt to convert unicode objects to strings in *._setting_attr_string()W. Trevor King2009-11-172-2/+6
|
* Set binary=True for mapfile file handlingW. Trevor King2009-11-171-4/+9
| | | | | | | | The YAML library produces Python string encodings of unicode objects. There's no reason to try and convert them back into Python unicode objects just to save them with binary=False, because the files are only read in to be passed into the YAML parser, which can handle the unicode characters correctly.
* Added unicode_output option to VCS._u_invoke()W. Trevor King2009-11-171-2/+8
|
* rename "output","error" -> "stdout","stderr" in VCS._u_invoke()W. Trevor King2009-11-171-4/+4
|
* Pass content_type to Comment.new_reply() to fix error adding non-text/ commentsW. Trevor King2009-10-201-1/+3
|
* Oops, fixed return typo in libbe.darcs.Darcs._vcs_get_file_contents()W. Trevor King2009-10-061-8/+8
| | | | | | | | | | | | | | | For self.parsed_version[0] >= 2, was returning the entire output of ._u_invoke_client() (status, output, and error). Now it just returns the output, which is what we want. This fixes Chris' failed test: ====================================================================== FAIL: Should get file contents as committed to specified revision. ---------------------------------------------------------------------- Traceback (most recent call last): File "libbe/vcs.py", line 852, in test_revision_file_contents_as_committed self.test_contents['rev_1'], committed_contents) AssertionError: 'Lorem ipsum' != (0, 'Lorem ipsum', '') ----------------------------------------------------------------------
* Moved VCS detection from _vcs_help() to _vcs_version().W. Trevor King2009-10-066-22/+29
| | | | | | | The version string is useful information to have around, while the help string is probably not. For example, we use it in darcs.Darcs._vcs_get_file_contents() to construct an incantation appropriate to the version we're dealing with.
* Moved from *.__del__() to exclusive use of *.cleanup().W. Trevor King2009-10-054-14/+9
| | | | | | | | | *.__del__() is run some unspecified time after the refcount for an object is reduced to zero. Sometimes that means that the rest of the world has already been deallocated, which makes life difficult, especially when Python won't attempt to construct stack traces inside *.__del__(). We were always (hopefully ;) calling del(*) anyway, so we just replace those calls with *.cleanup()
* Fixed bugdir name collision in cmdutil.bug_from_shortname()W. Trevor King2009-09-231-2/+2
|
* 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.
* Include stdout in CommandError.W. Trevor King2009-09-193-8/+9
|
* Added libbe.version, wrapping the auto-generated libbe._version.W. Trevor King2009-09-151-0/+50
| | | | | | | | | | | | | | | | Two major benefits: 1) Programatic access to the BE version. Previously the version-string logic was internal to the commandline interface ./be, which left the other interfaces hanging. 2) Simple to override auto-generated revision id version with any string you like (by setting libbe.version._VERSION, if that's the way you want to run things or the way your packaging system requires. Note that other modules should never read libbe.version._VERSION, since it may not be defined. Instead they should use the output of libbe.version.version().
* Added docstrings to libbe submodules.W. Trevor King2009-08-3119-29/+123
| | | | Also a few minor tweaks to the module imports.