Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 35499:b55a142f00c5
scmutil: use a tuple of possible values instead of using startswith()
This patch also adds a review comment which is helpful as inline comment.
Differential Revision: https://phab.mercurial-scm.org/D1761
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 26 Dec 2017 22:56:07 +0530 |
parents | 8bb90cc4668e |
children | 1a09dad8b85a |
comparison
equal
deleted
inserted
replaced
35498:dfaf9f10e2e5 | 35499:b55a142f00c5 |
---|---|
1317 """ | 1317 """ |
1318 if not repo.filtername or not repo.ui.configbool('experimental', | 1318 if not repo.filtername or not repo.ui.configbool('experimental', |
1319 'directaccess'): | 1319 'directaccess'): |
1320 return repo | 1320 return repo |
1321 | 1321 |
1322 if not repo.filtername.startswith('visible'): | 1322 if repo.filtername not in ('visible', 'visible-hidden'): |
1323 return repo | 1323 return repo |
1324 | 1324 |
1325 symbols = set() | 1325 symbols = set() |
1326 for spec in specs: | 1326 for spec in specs: |
1327 try: | 1327 try: |
1343 unfi = repo.unfiltered() | 1343 unfi = repo.unfiltered() |
1344 revstr = ", ".join([pycompat.bytestr(unfi[l]) for l in revs]) | 1344 revstr = ", ".join([pycompat.bytestr(unfi[l]) for l in revs]) |
1345 repo.ui.warn(_("warning: accessing hidden changesets for write " | 1345 repo.ui.warn(_("warning: accessing hidden changesets for write " |
1346 "operation: %s\n") % revstr) | 1346 "operation: %s\n") % revstr) |
1347 | 1347 |
1348 # we have to use new filtername to separate branch/tags cache until we can | |
1349 # disbale these cache when revisions are dynamically pinned. | |
1348 return repo.filtered('visible-hidden', revs) | 1350 return repo.filtered('visible-hidden', revs) |
1349 | 1351 |
1350 def _getrevsfromsymbols(repo, symbols): | 1352 def _getrevsfromsymbols(repo, symbols): |
1351 """parse the list of symbols and returns a set of revision numbers of hidden | 1353 """parse the list of symbols and returns a set of revision numbers of hidden |
1352 changesets present in symbols""" | 1354 changesets present in symbols""" |