Show More
@@ -143,10 +143,14 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 | def readgitpatch(fp, firstline=None): |
|
146 | class patchmeta: | |
147 | """extract git-style metadata about patches from <patchname>""" |
|
147 | """Patched file metadata | |
148 | class gitpatch: |
|
148 | ||
149 |
|
|
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 | """ | |||
150 |
|
|
154 | def __init__(self, path): | |
151 |
|
|
155 | self.path = path | |
152 |
|
|
156 | self.oldpath = None | |
@@ -155,6 +159,9 b' def readgitpatch(fp, firstline=None):' | |||||
155 |
|
|
159 | self.lineno = 0 | |
156 |
|
|
160 | self.binary = False | |
157 |
|
161 | |||
|
162 | def readgitpatch(fp, firstline=None): | |||
|
163 | """extract git-style metadata about patches from <patchname>""" | |||
|
164 | ||||
158 | def reader(fp, firstline): |
|
165 | def reader(fp, firstline): | |
159 | if firstline is not None: |
|
166 | if firstline is not None: | |
160 | yield firstline |
|
167 | yield firstline | |
@@ -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