[projects/git-slug: 25/170] Allow for multiple patterns describing packages to operate on

glen glen at pld-linux.org
Mon Sep 21 21:40:54 CEST 2015


commit c48d0b2ef6df3be4759bda1a9dba7fdadb33062b
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Mon Sep 19 05:07:07 2011 +0100

    Allow for multiple patterns describing packages to operate on

 git_slug/refsdata.py | 4 ++--
 slug.py              | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/git_slug/refsdata.py b/git_slug/refsdata.py
index b471722..b49cc12 100644
--- a/git_slug/refsdata.py
+++ b/git_slug/refsdata.py
@@ -11,10 +11,10 @@ class RemoteRefsError(Exception):
     pass
 
 class RemoteRefsData:
-    def __init__(self, stream, pattern, dirpattern='*'):
+    def __init__(self, stream, pattern, dirpattern=['*']):
         self.heads = collections.defaultdict(lambda: collections.defaultdict(lambda: EMPTYSHA1))
         pats = re.compile('|'.join(fnmatch.translate(os.path.join('refs/heads', p)) for p in pattern))
-        dirpat=re.compile(fnmatch.translate(dirpattern))
+        dirpat=re.compile('|'.join(fnmatch.translate(p) for p in dirpattern))
         for line in stream.readlines():
             if isinstance(line, bytes):
                 line = line.decode("utf-8")
diff --git a/slug.py b/slug.py
index 9c5d35d..6cbf0e3 100755
--- a/slug.py
+++ b/slug.py
@@ -159,7 +159,7 @@ clone.add_argument('-n', '--newpkgs', help='download packages that do not exist
         action='store_true')
 clone.add_argument('-r', '--remoterefs', help='repository with list of all refs',
     default=os.path.expanduser('~/PLD_clone/Refs.git'))
-clone.add_argument('dirpattern', nargs='?', default = '*')
+clone.add_argument('dirpattern', nargs='*', default = ['*'])
 clone.set_defaults(func=fetch_packages)
 
 create = subparsers.add_parser('init', help='init new repository', parents=[common_options],
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list