equal
deleted
inserted
replaced
459 """Remove existing message, keeping the rest of the comments fields. |
459 """Remove existing message, keeping the rest of the comments fields. |
460 If comments contains 'subject: ', message will prepend |
460 If comments contains 'subject: ', message will prepend |
461 the field and a blank line.""" |
461 the field and a blank line.""" |
462 if self.message: |
462 if self.message: |
463 subj = b'subject: ' + self.message[0].lower() |
463 subj = b'subject: ' + self.message[0].lower() |
464 for i in pycompat.xrange(len(self.comments)): |
464 for i in range(len(self.comments)): |
465 if subj == self.comments[i].lower(): |
465 if subj == self.comments[i].lower(): |
466 del self.comments[i] |
466 del self.comments[i] |
467 self.message = self.message[2:] |
467 self.message = self.message[2:] |
468 break |
468 break |
469 ci = 0 |
469 ci = 0 |
2038 for f in r: |
2038 for f in r: |
2039 repo.dirstate.update_file_p1(f, p1_tracked=True) |
2039 repo.dirstate.update_file_p1(f, p1_tracked=True) |
2040 # if the patch excludes a modified file, mark that |
2040 # if the patch excludes a modified file, mark that |
2041 # file with mtime=0 so status can see it. |
2041 # file with mtime=0 so status can see it. |
2042 mm = [] |
2042 mm = [] |
2043 for i in pycompat.xrange(len(m) - 1, -1, -1): |
2043 for i in range(len(m) - 1, -1, -1): |
2044 if not match1(m[i]): |
2044 if not match1(m[i]): |
2045 mm.append(m[i]) |
2045 mm.append(m[i]) |
2046 del m[i] |
2046 del m[i] |
2047 for f in m: |
2047 for f in m: |
2048 repo.dirstate.update_file_p1(f, p1_tracked=True) |
2048 repo.dirstate.update_file_p1(f, p1_tracked=True) |
2163 if not patch: |
2163 if not patch: |
2164 start = self.seriesend() |
2164 start = self.seriesend() |
2165 else: |
2165 else: |
2166 start = self.series.index(patch) + 1 |
2166 start = self.series.index(patch) + 1 |
2167 unapplied = [] |
2167 unapplied = [] |
2168 for i in pycompat.xrange(start, len(self.series)): |
2168 for i in range(start, len(self.series)): |
2169 pushable, reason = self.pushable(i) |
2169 pushable, reason = self.pushable(i) |
2170 if pushable: |
2170 if pushable: |
2171 unapplied.append((i, self.series[i])) |
2171 unapplied.append((i, self.series[i])) |
2172 self.explainpushable(i) |
2172 self.explainpushable(i) |
2173 return unapplied |
2173 return unapplied |
2208 if length is None: |
2208 if length is None: |
2209 length = len(self.series) - start |
2209 length = len(self.series) - start |
2210 if not missing: |
2210 if not missing: |
2211 if self.ui.verbose: |
2211 if self.ui.verbose: |
2212 idxwidth = len(b"%d" % (start + length - 1)) |
2212 idxwidth = len(b"%d" % (start + length - 1)) |
2213 for i in pycompat.xrange(start, start + length): |
2213 for i in range(start, start + length): |
2214 patch = self.series[i] |
2214 patch = self.series[i] |
2215 if patch in applied: |
2215 if patch in applied: |
2216 char, state = b'A', b'applied' |
2216 char, state = b'A', b'applied' |
2217 elif self.pushable(i)[0]: |
2217 elif self.pushable(i)[0]: |
2218 char, state = b'U', b'unapplied' |
2218 char, state = b'U', b'unapplied' |
2369 end = 0 |
2369 end = 0 |
2370 |
2370 |
2371 def nextpatch(start): |
2371 def nextpatch(start): |
2372 if all_patches or start >= len(self.series): |
2372 if all_patches or start >= len(self.series): |
2373 return start |
2373 return start |
2374 for i in pycompat.xrange(start, len(self.series)): |
2374 for i in range(start, len(self.series)): |
2375 p, reason = self.pushable(i) |
2375 p, reason = self.pushable(i) |
2376 if p: |
2376 if p: |
2377 return i |
2377 return i |
2378 self.explainpushable(i) |
2378 self.explainpushable(i) |
2379 return len(self.series) |
2379 return len(self.series) |
3387 if opts.get('list'): |
3387 if opts.get('list'): |
3388 if args or opts.get('none'): |
3388 if args or opts.get('none'): |
3389 raise error.Abort( |
3389 raise error.Abort( |
3390 _(b'cannot mix -l/--list with options or arguments') |
3390 _(b'cannot mix -l/--list with options or arguments') |
3391 ) |
3391 ) |
3392 for i in pycompat.xrange(len(q.series)): |
3392 for i in range(len(q.series)): |
3393 status(i) |
3393 status(i) |
3394 return |
3394 return |
3395 if not args or args[0][0:1] in b'-+': |
3395 if not args or args[0][0:1] in b'-+': |
3396 if not q.applied: |
3396 if not q.applied: |
3397 raise error.Abort(_(b'no patches applied')) |
3397 raise error.Abort(_(b'no patches applied')) |
3765 opts = pycompat.byteskwargs(opts) |
3765 opts = pycompat.byteskwargs(opts) |
3766 guards = q.active() |
3766 guards = q.active() |
3767 pushable = lambda i: q.pushable(q.applied[i].name)[0] |
3767 pushable = lambda i: q.pushable(q.applied[i].name)[0] |
3768 if args or opts.get(b'none'): |
3768 if args or opts.get(b'none'): |
3769 old_unapplied = q.unapplied(repo) |
3769 old_unapplied = q.unapplied(repo) |
3770 old_guarded = [ |
3770 old_guarded = [i for i in range(len(q.applied)) if not pushable(i)] |
3771 i for i in pycompat.xrange(len(q.applied)) if not pushable(i) |
|
3772 ] |
|
3773 q.setactive(args) |
3771 q.setactive(args) |
3774 q.savedirty() |
3772 q.savedirty() |
3775 if not args: |
3773 if not args: |
3776 ui.status(_(b'guards deactivated\n')) |
3774 ui.status(_(b'guards deactivated\n')) |
3777 if not opts.get(b'pop') and not opts.get(b'reapply'): |
3775 if not opts.get(b'pop') and not opts.get(b'reapply'): |
3778 unapplied = q.unapplied(repo) |
3776 unapplied = q.unapplied(repo) |
3779 guarded = [ |
3777 guarded = [i for i in range(len(q.applied)) if not pushable(i)] |
3780 i for i in pycompat.xrange(len(q.applied)) if not pushable(i) |
|
3781 ] |
|
3782 if len(unapplied) != len(old_unapplied): |
3778 if len(unapplied) != len(old_unapplied): |
3783 ui.status( |
3779 ui.status( |
3784 _( |
3780 _( |
3785 b'number of unguarded, unapplied patches has ' |
3781 b'number of unguarded, unapplied patches has ' |
3786 b'changed from %d to %d\n' |
3782 b'changed from %d to %d\n' |
3823 else: |
3819 else: |
3824 ui.write(_(b'no active guards\n')) |
3820 ui.write(_(b'no active guards\n')) |
3825 reapply = opts.get(b'reapply') and q.applied and q.applied[-1].name |
3821 reapply = opts.get(b'reapply') and q.applied and q.applied[-1].name |
3826 popped = False |
3822 popped = False |
3827 if opts.get(b'pop') or opts.get(b'reapply'): |
3823 if opts.get(b'pop') or opts.get(b'reapply'): |
3828 for i in pycompat.xrange(len(q.applied)): |
3824 for i in range(len(q.applied)): |
3829 if not pushable(i): |
3825 if not pushable(i): |
3830 ui.status(_(b'popping guarded patches\n')) |
3826 ui.status(_(b'popping guarded patches\n')) |
3831 popped = True |
3827 popped = True |
3832 if i == 0: |
3828 if i == 0: |
3833 q.pop(repo, all=True) |
3829 q.pop(repo, all=True) |