be.git
15 years agoNow becommands.new's unittest cleans up after itself.
W. Trevor King [Fri, 31 Jul 2009 19:05:19 +0000 (15:05 -0400)]
Now becommands.new's unittest cleans up after itself.

15 years agoImproved unittest cleanup by adding BugDir.cleanup().
W. Trevor King [Fri, 31 Jul 2009 18:59:06 +0000 (14:59 -0400)]
Improved unittest cleanup by adding BugDir.cleanup().

Also simple_bug_dir -> SimpleBugDir class, which allows me to add
utility.Dir cleanup to SimpleBugDir.cleanup().

Still having a bit of trouble with the becommand.new tests due to
bugdir loading though...

15 years agoReturn to original directory after libbe.bugdir.SimpleBugDirTestCase().
W. Trevor King [Fri, 31 Jul 2009 09:24:05 +0000 (05:24 -0400)]
Return to original directory after libbe.bugdir.SimpleBugDirTestCase().

This was causing strange "RCS not found" errors in the bzr and hg
unittests.  For example, the bzr tests all passed:
  wking@thor:be.wtk-rr$ python test.py bzr
  ...
  Ran 12 tests in 24.143s

  OK
Except when run after the bugdir tests:
  wking@thor:be.wtk-rr$ python test.py bugdir bzr
  ...
  Ran 19 tests in 1.862s

  FAILED (errors=12)
Where the failures were all
  AssertionError: bzr RCS not found

Fixed by returning to intial directory after SimpleBugDirTestCase
execution.  Problem is due to Python issues with unlinked directories
though, so bzr/hg will _still_ not work from unlinked directories.
This is for Python 2.5.4 on Ubuntu 8.04.3, but probably effects other
pythons too.

Details:

Isolated problem to unlinked directories:
  mkdir /tmp/a
  cd /tmp/a
  rmdir /tmp/a
  python /home/wking/src/fun/be/be.wtk-rr/test.py bzr
which fails with the same "RCS not found" errors because bzr fails:
  wking@thor:/$ mkdir /tmp/a; cd /tmp/a; rmdir /tmp/a; bzr --help; cd /;
  rmdir: removing directory, /tmp/a
  'import site' failed; use -v for traceback
  bzr: ERROR: Couldn't import bzrlib and dependencies.
  Please check bzrlib is on your PYTHONPATH.

  Traceback (most recent call last):
    File "/usr/bin/bzr", line 64, in <module>
      import bzrlib
  ImportError: No module named bzrlib
which fails becase 'import site' fails:
  wking@thor:/$ mkdir /tmp/a; cd /tmp/a; rmdir /tmp/a; python -c 'import site'; cd /;
  rmdir: removing directory, /tmp/a
  'import site' failed; use -v for traceback
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/wking/lib/python/site.py", line 73, in <module>
      __boot()
    File "/home/wking/lib/python/site.py", line 33, in __boot
      imp.load_module('site',stream,path,descr)
    File "/usr/lib/python2.5/site.py", line 408, in <module>
      main()
    File "/usr/lib/python2.5/site.py", line 392, in main
      paths_in_sys = removeduppaths()
    File "/usr/lib/python2.5/site.py", line 96, in removeduppaths
      dir, dircase = makepath(dir)
    File "/usr/lib/python2.5/site.py", line 72, in makepath
      dir = os.path.abspath(os.path.join(*paths))
    File "/usr/lib/python2.5/posixpath.py", line 403, in abspath
      path = join(os.getcwd(), path)
  OSError: [Errno 2] No such file or directory
which fails because our cwd doesn't exist.  That makes sense ;).
Still I think Python should be able to handle it, so I reported it
  http://bugs.python.org/issue6612

15 years agoRemoved libbe.bzr.Bzr's automerge on post-commit.
W. Trevor King [Fri, 31 Jul 2009 08:57:32 +0000 (04:57 -0400)]
Removed libbe.bzr.Bzr's automerge on post-commit.

I'd done this already in
  wking@drexel.edu-20090723154304-swmkxpfagdzff9ai
but for some reason the merge with the email branch brought it back.

15 years agoFixed libbe.bugdir.BugDirTestCase.testComments(sync_with_disk=False).
W. Trevor King [Fri, 31 Jul 2009 08:25:21 +0000 (04:25 -0400)]
Fixed libbe.bugdir.BugDirTestCase.testComments(sync_with_disk=False).

