Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG9b1536b02221: backout: use context manager for locks
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/commands.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 14 2018, 6:08 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
See :hg:`help dates` for a list of formats valid for -d/--date. | See :hg:`help dates` for a list of formats valid for -d/--date. | ||||
See :hg:`help revert` for a way to restore files to the state | See :hg:`help revert` for a way to restore files to the state | ||||
of another revision. | of another revision. | ||||
Returns 0 on success, 1 if nothing to backout or there are unresolved | Returns 0 on success, 1 if nothing to backout or there are unresolved | ||||
files. | files. | ||||
''' | ''' | ||||
wlock = lock = None | with repo.wlock(), repo.lock(): | ||||
try: | |||||
wlock = repo.wlock() | |||||
lock = repo.lock() | |||||
return _dobackout(ui, repo, node, rev, **opts) | return _dobackout(ui, repo, node, rev, **opts) | ||||
finally: | |||||
release(lock, wlock) | |||||
def _dobackout(ui, repo, node=None, rev=None, **opts): | def _dobackout(ui, repo, node=None, rev=None, **opts): | ||||
opts = pycompat.byteskwargs(opts) | opts = pycompat.byteskwargs(opts) | ||||
if opts.get('commit') and opts.get('no_commit'): | if opts.get('commit') and opts.get('no_commit'): | ||||
raise error.Abort(_("cannot use --commit with --no-commit")) | raise error.Abort(_("cannot use --commit with --no-commit")) | ||||
if opts.get('merge') and opts.get('no_commit'): | if opts.get('merge') and opts.get('no_commit'): | ||||
raise error.Abort(_("cannot use --merge with --no-commit")) | raise error.Abort(_("cannot use --merge with --no-commit")) | ||||