Show More
@@ -20,8 +20,8 b' import lock as lockmod' | |||||
20 | def parsealiases(cmd): |
|
20 | def parsealiases(cmd): | |
21 | return cmd.lstrip("^").split("|") |
|
21 | return cmd.lstrip("^").split("|") | |
22 |
|
22 | |||
23 |
def recordfilter(ui, |
|
23 | def recordfilter(ui, originalhunks): | |
24 |
return patch.filterpatch(ui, |
|
24 | return patch.filterpatch(ui, originalhunks) | |
25 |
|
25 | |||
26 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, |
|
26 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, | |
27 | filterfn, *pats, **opts): |
|
27 | filterfn, *pats, **opts): | |
@@ -59,19 +59,15 b' def dorecord(ui, repo, commitfunc, cmdsu' | |||||
59 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
|
59 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) | |
60 | diffopts.nodates = True |
|
60 | diffopts.nodates = True | |
61 | diffopts.git = True |
|
61 | diffopts.git = True | |
62 |
original |
|
62 | originaldiff = patch.diff(repo, changes=status, opts=diffopts) | |
63 | fp = cStringIO.StringIO() |
|
63 | originalchunks = patch.parsepatch(originaldiff) | |
64 | fp.write(''.join(originalchunks)) |
|
|||
65 | fp.seek(0) |
|
|||
66 |
|
64 | |||
67 | # 1. filter patch, so we have intending-to apply subset of it |
|
65 | # 1. filter patch, so we have intending-to apply subset of it | |
68 | try: |
|
66 | try: | |
69 |
chunks = filterfn(ui, |
|
67 | chunks = filterfn(ui, originalchunks) | |
70 | except patch.PatchError, err: |
|
68 | except patch.PatchError, err: | |
71 | raise util.Abort(_('error parsing patch: %s') % err) |
|
69 | raise util.Abort(_('error parsing patch: %s') % err) | |
72 |
|
70 | |||
73 | del fp |
|
|||
74 |
|
||||
75 | contenders = set() |
|
71 | contenders = set() | |
76 | for h in chunks: |
|
72 | for h in chunks: | |
77 | try: |
|
73 | try: |
@@ -15,6 +15,7 b' import email.Parser' | |||||
15 |
|
15 | |||
16 | from i18n import _ |
|
16 | from i18n import _ | |
17 | from node import hex, short |
|
17 | from node import hex, short | |
|
18 | import cStringIO | |||
18 | import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error |
|
19 | import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error | |
19 |
|
20 | |||
20 | gitre = re.compile('diff --git a/(.*) b/(.*)') |
|
21 | gitre = re.compile('diff --git a/(.*) b/(.*)') | |
@@ -1352,7 +1353,7 b' def parsefilename(str):' | |||||
1352 | return s |
|
1353 | return s | |
1353 | return s[:i] |
|
1354 | return s[:i] | |
1354 |
|
1355 | |||
1355 |
def parsepatch( |
|
1356 | def parsepatch(originalchunks): | |
1356 | """patch -> [] of headers -> [] of hunks """ |
|
1357 | """patch -> [] of headers -> [] of hunks """ | |
1357 | class parser(object): |
|
1358 | class parser(object): | |
1358 | """patch parsing state machine""" |
|
1359 | """patch parsing state machine""" | |
@@ -1421,6 +1422,9 b' def parsepatch(fp):' | |||||
1421 | } |
|
1422 | } | |
1422 |
|
1423 | |||
1423 | p = parser() |
|
1424 | p = parser() | |
|
1425 | fp = cStringIO.StringIO() | |||
|
1426 | fp.write(''.join(originalchunks)) | |||
|
1427 | fp.seek(0) | |||
1424 |
|
1428 | |||
1425 | state = 'context' |
|
1429 | state = 'context' | |
1426 | for newstate, data in scanpatch(fp): |
|
1430 | for newstate, data in scanpatch(fp): | |
@@ -1430,6 +1434,7 b' def parsepatch(fp):' | |||||
1430 | raise PatchError('unhandled transition: %s -> %s' % |
|
1434 | raise PatchError('unhandled transition: %s -> %s' % | |
1431 | (state, newstate)) |
|
1435 | (state, newstate)) | |
1432 | state = newstate |
|
1436 | state = newstate | |
|
1437 | del fp | |||
1433 | return p.finished() |
|
1438 | return p.finished() | |
1434 |
|
1439 | |||
1435 | def pathtransform(path, strip, prefix): |
|
1440 | def pathtransform(path, strip, prefix): |
General Comments 0
You need to be logged in to leave comments.
Login now