Mercurial > hg-stable
comparison hgext/shelve.py @ 32331:bd872f64a8ba
cleanup: use set literals
We no longer support Python 2.6, so we can now use set literals.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 10 Feb 2017 16:56:29 -0800 |
parents | fe3105e6e051 |
children | 46ba2cdda476 |
comparison
equal
deleted
inserted
replaced
32330:2959c3e986e0 | 32331:bd872f64a8ba |
---|---|
350 | 350 |
351 def mutableancestors(ctx): | 351 def mutableancestors(ctx): |
352 """return all mutable ancestors for ctx (included) | 352 """return all mutable ancestors for ctx (included) |
353 | 353 |
354 Much faster than the revset ancestors(ctx) & draft()""" | 354 Much faster than the revset ancestors(ctx) & draft()""" |
355 seen = set([nodemod.nullrev]) | 355 seen = {nodemod.nullrev} |
356 visit = collections.deque() | 356 visit = collections.deque() |
357 visit.append(ctx) | 357 visit.append(ctx) |
358 while visit: | 358 while visit: |
359 ctx = visit.popleft() | 359 ctx = visit.popleft() |
360 yield ctx.node() | 360 yield ctx.node() |
1004 | 1004 |
1005 To delete specific shelved changes, use ``--delete``. To delete | 1005 To delete specific shelved changes, use ``--delete``. To delete |
1006 all shelved changes, use ``--cleanup``. | 1006 all shelved changes, use ``--cleanup``. |
1007 ''' | 1007 ''' |
1008 allowables = [ | 1008 allowables = [ |
1009 ('addremove', set(['create'])), # 'create' is pseudo action | 1009 ('addremove', {'create'}), # 'create' is pseudo action |
1010 ('unknown', set(['create'])), | 1010 ('unknown', {'create'}), |
1011 ('cleanup', set(['cleanup'])), | 1011 ('cleanup', {'cleanup'}), |
1012 # ('date', set(['create'])), # ignored for passing '--date "0 0"' in tests | 1012 # ('date', {'create'}), # ignored for passing '--date "0 0"' in tests |
1013 ('delete', set(['delete'])), | 1013 ('delete', {'delete'}), |
1014 ('edit', set(['create'])), | 1014 ('edit', {'create'}), |
1015 ('list', set(['list'])), | 1015 ('list', {'list'}), |
1016 ('message', set(['create'])), | 1016 ('message', {'create'}), |
1017 ('name', set(['create'])), | 1017 ('name', {'create'}), |
1018 ('patch', set(['patch', 'list'])), | 1018 ('patch', {'patch', 'list'}), |
1019 ('stat', set(['stat', 'list'])), | 1019 ('stat', {'stat', 'list'}), |
1020 ] | 1020 ] |
1021 def checkopt(opt): | 1021 def checkopt(opt): |
1022 if opts.get(opt): | 1022 if opts.get(opt): |
1023 for i, allowable in allowables: | 1023 for i, allowable in allowables: |
1024 if opts[i] and opt not in allowable: | 1024 if opts[i] and opt not in allowable: |