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

15 years agoIn be-handle-mail, don't mess with stdin if the command doesn't need it.
W. Trevor King [Sat, 18 Jul 2009 14:48:37 +0000 (10:48 -0400)]
In be-handle-mail, don't mess with stdin if the command doesn't need it.

This fixes problems with StringIO(None).

15 years agoIn be-handle-mail, give new bug summary via command line.
W. Trevor King [Sat, 18 Jul 2009 14:45:13 +0000 (10:45 -0400)]
In be-handle-mail, give new bug summary via command line.

Fixes incorrect implementation of _comment_ bodies via stdin in my
  wking@drexel.edu-20090718143517-mkd6toxmcoij3qwk
commit.

15 years agoMerged some bugfixes from be.wtk-rr
W. Trevor King [Sat, 18 Jul 2009 14:42:54 +0000 (10:42 -0400)]
Merged some bugfixes from be.wtk-rr

15 years agoImport sys in becommands/new.py.
W. Trevor King [Sat, 18 Jul 2009 14:41:11 +0000 (10:41 -0400)]
Import sys in becommands/new.py.

Required for reading the bug summary string from stdin.

15 years agoFor be-handle-mail, pass comment body in via a temporary stdin.
W. Trevor King [Sat, 18 Jul 2009 14:35:17 +0000 (10:35 -0400)]
For be-handle-mail, pass comment body in via a temporary stdin.

This avoids decode-recode issues inside libbe.cmdutil.execute(), as
well as problems due to large comment bodies.

15 years agoFixed broken path in libbe.rcs.RCS._rcs_get_file_contents(binary=True).
W. Trevor King [Sat, 18 Jul 2009 14:29:11 +0000 (10:29 -0400)]
Fixed broken path in libbe.rcs.RCS._rcs_get_file_contents(binary=True).

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.

15 years agoCorrected author_addr -> info["author_addr"] in be-handle-mail
W. Trevor King [Sat, 18 Jul 2009 14:03:48 +0000 (10:03 -0400)]
Corrected author_addr -> info["author_addr"] in be-handle-mail

15 years agoFixed typo in one of be-handle-mail's InvalidCommand calls.
W. Trevor King [Sat, 18 Jul 2009 13:51:17 +0000 (09:51 -0400)]
Fixed typo in one of be-handle-mail's InvalidCommand calls.

Also restored Makefile target to home (from local), which I'd
accidentally committed two commits ago...

15 years agoAllow external override of libbe.encoding.get_encoding().
W. Trevor King [Sat, 18 Jul 2009 13:47:46 +0000 (09:47 -0400)]
Allow external override of libbe.encoding.get_encoding().

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.

15 years agoFixed some missing references in be-handle-mail.InvalidSubject
W. Trevor King [Sat, 18 Jul 2009 13:36:23 +0000 (09:36 -0400)]
Fixed some missing references in be-handle-mail.InvalidSubject

15 years agoHardcoded UTF-8 encoding in be-handle-mail.
W. Trevor King [Sat, 18 Jul 2009 13:31:44 +0000 (09:31 -0400)]
Hardcoded UTF-8 encoding in be-handle-mail.

When run by procmail, the encoding returned by
libbe.encoding.get_encoding is ANSI_X3.4-1968, which chokes on unicode
output.  I can't think of a more elegant solution than hardcoding in
the default encoding.

15 years agoAdded "to_unicode" to send_pgp_mime.flatten()
W. Trevor King [Sat, 18 Jul 2009 13:21:03 +0000 (09:21 -0400)]
Added "to_unicode" to send_pgp_mime.flatten()

be-handle-mail wants unicode output, since all it's internal
processing is done with unicode.  However, the flatten calls in
send_pgp_mime work with the encoded binary string output, and
execute(sendmail, stdin=flatten(msg, to_unicode=True)) fails
with
  Exception: u
  while executing /usr/sbin/sendmail -t
  sendmail: fatal: wking(1001): No recipient addresses found in message header

15 years agosend_pgp_mime.py attempts to avoid UTF-8 for MIMEText messages.
W. Trevor King [Sat, 18 Jul 2009 13:04:25 +0000 (09:04 -0400)]
send_pgp_mime.py attempts to avoid UTF-8 for MIMEText messages.

This keeps the transfer-encoding out of base64 if possible.

Also added a "help" example to interafaces/email/interactive/examples.

15 years agoAdded send_pgp_mime.Mail.encodedMIMEText() for unicode handling.
W. Trevor King [Sat, 18 Jul 2009 12:47:11 +0000 (08:47 -0400)]
Added send_pgp_mime.Mail.encodedMIMEText() for unicode handling.

Now be-handle-mail handles examples/unicode without crashing
  cat examples/unicode | ./be-handle-mail -o -l -
But the output email is encoded in base64:

MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
From: BE Bugs <wking@thor.physics.drexel.edu>
To: John Doe <jdoe@example.com>
Date: Sat, 18 Jul 2009 12:22:05 +0000
Subject: [be-bug] Re: show
In-reply-to: <abcd@example.com>

UmVzdWx0cyBvZiBydW5uaW5nOiAoZXhpdCBjb2RlIDApCiAgc2hvdyAKCnN0ZG91dDoKCjw/eG1s
IHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiA/Pgo8YnVnPgogIDx1dWlkPmY3Y2NkOTE2
LWI1YzctNDg5MC1hMmUzLThjOGFjZTE3YWUzYTwvdXVpZD4KICA8c2hvcnQtbmFtZT5mN2M8L3No
b3J0LW5hbWU+CiAgPHNldmVyaXR5Pm1pbm9yPC9zZXZlcml0eT4KICA8c3RhdHVzPmZpeGVkPC9z
...

This is perhaps the best we can get out of python < 3.1/2.7, see
  http://bugs.python.org/issue1368247

15 years agoFixed options.logfile -> logpath typo in be-handle-mail.open_logfile().
W. Trevor King [Sat, 18 Jul 2009 12:23:13 +0000 (08:23 -0400)]
Fixed options.logfile -> logpath typo in be-handle-mail.open_logfile().

15 years agoBetter unicode handling in be-handle-mail.
W. Trevor King [Sat, 18 Jul 2009 11:43:29 +0000 (07:43 -0400)]
Better unicode handling in be-handle-mail.

be-handle-mail now gets a bit further on
  cat examples/unicode | ./be-handle-mail -o -l - 2>&1 1>/dev/null
It successfully reads in unicode output from the command execution and
successfully prints that output to the log ("-l - 2>&1 1>/dev/null" sets
up the log to be printed to the terminal's stdout).  However, it chokes
later on with
  responding to John Doe <jdoe@example.com>: show
  Traceback (most recent call last):
    File "./be-handle-mail", line 274, in <module>
      main()
    File "./be-handle-mail", line 266, in main
      response_email = compose_response(ret, out_text, err_text, info).plain()
    File "./be-handle-mail", line 210, in compose_response
      LOGFILE.write("\n%s\n\n" % send_pgp_mime.flatten(response_email.plain()))
    File "/home/wking/src/fun/be/be.email/interfaces/email/interactive/send_pgp_mime.py", line 165, in flatten
      g.flatten(msg)
    File "/usr/lib/python2.5/email/generator.py" ...
    ...
  UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 2581: ordinal not in
  range(128)

15 years agoAdded tracebacks to be-handle-mail's "uncaught exceptions".
W. Trevor King [Sat, 18 Jul 2009 10:50:40 +0000 (06:50 -0400)]
Added tracebacks to be-handle-mail's "uncaught exceptions".

15 years agoAdded an email interface example requesting unicode comment output.
W. Trevor King [Fri, 17 Jul 2009 13:09:44 +0000 (09:09 -0400)]
Added an email interface example requesting unicode comment output.

Indeed, be-handle-mail chokes... :(

15 years agoAdded "be-handle-mail --logfile LOGFILE" for sane logfile handling.
W. Trevor King [Fri, 17 Jul 2009 13:00:54 +0000 (09:00 -0400)]
Added "be-handle-mail --logfile LOGFILE" for sane logfile handling.

The previous setup had been pretty wimpy; now there's a degree of
flexibility.

15 years agoAdded symlinks to libbe and becommands in interfaces/email/interactive.
W. Trevor King [Fri, 17 Jul 2009 12:24:33 +0000 (08:24 -0400)]
Added symlinks to libbe and becommands in interfaces/email/interactive.

With this set-up, be-handle-mail run from its own directory will load
your working-state BE setup, not your system-wide BE installation.

15 years agoSetup be-handle-mail.BE_DIR to point to the BE repo by default.
W. Trevor King [Fri, 17 Jul 2009 12:21:49 +0000 (08:21 -0400)]
Setup be-handle-mail.BE_DIR to point to the BE repo by default.

At least, it points to the directory where be-handle-mail lives.  If
you haven't moved it, that will be somewhere inside the BE repository.

This removes my hardcoded BE_DIR.

15 years ago"be-handle-mail --output" added to support easy testing.
W. Trevor King [Fri, 17 Jul 2009 12:16:45 +0000 (08:16 -0400)]
"be-handle-mail --output" added to support easy testing.

15 years agoRemoved debugging reply-address adjustment from be-handle-mail.
W. Trevor King [Thu, 16 Jul 2009 13:13:07 +0000 (09:13 -0400)]
Removed debugging reply-address adjustment from be-handle-mail.

Everything seems to be working now.  On to the remote tests ;).

15 years agobe-hand-mail now catches errors and sends appropriate responses.
W. Trevor King [Thu, 16 Jul 2009 11:34:31 +0000 (07:34 -0400)]
be-hand-mail now catches errors and sends appropriate responses.

15 years agoNow be-handle-mail successfully catches stdout/stderr.
W. Trevor King [Thu, 16 Jul 2009 10:40:55 +0000 (06:40 -0400)]
Now be-handle-mail successfully catches stdout/stderr.

15 years agoRenamed test->manipulate_encodings in becommands.*.execute.
W. Trevor King [Thu, 16 Jul 2009 09:50:31 +0000 (05:50 -0400)]
Renamed test->manipulate_encodings in becommands.*.execute.

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.

15 years agoOops again, removed some old debugging logging
W. Trevor King [Wed, 15 Jul 2009 19:50:58 +0000 (15:50 -0400)]
Oops again, removed some old debugging logging

15 years agoOops, the header keys in be-handle-mail should all be unicode.
W. Trevor King [Wed, 15 Jul 2009 19:48:55 +0000 (15:48 -0400)]
Oops, the header keys in be-handle-mail should all be unicode.

Even though I convert to ascii in send_pgp_mime.Mail.__init__(), it's
still good to be consistent inside each module ;).

