ooo-build r13142 - in trunk: . bin



Author: jannieuw
Date: Thu Jul 10 08:44:20 2008
New Revision: 13142
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13142&view=rev

Log:
2008-07-10  Jan Nieuwenhuizen  <janneke gnu org>

	* bin/gob: Fixes and cleanups for patch dependency calculation and
	branch aggregation.  Add assimilate hints for dispersed branches.
	Add printing of all patch-dependencies, reset feature, dependency
	statistics, patch-depend feature.  Support for interruptable
	git-export.  Support dev300-m21 git-export.


Modified:
   trunk/ChangeLog
   trunk/bin/gob

Modified: trunk/bin/gob
==============================================================================
--- trunk/bin/gob	(original)
+++ trunk/bin/gob	Thu Jul 10 08:44:20 2008
@@ -24,27 +24,26 @@
 def system (command, raise_on_error=True):
     if options.verbose > 1:
         print >> sys.stderr, 'executing: %(command)s' % locals ()
-    silence = ''
     if options.verbose < 2:
-        silence = ' > .log- 2>&1'
-    status = os.system (command + silence)
+        command = '(%(command)s) > gob.log 2>&1' % locals ()
+    status = os.system (command)
     if status and raise_on_error:
         print >> sys.stderr, command
-        print >> sys.stderr, file ('.log-').read ()
+        print >> sys.stderr, file ('gob.log').read ()
         raise SystemFailed ('Command failed: %(command)s' % locals ())
 
 def read_pipe (command, raise_on_error=True):
     if options.verbose > 1:
         print >> sys.stderr, 'executing: %(command)s' % locals ()
     if options.verbose < 2:
-        silence = ' 2> .log-'
-    pipe = os.popen (command + silence)
+        command = '(%(command)s) 2> gob.log' % locals ()
+    pipe = os.popen (command)
     output = pipe.read ()
     if options.verbose > 2:
         print >> sys.stderr, 'pipe-output:\n%(output)s)s' % locals ()
     if pipe.close () and raise_on_error:
         print >> sys.stderr, command
-        print >> sys.stderr, file ('.log-').read ()
+        print >> sys.stderr, file ('gob.log').read ()
         raise SystemFailed ('Pipe failed: %(command)s' % locals ())
     return output
 
@@ -66,15 +65,12 @@
     if not patch_file:
         return None
 
-    if options.milestone == '21':
-        # Additional dependency on cws-scsheetprotection02 in
-        # dev300-m21.  This is most unfortunate, it pulls whole of vba
-        # into 4 other branches, instead of just
-        # cws-scsheetprotection02.
-        m = re.search ('cws-scsheetprotection02', patch_file)
+    if 'vba' in options.dir_branch and int (options.milestone) > 19:
+        m = re.search ('(cws-scsheetprotection02|sc-autofilter-empty-nonempty|sc-copy-source-border|sc-datapilot|sc-move-from-origin|sc-paste-on-enter|sc-save-password-minlength|scroll-accel|xl-import-formradiobutton)', patch_file)
         if m:
             return 'vba'
 
+    # Prevent from going into ooxml
     m = re.search ('(writerfilter-qnametostr-NOOPTFILES)', patch_file)
     if m:
         return m.group (1)
@@ -82,34 +78,76 @@
     dir = os.path.basename (os.path.dirname  (patch_file))
     base = os.path.splitext (os.path.basename (patch_file))[0]
 