15 years agoFixed comment.cmp_attr unittest because "o" > "a" so cmp("o", "a") == 1.
W. Trevor King [Fri, 31 Jul 2009 08:17:05 +0000 (04:17 -0400)]
Fixed comment.cmp_attr unittest because "o" > "a" so cmp("o", "a") == 1.

15 years agoFixed indent spacing in libbe.diff.report().
W. Trevor King [Fri, 31 Jul 2009 08:13:33 +0000 (04:13 -0400)]
Fixed indent spacing in libbe.diff.report().

Only increment depth if data_part != None.

15 years agoMerged interactive email interface
W. Trevor King [Wed, 29 Jul 2009 19:56:10 +0000 (15:56 -0400)]
Merged interactive email interface

15 years agoCorrected some problems with revision_id() before an initial commit.
W. Trevor King [Wed, 29 Jul 2009 19:49:45 +0000 (15:49 -0400)]
Corrected some problems with revision_id() before an initial commit.

15 years agoAdded clean messages on bug_from_shortname failure.
W. Trevor King [Wed, 29 Jul 2009 19:46:37 +0000 (15:46 -0400)]
Added clean messages on bug_from_shortname failure.

So user's don't get confused.

15 years agobe-handle-mail no longer sends blank subscriber emails when no change occurs.
W. Trevor King [Mon, 27 Jul 2009 21:04:42 +0000 (17:04 -0400)]
be-handle-mail no longer sends blank subscriber emails when no change occurs.

It had been mailing out the empty MIMEMultipart root returned by
diff_tree.report().

15 years agoFixed _procmailrc rules.
W. Trevor King [Mon, 27 Jul 2009 20:38:30 +0000 (16:38 -0400)]
Fixed _procmailrc rules.

"[" is a special character.

Also a few minor cleanups in be-handle-mail.

15 years agoRestored Makefile to /home/wking installation
W. Trevor King [Mon, 27 Jul 2009 19:05:55 +0000 (15:05 -0400)]
Restored Makefile to /home/wking installation

15 years agoCleaned up be-handle-mail's subscriber notification emails (fewer attachments).
W. Trevor King [Mon, 27 Jul 2009 18:42:17 +0000 (14:42 -0400)]
Cleaned up be-handle-mail's subscriber notification emails (fewer attachments).

Previously, every node in the DiffTree created it's own attachment.
Now they're consolidated into a single attachment per bug.  higher
level nodes are still one attachment per node.

Also:
  * added send_pgp_mime.append_text()
  * pulled guess_encoding() out of send_pgp_mime.encodedMIMEText().
  * renamed data_string -> data_part in libbe.diff, since it needn't be a string.

15 years agoAllow "subscribe" command via the email interface.
W. Trevor King [Mon, 27 Jul 2009 13:24:46 +0000 (09:24 -0400)]
Allow "subscribe" command via the email interface.

15 years agoTweaked the output text for modified bugs in libbe.diff and be-handle-mail.
W. Trevor King [Mon, 27 Jul 2009 13:06:27 +0000 (09:06 -0400)]
Tweaked the output text for modified bugs in libbe.diff and be-handle-mail.

15 years agoAdded "be-handle-mail --notify-since REVISION".
W. Trevor King [Mon, 27 Jul 2009 13:01:04 +0000 (09:01 -0400)]
Added "be-handle-mail --notify-since REVISION".

15 years agoAdded an additional format check to be-handle-mail's pseudoheader parsing.
W. Trevor King [Mon, 27 Jul 2009 12:38:33 +0000 (08:38 -0400)]
Added an additional format check to be-handle-mail's pseudoheader parsing.

Marked outstanding email interface bugs as fixed.

15 years agoMerged "be subscribe" and be-handle-mail subscription support.
W. Trevor King [Mon, 27 Jul 2009 12:12:16 +0000 (08:12 -0400)]
Merged "be subscribe" and be-handle-mail subscription support.

Also assorted other changes and fixes in the be.subscribe branch.
Highlights:
  * Much more powerful libbe.diff with subclassable report generators.
  * "be diff" compares working copy with last commit by default.
  * comment reference text shown in "be comment" EDITOR footer
  * .revision_id() for all VCSs
  * meaningful comment comparison and stricter bug comparison
  * stricter .sync_with_disk interpretation.  See BugDir.__doc__.
  * Comment.From and .time_string -> .author and .date, for better
    conformance with settings_object.setting_name_to_attr_name().

