aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-05 03:53:26 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-05 03:53:26 -0500
commit06f4869e74ed800156fb4c46116741a17fc04ef1 (patch)
treebfb223478b3a20e522c9c1d5ffa488f510074b91
parentf7f0d9c959aee752298fdfe7a73939cf4c09fda5 (diff)
downloadbugseverywhere-06f4869e74ed800156fb4c46116741a17fc04ef1.tar.gz
Added BUGDIR_TYPE_MOD and BUGDIR_TYPE_REM to libbe.diff.
Now you can subscribe to only hear about modified bugs or only about removed bugs. Kindof odd for a general subscription, but possibly useful as an argument to the upcoming `be diff --subscribe`, e.g. be diff --subscribe DIR:mod which would replace the old be diff --modified
-rw-r--r--libbe/diff.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/libbe/diff.py b/libbe/diff.py
index 73db13d..3122fe8 100644
--- a/libbe/diff.py
+++ b/libbe/diff.py
@@ -48,7 +48,10 @@ class SubscriptionType (tree.Tree):
BUGDIR_ID = "DIR"
BUGDIR_TYPE_NEW = SubscriptionType("new")
-BUGDIR_TYPE_ALL = SubscriptionType("all", [BUGDIR_TYPE_NEW])
+BUGDIR_TYPE_MOD = SubscriptionType("mod")
+BUGDIR_TYPE_REM = SubscriptionType("rem")
+BUGDIR_TYPE_ALL = SubscriptionType("all",
+ [BUGDIR_TYPE_NEW, BUGDIR_TYPE_MOD, BUGDIR_TYPE_REM])
# same name as BUGDIR_TYPE_ALL for consistency
BUG_TYPE_ALL = SubscriptionType(str(BUGDIR_TYPE_ALL))
@@ -296,12 +299,16 @@ class Diff (object):
(old_bug,new_bug) pairs.
"""
bugdir_types = [s.type for s in subscriptions if s.id == BUGDIR_ID]
- if BUGDIR_TYPE_ALL in bugdir_types:
- new_uuids = list(self.new_bugdir.uuids())
- old_uuids = list(self.old_bugdir.uuids())
- elif BUGDIR_TYPE_NEW in bugdir_types:
- new_uuids = list(self.new_bugdir.uuids())
- old_uuids = []
+ new_uuids = []
+ old_uuids = []
+ for bd_type in [BUGDIR_TYPE_ALL, BUGDIR_TYPE_NEW, BUGDIR_TYPE_MOD]:
+ if bd_type in bugdir_types:
+ new_uuids = list(self.new_bugdir.uuids())
+ break
+ for bd_type in [BUGDIR_TYPE_ALL, BUGDIR_TYPE_REM]:
+ if bd_type in bugdir_types:
+ old_uuids = list(self.old_bugdir.uuids())
+ break
subscribed_bugs = [s.id for s in subscriptions
if BUG_TYPE_ALL.has_descendant( \
s.type, match_self=True)]
@@ -319,9 +326,13 @@ class Diff (object):
try:
old_bug = self.old_bugdir.bug_from_uuid(uuid)
except KeyError:
- added.append(new_bug)
+ if BUGDIR_TYPE_ALL in bugdir_types \
+ or BUGDIR_TYPE_NEW in bugdir_types \
+ or uuid in subscribed_bugs:
+ added.append(new_bug)
continue
if BUGDIR_TYPE_ALL in bugdir_types \
+ or BUGDIR_TYPE_MOD in bugdir_types \
or uuid in subscribed_bugs:
if old_bug.sync_with_disk == True:
old_bug.load_comments()