meld r1295 - in trunk: . vc



Author: vincele
Date: Thu Mar 26 23:04:14 2009
New Revision: 1295
URL: http://svn.gnome.org/viewvc/meld?rev=1295&view=rev

Log:
Extract get_patch_files() method from vcview.show_patch() into _vc.Vc
The regex patch parsing should stay internal to VC
And this new method will be used for patch file support


Modified:
   trunk/vc/_vc.py
   trunk/vcview.py

Modified: trunk/vc/_vc.py
==============================================================================
--- trunk/vc/_vc.py	(original)
+++ trunk/vc/_vc.py	Thu Mar 26 23:04:14 2009
@@ -22,6 +22,7 @@
 ### THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
+import re
 from gettext import gettext as _
 
 # ignored, new, normal, ignored changes,
@@ -68,6 +69,7 @@
 class Vc(object):
 
     PATCH_STRIP_NUM = 0
+    PATCH_INDEX_RE = ''
     VC_DIR = None
 
     def __init__(self, location):
@@ -107,6 +109,10 @@
     def uncache_inventory(self):
         pass
 
+    def get_patch_files(self, patch):
+        regex = re.compile(self.PATCH_INDEX_RE, re.M)
+        return [f.strip() for f in regex.findall(patch)]
+
     def listdir_filter(self, entries):
         return [f for f in entries if f != self.VC_DIR]
 

Modified: trunk/vcview.py
==============================================================================
--- trunk/vcview.py	(original)
+++ trunk/vcview.py	Thu Mar 26 23:04:14 2009
@@ -450,10 +450,8 @@
         tmpdir = tempfile.mkdtemp("-meld")
         self.tempdirs.append(tmpdir)
 
-        regex = re.compile(self.vc.PATCH_INDEX_RE, re.M)
-        files = [f.strip() for f in regex.findall(patch)]
         diffs = []
-        for fname in files:
+        for fname in self.vc.get_patch_files(patch):
             destfile = os.path.join(tmpdir,fname)
             destdir = os.path.dirname( destfile )
 



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