Show More
@@ -143,17 +143,24 b' GP_PATCH = 1 << 0 # we have to run pat' | |||||
143 | GP_FILTER = 1 << 1 # there's some copy/rename operation |
|
143 | GP_FILTER = 1 << 1 # there's some copy/rename operation | |
144 | GP_BINARY = 1 << 2 # there's a binary patch |
|
144 | GP_BINARY = 1 << 2 # there's a binary patch | |
145 |
|
145 | |||
|
146 | class patchmeta: | |||
|
147 | """Patched file metadata | |||
|
148 | ||||
|
149 | 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY | |||
|
150 | or COPY. 'path' is patched file path. 'oldpath' is set to the | |||
|
151 | origin file when 'op' is either COPY or RENAME, None | |||
|
152 | otherwise. 'mode' is set to the new mode of patched file or None. | |||
|
153 | """ | |||
|
154 | def __init__(self, path): | |||
|
155 | self.path = path | |||
|
156 | self.oldpath = None | |||
|
157 | self.mode = None | |||
|
158 | self.op = 'MODIFY' | |||
|
159 | self.lineno = 0 | |||
|
160 | self.binary = False | |||
|
161 | ||||
146 | def readgitpatch(fp, firstline=None): |
|
162 | def readgitpatch(fp, firstline=None): | |
147 | """extract git-style metadata about patches from <patchname>""" |
|
163 | """extract git-style metadata about patches from <patchname>""" | |
148 | class gitpatch: |
|
|||
149 | "op is one of ADD, DELETE, RENAME, MODIFY or COPY" |
|
|||
150 | def __init__(self, path): |
|
|||
151 | self.path = path |
|
|||
152 | self.oldpath = None |
|
|||
153 | self.mode = None |
|
|||
154 | self.op = 'MODIFY' |
|
|||
155 | self.lineno = 0 |
|
|||
156 | self.binary = False |
|
|||
157 |
|
164 | |||
158 | def reader(fp, firstline): |
|
165 | def reader(fp, firstline): | |
159 | if firstline is not None: |
|
166 | if firstline is not None: | |
@@ -177,7 +184,7 b' def readgitpatch(fp, firstline=None):' | |||||
177 | if gp: |
|
184 | if gp: | |
178 | gitpatches.append(gp) |
|
185 | gitpatches.append(gp) | |
179 | src, dst = m.group(1, 2) |
|
186 | src, dst = m.group(1, 2) | |
180 |
gp = |
|
187 | gp = patchmeta(dst) | |
181 | gp.lineno = lineno |
|
188 | gp.lineno = lineno | |
182 | elif gp: |
|
189 | elif gp: | |
183 | if line.startswith('--- '): |
|
190 | if line.startswith('--- '): |
General Comments 0
You need to be logged in to leave comments.
Login now