equal
deleted
inserted
replaced
924 if line.startswith('diff --git'): |
924 if line.startswith('diff --git'): |
925 self.diffopts().git = True |
925 self.diffopts().git = True |
926 break |
926 break |
927 |
927 |
928 msg = opts.get('msg', '').rstrip() |
928 msg = opts.get('msg', '').rstrip() |
|
929 if msg and comments: |
|
930 # Remove existing message, keeping the rest of the comments |
|
931 # fields. |
|
932 # If comments contains 'subject: ', message will prepend |
|
933 # the field and a blank line. |
|
934 if message: |
|
935 subj = 'subject: ' + message[0].lower() |
|
936 for i in xrange(len(comments)): |
|
937 if subj == comments[i].lower(): |
|
938 del comments[i] |
|
939 message = message[2:] |
|
940 break |
|
941 ci = 0 |
|
942 for mi in xrange(len(message)): |
|
943 while message[mi] != comments[ci]: |
|
944 ci += 1 |
|
945 del comments[ci] |
929 if msg: |
946 if msg: |
930 if comments: |
|
931 # Remove existing message. |
|
932 ci = 0 |
|
933 subj = None |
|
934 for mi in xrange(len(message)): |
|
935 if comments[ci].lower().startswith('subject: '): |
|
936 subj = comments[ci][9:] |
|
937 while message[mi] != comments[ci] and message[mi] != subj: |
|
938 ci += 1 |
|
939 del comments[ci] |
|
940 comments.append(msg) |
947 comments.append(msg) |
941 |
948 |
942 patchf.seek(0) |
949 patchf.seek(0) |
943 patchf.truncate() |
950 patchf.truncate() |
944 |
951 |