412 '''Remove existing message, keeping the rest of the comments fields. |
412 '''Remove existing message, keeping the rest of the comments fields. |
413 If comments contains 'subject: ', message will prepend |
413 If comments contains 'subject: ', message will prepend |
414 the field and a blank line.''' |
414 the field and a blank line.''' |
415 if self.message: |
415 if self.message: |
416 subj = 'subject: ' + self.message[0].lower() |
416 subj = 'subject: ' + self.message[0].lower() |
417 for i in xrange(len(self.comments)): |
417 for i in pycompat.xrange(len(self.comments)): |
418 if subj == self.comments[i].lower(): |
418 if subj == self.comments[i].lower(): |
419 del self.comments[i] |
419 del self.comments[i] |
420 self.message = self.message[2:] |
420 self.message = self.message[2:] |
421 break |
421 break |
422 ci = 0 |
422 ci = 0 |
1798 for f in r: |
1798 for f in r: |
1799 repo.dirstate.remove(f) |
1799 repo.dirstate.remove(f) |
1800 # if the patch excludes a modified file, mark that |
1800 # if the patch excludes a modified file, mark that |
1801 # file with mtime=0 so status can see it. |
1801 # file with mtime=0 so status can see it. |
1802 mm = [] |
1802 mm = [] |
1803 for i in xrange(len(m) - 1, -1, -1): |
1803 for i in pycompat.xrange(len(m) - 1, -1, -1): |
1804 if not match1(m[i]): |
1804 if not match1(m[i]): |
1805 mm.append(m[i]) |
1805 mm.append(m[i]) |
1806 del m[i] |
1806 del m[i] |
1807 for f in m: |
1807 for f in m: |
1808 repo.dirstate.normal(f) |
1808 repo.dirstate.normal(f) |
1906 if not patch: |
1906 if not patch: |
1907 start = self.seriesend() |
1907 start = self.seriesend() |
1908 else: |
1908 else: |
1909 start = self.series.index(patch) + 1 |
1909 start = self.series.index(patch) + 1 |
1910 unapplied = [] |
1910 unapplied = [] |
1911 for i in xrange(start, len(self.series)): |
1911 for i in pycompat.xrange(start, len(self.series)): |
1912 pushable, reason = self.pushable(i) |
1912 pushable, reason = self.pushable(i) |
1913 if pushable: |
1913 if pushable: |
1914 unapplied.append((i, self.series[i])) |
1914 unapplied.append((i, self.series[i])) |
1915 self.explainpushable(i) |
1915 self.explainpushable(i) |
1916 return unapplied |
1916 return unapplied |
1944 if length is None: |
1944 if length is None: |
1945 length = len(self.series) - start |
1945 length = len(self.series) - start |
1946 if not missing: |
1946 if not missing: |
1947 if self.ui.verbose: |
1947 if self.ui.verbose: |
1948 idxwidth = len("%d" % (start + length - 1)) |
1948 idxwidth = len("%d" % (start + length - 1)) |
1949 for i in xrange(start, start + length): |
1949 for i in pycompat.xrange(start, start + length): |
1950 patch = self.series[i] |
1950 patch = self.series[i] |
1951 if patch in applied: |
1951 if patch in applied: |
1952 char, state = 'A', 'applied' |
1952 char, state = 'A', 'applied' |
1953 elif self.pushable(i)[0]: |
1953 elif self.pushable(i)[0]: |
1954 char, state = 'U', 'unapplied' |
1954 char, state = 'U', 'unapplied' |
2089 """ |
2089 """ |
2090 end = 0 |
2090 end = 0 |
2091 def nextpatch(start): |
2091 def nextpatch(start): |
2092 if all_patches or start >= len(self.series): |
2092 if all_patches or start >= len(self.series): |
2093 return start |
2093 return start |
2094 for i in xrange(start, len(self.series)): |
2094 for i in pycompat.xrange(start, len(self.series)): |
2095 p, reason = self.pushable(i) |
2095 p, reason = self.pushable(i) |
2096 if p: |
2096 if p: |
2097 return i |
2097 return i |
2098 self.explainpushable(i) |
2098 self.explainpushable(i) |
2099 return len(self.series) |
2099 return len(self.series) |
2874 args = list(args) |
2874 args = list(args) |
2875 if opts.get(r'list'): |
2875 if opts.get(r'list'): |
2876 if args or opts.get(r'none'): |
2876 if args or opts.get(r'none'): |
2877 raise error.Abort(_('cannot mix -l/--list with options or ' |
2877 raise error.Abort(_('cannot mix -l/--list with options or ' |
2878 'arguments')) |
2878 'arguments')) |
2879 for i in xrange(len(q.series)): |
2879 for i in pycompat.xrange(len(q.series)): |
2880 status(i) |
2880 status(i) |
2881 return |
2881 return |
2882 if not args or args[0][0:1] in '-+': |
2882 if not args or args[0][0:1] in '-+': |
2883 if not q.applied: |
2883 if not q.applied: |
2884 raise error.Abort(_('no patches applied')) |
2884 raise error.Abort(_('no patches applied')) |
3177 opts = pycompat.byteskwargs(opts) |
3177 opts = pycompat.byteskwargs(opts) |
3178 guards = q.active() |
3178 guards = q.active() |
3179 pushable = lambda i: q.pushable(q.applied[i].name)[0] |
3179 pushable = lambda i: q.pushable(q.applied[i].name)[0] |
3180 if args or opts.get('none'): |
3180 if args or opts.get('none'): |
3181 old_unapplied = q.unapplied(repo) |
3181 old_unapplied = q.unapplied(repo) |
3182 old_guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] |
3182 old_guarded = [i for i in pycompat.xrange(len(q.applied)) |
|
3183 if not pushable(i)] |
3183 q.setactive(args) |
3184 q.setactive(args) |
3184 q.savedirty() |
3185 q.savedirty() |
3185 if not args: |
3186 if not args: |
3186 ui.status(_('guards deactivated\n')) |
3187 ui.status(_('guards deactivated\n')) |
3187 if not opts.get('pop') and not opts.get('reapply'): |
3188 if not opts.get('pop') and not opts.get('reapply'): |
3188 unapplied = q.unapplied(repo) |
3189 unapplied = q.unapplied(repo) |
3189 guarded = [i for i in xrange(len(q.applied)) if not pushable(i)] |
3190 guarded = [i for i in pycompat.xrange(len(q.applied)) |
|
3191 if not pushable(i)] |
3190 if len(unapplied) != len(old_unapplied): |
3192 if len(unapplied) != len(old_unapplied): |
3191 ui.status(_('number of unguarded, unapplied patches has ' |
3193 ui.status(_('number of unguarded, unapplied patches has ' |
3192 'changed from %d to %d\n') % |
3194 'changed from %d to %d\n') % |
3193 (len(old_unapplied), len(unapplied))) |
3195 (len(old_unapplied), len(unapplied))) |
3194 if len(guarded) != len(old_guarded): |
3196 if len(guarded) != len(old_guarded): |
3223 else: |
3225 else: |
3224 ui.write(_('no active guards\n')) |
3226 ui.write(_('no active guards\n')) |
3225 reapply = opts.get('reapply') and q.applied and q.applied[-1].name |
3227 reapply = opts.get('reapply') and q.applied and q.applied[-1].name |
3226 popped = False |
3228 popped = False |
3227 if opts.get('pop') or opts.get('reapply'): |
3229 if opts.get('pop') or opts.get('reapply'): |
3228 for i in xrange(len(q.applied)): |
3230 for i in pycompat.xrange(len(q.applied)): |
3229 if not pushable(i): |
3231 if not pushable(i): |
3230 ui.status(_('popping guarded patches\n')) |
3232 ui.status(_('popping guarded patches\n')) |
3231 popped = True |
3233 popped = True |
3232 if i == 0: |
3234 if i == 0: |
3233 q.pop(repo, all=True) |
3235 q.pop(repo, all=True) |