-    if (not re.search ('chart2|helpcontent2|javainstaller2|scp2|sfx2|sj2|stlport5|testshl2|transex3|\d\d+$', base)
+    module_re = None
+    if not module_re:
+        modules = list_dirs (options.build_dir)
+        module_re = '|'.join (modules)
+
+    # Patches with a simple digit suffix are aggregated into one branch
+    if (not re.search ('%(module_re)s$|\d\d+$' % locals (), base)
         and re.search ('\d$', base)):
         base = re.sub ('-*\d$', '', base)
 
-    if not re.search ('[.]$|^[.][.]$|64bit|dev300|hotfixes' , dir):
+    # Patches in a separated may be aggregated into one branch
+    if dir in options.dir_branch:
         return dir
 
-    m = re.search ('^(cjk-character-units|cws-scsheetprotection02|emf\+|fpicker-kde|jvmfwk-gij|lockfile|mono|sal-strintern-speed|sc-dataform|sc-datapilot|speed-configmgr|svg-import|system-lpsolve|transogl|unittesting|unxsplash|vba|wpgimporter|writerfilter)', base)
+    # Pathes with a branch_prefix are aggregated into one branch
+    branch_prefix = [
+        'cjk-character-units',
+        'cws-layoutdialogs',
+        'cws-scsheetprotection02',
+        'emf+',
+        'fpicker-kde',
+        'jvmfwk-gij',
+        'lockfile',
+        'mono',
+        'sal-strintern-speed',
+        'sc-dataform',
+        'sc-datapilot',
+        'speed-configmgr',
+        'svg-import',
+        'system-lpsolve',
+        'tools-urlobj-smb-scheme',
+        'transogl',
+        'unittesting',
+        'unxsplash',
+        'vba',
+        'wpgimporter',
+        'writerfiltery'
+        ]
+
+    branch_prefix_re = '^(' + '|'.join (branch_prefix).replace ('+', '\+') + ')'
+    m = re.search (branch_prefix_re, base)
     if m:
-        return m.group (1)
-    
-    if re.search ('^(cairocanvas-alpha-pixmap-rewrite|vcl-grey-alpha-unix-sal-bitmap)', base):
-        return 'emf+'
+        def assert_dir_group (m, s):
+            return s in options.dir_branch or m.group (1) != s
+        if (assert_dir_group (m, 'vba')
+            and assert_dir_group (m, 'emf+')
+            and assert_dir_group (m, 'unittesting')):
+            return m.group (1)
 
-    if re.search ('^(fix-linkoo|linkoo-)', base):
-        return 'linkoo'
+    if 'emf+' in options.dir_branch and re.search ('^(cairocanvas-alpha-pixmap-rewrite|vcl-grey-alpha-unix-sal-bitmap)', base):
+        return 'emf+'
 
-    if re.search ('^(win32-installer-register-moox-types)', base):
+    if 'ooxml' in options.dir_branch and re.search ('^(win32-installer-register-moox-types)', base):
         return 'ooxml'
 
-    if re.search ('^(default-autotext-and-form-name|sc-toggle-merge-center)', base):
+    if 'vba' in options.dir_branch and re.search ('^(default-autotext-and-form-name|sc-toggle-merge-center)', base):
         return 'vba'
 
-    module_re = None
-    if not module_re:
-        modules = list_dirs (options.build_dir)
-        module_re = '|'.join (modules)
-    return re.sub ('-(%(module_re)s)$' % locals (), '', base)
+    if re.search ('^(fix-linkoo|linkoo-)', base):
+        return 'linkoo'
+
+    # Patches with a module suffix are aggregated into one branch
+    base = re.sub ('-(%(module_re)s)$' % locals (), '', base)
+
+    # Remove workspace and milestone suffixes
+    workspace = options.workspace
+    milestone = options.milestone
+    base = re.sub ('-%(workspace)s' % locals (), '', base)
+    base = re.sub ('-m%(milestone)s' % locals (), '', base)
+    return base
 
 def dump_gob (gob_dir, branch, patches):
     owner = ''
@@ -127,7 +165,40 @@
 owner: %(owner)s
 ''' % locals ())
 
-def range_union (a, b, fuzz=1):
+# Hard handy work for m19 gets quickly bit rotten
+# Use patch dependency calculation instead
+manual_m19_branch_dependencies = {
+    'buildfix-layoutdialogs': ['cws-layoutdialogs'],
+    'cairocanvas-fix-image-cache': ['cairo'],
+    'cws-scsheetprotection02': ['sc-datapilot', 'sc-paste-on-enter'],
+    'emf+': ['link-as-needed'],
+    'forms-radio-button-group-names': ['form-control-visibility'],
+    'layout-plugin': ['cws-layoutdialogs'],
+    'layout-tab': ['layout-plugin'],
+    'linkwarn-svtools-miscopts-bits': ['novell-win32-odma'],
+    'ooo59127.vcl.honourcairofont': ['ooo64508.vcl.honourfontconfighinting'],
+    'oosplash-etc-openoffice-sofficerc': ['unxsplash'],
+    'ooxml': ['lwp-filter-component'],
+    'sc-copy-on-merged-cells': ['sc-dataform'],
+    'sc-dataform': ['sc-hrc-ooo-build-resources'],
+    'sc-datapilot': ['sc-dataform'],
+    'sc-dp-gridlayout': ['sc-datapilot'],
+    'sc-export-shape-hlink-bindings': ['sc-export-shape-macro-bindings'],
+    'sc-simple-sort-include-format-header': ['sc-natural-sort'],
+    'sc-toggle-merge-center': ['vba'],
+    'sfx2-pre-and-postprocess-crash-fix': ['sfx2-pre-and-postprocess-during-save-load'],
+    'sfx2-pre-and-postprocess-during-save-load': ['sfx2-remove-check-update-on-fileload'],
+    'speed-bdirect': ['speed-symbolic-functions'],
+    'speed-store-lck': ['store-core'],
+    'static-libs-use-_pic': ['system-lpsolve'],
+    'ui-desktop-integration': ['linkwarn-svtools-miscopts-bits'],
+    'unittesting': ['tools-qa-urlobj-unittest', 'gnome-vfs-late-init'],
+    'vba': ['cws-npower10', 'cws-pflin10', 'cws-npower11'],
+    'vcl-linking-randr': ['autocorrect-accidental-caps-lock', 'internal-mesa-headers'],
+    'wpgimporter': ['wpsimport'],
+}	
+
+def range_union (a, b, fuzz=0):
     u = (max (a[0], b[0]) - fuzz, min (a[1], b[1]) + fuzz, a[2], b[2])
     if u[0] > u[1]:
         return None
@@ -136,11 +207,10 @@
 class File:
     def __init__ (self, s):
         self.string = s
-        if self.string.find ('\n+++ ') == -1:
-            self.name = None
-            return
-        self.name = re.search ('\n[+]{3}\s+([^\s]+)', self.string).group (1)
         self.ranges = None
+        self.name = None
+        if self.string.find ('\n+++ ') >= 0:
+            self.name = re.search ('\n[+]{3}\s+([^\s]+)', self.string).group (1)
     def __repr__ (self):
         return '<File: %(name)s>' % self.__dict__
     def get_ranges (self):
@@ -155,7 +225,7 @@
         if file_name in q.files.keys ():
             for a in p.files[file_name].get_ranges ():
                 for b in q.files[file_name].get_ranges ():
-                    union = range_union (a, b)
+                    union = range_union (a, b, int (options.fuzz))
                     if union:
                         return union
     return False
@@ -177,15 +247,30 @@
         if patch in branches[branch]:
             first_patch = patch
             break
+    last_patch = None
+    for patch in reversed (patches):
+        if patch in branches[branch]:
+            last_patch = patch
+            break
     for patch in branches[branch]:
+        assimilate = False
         for p in patches:
+            if p == last_patch:
+                name = p.name
+                break
             if p == first_patch:
+                name = p.name
                 # We cannot have a branch pre-depend on a patch/branch
                 # that does not exist yet.  FIXME: if it is really
                 # needed, it should be auto-assimilated by the branch.
                 # This is now done manually in patch_get_branch ().
-                break
+                assimilate = True
             o = patch_depend (patch, p)
+            if assimilate and o and p not in branches[branch]:
+                name = p.name
+                ab = patch_get_branch (p)
+                print 'ASSIMILATE[%(branch)s]: %(name)s [%(ab)s]' % locals ()
+                continue
             if o:
                 patch_dependencies[p] = p
                 patch_overlaps += [o]
@@ -198,13 +283,8 @@
         return ['pristine']
     return branch_dependencies.values ()
 
+# No overrides are necessary when using fuzz >= 40
 branch_override_dependencies = {
-    'ooxml': ['lwp-filter-component'],
-    'sc-copy-on-merged-cells': ['sc-dataform'],
-    'sfx2-pre-and-postprocess-crash-fix': ['sfx2-pre-and-postprocess-during-save-load'],
-    'sfx2-pre-and-postprocess-during-save-load': ['sfx2-remove-check-update-on-fileload'],
-    'unittesting': ['tools-qa-urlobj-unittest', 'gnome-vfs-late-init'],
-    'vcl-linking-randr': ['autocorrect-accidental-caps-lock', 'internal-mesa-headers'],
     }
 
 def branch_get_dependencies_with_override (branches, patches, branch):
@@ -315,7 +395,7 @@
 setup_native/source/win32/nsis/ooobitmap_nld.bmp
 setup_native/source/win32/nsis/ooobitmap_ooop.bmp
 setup_native/source/win32/nsis/ooosetup_nld.ico
-solenv/unxlngx*
+solenv/unxlng*/
 svx/res
 '''
 
@@ -324,9 +404,11 @@
         if i[0] == '/':
             file (dir + '/.gitignore', 'a').write (i + '\n')
         else:
+            slash = ''
             if i[-1] == '/':
                 i = i[:-1]
-            file (dir + '/' + os.path.dirname (i) + '/.gitignore', 'a').write (os.path.basename (i) + '\n')
+                slash = '/'
+            file (dir + '/' + os.path.dirname (i) + '/.gitignore', 'a').write (os.path.basename (i) + slash + '\n')
 
 def get_drink ():
     if os.path.exists ('config.log'):
@@ -342,10 +424,15 @@
     def __init__ (self, dir, patched):
         self.dir = dir
         self.patched = patched
+        self.scratch = 'work/scratch'
         self.workspace = options.workspace
         self.milestone = options.milestone
         self.pristine = 'upstream/%(workspace)s-m%(milestone)s' % self.__dict__
         self.commits = {}
+        if not os.path.exists (self.dir):
+            drink = get_drink ()
+            print >> sys.stderr, 'Unpacking source tree - [ go and have some %(drink)s ] ...' % locals ()
+            system ('make unpack')
         if not os.path.isdir (dir + '/.git'):
             create_gitignores (dir)
             drink = get_drink ()
@@ -357,11 +444,15 @@
             self.system ('git-tag gob-%(workspace)s-%(milestone)s %(pristine)s' % self.__dict__)
             self.system ('git-branch pristine')
             self.system ('git-gc')
-        self.assert_clean ()
+        if self.is_modified ():
+            self.system ('git reset --hard HEAD')
+            self.system ('git clean -f')
         if self.has_branch (self.patched):
             self.checkout (self.patched)
         else:
             self.system ('git-checkout -b %(patched)s pristine' % self.__dict__)
+        if self.has_branch (self.scratch):
+            self.system ('git branch -D %(scratch)s' % self.__dict__)
     def pipe (self, command, raise_on_error=True):
         dir = self.dir
         return read_pipe ('cd %(dir)s && %(command)s' % locals (), raise_on_error)
@@ -394,6 +485,7 @@
         return re.sub ('# On branch.*\nnothing to commit \(working directory clean\)\n', '',
                        self.pipe ('git-status', raise_on_error=False))
     def assert_clean (self):
+        dir = self.dir
         pending = self.is_modified ()
         if pending:
             raise GitFailed ('working directory unclean: %(dir)s\n%(pending)s' % locals ())
@@ -407,14 +499,16 @@
     def has_branch (self, branch):
         return branch in self.get_branches ()
     def apply_patch (self, branches, patches, patch):
-        print >> sys.stderr, 'Applying patch:', patch.name
-        self.assert_clean ()
-        self.checkout (self.patched)
+        branch = patch_get_branch (patch)
+        print >> sys.stderr, 'Applying patch[%(branch)s]:' % locals (), patch.name
+        patched = self.get_current_branch ()
         apply_patch (self.dir, patch.file_name)
         base = os.path.basename (patch.file_name)
         self.commit ('Apply %(base)s.' % locals ())
-        branch = patch_get_branch (patch)
-        dependencies = branch_get_dependencies_with_override (branches, patches, branch)
+        if options.milestone == '19':
+            dependencies = manual_m19_branch_dependencies.get (branch, ['pristine'])
+        else:
+            dependencies = branch_get_dependencies_with_override (branches, patches, branch)
         if not self.has_branch (branch):
             base_depend = dependencies[0]
             self.system ('git-checkout -b %(branch)s %(base_depend)s' % locals ())
@@ -422,9 +516,20 @@
                 self.system ('git-rebase %(dependency)s' % locals ())
         else:
             self.checkout (branch)
-        log = self.get_log (self.patched)
+        log = self.get_log (patched)
         commit = log[:log.index (' ')]
         self.system ('git-cherry-pick -x %(commit)s' % locals ())
+    def before_ (self):
+        self.assert_clean ()
+        self.system ('git checkout -b %(scratch)s %(patched)s' % self.__dict__)
+    def after_ (self):
+        self.system ('git push . %(scratch)s:%(patched)s' % self.__dict__)
+        self.checkout (self.patched)
+        self.system ('git branch -D %(scratch)s' % self.__dict__)
+    def pick_patch (self, patch, commit):
+        branch = patch_get_branch (patch)
+        print >> sys.stderr, 'Picking patch[%(branch)s]:' % locals (), patch.name
+        self.system ('git-cherry-pick -x %(commit)s' % locals ())
     def add_patch (self, branches, patches, patch):
         if patch.name in self.get_log ():
             print >> sys.stderr, 'patch already applied, skipping:', patch.name
@@ -438,16 +543,27 @@
             m = re.search ('(^|\n)([^\s]+)\s+.*(\s|/)%(name)s' % patch.__dict__, self.get_log (branch))
             if m:
                 commit = m.group (2)
+        self.before_ ()
         if commit:
-            print >> sys.stderr, 'Adding patch:', patch.name
-            self.assert_clean ()
-            self.checkout (self.patched)
-            self.system ('git-cherry-pick -x %(commit)s' % locals ())
+            self.pick_patch (patch, commit)
         else:
             self.apply_patch (branches, patches, patch)
+        self.after_ ()
 
 class Patch:
+    def __init__ (self, file_name):
+        self.file_name = file_name
+        if self.file_name:
+            self.set_files ()
+        self.file_name = None
+    def set_files (self):
+        self.files = dict (map (lambda x: (x.name, x), map (File, ('\n' + file (self.file_name).read ()).split ('\n---')[1:])))
+    def __repr__ (self):
+        return '<Patch: ' + str (map (str, self.files.values ())) + ' >'
+
+class Apply_patch (Patch):
     def __init__ (self, s, section, owner, issue):
+        Patch.__init__ (self, None)
         self.string = s
         self.section = section
         self.owner = owner
@@ -460,13 +576,12 @@
         self.issues = map (lambda x: x[0], re.findall ('((i|n)#[0-9]+)', self.string))
         if issue:
             self.issues.append (issue)
-        self.file_name = None
-        self.files = None
     def __repr__ (self):
         return '<Patch: %(file_name)s [%(section)s] %(owner)s %(issues)s>' % self.__dict__
     def set_file_name (self, dir, path):
         self.file_name = find_file (dir, path, self.name)
-        self.files = dict (map (lambda x: (x.name, x), map (File, file (self.file_name).read ().split ('\n---')[1:])))
+        self.set_files ()
+        return self
 
 class Section:
     def __init__ (self, s):
@@ -485,7 +600,7 @@
         return '<Section: %(tag)s %(owner)s %(issue)s>' % self.__dict__
     def get_patches (self):
         def create_patch (s):
-            return Patch (s[0], self.tag, self.owner, self.issue)
+            return Apply_patch (s[0], self.tag, self.owner, self.issue)
         return map (create_patch, re.findall ('\n\s*([^#\s].*.(diff|patch).*)', self.string))
 
 class Apply:
@@ -569,18 +684,14 @@
             if patches:
                 dump_gob (gob_dir, branch, patches)
     def checkout (self):
-        '''checkout patched'''
+        '''checkout patched ('master') branch'''
         git = Git (self.options.build_dir, self.options.patched)
     def git_export (self):
         '''export to GIT with branches'''
         if (not options.force
-            and (self.options.milestone != '19'
+            and (self.options.milestone not in ['19', '21']
                  or self.options.workspace != 'dev300')):
-            raise SystemFailed ('Export only supported for dev300-m19.  Use --force to override')
-        if not os.path.exists (self.options.build_dir):
-            drink = get_drink ()
-            print >> sys.stderr, 'Unpacking source tree - [ go and have some %(drink)s ] ...' % locals ()
-            system ('make unpack')
+            raise SystemFailed ('Export only supported for dev300-m19, dev300-m21.  Use --force to override')
         git = Git (self.options.build_dir, self.options.patched)
         patches = self.get_patches ()
         branches = self.get_branches ()
@@ -610,7 +721,7 @@
         git.commit ('Update to svn:r%(svn_revision)s patched.' % locals ())
         git.system ('git-rebase patched')
     def dependencies (self):
-        '''list patch dependencies'''
+        '''list branch dependencies'''
         patches = self.get_patches ()
         branches = self.get_branches ()
         independent = 0
@@ -618,31 +729,98 @@
             dependencies = sorted (branch_get_dependencies (branches, patches, branch))
             if dependencies == ['pristine']:
                 independent += 1
-            print 'BRANCH:', branch, dependencies
+            print 'BRANCH:', branch, '->', dependencies
         print 'INDEPENDENT:', independent
+    def patch_dependencies (self):
+        '''list patch dependencies'''
+        branches = self.get_branches ()
+        patches = self.get_patches ()
+        for patch in patches:
+            branch = patch_get_branch (patch)
+            name = patch.name
+            print 'PATCH[%(branch)s]: %(name)s -> ' % locals (), patch_get_dependencies (patches, patch)
     def bump (self):
         '''bump BRANCH TAG-NAME - bump current branch (BRANCH=new upstream)'''
-        if self.options.arguments != 2:
+        if len (self.options.arguments) != 2:
             print 'Usage: gob bump BRANCH TAG-NAME'
             print 'BRANCH: new upstream'
             print 'Example:'
             print '    gob bump upstream/dev300-m21 my-21-update'
-            sys.exit (1)
+            sys.exit (2)
         branch = self.options.arguments[0]
         tag = self.options.arguments[1]
         git_dir = self.options.build_dir
         system ('cd %(git_dir)s && gob-bump %(branch)s %(tag)s' % locals ())
     def update (self):
         '''update BRANCH - update current branch (BRANCH='master')'''
-        if self.options.arguments != 1:
+        if len (self.options.arguments) != 1:
             print 'Usage: gob update BRANCH'
             print '''BRANCH: the 'master' branch'''
             print 'Example: '
             print '    gob update distro/SUSE'
-            sys.exit (1)
+            sys.exit (2)
         branch = self.options.arguments[0]
         git_dir = self.options.build_dir
         system ('cdi %(git_dir)s && gob-update %(branch)s' % locals ())
+    def reset (self):
+        '''reset - set GIT tree to pristine and remove all branches'''
+        git = Git (self.options.build_dir, self.options.patched)
+        git.system ('git-checkout -f %(patched)s' % git.__dict__)
+        git.system ('git-reset --hard pristine')
+        git.system ('''git-branch | grep -Ev '/|master|patched|pristine|upstream|%(patched)s' | xargs git branch -D''' % git.__dict__)
+    def patch_depend (self):
+        '''patch-depend PATCH-1 PATCH-2 - show overlap between patches'''
+        if len (self.options.arguments) != 2:
+            print 'Usage: patch-depend PATCH-1 PATCH-2'
+            sys.exit (2)
+        union = patch_depend (Patch (self.options.arguments[0]), Patch (self.options.arguments[1]))
+        if union:
+            print union[0], '--', union[1]
+            print union[2]
+            print '<<<<<<<<<<<<<<<<<<<<<<<<<=========================>>>>>>>>>>>>>>>>>>>>>>>>>'
+            print union[3]
+            sys.exit (1)
+    def statistics (self):
+        ### not advertised
+        ### show some statistics on dependensies
+        patches = self.get_patches ()
+        branches = self.get_branches ()
+        full_match = 0
+        match = 0
+        fail = 0
+        extra = 0
+        independent = 0
+        for branch in branches:
+            manual_dependencies = sorted (branch_dependencies.get (branch, ['pristine']))
+            auto_dependencies = sorted (branch_get_dependencies (branches, patches, branch))
+            missing = False
+            for m in manual_dependencies:
+                if m != 'pristine' and not m in auto_dependencies:
+                    missing = True
+                    break
+            if missing:
+                fail += 1
+                print
+                print 'BRANCH:', branch
+                print 'MANUAL:', manual_dependencies
+                print 'AUTO:', auto_dependencies
+                #dependencies 'OVERLAPS:', overlaps
+            if auto_dependencies == ['pristine']:
+                independent += 1
+            elif auto_dependencies == manual_dependencies:
+                full_match += 1
+            elif manual_dependencies == ['pristine']:
+                extra += 1
+                #print 'BRANCH:', branch
+                #print 'EXTRA:', auto_dependencies
+            elif not missing:
+                match += 1
+        print
+        print 'FAIL:', fail
+        print 'FULL_MATCH:', full_match
+        print 'MATCH:', match
+        print 'EXTRA:', extra
+        print 'INDEPENDENT:', independent
 
 def get_cli_parser ():
     p = optparse.OptionParser ()
@@ -693,8 +871,18 @@
     p.add_option ('--patched',
                   default='patched',
                   dest='patched',
-                  metavar='BRANCH',
-                  help='name of patched branch')
+                  metavar='NAME',
+                  help='''use NAME as patched 'master' branch name''')
+    p.add_option ('--dir-branch',
+                  default=[],
+                  dest='dir_branch',
+                  metavar='DIR',
+                  help='aggregate patches in directory DIR into one branch')
+    p.add_option ('--fuzz',
+                  default='40', # FIXME: 40 = magic sweet spot for dev300-m21
+                  dest='fuzz',
+                  metavar='INT',
+                  help='use FUZZ as fuzz factor for patch overlap')
     p.add_option ('--force', action='store_true', dest='force', default=False)
     p.add_option ('-v', '--verbose', action='count', dest='verbose', default=1)
     p.add_option ('-q', '--quiet', action='count', dest='quiet', default=0)
@@ -718,13 +906,20 @@
     p.print_help ()
     sys.exit (2)
 
-options = None
-def main ():
-    global options
-    options = parse_options ()
+def set_option_defaults (options):
     options.verbose -= options.quiet
     if not options.distros:
         options.distros = ['SUSE']
+    if not options.dir_branch:
+        options.dir_branch = filter (lambda x: x not in ['.', '..', '.svn', '64bit', 'dev300', 'hotfixes'], list_dirs (options.apply_dir + '/..'))
+        too_dispersed = ['cairo', 'vba']
+        options.dir_branch = filter (lambda x: x not in too_dispersed, options.dir_branch)
+    return options
+
+options = None
+def main ():
+    global options
+    options = set_option_defaults (parse_options ())
     apply_file = options.apply_dir + '/apply'
     apply = Apply (apply_file, options.workspace, options.milestone)
     Command.__dict__[options.command] (Command (apply, options))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]