Added `be list --sort *` for user-selectable sorting.
authorW. Trevor King <wking@drexel.edu>
Mon, 22 Jun 2009 20:27:46 +0000 (16:27 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 22 Jun 2009 20:27:46 +0000 (16:27 -0400)
Also added libbe.bug.cmp_last_modified, which handles part of
9ce2f015-8ea0-43a5-a03d-fc36f6d202fe.  To do better we could extend
the RCS framework.

I also transcribed a few emails from the be-devel list onto their
relavent bugs and closed a few bugs.

Finally, I removed some left over InvalidValue cruft.

30 files changed:
.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/body [new file with mode: 0644]
.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/72dab0c4-f04d-4ff0-9319-f55aafaea627/values [new file with mode: 0644]
.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/body [new file with mode: 0644]
.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/comments/c454aa67-ca30-43e8-9be4-58cbddd01b63/values [new file with mode: 0644]
.be/bugs/576e804a-8b76-4876-8e9d-d7a72b0aef10/values
.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/body [new file with mode: 0644]
.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/3e7144eb-c934-4b62-94b7-7dbfa90ed6ee/values [new file with mode: 0644]
.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/comments/7d7e703f-22f2-4c47-86a3-fcc3c8ead576/values
.be/bugs/8e948522-c6a1-4c97-af93-2cf4090f44b5/values
.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/body [new file with mode: 0644]
.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/095ade7c-9378-41bd-8137-f2731c6afcac/values [new file with mode: 0644]
.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/body [new file with mode: 0644]
.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/comments/d81d0df9-e6d9-4fe8-8dbe-989ef2c81f00/values [new file with mode: 0644]
.be/bugs/9ce2f015-8ea0-43a5-a03d-fc36f6d202fe/values
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/body [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/22348320-40d3-422c-bdf0-0f6a6bde3fab/values [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/body [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/354dcfc6-5997-4ffe-b7a0-baa852213539/values [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/body [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/c129067c-2341-4e7a-92a6-2dcd30d3bbf5/values [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/body [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/comments/f847c981-873e-41ae-b5ce-83dfe60b9afe/values [new file with mode: 0644]
.be/bugs/c76d7899-d495-4103-9355-012c0a6fece3/values
.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/body [new file with mode: 0644]
.be/bugs/cf56e648-3b09-4131-8847-02dff12b4db2/comments/0e5fab2a-66eb-4f7d-979f-b50181f604d4/values [new file with mode: 0644]
becommands/comment.py
becommands/list.py
becommands/set.py
libbe/bug.py
libbe/bugdir.py

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 (file)
index 0000000..fd86659
--- /dev/null
@@ -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 (file)
index 0000000..3a2ebfb
--- /dev/null
@@ -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 (file)
index 0000000..f673cc5
--- /dev/null
@@ -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 (file)
index 0000000..1456cca
--- /dev/null
@@ -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
+
index 7d5bb11604f8e06a6f3b060a0ce49372913d539c..16906f1feed5bf7e7cad2100bf049e42fd116027 100644 (file)
@@ -4,7 +4,7 @@ creator: abentley
 severity: minor
 
 
-status: open
+status: closed
 
 
 summary: Allow attachments
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 (file)
index 0000000..635893b
--- /dev/null
@@ -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 (file)
index 0000000..cebf3cf
--- /dev/null
@@ -0,0 +1,8 @@
+Content-type: text/plain
+
+
+Date: Mon, 22 Jun 2009 19:46:45 +0000
+
+
+From: W. Trevor King <wking@drexel.edu>
+
index 6f59e9c75229674c6b51174ea18ec7ccb47b2b7f..560e158497c7ea3550b72857b58b3faef8d30492 100644 (file)
@@ -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>
 
index b8279019d1d4c56a342f0430967ea42b01144f6c..391d092d14e60e7b6782067e288222b4cb379cf7 100644 (file)
@@ -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 (file)
index 0000000..bfb1037
--- /dev/null
@@ -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 (file)
index 0000000..7ba64d0
--- /dev/null
@@ -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/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 (file)
index 0000000..5e3ef6b
--- /dev/null
@@ -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 (file)
index 0000000..2355aa5
--- /dev/null
@@ -0,0 +1,8 @@
+Content-type: text/plain
+
+
+Date: Mon, 22 Jun 2009 19:43:21 +0000
+
+
+From: W. Trevor King <wking@drexel.edu>
+
index 0292ab5ef503e76475ba67c7ca57fbb5ad00b1b0..a4d67fd04ec257cbfd96398a9b918227d18a5940 100644 (file)
@@ -1,35 +1,14 @@
+creator: abentley
 
 
+severity: minor
 
-creator=abentley
 
+status: open
 
 
+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 (file)
index 0000000..2767d69
--- /dev/null
@@ -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 (file)
index 0000000..bfc4ff7
--- /dev/null
@@ -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 (file)
index 0000000..7fcd766
--- /dev/null
@@ -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 (file)
index 0000000..bc3434d
--- /dev/null
@@ -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 (file)
index 0000000..04a97cd
--- /dev/null
@@ -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 (file)
index 0000000..172a87c
--- /dev/null
@@ -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 (file)
index 0000000..cc02836
--- /dev/null
@@ -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 (file)
index 0000000..0ecd143
--- /dev/null
@@ -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
+
index a81bcc9dedc49f1ed88e06a09a359fdaafedd3d3..d000d2e48d0e7d07a4ad593e050c6ccd5dedcc30 100644 (file)
@@ -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 (file)
index 0000000..89d64c5
--- /dev/null
@@ -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 (file)
index 0000000..e8c9da6
--- /dev/null
@@ -0,0 +1,8 @@
+Content-type: text/plain
+
+
+Date: Mon, 22 Jun 2009 19:48:44 +0000
+
+
+From: W. Trevor King <wking@drexel.edu>
+
index 29e9f88c0aeb9ef021f71c7b56ebd197b0a5dfdd..f7459ddf14ad2962b9b8fd1fd81b05e75d6000ef 100644 (file)
@@ -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="""
index 9f4e037375c4ed5e67aad3cfebaa24d090026743..1f06569a1c83f612faa3cc6be3bef1f5f76d3a2a 100644 (file)
@@ -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"),
index b8a125e6040562a17d070d3b4a7f064451d98188..c8bbe4f19311c8b5a5e673746055a1471c81b718 100644 (file)
@@ -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()
index 8c095c5c5d2976c04f7215601db13e6d20818d14..43974dd9d72a7ac03e677fab46d095cb08d0e25c 100644 (file)
@@ -276,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)
@@ -466,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()
index 788522497f26404982268286e8967c012e63bcd4..a9ec42e354ae0990cc2e13fec9c34621e1d7de05 100644 (file)
@@ -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.  "