Show More
@@ -850,8 +850,15 b' def tryimportone(ui, repo, hunk, parents' | |||
|
850 | 850 | """ |
|
851 | 851 | # avoid cycle context -> subrepo -> cmdutil |
|
852 | 852 | import context |
|
853 | tmpname, message, user, date, branch, nodeid, p1, p2 = \ | |
|
854 | patch.extract(ui, hunk) | |
|
853 | extractdata = patch.extract(ui, hunk) | |
|
854 | tmpname = extractdata.get('filename') | |
|
855 | message = extractdata.get('message') | |
|
856 | user = extractdata.get('user') | |
|
857 | date = extractdata.get('date') | |
|
858 | branch = extractdata.get('branch') | |
|
859 | nodeid = extractdata.get('nodeid') | |
|
860 | p1 = extractdata.get('p1') | |
|
861 | p2 = extractdata.get('p2') | |
|
855 | 862 | |
|
856 | 863 | update = not opts.get('bypass') |
|
857 | 864 | strip = opts["strip"] |
@@ -156,8 +156,16 b' def extract(ui, fileobj):' | |||
|
156 | 156 | |
|
157 | 157 | patch can be a normal patch or contained in an email message. |
|
158 | 158 | |
|
159 | return tuple (filename, message, user, date, branch, node, p1, p2). | |
|
160 | Any item in the returned tuple can be None. If filename is None, | |
|
159 | return a dictionnary. Standard keys are: | |
|
160 | - filename, | |
|
161 | - message, | |
|
162 | - user, | |
|
163 | - date, | |
|
164 | - branch, | |
|
165 | - node, | |
|
166 | - p1, | |
|
167 | - p2. | |
|
168 | Any item can be missing from the dictionary. If filename is mising, | |
|
161 | 169 | fileobj did not contain a patch. Caller must unlink filename when done.''' |
|
162 | 170 | |
|
163 | 171 | # attempt to detect the start of a patch |
@@ -167,6 +175,7 b' def extract(ui, fileobj):' | |||
|
167 | 175 | r'---[ \t].*?^\+\+\+[ \t]|' |
|
168 | 176 | r'\*\*\*[ \t].*?^---[ \t])', re.MULTILINE|re.DOTALL) |
|
169 | 177 | |
|
178 | data = {} | |
|
170 | 179 | fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') |
|
171 | 180 | tmpfp = os.fdopen(fd, 'w') |
|
172 | 181 | try: |
@@ -256,7 +265,11 b' def extract(ui, fileobj):' | |||
|
256 | 265 | tmpfp.close() |
|
257 | 266 | if not diffs_seen: |
|
258 | 267 | os.unlink(tmpname) |
|
259 | return None, message, user, date, branch, None, None, None | |
|
268 | data['message'] = message | |
|
269 | data['user'] = user | |
|
270 | data['date'] = date | |
|
271 | data['branch'] = branch | |
|
272 | return data | |
|
260 | 273 | |
|
261 | 274 | if parents: |
|
262 | 275 | p1 = parents.pop(0) |
@@ -268,7 +281,15 b' def extract(ui, fileobj):' | |||
|
268 | 281 | else: |
|
269 | 282 | p2 = None |
|
270 | 283 | |
|
271 | return tmpname, message, user, date, branch, nodeid, p1, p2 | |
|
284 | data['filename'] = tmpname | |
|
285 | data['message'] = message | |
|
286 | data['user'] = user | |
|
287 | data['date'] = date | |
|
288 | data['branch'] = branch | |
|
289 | data['nodeid'] = nodeid | |
|
290 | data['p1'] = p1 | |
|
291 | data['p2'] = p2 | |
|
292 | return data | |
|
272 | 293 | |
|
273 | 294 | class patchmeta(object): |
|
274 | 295 | """Patched file metadata |
General Comments 0
You need to be logged in to leave comments.
Login now