Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG1e508097f570: update: simplify slightly
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
| pulkit |
| hg-reviewers |
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/commands.py (9 lines) | |||
| M | tests/test-update-branches.t (6 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| 1e508097f570 | c85d5fd1a5d9 | Valentin Gatien-Baron | Mar 2 2020, 3:34 PM |
| If you want to revert just one file to an older revision, use | If you want to revert just one file to an older revision, use | ||||
| :hg:`revert [-r REV] NAME`. | :hg:`revert [-r REV] NAME`. | ||||
| 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. | ||||
| Returns 0 on success, 1 if there are unresolved files. | Returns 0 on success, 1 if there are unresolved files. | ||||
| """ | """ | ||||
| cmdutil.check_at_most_one_arg(opts, b'clean', b'check', b'merge') | |||||
| rev = opts.get('rev') | rev = opts.get('rev') | ||||
| date = opts.get('date') | date = opts.get('date') | ||||
| clean = opts.get('clean') | clean = opts.get('clean') | ||||
| check = opts.get('check') | check = opts.get('check') | ||||
| merge = opts.get('merge') | merge = opts.get('merge') | ||||
| if rev and node: | if rev and node: | ||||
| raise error.Abort(_(b"please specify just one revision")) | raise error.Abort(_(b"please specify just one revision")) | ||||
| if ui.configbool(b'commands', b'update.requiredest'): | if ui.configbool(b'commands', b'update.requiredest'): | ||||
| if not node and not rev and not date: | if not node and not rev and not date: | ||||
| raise error.Abort( | raise error.Abort( | ||||
| _(b'you must specify a destination'), | _(b'you must specify a destination'), | ||||
| hint=_(b'for example: hg update ".::"'), | hint=_(b'for example: hg update ".::"'), | ||||
| ) | ) | ||||
| if rev is None or rev == b'': | if rev is None or rev == b'': | ||||
| rev = node | rev = node | ||||
| if date and rev is not None: | if date and rev is not None: | ||||
| raise error.Abort(_(b"you can't specify a revision and a date")) | raise error.Abort(_(b"you can't specify a revision and a date")) | ||||
| if len([x for x in (clean, check, merge) if x]) > 1: | |||||
| raise error.Abort( | |||||
| _( | |||||
| b"can only specify one of -C/--clean, -c/--check, " | |||||
| b"or -m/--merge" | |||||
| ) | |||||
| ) | |||||
| updatecheck = None | updatecheck = None | ||||
| if check: | if check: | ||||
| updatecheck = b'abort' | updatecheck = b'abort' | ||||
| elif merge: | elif merge: | ||||
| updatecheck = b'none' | updatecheck = b'none' | ||||
| with repo.wlock(): | with repo.wlock(): | ||||
| cmdutil.clearunfinished(repo) | cmdutil.clearunfinished(repo) | ||||
| $ norevtest '-c clean same' clean 2 -c | $ norevtest '-c clean same' clean 2 -c | ||||
| 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
| updated to "bd10386d478c: 2" | updated to "bd10386d478c: 2" | ||||
| 1 other heads for branch "default" | 1 other heads for branch "default" | ||||
| parent=2 | parent=2 | ||||
| $ revtest '-cC dirty linear' dirty 1 2 -cC | $ revtest '-cC dirty linear' dirty 1 2 -cC | ||||
| abort: can only specify one of -C/--clean, -c/--check, or -m/--merge | abort: cannot specify both --clean and --check | ||||
| parent=1 | parent=1 | ||||
| M foo | M foo | ||||
| $ revtest '-mc dirty linear' dirty 1 2 -mc | $ revtest '-mc dirty linear' dirty 1 2 -mc | ||||
| abort: can only specify one of -C/--clean, -c/--check, or -m/--merge | abort: cannot specify both --check and --merge | ||||
| parent=1 | parent=1 | ||||
| M foo | M foo | ||||
| $ revtest '-mC dirty linear' dirty 1 2 -mC | $ revtest '-mC dirty linear' dirty 1 2 -mC | ||||
| abort: can only specify one of -C/--clean, -c/--check, or -m/--merge | abort: cannot specify both --clean and --merge | ||||
| parent=1 | parent=1 | ||||
| M foo | M foo | ||||
| $ echo '[commands]' >> .hg/hgrc | $ echo '[commands]' >> .hg/hgrc | ||||
| $ echo 'update.check = abort' >> .hg/hgrc | $ echo 'update.check = abort' >> .hg/hgrc | ||||
| $ revtest 'none dirty linear' dirty 1 2 | $ revtest 'none dirty linear' dirty 1 2 | ||||
| abort: uncommitted changes | abort: uncommitted changes | ||||