Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 37029:e2a0aaec7d86
commands: use keyword arguments in update function
This will help us in having a dictionary with the values of all the arguments
and we can add more flags without adding an argument to the function.
Differential Revision: https://phab.mercurial-scm.org/D2896
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 25 Dec 2017 15:56:07 +0530 |
parents | 66c0ff381cfc |
children | b235bde38a83 |
comparison
equal
deleted
inserted
replaced
37028:0782ac132a41 | 37029:e2a0aaec7d86 |
---|---|
5440 ('m', 'merge', None, _('merge uncommitted changes')), | 5440 ('m', 'merge', None, _('merge uncommitted changes')), |
5441 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), | 5441 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
5442 ('r', 'rev', '', _('revision'), _('REV')) | 5442 ('r', 'rev', '', _('revision'), _('REV')) |
5443 ] + mergetoolopts, | 5443 ] + mergetoolopts, |
5444 _('[-C|-c|-m] [-d DATE] [[-r] REV]')) | 5444 _('[-C|-c|-m] [-d DATE] [[-r] REV]')) |
5445 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, | 5445 def update(ui, repo, node=None, **opts): |
5446 merge=None, tool=None): | |
5447 """update working directory (or switch revisions) | 5446 """update working directory (or switch revisions) |
5448 | 5447 |
5449 Update the repository's working directory to the specified | 5448 Update the repository's working directory to the specified |
5450 changeset. If no changeset is specified, update to the tip of the | 5449 changeset. If no changeset is specified, update to the tip of the |
5451 current named branch and move the active bookmark (see :hg:`help | 5450 current named branch and move the active bookmark (see :hg:`help |
5496 | 5495 |
5497 See :hg:`help dates` for a list of formats valid for -d/--date. | 5496 See :hg:`help dates` for a list of formats valid for -d/--date. |
5498 | 5497 |
5499 Returns 0 on success, 1 if there are unresolved files. | 5498 Returns 0 on success, 1 if there are unresolved files. |
5500 """ | 5499 """ |
5500 rev = opts.get(r'rev') | |
5501 date = opts.get(r'date') | |
5502 clean = opts.get(r'clean') | |
5503 check = opts.get(r'check') | |
5504 merge = opts.get(r'merge') | |
5501 if rev and node: | 5505 if rev and node: |
5502 raise error.Abort(_("please specify just one revision")) | 5506 raise error.Abort(_("please specify just one revision")) |
5503 | 5507 |
5504 if ui.configbool('commands', 'update.requiredest'): | 5508 if ui.configbool('commands', 'update.requiredest'): |
5505 if not node and not rev and not date: | 5509 if not node and not rev and not date: |
5540 | 5544 |
5541 if ctx.obsolete(): | 5545 if ctx.obsolete(): |
5542 obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx) | 5546 obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx) |
5543 ui.warn("(%s)\n" % obsfatemsg) | 5547 ui.warn("(%s)\n" % obsfatemsg) |
5544 | 5548 |
5545 repo.ui.setconfig('ui', 'forcemerge', tool, 'update') | 5549 repo.ui.setconfig('ui', 'forcemerge', opts.get(r'tool'), 'update') |
5546 | 5550 |
5547 return hg.updatetotally(ui, repo, rev, brev, clean=clean, | 5551 return hg.updatetotally(ui, repo, rev, brev, clean=clean, |
5548 updatecheck=updatecheck) | 5552 updatecheck=updatecheck) |
5549 | 5553 |
5550 @command('verify', []) | 5554 @command('verify', []) |