[kernel] r5197 - people/waldi/linux-2.6/debian/bin

Bastian Blank waldi at costa.debian.org
Tue Jan 3 15:25:03 UTC 2006


Author: waldi
Date: Tue Jan  3 15:25:03 2006
New Revision: 5197

Modified:
   people/waldi/linux-2.6/debian/bin/apply.py
Log:
debian/bin/apply.py: Record shortest possible extra version in version file.


Modified: people/waldi/linux-2.6/debian/bin/apply.py
==============================================================================
--- people/waldi/linux-2.6/debian/bin/apply.py	(original)
+++ people/waldi/linux-2.6/debian/bin/apply.py	Tue Jan  3 15:25:03 2006
@@ -49,7 +49,6 @@
         return '<%s object for %s>' % (self.__class__.__name__, self.name)
 
     def apply(self):
-        changes = 0
         if self.reverse:
             for operation, patch, patchinfo in self[::-1]:
                 if operation == '.':
@@ -58,16 +57,13 @@
 """ % patch
                 elif operation == '+':
                     self.patch_deapply(patch, patchinfo)
-                    changes += 1
                 elif operation == '-':
                     self.patch_apply(patch, patchinfo)
-                    changes += 1
                 elif operation == 'X':
                     os.rename(patchinfo[1], patchinfo[0])
                     print """\
   (X) RESTORED  %s\
 """ % patch
-                    changes += 1
             print "--> %s fully unapplied." % self.name
 
         else:
@@ -78,18 +74,14 @@
 """ % patch
                 elif operation == '+':
                     self.patch_apply(patch, patchinfo)
-                    changes += 1
                 elif operation == '-':
                     self.patch_deapply(patch, patchinf)
-                    changes += 1
                 elif operation == 'X':
                     os.rename(patchinfo[0], patchinfo[1])
                     print """\
   (X) REMOVED   %s\
 """ % patch
-                    changes += 1
             print "--> %s fully applied." % self.name
-        return changes
 
     def patch_apply(self, patch, patchinfo):
         ret = self.patch_call(patchinfo, '--fuzz=1')
@@ -145,6 +137,7 @@
 class series_extra(series):
     def __init__(self, name, home, extra, reverse = False):
         self.extra = extra
+        self.extra_used = ()
         self.name = name
         self.reverse = reverse
 
@@ -187,12 +180,12 @@
             self.append((operation, patch, patchinfo))
 
     def _check_extra(self, extra):
-        if extra.has_key(tuple(self.extra[:1])):
-            return True
-        if extra.has_key(tuple(self.extra[:2])):
-            return True
-        if extra.has_key(tuple(self.extra[:3])):
-            return True
+        for i in (1, 2, 3):
+            t = tuple(self.extra[:1])
+            if extra.has_key(t):
+                if i > len(self.extra_used):
+                    self.extra_used = t
+                return True
         return False
 
     @staticmethod
@@ -317,13 +310,9 @@
         consider = revisions[current_index:0:-1]
         s = series_extra.read_all(consider, home, current_extra, reverse = True)
         vfile.begin()
-        changes = 0
         for i in s:
-            changes += i.apply()
-        if changes:
-            vfile.commit(current, ())
-        else:
-            vfile.commit()
+            i.apply()
+        vfile.commit(current, ())
 
     if current_index < target_index:
         consider = revisions[current_index + 1:target_index + 1]
@@ -343,14 +332,15 @@
     if target_extra:
         consider = revisions[1:target_index + 1]
         s = series_extra.read_all(consider, home, target_extra)
+        real_extra = ()
+        for i in s:
+            t = i.extra_used
+            if len(t) > len(real_extra):
+                real_extra = t
         vfile.begin()
-        changes = 0
         for i in s:
-            changes += i.apply()
-        if changes:
-            vfile.commit(target, target_extra)
-        else:
-            vfile.commit()
+            i.apply()
+        vfile.commit(target, real_extra)
 
 def parse_options():
     from optparse import OptionParser



More information about the Kernel-svn-changes mailing list