15 years agoSubscribing myself to all changes.
W. Trevor King [Mon, 27 Jul 2009 12:11:11 +0000 (08:11 -0400)]
Subscribing myself to all changes.

15 years agoMoved be-handle-mail over to new libbe.diff classes.
W. Trevor King [Mon, 27 Jul 2009 12:09:20 +0000 (08:09 -0400)]
Moved be-handle-mail over to new libbe.diff classes.

15 years agoRemoved debugging exception from libbe/comment.py.
W. Trevor King [Mon, 27 Jul 2009 11:59:38 +0000 (07:59 -0400)]
Removed debugging exception from libbe/comment.py.

15 years agoComment.remove() now ignores .sync_with_disk when removing the root comment.
W. Trevor King [Mon, 27 Jul 2009 11:56:17 +0000 (07:56 -0400)]
Comment.remove() now ignores .sync_with_disk when removing the root comment.

15 years agoAdded default to settings_object.versioned_property's change_hook_property.
W. Trevor King [Mon, 27 Jul 2009 11:47:35 +0000 (07:47 -0400)]
Added default to settings_object.versioned_property's change_hook_property.

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.

15 years agoPut bd into read-only mode in becommands/diff.py.
W. Trevor King [Mon, 27 Jul 2009 11:22:01 +0000 (07:22 -0400)]
Put bd into read-only mode in becommands/diff.py.

Otherwise comment comparison reads were triggering notice of the
  None -> EMPTY
transition in comment.extra_strings, which was causing a write to
disk.  This trigger is probably occuring in Bug and BugDir too.
Perhaps I should just remove the trigger...

15 years agoAdded cmp functions to libbe.comment, and fleshed them out in libbe.bug.
W. Trevor King [Mon, 27 Jul 2009 11:18:13 +0000 (07:18 -0400)]
Added cmp functions to libbe.comment, and fleshed them out in libbe.bug.

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).

15 years agoHack Comment.load_settings() to work around From->Author change.
W. Trevor King [Mon, 27 Jul 2009 10:23:20 +0000 (06:23 -0400)]
Hack Comment.load_settings() to work around From->Author change.

"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.

15 years agoCache data strings in libbe.diff.DiffTree.
W. Trevor King [Mon, 27 Jul 2009 09:57:40 +0000 (05:57 -0400)]
Cache data strings in libbe.diff.DiffTree.

This makes repeated .report() generation from the same tree more
efficient.

15 years agoMajor rewrite of libbe.diff introduces DiffTree and Diff classes.
W. Trevor King [Mon, 27 Jul 2009 09:14:49 +0000 (05:14 -0400)]
Major rewrite of libbe.diff introduces DiffTree and Diff classes.

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.

15 years ago.sync_with_disk fixes for libbe.bugdir and .comment.
W. Trevor King [Mon, 27 Jul 2009 09:11:33 +0000 (05:11 -0400)]
.sync_with_disk fixes for libbe.bugdir and .comment.

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.

15 years agoAdded DiskAccessRequired errors to libbe.bug.Bug and .comment.Comment.
W. Trevor King [Mon, 27 Jul 2009 00:40:08 +0000 (20:40 -0400)]
Added DiskAccessRequired errors to libbe.bug.Bug and .comment.Comment.

15 years agoBugDir._in_memory was a stupid idea. Took it back out.
W. Trevor King [Mon, 27 Jul 2009 00:04:32 +0000 (20:04 -0400)]
BugDir._in_memory was a stupid idea.  Took it back out.

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.

15 years agoAdded in_memory to BugDir.__init__ to disable saving/loading completely.
W. Trevor King [Sat, 25 Jul 2009 12:59:38 +0000 (08:59 -0400)]
Added in_memory to BugDir.__init__ to disable saving/loading completely.

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.

15 years agoAdded on_disk option to libbe.bugdir.simple_bug_dir().
W. Trevor King [Sat, 25 Jul 2009 11:32:12 +0000 (07:32 -0400)]
Added on_disk option to libbe.bugdir.simple_bug_dir().

Now you can easily generate simple_bug_dirs that live only in memory.

15 years agoRenamed Comment.From and .time_string to .author and .date respectively.
W. Trevor King [Sat, 25 Jul 2009 11:26:19 +0000 (07:26 -0400)]
Renamed Comment.From and .time_string to .author and .date respectively.

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.

15 years agoAdded autocommit wishlist request by Martin Krafft
W. Trevor King [Fri, 24 Jul 2009 20:14:57 +0000 (16:14 -0400)]
Added autocommit wishlist request by Martin Krafft

