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