Mercurial > evolve
comparison hgext/directaccess.py @ 1552:ebebff25b891
check-code: make directaccess.py comply with check-code
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Fri, 04 Dec 2015 15:28:00 -0800 |
parents | 50e683d9835e |
children | 4565b046b850 |
comparison
equal
deleted
inserted
replaced
1551:40e496bc7b54 | 1552:ebebff25b891 |
---|---|
1 """ This extension provides direct access | 1 """ This extension provides direct access |
2 It is the ability to refer and access hidden sha in commands provided that you | 2 It is the ability to refer and access hidden sha in commands provided that you |
3 know their value. | 3 know their value. |
4 For example hg log -r xxx where xxx is a commit has should work whether xxx is | 4 For example hg log -r xxx where xxx is a commit has should work whether xxx is |
5 hidden or not as we assume that the user knows what he is doing when referring | 5 hidden or not as we assume that the user knows what he is doing when referring |
6 to xxx. | 6 to xxx. |
7 """ | 7 """ |
70 hidden = frozenset(r for r in hidden if r not in blocked) | 70 hidden = frozenset(r for r in hidden if r not in blocked) |
71 return hidden | 71 return hidden |
72 | 72 |
73 def setupdirectaccess(): | 73 def setupdirectaccess(): |
74 """ Add two new filtername that behave like visible to provide direct access | 74 """ Add two new filtername that behave like visible to provide direct access |
75 and direct access with warning. Wraps the commands to setup direct access """ | 75 and direct access with warning. Wraps the commands to setup direct access |
76 """ | |
76 repoview.filtertable.update({'visible-directaccess-nowarn': _computehidden}) | 77 repoview.filtertable.update({'visible-directaccess-nowarn': _computehidden}) |
77 repoview.filtertable.update({'visible-directaccess-warn': _computehidden}) | 78 repoview.filtertable.update({'visible-directaccess-warn': _computehidden}) |
78 branchmap.subsettable['visible-directaccess-nowarn'] = 'visible' | 79 branchmap.subsettable['visible-directaccess-nowarn'] = 'visible' |
79 branchmap.subsettable['visible-directaccess-warn'] = 'visible' | 80 branchmap.subsettable['visible-directaccess-warn'] = 'visible' |
80 | 81 |
187 if rev not in repo.changelog: | 188 if rev not in repo.changelog: |
188 repo._explicitaccess.add(rev) | 189 repo._explicitaccess.add(rev) |
189 if prelength != len(repo._explicitaccess): | 190 if prelength != len(repo._explicitaccess): |
190 if repo.filtername != 'visible-directaccess-nowarn': | 191 if repo.filtername != 'visible-directaccess-nowarn': |
191 unhiddencommits = repo._explicitaccess - accessbefore | 192 unhiddencommits = repo._explicitaccess - accessbefore |
192 repo.ui.warn( _("Warning: accessing hidden changesets %s " | 193 repo.ui.warn(_("Warning: accessing hidden changesets %s " |
193 "for write operation\n") % | 194 "for write operation\n") % |
194 (",".join([str(repo.unfiltered()[l]) | 195 (",".join([str(repo.unfiltered()[l]) |
195 for l in unhiddencommits]))) | 196 for l in unhiddencommits]))) |
196 repo.invalidatevolatilesets() | 197 repo.invalidatevolatilesets() |