15 years agobe-handle-mail succesfully sends replies.
W. Trevor King [Wed, 15 Jul 2009 19:45:27 +0000 (15:45 -0400)]
be-handle-mail succesfully sends replies.

Although I'm not catching stdout/stderr yet, so the replies aren't
very useful ;).  Still it the send_pgp_mime.py interface is working :).

I've added rudimentary logging (via LOGFILE) to keep track of what
be-handle-mail is up to.  There's also BE_DIR, which sets the
directory that BE lives in (important ;).

The author handling got more consistent, thanks to
send_pgp_mime.source_email (using the new return_realname option) and
email.utils.formataddr().  Now author_addr should look the same
regardless of which phrasing you use to set it (e.g. "NAME <ADDR>" vs
"ADDR (NAME)", and possibly others.)

15 years agoAdjusted _procmailrc to not match reply emails.
W. Trevor King [Wed, 15 Jul 2009 19:33:36 +0000 (15:33 -0400)]
Adjusted _procmailrc to not match reply emails.

You might want to keep the output to read later ;).

15 years agoAdd unicode-header handling to send_pgp_mime.py
W. Trevor King [Wed, 15 Jul 2009 19:13:39 +0000 (15:13 -0400)]
Add unicode-header handling to send_pgp_mime.py

Also:

Switched
 email.message_from_string()
to
 email.parser.Parser().parsestr()
for parsing the header, for access to the headersonly option.

Adjusted module import order to alphebetize non-mime email modules.

Added return_realname to source_email(), which makes it more useful to
be-handle-mail (currently uncommitted).

Added a doctest for the plain() output and removed redundant
Content-Type line from the doctests (which we'd removed from the
output with the last commit).

Note that many doctests _will_fail_ unless me@big.edu and you@big.edu
are in your gpg keyring.  At some point I should make those addresses
options to --test...

15 years agoMinor tweaks in send_pgp_mime.py
W. Trevor King [Wed, 15 Jul 2009 18:06:03 +0000 (14:06 -0400)]
Minor tweaks in send_pgp_mime.py

 * No reason to set maxheaderlen to something other than the default.
 * MIMEText sets content-type and charset automatically.

15 years agoAdded --mode=plain option to send_pgp_mime.
W. Trevor King [Wed, 15 Jul 2009 17:18:19 +0000 (13:18 -0400)]
Added --mode=plain option to send_pgp_mime.

Also a few more tweaks to get things working.  I think be-handle-mail
is parsing the incoming messages correctly now, but I'm not getting
replies back for some reason.  Some of the adjustments:

  * Moved send_pgp_mime -> send_pgp_mime.py, otherwise Python doesn't
    recognize it as an importable module.
  * I use postfix now instead of msmtp, so send_pgp_mime.sendmail now
    points to postfix's sendmail-compatable frontend.
  * Added "--mode=plain" option to send_pgp_mime.py, so I can test
    my procmail rules and send_pgp_mime itself without worrying about
    be-handle-mail.
  * Fixed some typos in be-handle-mail.

15 years agoFirst attempt at real response email.
W. Trevor King [Wed, 15 Jul 2009 16:43:34 +0000 (12:43 -0400)]
First attempt at real response email.

15 years agoAdded some comments to send_pgp_mime
W. Trevor King [Wed, 15 Jul 2009 16:10:19 +0000 (12:10 -0400)]
Added some comments to send_pgp_mime

15 years agoIncorperated send_pgp_mime into be-handle-mail.
W. Trevor King [Wed, 15 Jul 2009 13:55:20 +0000 (09:55 -0400)]
Incorperated send_pgp_mime into be-handle-mail.