15 years agobe-handle-mail successfully generates bugdir-changed notification emails.
W. Trevor King [Thu, 23 Jul 2009 20:18:34 +0000 (16:18 -0400)]
be-handle-mail successfully generates bugdir-changed notification emails.

This still needs a lot of cleaning up, but it worked for an "all"
subscription to "DIR", so I thought I'd lock in the current status ;).

15 years ago"be diff" now compares agains the last commit (for versioning VCSs).
W. Trevor King [Thu, 23 Jul 2009 18:24:36 +0000 (14:24 -0400)]
"be diff" now compares agains the last commit (for versioning VCSs).

This is the default behaviour of most of the VCSs own diff commands.

15 years agoAdded .revision_id() to all the VCSs.
W. Trevor King [Thu, 23 Jul 2009 18:19:15 +0000 (14:19 -0400)]
Added .revision_id() to all the VCSs.

This makes it easier to compare recent revisions without a human
around to give you revision numbers.

15 years agolibbe.rcs.RCS.commit() now actually calls .pre/postcommit().
W. Trevor King [Thu, 23 Jul 2009 15:43:04 +0000 (11:43 -0400)]
libbe.rcs.RCS.commit() now actually calls .pre/postcommit().

It hadn't before, which defeats the Pu purpose of hook functions.
This hand't caused any problems though, since only libbe.bzr defined a
postcommit() and there were no precommit() definitions.

Bzr's postcommit() had been to auto-merge from the default merge
source.  Yikes!  Removed that ;).

15 years agoBroke encodedMIMEText out of send-pgp-mime.PGPMimeMessageFactory.
W. Trevor King [Thu, 23 Jul 2009 15:37:45 +0000 (11:37 -0400)]
Broke encodedMIMEText out of send-pgp-mime.PGPMimeMessageFactory.

It's useful enough even when you're not intending to encrypt
something.

15 years agoAdded Tree types and get_bugdir_subscribers to becommands/subscribe.py.
W. Trevor King [Thu, 23 Jul 2009 15:27:59 +0000 (11:27 -0400)]
Added Tree types and get_bugdir_subscribers to becommands/subscribe.py.

The Tree subclass SubscriptionType may be a few more lines to setup,
but they should be really easy to extend and will automatically keep
the longhelp and type handling in sync.

An example extension for bugdir types would be
  all -> assigned -> <user>
to subscribe only to bugs being assigned to the specified user.  You'd
have to loosen the currently strict InvalidType checking to make that
work, but the current type-tree handling would be up to the task.

Also a bit of reorganizing to hide the private functions.

15 years agoMerged libbe.diff upgrades and libbe.tree.Tree.has_descendant from be.wtk-rr.
W. Trevor King [Thu, 23 Jul 2009 14:10:36 +0000 (10:10 -0400)]
Merged libbe.diff upgrades and libbe.tree.Tree.has_descendant from be.wtk-rr.

Also pulls "show referenced text" fix to "be comment".

15 years agoAdded bugdir setting comparision to libbe.diff.
W. Trevor King [Thu, 23 Jul 2009 14:08:04 +0000 (10:08 -0400)]
Added bugdir setting comparision to libbe.diff.

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.

15 years agoAdded libbe.bug.cmp_comments(), and added that to default bug comparison.
W. Trevor King [Thu, 23 Jul 2009 13:59:14 +0000 (09:59 -0400)]
Added libbe.bug.cmp_comments(), and added that to default bug comparison.

15 years agoFixed unrecognized "Test" typo in becommands/comment.py.
W. Trevor King [Thu, 23 Jul 2009 13:52:47 +0000 (09:52 -0400)]
Fixed unrecognized "Test" typo in becommands/comment.py.

15 years agoAdded comment on notification granularity (commit-level).
W. Trevor King [Thu, 23 Jul 2009 13:28:48 +0000 (09:28 -0400)]
Added comment on notification granularity (commit-level).

15 years agoAdded libbe.tree.Tree.has_descendant().
W. Trevor King [Thu, 23 Jul 2009 13:25:34 +0000 (09:25 -0400)]
Added libbe.tree.Tree.has_descendant().

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.

15 years agolibbe/tree.Tree.traverse(depthFirst)->depth_first & stripped trailing spaces.
W. Trevor King [Thu, 23 Jul 2009 13:20:52 +0000 (09:20 -0400)]
libbe/tree.Tree.traverse(depthFirst)->depth_first & stripped trailing spaces.

