Mercurial > hg
comparison hgext/mq.py @ 19500:a96565abbd59 stable
mq: rename next() to nextpatch() to avoid confusing a future check-code patch
next() is a builtin starting in 2.6, so it's also nice to avoid
shadowing the builtin.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Thu, 25 Jul 2013 10:42:36 -0400 |
parents | ee1af0f33d0e |
children | 6bbce5efc67b 478f3379768a |
comparison
equal
deleted
inserted
replaced
19499:81318ca090a2 | 19500:a96565abbd59 |
---|---|
1875 """If all_patches is False, return the index of the next pushable patch | 1875 """If all_patches is False, return the index of the next pushable patch |
1876 in the series, or the series length. If all_patches is True, return the | 1876 in the series, or the series length. If all_patches is True, return the |
1877 index of the first patch past the last applied one. | 1877 index of the first patch past the last applied one. |
1878 """ | 1878 """ |
1879 end = 0 | 1879 end = 0 |
1880 def next(start): | 1880 def nextpatch(start): |
1881 if all_patches or start >= len(self.series): | 1881 if all_patches or start >= len(self.series): |
1882 return start | 1882 return start |
1883 for i in xrange(start, len(self.series)): | 1883 for i in xrange(start, len(self.series)): |
1884 p, reason = self.pushable(i) | 1884 p, reason = self.pushable(i) |
1885 if p: | 1885 if p: |
1890 p = self.applied[-1].name | 1890 p = self.applied[-1].name |
1891 try: | 1891 try: |
1892 end = self.series.index(p) | 1892 end = self.series.index(p) |
1893 except ValueError: | 1893 except ValueError: |
1894 return 0 | 1894 return 0 |
1895 return next(end + 1) | 1895 return nextpatch(end + 1) |
1896 return next(end) | 1896 return nextpatch(end) |
1897 | 1897 |
1898 def appliedname(self, index): | 1898 def appliedname(self, index): |
1899 pname = self.applied[index].name | 1899 pname = self.applied[index].name |
1900 if not self.ui.verbose: | 1900 if not self.ui.verbose: |
1901 p = pname | 1901 p = pname |