diff options
55 files changed, 816 insertions, 214 deletions
diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/6010e186-0260-44e5-8442-8df2269910ce/values b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/6010e186-0260-44e5-8442-8df2269910ce/values index d3cc779..b778afb 100644 --- a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/6010e186-0260-44e5-8442-8df2269910ce/values +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/6010e186-0260-44e5-8442-8df2269910ce/values @@ -1,21 +1,8 @@ +Content-type: text/plain - -Content-type=text/plain - - - - - - -Date=Mon, 17 Apr 2006 20:59:15 +0000 - - - - - - -From=abentley +Date: Mon, 17 Apr 2006 20:59:15 +0000 +From: abentley diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body new file mode 100644 index 0000000..4ac7a33 --- /dev/null +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body @@ -0,0 +1,3 @@ +This could be implemented with an external frontend storing the +dependency data in arbitrary tags. + diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values new file mode 100644 index 0000000..f6daae2 --- /dev/null +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 21:29:13 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/body b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/body new file mode 100644 index 0000000..b68090a --- /dev/null +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/body @@ -0,0 +1 @@ +Merged into bug 7ec2c071-9630-42b0-b08a-9854616f9144
\ No newline at end of file diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/values b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/values new file mode 100644 index 0000000..2425f4f --- /dev/null +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/comments/c531727a-9d0f-486f-aa0e-d4d2f2236640/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 21:29:33 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/values b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/values index ff42413..2afafb8 100644 --- a/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/values +++ b/.be/bugs/17921fbc-e7f0-4f31-8cdd-598e5ba7237b/values @@ -1,35 +1,14 @@ +creator: abentley +severity: minor -creator=abentley +status: closed +summary: Indicate bug dependencies - -severity=minor - - - - - - -status=open - - - - - - -summary=Indicate bug dependencies - - - - - - -time=Wed, 04 Jan 2006 21:05:37 +0000 - - +time: Wed, 04 Jan 2006 21:05:37 +0000 diff --git a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/body b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/body new file mode 100644 index 0000000..fd86659 --- /dev/null +++ b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/body @@ -0,0 +1 @@ +<html><head></head><body>Hello world</body></html> diff --git a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/values b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/values new file mode 100644 index 0000000..3a2ebfb --- /dev/null +++ b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/values @@ -0,0 +1,11 @@ +Content-type: text/html + + +Date: Mon, 22 Jun 2009 20:05:00 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: c454aa67-ca30-43e8-9be4-58cbddd01b63 + diff --git a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/body b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/body new file mode 100644 index 0000000..f673cc5 --- /dev/null +++ b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/body @@ -0,0 +1,30 @@ +Excerpt from my mail to the list on Sat, 20 Jun 2009 21:55:54 -0400: + +On Mon, Nov 24, 2008 at 07:15:08PM -0500, Aaron Bentley wrote: +> 576:om: Allow attachments +> Sensible. + +I'm not as convinced they are a good idea as I once was. I've just +added comments-from-stdin, e.g. + some-invalid-command | be comment <bug-id> - +Which is mostly what I'd be using attachments for anyway. If you +really want to support the attachments/mime-types etc. like we had +maybe been leaning towards before, you'd need to look at the output of +`be show ...' with an email client, which seems a bit excessive. Do +we even want mime types at all? With the xml output a la Thomas, you +should be able to pipe into whatever sort of `viewer' you want, and it +doesn't end up being hardcoded into the main repo. + + +Notes since my email: + +be->xml->mutt has since been implemented, and it preserves comment +mime-type. This allows those that want to go crazy to attach whatever +they want to their comments: + + $ echo "<html><head></head><body>Hello world</body></html>" | be comment --content-type text/html 576:2 - + +I think non-text attachments without a browser/mail-viewer don't make +sense, so I'm closing this bug. Feel free to keep it open in your own +repo, or argue with me on the list ;). + diff --git a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/values b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/values new file mode 100644 index 0000000..1456cca --- /dev/null +++ b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:03:27 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: d83a5436-85e3-42c7-9a89-a6d50df9d279 + diff --git a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/values b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/values index 7d5bb11..16906f1 100644 --- a/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/values +++ b/.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/values @@ -4,7 +4,7 @@ creator: abentley severity: minor -status: open +status: closed summary: Allow attachments diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/body new file mode 100644 index 0000000..6ad8230 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/body @@ -0,0 +1,39 @@ +In my Tue, 25 Nov 2008 08:30:19 -0500 email: + +Implemented as a free-form value field similar to target? A +comma-seperated list of tags? Perhaps once we have per-bug/comment +attribute searching it would be easier to have a 'create-attribute' +becommand, e.g. + be create-attribute [-valid=X,Y,Z] [bugdir|bug|comment] [NAME] [DEFAULT] + +We could ship some suggested configuration scripts to set people up, +and keep the core code more general/flexible. + + +Plan: + +Extend and make more consitent the settings_property() attributes. +Create becommand/(create/remove)-attribute for logic-less attributes. +Create a few mix-ins for logic-ed attributes + +Usage example: + Goal: + set up for `be depends BUGA BUGB`, `be depends --tree BUGA`, etc + Procedure: + be set --apend mixins bug:dependency + Where we've defined + becommands/depends.py, but it is hidden until the mixin is activated + libbe/mixins/bug/dependency.Mixin (inheriting from BugMixin) + to + parse/generate comma seperated dependency uuids for saving/loading + pretty-print the dependency list (e.g. uuid->shortname) + walk the dependency tree and check target bug status. + +With more complicated mixins, there could be inter-mixin dependencies, +e.g. a dependency tracker that searches depends based on bug.status +might depend on the base dependency mixin. This way people who need +it could make rich interfaces without confusing the people who don't. + +How does that sound? + + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/values new file mode 100644 index 0000000..4d945d0 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/401950a0-a5ff-46f3-afac-a9cfb300f94b/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:39:39 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/body new file mode 100644 index 0000000..33638ab --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/body @@ -0,0 +1,5 @@ +It's tricky to say whether we should have dependencies or reverse dependencies +or both. + +In the case where a bug is removed, normal dependencies mean that its +dependencies are erased from this system. diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/values new file mode 100644 index 0000000..98b7985 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/6010e186-0260-44e5-8442-8df2269910ce/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 17 Apr 2006 20:59:15 +0000 + + +From: abentley + + +In-reply-to: f87fd684-6af1-498d-98d5-f915bcee76a9 + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/body new file mode 100644 index 0000000..57439b7 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/body @@ -0,0 +1,47 @@ +From my Tue, 25 Nov 2008 13:27:12 -0500 email: + +> >> 7ec:om: Arbitrary tags +> >> Sensible +> > +> > Implemented as a free-form value field similar to target? A +> > comma-seperated list of tags? +> + +That is a much better format than my unmergable one ;). + +> "append" usually has two "p"s. Is the omission deliberate? + +Nope, sorry :p + +> It sounds pretty complicated. I would probably use a type system rather +> than "mixins", and define types as "scalar", "set" and maybe "list" and +> "map". Dependencies would be a set, and their special behaviour would +> be hardcoded according to their name, not a property of their type. + +Ok. I'm just worried about bloat. It's pretty easy to move things +around at the moment, but I'm worried that adding lots of attributes +with special code will start a slippery slope of trying to satisfy +everybody internally. Then things start looking more like Arch, with +newbies scared off by the confusion. I know the Arch people like the +power, but it took me several hours to figure out how to create a +repository ;). Some people like bug dependencies, and some do not + e.g. + https://bugs.launchpad.net/malone/+bug/95419 + http://trac.edgewall.org/ticket/31 + +From the *long* Trac post, you can see that this is divisive issue. + +I would be in favor of emulating TracCrossReferences +(http://trac.edgewall.org/wiki/TracCrossReferences) in our core. We +could have references and backlinks fields for bugs (and comments?). +But I'd rather not add blocking, etc. However, having a seperate +plugin obviously doesn't work for some people ;). We'd like to bundle +lots of functionality, but keep the core fairly clean and flexible. + +Therefore, I'd like a way to put non-core implememtation code in a +seperate submod. We already call our libbe code "plugins", and we're +extending the builtin BugDir, Bug, etc code, so I thought we'd call +the non-core submods mixins (see http://en.wikipedia.org/wiki/Mixin). + +Anyhow, just my 2c. + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/values new file mode 100644 index 0000000..3754f28 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/bb988ed4-d3d5-4e49-b67e-c7ccb8ae44d3/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:42:12 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: ec133a4e-c9ff-4499-b469-cb0a2ca9a685 + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body new file mode 100644 index 0000000..4ac7a33 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/body @@ -0,0 +1,3 @@ +This could be implemented with an external frontend storing the +dependency data in arbitrary tags. + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values new file mode 100644 index 0000000..11fb7b0 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/c2b78df3-641a-4d4d-ba94-33b26eda6364/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 21:29:13 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: f87fd684-6af1-498d-98d5-f915bcee76a9 + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/body new file mode 100644 index 0000000..a06e236 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/body @@ -0,0 +1,55 @@ +In Aaron's Tue, 25 Nov 2008 09:32:29 -0500 email: + +>> 7ec:om: Arbitrary tags +>> Sensible +> +> Implemented as a free-form value field similar to target? A +> comma-seperated list of tags? + +I believe I planned to store it as an alpha-sorted, one-entry-per-line +list, so it would support merging easily. + +> Perhaps once we have per-bug/comment +> attribute searching it would be easier to have a 'create-attribute' +> becommand, e.g. +> be create-attribute [-valid=X,Y,Z] [bugdir|bug|comment] [NAME] [DEFAULT] + +Well, it really depends how much semantics you want to embed in the data +format. Some values are scalars, some may be sets (i.e. tags), some may +be ordered lists or even mappings. How much you want to reflect that in +the data format is up to you. + +> Extend and make more consitent the settings_property() attributes. +> Create becommand/(create/remove)-attribute for logic-less attributes. +> Create a few mix-ins for logic-ed attributes + +I don't find the term mix-in very intuitive here. + +> Usage example: +> Goal: +> set up for `be depends BUGA BUGB`, `be depends --tree BUGA`, etc +> Procedure: +> be set --apend mixins bug:dependency + +"append" usually has two "p"s. Is the omission deliberate? + +> Where we've defined +> becommands/depends.py, but it is hidden until the mixin is activated +> libbe/mixins/bug/dependency.Mixin (inheriting from BugMixin) +> to +> parse/generate comma seperated dependency uuids for saving/loading +> pretty-print the dependency list (e.g. uuid->shortname) +> walk the dependency tree and check target bug status. +> +> With more complicated mixins, there could be inter-mixin dependencies, +> e.g. a dependency tracker that searches depends based on bug.status +> might depend on the base dependency mixin. This way people who need +> it could make rich interfaces without confusing the people who don't. +> +> How does that sound? + +It sounds pretty complicated. I would probably use a type system rather +than "mixins", and define types as "scalar", "set" and maybe "list" and +"map". Dependencies would be a set, and their special behaviour would +be hardcoded according to their name, not a property of their type. + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/values new file mode 100644 index 0000000..9078dd6 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/ec133a4e-c9ff-4499-b469-cb0a2ca9a685/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:40:54 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: 401950a0-a5ff-46f3-afac-a9cfb300f94b + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/body b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/body new file mode 100644 index 0000000..a28cfe4 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/body @@ -0,0 +1 @@ +Merged from bug 17921fbc-e7f0-4f31-8cdd-598e5ba7237b
\ No newline at end of file diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/values new file mode 100644 index 0000000..0465a85 --- /dev/null +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/comments/f87fd684-6af1-498d-98d5-f915bcee76a9/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 21:29:32 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/values b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/values index 355e32e..07811f7 100644 --- a/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/values +++ b/.be/bugs/7ec2c071-9630-42b0-b08a-9854616f9144/values @@ -1,35 +1,14 @@ +creator: abentley +severity: minor -creator=abentley +status: open +summary: Arbitrary tags - -severity=minor - - - - - - -status=open - - - - - - -summary=Arbitrary tags - - - - - - -time=Wed, 04 Jan 2006 21:06:38 +0000 - - +time: Wed, 04 Jan 2006 21:06:38 +0000 diff --git a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/body b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/body new file mode 100644 index 0000000..635893b --- /dev/null +++ b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/body @@ -0,0 +1,4 @@ +From Aaron's Mon, 24 Nov 2008 19:15:09 -0500 email: + +8e9:om: list X most recent entries +Closeable. (And yes, I would do it instead of 'be diff') diff --git a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/values b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/values new file mode 100644 index 0000000..cebf3cf --- /dev/null +++ b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 19:46:45 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/7d7e703f-22f2-4c47-86a3-fcc3c8ead576/values b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/7d7e703f-22f2-4c47-86a3-fcc3c8ead576/values index 6f59e9c..560e158 100644 --- a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/7d7e703f-22f2-4c47-86a3-fcc3c8ead576/values +++ b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/7d7e703f-22f2-4c47-86a3-fcc3c8ead576/values @@ -1,21 +1,8 @@ +Content-type: text/plain - -Content-type=text/plain - - - - - - -Date=Mon, 24 Nov 2008 13:10:38 +0000 - - - - - - -From=W. Trevor King <wking@drexel.edu> +Date: Mon, 24 Nov 2008 13:10:38 +0000 +From: W. Trevor King <wking@drexel.edu> diff --git a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/values b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/values index b827901..391d092 100644 --- a/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/values +++ b/.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/values @@ -1,35 +1,14 @@ +creator: abentley +severity: minor -creator=abentley +status: closed +summary: list X most recent entries - -severity=minor - - - - - - -status=open - - - - - - -summary=list X most recent entries - - - - - - -time=Wed, 25 Jan 2006 15:44:18 +0000 - - +time: Wed, 25 Jan 2006 15:44:18 +0000 diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/body b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/body new file mode 100644 index 0000000..bfb1037 --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/body @@ -0,0 +1,19 @@ +Presumably this would be to allow sorting of bugs by last-modified +date instead of by creation date. With the xml output, this is no +longer needed. For example, I view bugs in mutt with + $ be list | xml/be-xml-to-mbox | xml/catmutt +and use mutt to sort the threads by last-modified, e.g. by adding + set sort=threads + set sort_aux=last-date +to my ~/.muttrc. + +That being said, I could go for a user-specified sort command in +becommands/list.py, rather than the current bug.cmp_full, since other +mail readers may suck more than mutt ;), and even mutt might not have +that perfect sort you desire coded into it :p. The problem is that +while the cmp_* functions in bug are short, they are not really the +sort of thing you'd want to type in on the command line. Perhaps we +can just slowly accumulate a rich array of bug.cmp_* functions as +they are requested, and allow the user to prepend their favorites to +the default cmp_full list... + diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/values b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/values new file mode 100644 index 0000000..7ba64d0 --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 18:40:43 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/body b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/body new file mode 100644 index 0000000..777975d --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/body @@ -0,0 +1,17 @@ +No need for RCS-expansion for the history. If the user is versioning +their code with some RCS, they presumably know how to use the RCS to +investigate the history already. The .be/ directory structure is not +so complicated that it's worth much work to avoid their having to peer +inside it by hand. + +In rare cases where people really do want to peer into history using +only BE or sort by e.g. bug closing time, they could add those +comments by hand, e.g. + $ echo 'bug closed' | be comment <bug> - + $ be close <bug> +So the already-implemented cmp_last_modified would handle it. + +If you want, you could add (optional) comment-generation to the +becommands themselves. For example becommand/merge.py already does +this. + diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/values b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/values new file mode 100644 index 0000000..47ac983 --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/4be35966-373b-438c-a35a-824f5c7a940a/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 21:12:00 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00 + diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/body b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/body new file mode 100644 index 0000000..5e3ef6b --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/body @@ -0,0 +1,9 @@ +User specfied sort added, along with bug.cmp_last_modified. + +Hmm, perhaps you don't want the last comment date, but e.g. the last +time one of the bug attributes are changed. In that case, I suggest + bzr log .be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/ + +Maybe log(file) functionality should be incorperated into libbe/rcs... +Perhaps accessed through a --history. I'm not sure I remember enough +Arch to do that ;). diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/values b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/values new file mode 100644 index 0000000..2355aa5 --- /dev/null +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 19:43:21 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/values b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/values index 0292ab5..f124ccb 100644 --- a/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/values +++ b/.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/values @@ -1,35 +1,14 @@ +creator: abentley +severity: minor -creator=abentley +status: closed +summary: Add last-modified field to bugs - -severity=minor - - - - - - -status=open - - - - - - -summary=Add last-modified field to bugs - - - - - - -time=Thu, 14 Sep 2006 18:08:53 +0000 - - +time: Thu, 14 Sep 2006 18:08:53 +0000 diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/body b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/body new file mode 100644 index 0000000..2767d69 --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/body @@ -0,0 +1,6 @@ +In my Tue, 25 Nov 2008 08:30:19 -0500 email: + +I thought feature requests would just have "wishlist" severity. What +would be an example of a to-do item that is not a feature request or a +bug? + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/values b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/values new file mode 100644 index 0000000..bfc4ff7 --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:12:35 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: 354dcfc6-5997-4ffe-b7a0-baa852213539 + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/body b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/body new file mode 100644 index 0000000..7fcd766 --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/body @@ -0,0 +1,7 @@ +In Aaron's Mon, 24 Nov 2008 19:15:08 -0500 email, he adds: + +Issue trackers should provide tracking of +1. bugs +2. feature requests +3. to-do items. + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/values b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/values new file mode 100644 index 0000000..bc3434d --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:11:02 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/body b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/body new file mode 100644 index 0000000..04a97cd --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/body @@ -0,0 +1,14 @@ +If you want more granularity than just `wishlist' what about the +`severities': + todo-critical + todo-minor + todo-... +Then get a list of available severities with + $ be list --help | grep -A1 '^severity' + severity + wishlist,minor,serious,critical,fatal,todo-critical,todo-minor +And show all the todos: + $ be list --severity todo-critical,todo-minor + +You can configure all the severities you'd like with + $ be set severity wishlist,minor,... diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/values b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/values new file mode 100644 index 0000000..172a87c --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:20:39 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: f847c981-873e-41ae-b5ce-83dfe60b9afe + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/body b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/body new file mode 100644 index 0000000..cc02836 --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/body @@ -0,0 +1,10 @@ +In Aaron's Tue, 25 Nov 2008 09:32:29 -0500 email: + +I think that approach doesn't give features the richness they need. +Features also have severities-- some features are important, and others +are just nice-to-have. And there should be a way to list *only* bugs, +or *only* features. + +In a bug tracker, "wishlist" is either an aberration, or it means a very +low severity. + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/values b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/values new file mode 100644 index 0000000..0ecd143 --- /dev/null +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 20:14:26 +0000 + + +From: W. Trevor King <wking@drexel.edu> + + +In-reply-to: 22348320-40d3-422c-bdf0-0f6a6bde3fab + diff --git a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/values b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/values index a81bcc9..d000d2e 100644 --- a/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/values +++ b/.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/values @@ -1,35 +1,14 @@ +creator: abentley +severity: minor -creator=abentley +status: closed +summary: Support 'issues', like todo, better - -severity=minor - - - - - - -status=open - - - - - - -summary=Support 'issues', like todo, better - - - - - - -time=Wed, 04 Jan 2006 21:09:02 +0000 - - +time: Wed, 04 Jan 2006 21:09:02 +0000 diff --git a/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/body b/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/body new file mode 100644 index 0000000..89d64c5 --- /dev/null +++ b/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/body @@ -0,0 +1,8 @@ +From Aaron's Mon, 24 Nov 2008 19:15:09 -0500 email + +cf5:oc: OK, maybe not fatal, but how about a new name that suggests +process tracking, not just bugs? + +If you can come with a better name, that would be great. But naming an +issue tracker for its bug-tracking features isn't a terrible idea. + diff --git a/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/values b/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/values new file mode 100644 index 0000000..e8c9da6 --- /dev/null +++ b/.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 22 Jun 2009 19:48:44 +0000 + + +From: W. Trevor King <wking@drexel.edu> + diff --git a/becommands/comment.py b/becommands/comment.py index 29e9f88..f7459dd 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -102,10 +102,14 @@ def execute(args, test=False): body+='\n' comment = parent.new_reply(body=body) + if options.content_type != None: + comment.content_type = options.content_type bd.save() def get_parser(): parser = cmdutil.CmdOptionParser("be comment ID [COMMENT]") + parser.add_option("-c", "--content-type", metavar="MIME", dest="content_type", + help="Set comment content-type (e.g. text/plain)", default=None) return parser longhelp=""" diff --git a/becommands/list.py b/becommands/list.py index 9f4e037..1f06569 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -19,6 +19,10 @@ from libbe import cmdutil, bugdir, bug import os __desc__ = __doc__ +# get a list of * for cmp_*() comparing two bugs. +AVAILABLE_CMPS = [fn[4:] for fn in dir(bug) if fn[:4] == 'cmp_'] +AVAILABLE_CMPS.remove("attr") # a cmp_* template. + def execute(args, test=False): """ >>> import os @@ -35,6 +39,13 @@ def execute(args, test=False): complete(options, args, parser) if len(args) > 0: raise cmdutil.UsageError("Too many arguments.") + cmp_list = [] + if options.sort_by != None: + for cmp in options.sort_by.split(','): + if cmp not in AVAILABLE_CMPS: + raise cmdutil.UserError("Invalid sort on '%s'.\nValid sorts:\n %s" + % (cmp, '\n '.join(AVAILABLE_CMPS))) + cmp_list.append(eval('bug.cmp_%s' % cmp)) bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) bd.load_all_bugs() @@ -115,7 +126,6 @@ def execute(args, test=False): print "No matching bugs found" def list_bugs(cur_bugs, title=None, just_uuids=False, xml=False): - cur_bugs.sort(bug.cmp_full) if xml == True: print "<bugs>" if len(cur_bugs) > 0: @@ -130,7 +140,13 @@ def execute(args, test=False): print bg.string(shortlist=True) if xml == True: print "</bugs>" - + + # sort bugs + cmp_list.extend(bug.DEFAULT_CMP_FULL_CMP_LIST) + cmp_fn = bug.BugCompoundComparator(cmp_list=cmp_list) + bugs.sort(cmp_fn) + + # print list of bugs list_bugs(bugs, just_uuids=options.uuids, xml=options.xml) def get_parser(): @@ -143,6 +159,8 @@ def get_parser(): help="List options matching ASSIGNED", default=None) parser.add_option("-t", "--target", metavar="TARGET", dest="target", help="List options matching TARGET", default=None) + parser.add_option("-S", "--sort", metavar="SORT-BY", dest="sort_by", + help="Adjust bug-sort criteria with comma-separated list SORT-BY. e.g. \"--sort creator,time\". Available criteria: %s" % ','.join(AVAILABLE_CMPS), default=None) # boolean options. All but uuids and xml are special cases of long forms bools = (("u", "uuids", "Only print the bug UUIDS"), ("w", "wishlist", "List bugs with 'wishlist' severity"), diff --git a/becommands/set.py b/becommands/set.py index b8a125e..c8bbe4f 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -63,12 +63,7 @@ def execute(args, test=False): msg += '\n '.join(bd.settings_properties) raise cmdutil.UserError(msg) old_setting = bd.settings.get(args[0]) - try: - setattr(bd, args[0], args[1]) - except bugdir.InvalidValue, e: - bd.settings[args[0]] = old_setting - bd.save() - raise cmdutil.UserError(e) + setattr(bd, args[0], args[1]) else: del bd.settings[args[0]] bd.save() diff --git a/becommands/show.py b/becommands/show.py index 4b0078f..b33a96b 100644 --- a/becommands/show.py +++ b/becommands/show.py @@ -41,10 +41,7 @@ def execute(args, test=False): <short-name>a</short-name> <severity>minor</severity> <status>open</status> - <assigned><class 'libbe.settings_object.EMPTY'></assigned> - <target><class 'libbe.settings_object.EMPTY'></target> - <reporter><class 'libbe.settings_object.EMPTY'></reporter> - <creator>John Doe <jdoe@example.com></creator> + <creator>John Doe <jdoe@example.com></creator> <created>...</created> <summary>Bug A</summary> </bug> diff --git a/libbe/bug.py b/libbe/bug.py index fe059fa..43974dd 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -18,6 +18,7 @@ import os import os.path import errno import time +import xml.sax.saxutils import doctest from beuuid import uuid_gen @@ -244,9 +245,7 @@ class Bug(settings_object.SavedSettingsObject): if self.time == None: timestring = "" else: - htime = utility.handy_time(self.time) - ftime = utility.time_to_str(self.time) - timestring = "%s (%s)" % (htime, ftime) + timestring = utility.time_to_str(self.time) info = [("uuid", self.uuid), ("short-name", shortname), @@ -260,8 +259,8 @@ class Bug(settings_object.SavedSettingsObject): ("summary", self.summary)] ret = '<bug>\n' for (k,v) in info: - if v is not None: - ret += ' <%s>%s</%s>\n' % (k,v,k) + if v is not settings_object.EMPTY: + ret += ' <%s>%s</%s>\n' % (k,xml.sax.saxutils.escape(v),k) if show_comments == True: comout = self.comment_root.xml_thread(auto_name_map=True, @@ -277,8 +276,8 @@ class Bug(settings_object.SavedSettingsObject): else: shortname = self.bugdir.bug_shortname(self) if shortlist == False: - if self.time_string == "": - timestring = self.time_string + if self.time == None: + timestring = "" else: htime = utility.handy_time(self.time) timestring = "%s (%s)" % (htime, self.time_string) @@ -467,19 +466,37 @@ cmp_assigned = lambda bug_1, bug_2 : cmp_attr(bug_1, bug_2, "assigned") # chronological rankings (newer < older) cmp_time = lambda bug_1, bug_2 : cmp_attr(bug_1, bug_2, "time", invert=True) -def cmp_full(bug_1, bug_2, cmp_list=(cmp_status,cmp_severity,cmp_assigned, - cmp_time,cmp_creator)): - for comparison in cmp_list : - val = comparison(bug_1, bug_2) - if val != 0 : - return val - return 0 - -class InvalidValue(ValueError): - def __init__(self, name, value): - msg = "Cannot assign value %s to %s" % (value, name) - Exception.__init__(self, msg) - self.name = name - self.value = value +DEFAULT_CMP_FULL_CMP_LIST = \ + (cmp_status,cmp_severity,cmp_assigned,cmp_time,cmp_creator) + +class BugCompoundComparator (object): + def __init__(self, cmp_list=DEFAULT_CMP_FULL_CMP_LIST): + self.cmp_list = cmp_list + def __call__(self, bug_1, bug_2): + for comparison in self.cmp_list : + val = comparison(bug_1, bug_2) + if val != 0 : + return val + return 0 + +cmp_full = BugCompoundComparator() + + +# define some bonus cmp_* functions +def cmp_last_modified(bug_1, bug_2): + """ + Like cmp_time(), but use most recent comment instead of bug + creation for the timestamp. + """ + def last_modified(bug): + time = bug.time + for comment in bug.comment_root.traverse(): + if comment.time > time: + time = comment.time + return time + val_1 = last_modified(bug_1) + val_2 = last_modified(bug_2) + return -cmp(val_1, val_2) + suite = doctest.DocTestSuite() diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 7885224..a9ec42e 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -51,13 +51,6 @@ class AlreadyInitialized(Exception): Exception.__init__(self, "Specified root is already initialized: %s" % path) -class InvalidValue(ValueError): - def __init__(self, name, value): - msg = "Cannot assign value %s to %s" % (value, name) - Exception.__init__(self, msg) - self.name = name - self.value = value - class MultipleBugMatches(ValueError): def __init__(self, shortname, matches): msg = ("More than one bug matches %s. " diff --git a/libbe/comment.py b/libbe/comment.py index e5c86c7..80b97a1 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -19,6 +19,7 @@ import os import os.path import time +import xml.sax.saxutils import textwrap import doctest @@ -223,10 +224,11 @@ class Comment(Tree, settings_object.SavedSettingsObject): >>> comm.time_string = "Thu, 01 Jan 1970 00:00:00 +0000" >>> print comm.xml(indent=2, shortname="com-1") <comment> - <name>com-1</name> <uuid>0123</uuid> + <short-name>com-1</short-name> <from></from> <date>Thu, 01 Jan 1970 00:00:00 +0000</date> + <content-type>text/plain</content-type> <body>Some insightful remarks</body> @@ -234,16 +236,18 @@ class Comment(Tree, settings_object.SavedSettingsObject): """ if shortname == None: shortname = self.uuid - lines = ["<comment>", - " <name>%s</name>" % (shortname,), - " <uuid>%s</uuid>" % self.uuid,] - if self.in_reply_to != None: - lines.append(" <in_reply_to>%s</in_reply_to>" % self.in_reply_to) - lines.extend([ - " <from>%s</from>" % self._setting_attr_string("From"), - " <date>%s</date>" % self.time_string, - " <body>%s</body>" % (self.body or "").rstrip('\n'), - "</comment>\n"]) + info = [("uuid", self.uuid), + ("short-name", shortname), + ("in-reply-to", self.in_reply_to), + ("from", self._setting_attr_string("From")), + ("date", self.time_string), + ("content-type", self.content_type), + ("body", (self.body or "").rstrip('\n'))] + lines = ["<comment>"] + for (k,v) in info: + if v not in [settings_object.EMPTY, None]: + lines.append(' <%s>%s</%s>' % (k,xml.sax.saxutils.escape(v),k)) + lines.append("</comment>") istring = ' '*indent sep = '\n' + istring return istring + sep.join(lines).rstrip('\n') diff --git a/xml/be-xml-to-mbox b/xml/be-xml-to-mbox new file mode 100755 index 0000000..7d07bac --- /dev/null +++ b/xml/be-xml-to-mbox @@ -0,0 +1,185 @@ +#!/usr/bin/env python +# Copyright (C) 2009 William Trevor King <wking@drexel.edu> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +""" +Convert xml output of `be list --xml` into mbox format for browsing +with a mail reader. For example + $ be list --xml --status=all | be-xml-to-mbox | catmutt + +mbox is a flat-file format, consisting of a series of messages. +Messages begin with a a From_ line, followed by RFC 822 email, +followed by a blank line. +""" + +#from mailbox import mbox, Message # the mailbox people really want an on-disk copy +import email.utils +import types + +from libbe.encoding import get_encoding, set_IO_stream_encodings +from libbe.utility import str_to_time as rfc2822_to_gmtime_integer +from time import asctime, gmtime +from xml.sax import make_parser +from xml.sax.handler import ContentHandler +from xml.sax.saxutils import unescape + + +DEFAULT_DOMAIN = "invalid.com" +DEFAULT_EMAIL = "dummy@" + DEFAULT_DOMAIN +DEFAULT_ENCODING = get_encoding() +set_IO_stream_encodings(DEFAULT_ENCODING) + +def rfc2822_to_asctime(rfc2822_string): + """Convert an RFC 2822-fomatted string into a asctime string. + >>> rfc2822_to_asctime("Thu, 01 Jan 1970 00:00:00 +0000") + "Thu Jan 01 00:00:00 1970" + """ + if rfc2822_string == "": + return asctime(gmtime(0)) + return asctime(gmtime(rfc2822_to_gmtime_integer(rfc2822_string))) + +class LimitedAttrDict (dict): + """ + Dict with error checking, to avoid invalid bug/comment fields. + """ + _attrs = [] # override with list of valid attribute names + def __init__(self, **kwargs): + dict.__init__(self) + for key,value in kwargs.items(): + self[key] = value + def __setitem__(self, key, item): + self._validate_key(key) + dict.__setitem__(self, key, item) + def _validate_key(self, key): + if key in self._attrs: + return + elif type(key) not in types.StringTypes: + raise TypeError, "Invalid attribute type %s for '%s'" % (type(key), key) + else: + raise ValueError, "Invalid attribute name '%s'" % key + +class Bug (LimitedAttrDict): + _attrs = [u"uuid", + u"short-name", + u"severity", + u"status", + u"assigned", + u"target", + u"reporter", + u"creator", + u"created", + u"summary", + u"comments"] + def print_to_mbox(self): + name,addr = email.utils.parseaddr(self["creator"]) + print "From %s %s" % (addr, rfc2822_to_asctime(self["created"])) + print "Message-ID: <%s@%s>" % (self["uuid"], DEFAULT_DOMAIN) + print "Date: %s" % self["created"] + print "From: %s" % self["creator"] + print "Content-Type: %s; charset=%s" % ("text/plain", DEFAULT_ENCODING) + print "Content-Transfer-Encoding: 8bit" + print "Subject: %s: %s" % (self["short-name"], self["summary"]) + print "" + print self["summary"] + print "" + for comment in self["comments"]: + comment.print_to_mbox(self) + +class Comment (LimitedAttrDict): + _attrs = [u"uuid", + u"short-name", + u"in-reply-to", + u"from", + u"date", + u"content-type", + u"body"] + def print_to_mbox(self, bug): + name,addr = email.utils.parseaddr(self["from"]) + print "From %s %s" % (addr, rfc2822_to_asctime(self["date"])) + print "Message-ID: <%s@%s>" % (self["uuid"], DEFAULT_DOMAIN) + print "Date: %s" % self["date"] + print "From: %s" % self["from"] + print "Content-Type: %s; charset=%s" % (self["content-type"], DEFAULT_ENCODING) + print "Content-Transfer-Encoding: 8bit" + print "Subject: %s: %s" % (self["short-name"], bug["summary"]) + if "in-reply-to" not in self.keys(): + self["in-reply-to"] = bug["uuid"] + print "In-Reply-To: <%s@%s>" % (self["in-reply-to"], DEFAULT_DOMAIN) + print "" + print self["body"] + print "" + +class BE_list_handler (ContentHandler): + def __init__(self): + self.reset() + + def reset(self): + self.bug = None + self.comment = None + self.text_field = None + + def startElement(self, name, attributes): + if name == "bug": + assert self.bug == None, "Nested bugs?!" + assert self.comment == None + assert self.text_field == None + self.bug = Bug(comments=[]) + elif name == "comment": + assert self.bug != None, "<comment> not in <bug>?" + assert self.text_field == None, "<comment> in text field %s?" % self.text_field + self.comment = Comment() + elif self.bug != None and self.comment == None: + # parse bug text field + if name != "comment": + self.text_field = name + self.text_data = "" + elif self.bug != None and self.comment != None: + # parse comment text field + self.text_field = name + self.text_data = "" + + def endElement(self, name): + if name == "bug": + assert self.bug != None, "Invalid XML?" + self.bug.print_to_mbox() + self.bug = None + elif name == "comment": + assert self.bug != None, "<comment> not in <bug>?" + assert self.text_field == None, "<comment> in text field %s?" % self.text_field + assert self.comment != None, "Invalid XML?" + self.bug["comments"].append(self.comment) + # comments printed by bug.print_to_mbox() + self.comment = None + elif self.bug != None and self.comment == None: + # parse bug text field + self.bug[self.text_field] = unescape(self.text_data.strip()) + self.text_field = None + self.text_data = None + elif self.bug != None and self.comment != None: + # parse comment text field + self.comment[self.text_field] = unescape(self.text_data.strip()) + self.text_field = None + self.text_data = None + + def characters(self, data): + if self.text_field != None: + self.text_data += data + +if __name__ == "__main__": + import sys + + parser = make_parser() + parser.setContentHandler(BE_list_handler()) + parser.parse(sys.stdin) diff --git a/xml/catmutt b/xml/catmutt new file mode 100755 index 0000000..601f14f --- /dev/null +++ b/xml/catmutt @@ -0,0 +1,59 @@ +#!/bin/sh + +# catmutt - wrap mutt allowing mboxes read from stdin. +# +# Copyright (C) 1998-1999 Moritz Barsnick <barsnick (at) gmx (dot) net>, +# 2009 William Trevor King <wking (at) drexel (dot) edu> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# developed from grepm-0.6 +# http://www.barsnick.net/sw/grepm.html + +PROGNAME=`basename "$0"` +export TMPDIR="${TMPDIR-/tmp}" # used by mktemp +umask 077 + +if [ $# -gt 0 ] && [ "$1" = "--help" ]; then + echo 1>&2 "Usage: ${PROGNAME} [--help] mutt-arguments" + echo 1>&2 "" + echo 1>&2 "Read a mailbox file from stdin and opens it with mutt." + echo 1>&2 "For example: cat somefile.mbox | ${PROGNAME}" + exit 0 +fi + +# Note: the -t/-p options to mktemp are deprecated for mktemp (GNU +# coreutils) 7.1 in favor of --tmpdir but the --tmpdir option does not +# exist yet for my 6.10-3ubuntu2 coreutils +TMPFILE=`mktemp -t catmutt.XXXXXX` || exit 1 + +trap "rm -f ${TMPFILE}; exit 1" 1 2 3 13 15 + +cat > "${TMPFILE}" || exit 1 + +# Now that we've read in the mailbox file, reopen stdin for mutt/user +# interaction. When in a pipe we're not technically in a tty, so use +# a little hack from "greno" at +# http://www.linuxforums.org/forum/linux-programming-scripting/98607-bash-stdin-problem.html +tty="/dev/`ps -p$$ --no-heading | awk '{print $2}'`" +exec < ${tty} + +if [ `wc -c "${TMPFILE}" | awk '{print $1}'` -gt 0 ]; then + echo 1>&2 "Calling mutt on temporary mailbox file (${TMPFILE})." + mutt -R -f "${TMPFILE}" "$@" +else + echo 1>&2 "Empty mailbox input." +fi + +rm -f "${TMPFILE}" && echo 1>&2 "Deleted temporary mailbox file (${TMPFILE})." |