15 years agoAdded becommands/subscribe.py to manage subscription list.
W. Trevor King [Wed, 22 Jul 2009 18:54:39 +0000 (14:54 -0400)]
Added becommands/subscribe.py to manage subscription list.

15 years agoShow text of comment's reference in notes when spawning EDITOR.
W. Trevor King [Wed, 22 Jul 2009 12:44:38 +0000 (08:44 -0400)]
Show text of comment's reference in notes when spawning EDITOR.

15 years agoMerged assorted changes from be.wtk-rr for BugDir.extra_strings.
W. Trevor King [Tue, 21 Jul 2009 20:33:28 +0000 (16:33 -0400)]
Merged assorted changes from be.wtk-rr for BugDir.extra_strings.

Other highlights:
  * be show --no-comments
  * Improved *.sync_with_disk.
  * Improved be-mbox-to-xml.

15 years agoAdded: subscribe/unsubscribe (bug #..., "new bugs", "all", etc.)
W. Trevor King [Tue, 21 Jul 2009 20:24:24 +0000 (16:24 -0400)]
Added: subscribe/unsubscribe (bug #..., "new bugs", "all", etc.)

15 years agoAdded .extra_strings to BugDir and Comment
W. Trevor King [Tue, 21 Jul 2009 20:22:34 +0000 (16:22 -0400)]
Added .extra_strings to BugDir and Comment

15 years agoI'll add Comment.extra_strings too, while I'm at it.
W. Trevor King [Tue, 21 Jul 2009 20:21:42 +0000 (16:21 -0400)]
I'll add Comment.extra_strings too, while I'm at it.

15 years agoAdded BugDir.extra_strings.
W. Trevor King [Tue, 21 Jul 2009 20:20:21 +0000 (16:20 -0400)]
Added BugDir.extra_strings.

15 years agoBug._extra_strings_check_fn() guts now utility.iterable_full_of_strings().
W. Trevor King [Tue, 21 Jul 2009 20:19:02 +0000 (16:19 -0400)]
Bug._extra_strings_check_fn() guts now utility.iterable_full_of_strings().

15 years agoMerged libbe.properties unittest fix
W. Trevor King [Tue, 21 Jul 2009 20:18:09 +0000 (16:18 -0400)]
Merged libbe.properties unittest fix

15 years agolibbe.properties unittest changes due to "extra change-hook save" fix.
W. Trevor King [Tue, 21 Jul 2009 20:14:53 +0000 (16:14 -0400)]
libbe.properties unittest changes due to "extra change-hook save" fix.

Missed these earlier.

15 years agoI imported a few threads from the mailing list as wishlist bugs.
W. Trevor King [Tue, 21 Jul 2009 19:22:09 +0000 (15:22 -0400)]
I imported a few threads from the mailing list as wishlist bugs.

12c:uw: Bug aggregation.  Multi-repo meta-BE?
529:ow: How should we version BE?
2f0:aw: Static html report generation
22b:aw: Sorting targets chronologically
d99:aw: CherryPy interface "Cherry-flavored BE"
e08:aw: Interactive email interface

15 years agoAdded "--no-comments" to "be show".
W. Trevor King [Tue, 21 Jul 2009 19:14:59 +0000 (15:14 -0400)]
Added "--no-comments" to "be show".

Also moved the XML-header line to the top of the argument loop, since
there should only be one.  We're still missing global tags wrapping the
whole thing though...

Also set options.XML default to False.  It had been defaulting to
None, which was breaking the non-XML newline-adding check.

15 years agobe-mbox-to-xml is now better at message-id, in-reply-to, and references.
W. Trevor King [Tue, 21 Jul 2009 18:17:03 +0000 (14:17 -0400)]
be-mbox-to-xml is now better at message-id, in-reply-to, and references.

A previous "len(ret) >= 0" had been stripping the alt-id and
in-reply-to from _all_ parts of multipart comments.  Now it only
strips them from parts after the first.  The following parts do not
specify and alt-id, and they all are in-reply-to the first part.

I also added the KNOWN_IDS list for selecting amongst an array of
possible in-reply-to or references ids.  This works well enough for
now, but would be more robust if we could import a list of previously
known ids from BE...

15 years ago"be comment --xml" now saves the comments (again).
W. Trevor King [Tue, 21 Jul 2009 17:32:24 +0000 (13:32 -0400)]
"be comment --xml" now saves the comments (again).

They are generated in memory (from_disk defaults to False)
  133:  new = comment.Comment(bug)
With the leaner saving since I started trusting sync_with_disk, they
were no longer making it to disk.

Easily fixed with an explicit save once you've got them all set up.

15 years agobe-mbox-to-xml handles emails without explicit transfer encodings.
W. Trevor King [Tue, 21 Jul 2009 17:24:55 +0000 (13:24 -0400)]
be-mbox-to-xml handles emails without explicit transfer encodings.

15 years agoAdded cProfile notes to README.dev.
W. Trevor King [Tue, 21 Jul 2009 17:14:24 +0000 (13:14 -0400)]
Added cProfile notes to README.dev.

15 years agoFixed extra change-hook save in testChangeHookMutableProperty.
W. Trevor King [Tue, 21 Jul 2009 16:07:27 +0000 (12:07 -0400)]
Fixed extra change-hook save in testChangeHookMutableProperty.

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.

15 years agoTouched up becommands/diff.py's help message.
W. Trevor King [Tue, 21 Jul 2009 14:32:15 +0000 (10:32 -0400)]
Touched up becommands/diff.py's help message.

15 years agoCleaned up saving/sync_with_disk.
W. Trevor King [Tue, 21 Jul 2009 11:28:26 +0000 (07:28 -0400)]
Cleaned up saving/sync_with_disk.

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...

15 years agoCleaned up some outdated libbe.settings_object.EMPTY cruft.
W. Trevor King [Mon, 20 Jul 2009 22:39:31 +0000 (18:39 -0400)]
Cleaned up some outdated libbe.settings_object.EMPTY cruft.

From back before commit
  wking@drexel.edu-20090619184215-nfx205yaj02sqrqx
cleaned up the versioned_property implementation.

Also a few style fixes and typos.

15 years agoUse shlex.split() to parse control lines in be-handle-mail.
W. Trevor King [Mon, 20 Jul 2009 21:37:31 +0000 (17:37 -0400)]
Use shlex.split() to parse control lines in be-handle-mail.

Split arguments following POSIX rather than at all whitespace.

15 years agoAdded pseudo-header list to interfaces/email/interactive/README.
W. Trevor King [Mon, 20 Jul 2009 18:59:10 +0000 (14:59 -0400)]
Added pseudo-header list to interfaces/email/interactive/README.

Also some minor textual cleanups.

15 years agoAdded psuedo-header handling to be-handle-mail.
W. Trevor King [Mon, 20 Jul 2009 18:30:40 +0000 (14:30 -0400)]
Added psuedo-header handling to be-handle-mail.

Many psuedo-headers had been ignored.  Now they are all implemented.

Getting this working exposed a few bugs in error message generation
for Commands with IDs in their argument list.  These bugs should now
be fixed.

15 years agoAdded more VCSs to the delete-commit notes in interfaces/README.
W. Trevor King [Mon, 20 Jul 2009 16:15:13 +0000 (12:15 -0400)]
Added more VCSs to the delete-commit notes in interfaces/README.

15 years agoAdded interfaces/email/interactive/README and be-handle-mail options.
W. Trevor King [Mon, 20 Jul 2009 15:44:11 +0000 (11:44 -0400)]
Added interfaces/email/interactive/README and be-handle-mail options.

The README should give enough info to install and use the interface.

While I was writing it, I thought that be-handle-mail could use the
--be-dir, --tag-base, and --test options.  generate_global_tags()
helps implement the --tag-base option.

I set up a unittest framework since checking is currently a
pipe-in-emails-by-hand sort of arrangement, which can be slow ;).
Currently only generate_global_tags() is tested.

I also restored "show" to ALLOWED_COMMANDS, since it seems to have
wandered off ;).

