Mercurial > hg
comparison mercurial/revset.py @ 29002:ea794f2eb19d stable
revset: unindent "if True" block in sort()
It was there to make the previous patch readable.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 23 Apr 2016 16:11:05 +0900 |
parents | 923fa9e06ea0 |
children | f86fa7168059 |
comparison
equal
deleted
inserted
replaced
29001:923fa9e06ea0 | 29002:ea794f2eb19d |
---|---|
1866 elif keys == ["-rev"]: | 1866 elif keys == ["-rev"]: |
1867 revs.sort(reverse=True) | 1867 revs.sort(reverse=True) |
1868 return revs | 1868 return revs |
1869 # sort() is guaranteed to be stable | 1869 # sort() is guaranteed to be stable |
1870 ctxs = [repo[r] for r in revs] | 1870 ctxs = [repo[r] for r in revs] |
1871 if True: | 1871 for k in reversed(keys): |
1872 for k in reversed(keys): | 1872 if k == 'rev': |
1873 if k == 'rev': | 1873 ctxs.sort(key=lambda c: c.rev()) |
1874 ctxs.sort(key=lambda c: c.rev()) | 1874 elif k == '-rev': |
1875 elif k == '-rev': | 1875 ctxs.sort(key=lambda c: c.rev(), reverse=True) |
1876 ctxs.sort(key=lambda c: c.rev(), reverse=True) | 1876 elif k == 'branch': |
1877 elif k == 'branch': | 1877 ctxs.sort(key=lambda c: c.branch()) |
1878 ctxs.sort(key=lambda c: c.branch()) | 1878 elif k == '-branch': |
1879 elif k == '-branch': | 1879 ctxs.sort(key=lambda c: c.branch(), reverse=True) |
1880 ctxs.sort(key=lambda c: c.branch(), reverse=True) | 1880 elif k == 'desc': |
1881 elif k == 'desc': | 1881 ctxs.sort(key=lambda c: c.description()) |
1882 ctxs.sort(key=lambda c: c.description()) | 1882 elif k == '-desc': |
1883 elif k == '-desc': | 1883 ctxs.sort(key=lambda c: c.description(), reverse=True) |
1884 ctxs.sort(key=lambda c: c.description(), reverse=True) | 1884 elif k in 'user author': |
1885 elif k in 'user author': | 1885 ctxs.sort(key=lambda c: c.user()) |
1886 ctxs.sort(key=lambda c: c.user()) | 1886 elif k in '-user -author': |
1887 elif k in '-user -author': | 1887 ctxs.sort(key=lambda c: c.user(), reverse=True) |
1888 ctxs.sort(key=lambda c: c.user(), reverse=True) | 1888 elif k == 'date': |
1889 elif k == 'date': | 1889 ctxs.sort(key=lambda c: c.date()[0]) |
1890 ctxs.sort(key=lambda c: c.date()[0]) | 1890 elif k == '-date': |
1891 elif k == '-date': | 1891 ctxs.sort(key=lambda c: c.date()[0], reverse=True) |
1892 ctxs.sort(key=lambda c: c.date()[0], reverse=True) | 1892 else: |
1893 else: | 1893 raise error.ParseError(_("unknown sort key %r") % k) |
1894 raise error.ParseError(_("unknown sort key %r") % k) | |
1895 return baseset([c.rev() for c in ctxs]) | 1894 return baseset([c.rev() for c in ctxs]) |
1896 | 1895 |
1897 @predicate('subrepo([pattern])') | 1896 @predicate('subrepo([pattern])') |
1898 def subrepo(repo, subset, x): | 1897 def subrepo(repo, subset, x): |
1899 """Changesets that add, modify or remove the given subrepo. If no subrepo | 1898 """Changesets that add, modify or remove the given subrepo. If no subrepo |