From 36623c805e092ffa5fc0af12152fa9a6d22647de Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Thu, 27 Mar 2014 14:26:38 +0800 Subject: [PATCH] multiple actions to same package, let's do latter That is, existing + add + remove = removed --- archrepo2/repomon.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/archrepo2/repomon.py b/archrepo2/repomon.py index e134a9c..5b94943 100755 --- a/archrepo2/repomon.py +++ b/archrepo2/repomon.py @@ -198,16 +198,14 @@ class RepoMan: actiondict[act.name] = act else: oldact = actiondict[act.name] - if oldact == act and oldact.action != act.action: - # same package, opposite actions, do nothing - del actiondict[act.name] - else: - # take the later action, but record the former + if oldact != act: + # different packages, do the latter, but record the former try: actiondict[act.name].callback(state=0) except: logger.exception('failed to run action %r.', actiondict[act.name]) - actiondict[act.name] = act + # same package, do the latter, and discard the forter + actiondict[act.name] = act toadd = [(x.path, x.callback) for x in actiondict.values() if x.action == 'add'] toremove = [(x.name, x.callback) for x in actiondict.values() if x.action == 'remove'] self._do_add(toadd)