15 years agobe-handle-mail shown to successfully commit partially-failing emails.
W. Trevor King [Sun, 19 Jul 2009 20:14:12 +0000 (16:14 -0400)]
be-handle-mail shown to successfully commit partially-failing emails.

I've added the test-case that show it.

15 years agoMore verbose User/UsageError reporting in be-handle-mail
W. Trevor King [Sun, 19 Jul 2009 20:10:57 +0000 (16:10 -0400)]
More verbose User/UsageError reporting in be-handle-mail

15 years agoWorked out some kinks in be-handle-mail's autocommit.
W. Trevor King [Sun, 19 Jul 2009 20:07:14 +0000 (16:07 -0400)]
Worked out some kinks in be-handle-mail's autocommit.

For example, it's helpful to actually run the autocommit command ;).

15 years agoFixed typos in be-handle-mail error message generation
W. Trevor King [Sun, 19 Jul 2009 19:53:40 +0000 (15:53 -0400)]
Fixed typos in be-handle-mail error message generation

15 years agoAdjusted final commit-handling in be-handle-mail.
W. Trevor King [Sun, 19 Jul 2009 19:39:26 +0000 (15:39 -0400)]
Adjusted final commit-handling in be-handle-mail.

Now the final commit will run whether or not the preceding commands
raise any exceptions.

