Patchwork D2896: commands: use keyword arguments in update function

login
register
mail settings
Submitter phabricator
Date March 19, 2018, 5:29 p.m.
Message ID <differential-rev-PHID-DREV-5hzfuzelnpqtzp6fp3ql-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29634/
State Superseded
Headers show

Comments

phabricator - March 19, 2018, 5:29 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2896

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - March 21, 2018, 4:20 a.m.
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  Python 3?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2896

To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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('rev')
+    date = opts.get('date')
+    clean = opts.get('clean')
+    check = opts.get('check')
+    merge = opts.get('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('tool'), 'update')
 
         return hg.updatetotally(ui, repo, rev, brev, clean=clean,
                                 updatecheck=updatecheck)