Details
Details
- Reviewers
yuja - Group Reviewers
hg-reviewers - Commits
- rHGaad6b9fdfc75: py3: handle keyword arguments in hgext/shelve.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
yuja |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
exchange, | exchange, | ||||
hg, | hg, | ||||
lock as lockmod, | lock as lockmod, | ||||
mdiff, | mdiff, | ||||
merge, | merge, | ||||
node as nodemod, | node as nodemod, | ||||
patch, | patch, | ||||
phases, | phases, | ||||
pycompat, | |||||
registrar, | registrar, | ||||
repair, | repair, | ||||
scmutil, | scmutil, | ||||
templatefilters, | templatefilters, | ||||
util, | util, | ||||
vfs as vfsmod, | vfs as vfsmod, | ||||
) | ) | ||||
hasmq = util.safehasattr(repo, 'mq') | hasmq = util.safehasattr(repo, 'mq') | ||||
if hasmq: | if hasmq: | ||||
saved, repo.mq.checkapplied = repo.mq.checkapplied, False | saved, repo.mq.checkapplied = repo.mq.checkapplied, False | ||||
overrides = {('phases', 'new-commit'): phases.secret} | overrides = {('phases', 'new-commit'): phases.secret} | ||||
try: | try: | ||||
editor_ = False | editor_ = False | ||||
if editor: | if editor: | ||||
editor_ = cmdutil.getcommiteditor(editform='shelve.shelve', | editor_ = cmdutil.getcommiteditor(editform='shelve.shelve', | ||||
**opts) | **pycompat.strkwargs(opts)) | ||||
with repo.ui.configoverride(overrides): | with repo.ui.configoverride(overrides): | ||||
return repo.commit(message, shelveuser, opts.get('date'), | return repo.commit(message, shelveuser, opts.get('date'), | ||||
match, editor=editor_, extra=extra) | match, editor=editor_, extra=extra) | ||||
finally: | finally: | ||||
if hasmq: | if hasmq: | ||||
repo.mq.checkapplied = saved | repo.mq.checkapplied = saved | ||||
def interactivecommitfunc(ui, repo, *pats, **opts): | def interactivecommitfunc(ui, repo, *pats, **opts): | ||||
opts = pycompat.byteskwargs(opts) | |||||
match = scmutil.match(repo['.'], pats, {}) | match = scmutil.match(repo['.'], pats, {}) | ||||
message = opts['message'] | message = opts['message'] | ||||
return commitfunc(ui, repo, message, match, opts) | return commitfunc(ui, repo, message, match, opts) | ||||
return interactivecommitfunc if interactive else commitfunc | return interactivecommitfunc if interactive else commitfunc | ||||
def _nothingtoshelvemessaging(ui, repo, pats, opts): | def _nothingtoshelvemessaging(ui, repo, pats, opts): | ||||
stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | ||||
repo.dirstate.setbranch(repo['.'].branch()) | repo.dirstate.setbranch(repo['.'].branch()) | ||||
commitfunc = getcommitfunc(extra, interactive, editor=True) | commitfunc = getcommitfunc(extra, interactive, editor=True) | ||||
if not interactive: | if not interactive: | ||||
node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | ||||
else: | else: | ||||
node = cmdutil.dorecord(ui, repo, commitfunc, None, | node = cmdutil.dorecord(ui, repo, commitfunc, None, | ||||
False, cmdutil.recordfilter, *pats, | False, cmdutil.recordfilter, *pats, | ||||
**opts) | **pycompat.strkwargs(opts)) | ||||
if not node: | if not node: | ||||
_nothingtoshelvemessaging(ui, repo, pats, opts) | _nothingtoshelvemessaging(ui, repo, pats, opts) | ||||
return 1 | return 1 | ||||
_shelvecreatedcommit(repo, node, name) | _shelvecreatedcommit(repo, node, name) | ||||
if ui.formatted(): | if ui.formatted(): | ||||
desc = util.ellipsis(desc, ui.termwidth()) | desc = util.ellipsis(desc, ui.termwidth()) | ||||
Timestamp in seconds is used to decide order of backups. More | Timestamp in seconds is used to decide order of backups. More | ||||
than ``maxbackups`` backups are kept, if same timestamp | than ``maxbackups`` backups are kept, if same timestamp | ||||
prevents from deciding exact order of them, for safety. | prevents from deciding exact order of them, for safety. | ||||
""" | """ | ||||
with repo.wlock(): | with repo.wlock(): | ||||
return _dounshelve(ui, repo, *shelved, **opts) | return _dounshelve(ui, repo, *shelved, **opts) | ||||
def _dounshelve(ui, repo, *shelved, **opts): | def _dounshelve(ui, repo, *shelved, **opts): | ||||
opts = pycompat.byteskwargs(opts) | |||||
abortf = opts.get('abort') | abortf = opts.get('abort') | ||||
continuef = opts.get('continue') | continuef = opts.get('continue') | ||||
if not abortf and not continuef: | if not abortf and not continuef: | ||||
cmdutil.checkunfinished(repo) | cmdutil.checkunfinished(repo) | ||||
shelved = list(shelved) | shelved = list(shelved) | ||||
if opts.get("name"): | if opts.get("name"): | ||||
shelved.append(opts["name"]) | shelved.append(opts["name"]) | ||||
To see a list of existing shelved changes, use the ``--list`` | To see a list of existing shelved changes, use the ``--list`` | ||||
option. For each shelved change, this will print its name, age, | option. For each shelved change, this will print its name, age, | ||||
and description; use ``--patch`` or ``--stat`` for more details. | and description; use ``--patch`` or ``--stat`` for more details. | ||||
To delete specific shelved changes, use ``--delete``. To delete | To delete specific shelved changes, use ``--delete``. To delete | ||||
all shelved changes, use ``--cleanup``. | all shelved changes, use ``--cleanup``. | ||||
''' | ''' | ||||
opts = pycompat.byteskwargs(opts) | |||||
allowables = [ | allowables = [ | ||||
('addremove', {'create'}), # 'create' is pseudo action | ('addremove', {'create'}), # 'create' is pseudo action | ||||
('unknown', {'create'}), | ('unknown', {'create'}), | ||||
('cleanup', {'cleanup'}), | ('cleanup', {'cleanup'}), | ||||
# ('date', {'create'}), # ignored for passing '--date "0 0"' in tests | # ('date', {'create'}), # ignored for passing '--date "0 0"' in tests | ||||
('delete', {'delete'}), | ('delete', {'delete'}), | ||||
('edit', {'create'}), | ('edit', {'create'}), | ||||
('list', {'list'}), | ('list', {'list'}), |