Note that since we've added the "--allow-empty" to "be commit", we
don't need to worry about empty commits after read-only actions.

15 years agoOops, _now_ I've fixed the multipart generation in be-handle-mail
W. Trevor King [Sun, 19 Jul 2009 19:32:41 +0000 (15:32 -0400)]
Oops, _now_ I've fixed the multipart generation in be-handle-mail

15 years agoMerged "be commit --allow-empty from be.wtk-rr"
W. Trevor King [Sun, 19 Jul 2009 19:26:48 +0000 (15:26 -0400)]
Merged "be commit --allow-empty from be.wtk-rr"

15 years agoAdded --allow-empty to "be commit"
W. Trevor King [Sun, 19 Jul 2009 19:24:51 +0000 (15:24 -0400)]
Added --allow-empty to "be commit"

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.

15 years agoFixed multipart bug in be-handle-mail.Message.response_email()
W. Trevor King [Sun, 19 Jul 2009 15:47:30 +0000 (11:47 -0400)]
Fixed multipart bug in be-handle-mail.Message.response_email()

I hadn't attached the mutipart body to the .response_header, which
meant that the reply lacked target email addresses, etc.

15 years agoAdded --disable-autocommit to be-handle-mail.
W. Trevor King [Sun, 19 Jul 2009 15:42:39 +0000 (11:42 -0400)]
Added --disable-autocommit to be-handle-mail.

Also restored repsonse-message logging to help track down bugs.

15 years agobe-handle-mail now commits after every successful email execution.
W. Trevor King [Sun, 19 Jul 2009 15:05:32 +0000 (11:05 -0400)]
be-handle-mail now commits after every successful email execution.

Caveats:

It will produce blank commits after emails that make no changes.
  Todo: --fail-on-null option to "be commit"
It will not commit changes due to emails that are partly successful.
  Todo: add "be revert"

15 years agoMerged becommands/commit.py addition from be.wtk-rr.
W. Trevor King [Sun, 19 Jul 2009 14:50:28 +0000 (10:50 -0400)]
Merged becommands/commit.py addition from be.wtk-rr.

15 years agoAdded becommands/commit.py and minor fixes.
W. Trevor King [Sun, 19 Jul 2009 14:48:12 +0000 (10:48 -0400)]
Added becommands/commit.py and minor fixes.

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.

15 years agoAdded more allowed commands and pseudo-headers to be-handle-mail.
W. Trevor King [Sun, 19 Jul 2009 14:36:21 +0000 (10:36 -0400)]
Added more allowed commands and pseudo-headers to be-handle-mail.

The new pseudo-headers are currently ignored.

15 years agoAdded interfaces/README with commit-deletion notes.
W. Trevor King [Sun, 19 Jul 2009 13:59:41 +0000 (09:59 -0400)]
Added interfaces/README with commit-deletion notes.

Up to now, my email interface never committed automatically, in order
to avoid locking in inappropriate changes.  However, with the ability
to modify bug status, etc., it could be hard to determine the correct
status with a single email's effects removed.  In order to make that
easier, I'm switching over to a "auto-commit after every user action"
model, and I've looked up the incantations for commit deletion for bzr
and git (the VCSs I use).  These incantations are recorded in
interfaces/README.

Next up: add auto-commit functionality.

15 years agobe-handle-mail's new DBT-style interface handles the example emails now.
W. Trevor King [Sun, 19 Jul 2009 12:36:56 +0000 (08:36 -0400)]
be-handle-mail's new DBT-style interface handles the example emails now.

15 years agoReworked be-handle-mail to be more like the Debian Bug Tracker.
W. Trevor King [Sun, 19 Jul 2009 11:57:28 +0000 (07:57 -0400)]
Reworked be-handle-mail to be more like the Debian Bug Tracker.

Changed all the example emails over to the new format.
Now it's time to try them all out and fix all the bugs ;).

