Mercurial > hg-stable
changeset 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 | 0782ac132a41 |
children | 81b35d275a60 |
files | mercurial/commands.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Mar 20 13:53:02 2018 -0700 +++ b/mercurial/commands.py Mon Dec 25 15:56:07 2017 +0530 @@ -5442,8 +5442,7 @@ ('r', 'rev', '', _('revision'), _('REV')) ] + mergetoolopts, _('[-C|-c|-m] [-d DATE] [[-r] REV]')) -def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, - merge=None, tool=None): +def update(ui, repo, node=None, **opts): """update working directory (or switch revisions) Update the repository's working directory to the specified @@ -5498,6 +5497,11 @@ Returns 0 on success, 1 if there are unresolved files. """ + rev = opts.get(r'rev') + date = opts.get(r'date') + clean = opts.get(r'clean') + check = opts.get(r'check') + merge = opts.get(r'merge') if rev and node: raise error.Abort(_("please specify just one revision")) @@ -5542,7 +5546,7 @@ obsfatemsg = obsutil._getfilteredreason(repo, ctxstr, ctx) ui.warn("(%s)\n" % obsfatemsg) - repo.ui.setconfig('ui', 'forcemerge', tool, 'update') + repo.ui.setconfig('ui', 'forcemerge', opts.get(r'tool'), 'update') return hg.updatetotally(ui, repo, rev, brev, clean=clean, updatecheck=updatecheck)