[Updated] [+ ] D10862: cmdutil: make amend() take str-keyed opts

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jun 18 21:55:16 UTC 2021


martinvonz updated this revision to Diff 28604.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10862?vs=28542&id=28604

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10862/new/

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1478,9 +1478,8 @@
   > command = registrar.command(cmdtable)
   > @command(b"amendtransient",[], _(b'hg amendtransient [rev]'))
   > def amend(ui, repo, *pats, **opts):
-  >   opts = pycompat.byteskwargs(opts)
-  >   opts[b'message'] = b'Test'
-  >   opts[b'logfile'] = None
+  >   opts['message'] = b'Test'
+  >   opts['logfile'] = None
   >   cmdutil.amend(ui, repo, repo[b'.'], {}, pats, opts)
   >   ui.write(b'%s\n' % stringutil.pprint(repo.changelog.headrevs()))
   > EOF
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2135,8 +2135,8 @@
         if not obsolete.isenabled(repo, obsolete.createmarkersopt):
             cmdutil.checkunfinished(repo)
 
+        node = cmdutil.amend(ui, repo, old, extra, pats, opts)
         opts = pycompat.byteskwargs(opts)
-        node = cmdutil.amend(ui, repo, old, extra, pats, opts)
         if node == old.node():
             ui.status(_(b"nothing changed\n"))
             return 1
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2783,6 +2783,7 @@
 
 
 def amend(ui, repo, old, extra, pats, opts):
+    opts = pycompat.byteskwargs(opts)
     # avoid cycle context -> subrepo -> cmdutil
     from . import context
 



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210618/cc186635/attachment-0002.html>


More information about the Mercurial-patches mailing list