You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/11/08 19:54:12 UTC

incubator-ponymail git commit: Ensure all valid links are matched if --project is not specified

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master fe894e2ad -> 5294554ab


Ensure all valid links are matched if --project is not specified

Follow-up to b2fa43a3a

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5294554a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5294554a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5294554a

Branch: refs/heads/master
Commit: 5294554ab4e91ccad98ed2b389eccec6028ff337
Parents: fe894e2
Author: Sebb <se...@apache.org>
Authored: Tue Nov 8 19:53:46 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Tue Nov 8 19:53:46 2016 +0000

----------------------------------------------------------------------
 tools/import-mbox.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5294554a/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index 1e7fac7..1aa5156 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -48,7 +48,12 @@ import archiver
 y = 0
 baddies = 0
 block = Lock()
-lists = []
+lists = [] # N.B. the entries in this list depend on the import type:
+# globDir: [filename, list-id]
+# modMbox: [list-id, mbox]
+# piperMail: [filename, list-id]
+# imap(s): [uids, listname, imap4]
+# other: [filename, list-override[
 start = time.time()
 quickmode = False
 private = False
@@ -454,12 +459,15 @@ if re.match(r"https?://", source):
     data = urlopen(source).read().decode('utf-8')
     print("Fetched %u bytes of main data, parsing month lists" % len(data))
     
-    # ensure there is a '-' between project and list name otherwise we match too much
-    # Note: It looks like mod_mbox always uses single quoted hrefs
-    ns = r"<a href='(%s-[-a-z0-9]+)/'" % project
-    if project.find("-") != -1:
-        ns = r"<a href='(%s)/'" % project
-    
+    if project:
+        # ensure there is a '-' between project and list name otherwise we match too much
+        # Note: It looks like mod_mbox always uses single quoted hrefs
+        ns = r"<a href='(%s-[-a-z0-9]+)/'" % project
+        if project.find("-") != -1:
+            ns = r"<a href='(%s)/'" % project
+    else: # match all possible project names
+        ns = r"<a href='([-a-z0-9]+)/'"
+
     if args.modmbox:
         for mlist in re.finditer(ns, data):
             ml = mlist.group(1)