Show More
@@ -76,7 +76,7 b' def scanpatch(fp):' | |||||
76 | if m: |
|
76 | if m: | |
77 | yield 'range', m.groups() |
|
77 | yield 'range', m.groups() | |
78 | else: |
|
78 | else: | |
79 | raise patch.PatchError('unknown patch content: %r' % line) |
|
79 | yield 'other', line | |
80 |
|
80 | |||
81 | class header(object): |
|
81 | class header(object): | |
82 | """patch header |
|
82 | """patch header | |
@@ -228,6 +228,9 b' def parsepatch(fp):' | |||||
228 | self.headers.append(h) |
|
228 | self.headers.append(h) | |
229 | self.header = h |
|
229 | self.header = h | |
230 |
|
230 | |||
|
231 | def addother(self, line): | |||
|
232 | pass # 'other' lines are ignored | |||
|
233 | ||||
231 | def finished(self): |
|
234 | def finished(self): | |
232 | self.addcontext([]) |
|
235 | self.addcontext([]) | |
233 | return self.headers |
|
236 | return self.headers | |
@@ -239,12 +242,14 b' def parsepatch(fp):' | |||||
239 | 'range': addrange}, |
|
242 | 'range': addrange}, | |
240 | 'context': {'file': newfile, |
|
243 | 'context': {'file': newfile, | |
241 | 'hunk': addhunk, |
|
244 | 'hunk': addhunk, | |
242 |
'range': addrange |
|
245 | 'range': addrange, | |
|
246 | 'other': addother}, | |||
243 | 'hunk': {'context': addcontext, |
|
247 | 'hunk': {'context': addcontext, | |
244 | 'file': newfile, |
|
248 | 'file': newfile, | |
245 | 'range': addrange}, |
|
249 | 'range': addrange}, | |
246 | 'range': {'context': addcontext, |
|
250 | 'range': {'context': addcontext, | |
247 | 'hunk': addhunk}, |
|
251 | 'hunk': addhunk}, | |
|
252 | 'other': {'other': addother}, | |||
248 | } |
|
253 | } | |
249 |
|
254 | |||
250 | p = parser() |
|
255 | p = parser() |
@@ -1036,10 +1036,10 b' Abort early when a merge is in progress' | |||||
1036 | $ hg up -C |
|
1036 | $ hg up -C | |
1037 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1037 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1038 |
|
1038 | |||
1039 | Editing patch |
|
1039 | Editing patch (and ignoring trailing text) | |
1040 |
|
1040 | |||
1041 | $ cat > editor.sh << '__EOF__' |
|
1041 | $ cat > editor.sh << '__EOF__' | |
1042 | > sed -e 7d -e '5s/^-/ /' "$1" > tmp |
|
1042 | > sed -e 7d -e '5s/^-/ /' -e '/^# ---/itrailing\nditto' "$1" > tmp | |
1043 | > mv tmp "$1" |
|
1043 | > mv tmp "$1" | |
1044 | > __EOF__ |
|
1044 | > __EOF__ | |
1045 | $ cat > editedfile << '__EOF__' |
|
1045 | $ cat > editedfile << '__EOF__' | |
@@ -1201,6 +1201,8 b' Malformed patch - error handling' | |||||
1201 | abort: error parsing patch: unhandled transition: range -> range |
|
1201 | abort: error parsing patch: unhandled transition: range -> range | |
1202 | [255] |
|
1202 | [255] | |
1203 |
|
1203 | |||
|
1204 | random text in random positions is still an error | |||
|
1205 | ||||
1204 | $ cat > editor.sh << '__EOF__' |
|
1206 | $ cat > editor.sh << '__EOF__' | |
1205 | > sed -e '/^@/iother' "$1" > tmp |
|
1207 | > sed -e '/^@/iother' "$1" > tmp | |
1206 | > mv tmp "$1" |
|
1208 | > mv tmp "$1" | |
@@ -1220,7 +1222,7 b' Malformed patch - error handling' | |||||
1220 | +This is the second line |
|
1222 | +This is the second line | |
1221 | +This line has been added |
|
1223 | +This line has been added | |
1222 | record this change to 'editedfile'? [Ynesfdaq?] |
|
1224 | record this change to 'editedfile'? [Ynesfdaq?] | |
1223 |
abort: error parsing patch: un |
|
1225 | abort: error parsing patch: unhandled transition: file -> other | |
1224 | [255] |
|
1226 | [255] | |
1225 |
|
1227 | |||
1226 | $ hg up -C |
|
1228 | $ hg up -C |
General Comments 0
You need to be logged in to leave comments.
Login now