15 years agoGeneralized _procmailrc to allow several tags: [be-bug...
W. Trevor King [Sun, 19 Jul 2009 10:24:24 +0000 (06:24 -0400)]
Generalized _procmailrc to allow several tags: [be-bug...

This is part of a process to make the email interface more like the
Debian Bug Tracker's.
  http://www.debian.org/Bugs/Reporting

_procmailrc had been out of date anyway, [be-mail] should have been
[be-bug].

15 years agoAdded new_with_comment ability to be-handle-mail.
W. Trevor King [Sat, 18 Jul 2009 21:53:20 +0000 (17:53 -0400)]
Added new_with_comment ability to be-handle-mail.

Waiting for a response so you can get the bug ID for your initial
comment is silly.  Now you don't have to :)

15 years agoAssorted bugfixes to get reworked be-handle-mail working.
W. Trevor King [Sat, 18 Jul 2009 21:02:11 +0000 (17:02 -0400)]
Assorted bugfixes to get reworked be-handle-mail working.

15 years agoMajor be-handle-mail rewrite to make things more modular.
W. Trevor King [Sat, 18 Jul 2009 20:16:13 +0000 (16:16 -0400)]
Major be-handle-mail rewrite to make things more modular.

Added Command and Message classes, and use new flexibility in
send_pgp_mime.py.

15 years agoOops, forgot to reset from/to_addr in send_pgp_mime.py unittests
W. Trevor King [Sat, 18 Jul 2009 19:29:26 +0000 (15:29 -0400)]
Oops, forgot to reset from/to_addr in send_pgp_mime.py unittests

15 years agoMajor send_pgp_mime.py reorganization to better integrate with email.Message.
W. Trevor King [Sat, 18 Jul 2009 19:17:11 +0000 (15:17 -0400)]
Major send_pgp_mime.py reorganization to better integrate with email.Message.

Now send_pgp_mime.py passes it's unittests again, and it should be
easier to use from be-handle-mail :).

Renamed Mail -> EncryptedMessageFactory, since its role is to generate
message bodies of various types (plain, signed, encrypted, ...)

Separated the header processing from Mail, now you need to
  header_from_text()
your header text to create an email.Message which you can use in
EncrypedMessageFactory.sign(), .encrypt(), ...  Once you've created
the body message you want, you can attach it to the header with
  attach_root(header, root_part)
where both header and root_part are email.Message instances.

Made EncryptedMessageFactory doctests more robust, through the use of
 # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
which removed the need for the .strip*() methods.

Also added the configurable from_addr and to_addr, which allows you
to run the doctests with successful gpg calls.  Just set them to
some address from your private keyring, and pass the passphrase for
that key in to your test via a file (or gpg-agent...)
  python send_pgp_mime.py -tP path/to/pasphrase/file

15 years agoStarting to seperate message handling in be-handle-mail.
W. Trevor King [Sat, 18 Jul 2009 15:49:05 +0000 (11:49 -0400)]
Starting to seperate message handling in be-handle-mail.

The goal being to make handling commands differently easier, rather
than just passing off the whole interface to becommands.

15 years agoNormalized whitespace in be-handle-mail and send_pgp_mime.py.
W. Trevor King [Sat, 18 Jul 2009 15:10:27 +0000 (11:10 -0400)]
Normalized whitespace in be-handle-mail and send_pgp_mime.py.

Also removed "commit after every message" from be-handle-mail,
because
  a) not implemented yet
  b) don't want to commit spam, since we'd have to find a way to
  remove it later.

Suggested future workflow:
  * "bzr diff" to poll for activity, blank output = no activity.
  * on activity:
    1) look at changes
    2) remove whatever
    3) commit email-interface repo.
    4) merge changes into your private repo
  * on private repo changes:
    * if activity in email-interface repo:
      1) deal with email activity as above
    * push your private repo onto the email-interface repo
      (and update the email repos' working tree, if required)

15 years agobe-handle-mail now handles non-text comments.
W. Trevor King [Sat, 18 Jul 2009 15:03:43 +0000 (11:03 -0400)]
be-handle-mail now handles non-text comments.

This required replacing both the codec-wrapped sys.stdin _and_ the raw
sys.__stdin__ with StringIO(stdin).  becommands/comment will use only
one or the other depending on the comment's content type.

Caveat: Get_body_type only grabs the body and type of the first
non-mulitpart section, which may not be what the user expects.

Todo: Add multiple comments for each part of a multipart message, like
we do in interfaces/xml/be-mbox-to-xml.