Todo: generate a real response email to replace the current dummy
email.

15 years agoRan update_copyright.sh on be-handle-mail and send_pgp_mime.
W. Trevor King [Wed, 15 Jul 2009 13:43:34 +0000 (09:43 -0400)]
Ran update_copyright.sh on be-handle-mail and send_pgp_mime.

15 years agoAdded my send_pgp_mime module to the project.
W. Trevor King [Wed, 15 Jul 2009 13:37:52 +0000 (09:37 -0400)]
Added my send_pgp_mime module to the project.

This is a bit of a shameless plug, since there's not much motivation
for encrypting bug emails.  However, I've already written it, and it
does send emails, so I'm using it ;).  Perhaps some company will want
to keep the bug submitter's contact information securely in a BE
database.  Anyhow, there's very little reason to _not_ use PGP, and
the module certainly doesn't force you to encrypt anything. ;)

15 years agoDon't install xml tools (e.g. be-xml-to-mbox, cattmutt, ...).
W. Trevor King [Wed, 15 Jul 2009 13:32:35 +0000 (09:32 -0400)]
Don't install xml tools (e.g. be-xml-to-mbox, cattmutt, ...).

There are lots of interfaces.  They should each have seperate
installation targets, to allow the user to pick only the interfaces
they expect to use.

15 years agoAdded be-handle-mail and some example emails.
W. Trevor King [Tue, 14 Jul 2009 21:10:51 +0000 (17:10 -0400)]
Added be-handle-mail and some example emails.

So far, it parses the emails and executes the specified task.

Todo: email the sender back with the output/errors/exit-status/etc.

15 years agoAdded --author and --alt-id to "be comment".
W. Trevor King [Tue, 14 Jul 2009 21:09:32 +0000 (17:09 -0400)]
Added --author and --alt-id to "be comment".

You could already add this info via the --xml input, now you can do it
from the command line too.

15 years agoRemoved xml.sax cruft from be-mbox-to-xml
W. Trevor King [Tue, 14 Jul 2009 20:04:19 +0000 (16:04 -0400)]
Removed xml.sax cruft from be-mbox-to-xml

15 years agoAdded _procmailrc file for interactive email handling.
W. Trevor King [Tue, 14 Jul 2009 19:49:58 +0000 (15:49 -0400)]
Added _procmailrc file for interactive email handling.

The beginnings of an interactive email interface to BE.

With a working procmail setup, copying _procmailrc to ~/.procmailrc
should sort through incoming email to that user, passing all messages
with subjects starting with [be-mail] on to the script be-handle-mail
and deleting the rest.

Now I just need to write be-handle-mail ;).

15 years agoMerged directory reorganization
W. Trevor King [Tue, 14 Jul 2009 19:27:32 +0000 (15:27 -0400)]
Merged directory reorganization

15 years agolibbe/_version.py made PHONY in Makefile.
W. Trevor King [Tue, 14 Jul 2009 19:25:44 +0000 (15:25 -0400)]
libbe/_version.py made PHONY in Makefile.

It should be updated after bzr commits, but Makefile doesn't
understand bzr, so just update every time.

15 years agoUpdated Makefile to match new organization
W. Trevor King [Tue, 14 Jul 2009 19:24:18 +0000 (15:24 -0400)]
Updated Makefile to match new organization

15 years agoReorganized directory structure, mostly to put all the interfaces in
W. Trevor King [Tue, 14 Jul 2009 19:18:07 +0000 (15:18 -0400)]
Reorganized directory structure, mostly to put all the interfaces in
one place and make things clearer to the uninitiated.  Here's my
current understanding:

.
|-- libbe          (the guts of BE)
|-- becommands     (plugins for all "be *" commands)
|-- doc            (documentation, currently just the man page)
|-- interfaces     (non-commandline interface implementations)
|   |-- web
|   |   |-- Bugs-Everywhere-Web    (in Turbogears)
|   |-- gui
|   |   |-- beg    (in Tkinter)
|   |   `-- wxbe   (in WX)
|   |-- email
|   `-- xml        (xml <-> whatever conversion)
`-- misc           (random odds and ends)
    `-- completion (shell completion scripts)

Note that I haven't attempted to use the web or gui interfaces in a
while, so I'm not sure how well they're holding vs the core
development.

15 years agoUpdated README to match current status.
W. Trevor King [Tue, 14 Jul 2009 18:34:40 +0000 (14:34 -0400)]
Updated README to match current status.

Mostly updated the list of supported VCSs.

Also corrected spacing inconsistency in README.dev.

15 years agoUpdated GPLv2 to current GPLv2.
W. Trevor King [Tue, 14 Jul 2009 12:13:47 +0000 (08:13 -0400)]
Updated GPLv2 to current GPLv2.

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.