make btspull take the list of bugs it has to deal with as an argument.
authormadcoder <madcoder>
Tue, 23 May 2006 22:02:08 +0000 (22:02 +0000)
committermadcoder <madcoder>
Tue, 23 May 2006 22:02:08 +0000 (22:02 +0000)
it no longer has to deal with forwards on the command line

bin/btspull-debugrun.sh
bin/btspull-run.sh
btspull
remote/base.py
remote/bugzilla.py

index 3eb69c91f2d8c32e387f07e22dcf90c8e8976d49..5500f0976f80d0e46a665a07f746ae2a8818ccf5 100755 (executable)
@@ -4,9 +4,5 @@ SPOOL=../db-h
 
 exec `dirname $0`/../btspull -n $@ \
      `grep http $SPOOL/index.fwd        \
-         | sort -n                      \
-         | sed -e 's/: .*/ / ; s/^/, /' \
-         | tr -d '\n'                   \
-         | sed -e 's/^, //'`
-
+         | sort -n | cut -d: -f1 | tr '\n' ' '`
 
index 270e18d0be4ad44696c18717a0396c58240408c2..171bcf07fed6a0261ef7ec5a31652e60f1c40f9e 100755 (executable)
@@ -4,10 +4,5 @@ SPOOL=../db-h
 
 exec `dirname $0`/../btspull $@ \
      `grep http $SPOOL/index.fwd        \
-         | sort -n                      \
-         | sed -e 's/: .*/ / ; s/^/, /' \
-         | tr -d '\n'                   \
-         | sed -e 's/^, //'`
-
-
+         | sort -n | cut -d: -f1 | tr '\n' ' '`
 
diff --git a/btspull b/btspull
index e8abd1a16167ded0af65b98113e0ab82fa079525..a7d3c2b0285113c8cbe6b353402657eed2469ec6 100755 (executable)
--- a/btspull
+++ b/btspull
@@ -85,39 +85,28 @@ if __name__ == "__main__":
 
     queues  = {}
 
-    cmds = [x.split('\007') for x in '\007'.join(args).split('\007,\007')]
-    for c in cmds:
-        if len(c) not in (1, 2): usage(1)
-        if len(c) is 1:
-            btsbug = btsi.getReport(c[0])
-
-            if btsbug is None:
-                warn("#%s does not exist" % (c[0]))
-                continue
-            if not btsbug.forward:
-                if not btsbug.fwdTo:
-                    warn("#%s has no forwards" % (c[0]))
-                if len(btsbug.fwdTo) is not 1:
-                    warn("#%s has more than one forward" % (c[0]))
-                continue
-
-            fwd = btsbug.forward
-        else:
-            btsbug = btsi.getReport(c[0])
-            if btsbug is None:
-                warn("#%s does not exist" % (c[0]))
-                continue
-
-            fwd = c[1]
+    for id in args:
+        btsbug = btsi.getReport(id)
+
+        if btsbug is None:
+            warn("#%s does not exist" % (id))
+            continue
 
         if short and btsbug.done:
             continue
 
-        rbts = RemoteBts.find(fwd)
+        if not btsbug.forward:
+            if not btsbug.fwdTo:
+                warn("#%s has no forwards" % (id))
+            if len(btsbug.fwdTo) is not 1:
+                warn("#%s has more than one forward" % (id))
+            continue
+
+        rbts = RemoteBts.find(btsbug.forward)
         if not rbts:
-            warn("#%s: not understood: %s" % (btsbug.id, fwd))
+            warn("#%s: not understood: %s" % (btsbug.id, btsbug.forward))
             continue
-        rbts.enqueue(btsbug, fwd)
+        rbts.enqueue(btsbug)
 
     try:
         res = []
index db8b4eea86746a96ce76f3aeaf53ab843bfa406b..afe89ec3af252f35c54e46b8b6e8a67472d9c9be 100644 (file)
@@ -204,17 +204,17 @@ class RemoteBts:
         self._bugcls = bugCls
         self._queue  = []
 
-    def enqueue(self, btsbug, fwd):
-        self._queue.append((btsbug, fwd))
+    def enqueue(self, btsbug):
+        self._queue.append(btsbug)
 
     def processQueue(self):
         res = []
         while self._queue:
-            btsbug, fwd = self._queue[0]
+            btsbug      = self._queue[0]
             self._queue = self._queue[1:]
 
             try:
-                rbug = self.getReport(fwd)
+                rbug = self.getReport(btsbug.forward)
                 if rbug:
                     actions = getActions(btsbug, rbug)
                     if actions:
@@ -225,7 +225,7 @@ class RemoteBts:
                 i = 0
                 type, value, tb = sys.exc_info()
                 exn = traceback.format_exception_only(type, value)
-                warn("*** #%s [%s] raised an exception %s" % (btsbug.id, fwd, exn))
+                warn("*** #%s [%s] raised an exception %s" % (btsbug.id, btsbug.forward, exn))
                 for file, lineno, _, text in traceback.extract_tb(tb):
                     i += 1
                     warn(" %d. %-70s [%s:%s]" % (i, text, os.path.basename(file), lineno))
index 6ed67bfef9ae75b4ce11723802338a4a5b8128e8..299ebb493931b5890e5eb3ecd244b9cd288dd41d 100644 (file)
@@ -131,9 +131,9 @@ class RemoteBugzilla(OldRemoteBugzilla):
     def __init__(self, cnf):
         OldRemoteBugzilla.__init__(self, cnf)
 
-    def enqueue(self, btsbug, fwd):
-        id = self.extractBugid(fwd)
-        if id is None: failwith(fwd)
+    def enqueue(self, btsbug):
+        id = self.extractBugid(btsbug.forward)
+        if id is None: failwith(btsbug.forward)
         self._queue.append((btsbug, id))
 
     def processQueue(self):