Details
Details
- Reviewers
 pulkit - Group Reviewers
 hg-reviewers - Commits
 - rHGfdaa4233dc18: convert: refactor authormap into separate function for outside use
 
Diff Detail
Diff Detail
- Repository
 - rHG Mercurial
 - Branch
 - default
 - Lint
 No Linters Available - Unit
 No Unit Test Coverage 
Event Timeline
| hgext/convert/convcmd.py | ||
|---|---|---|
| 479 | This will reassign self.authors instead of updating it. readauthormap is called twice in the __init__().  | |
| hgext/convert/convcmd.py | ||
|---|---|---|
| 58 | We disallow usage of default mutable arguments. Hence test-check-code.t says hi. +  hgext/convert/convcmd.py:58:
+   > def readauthormap(ui, authorfile, authors={}):
+   don't use mutable default arguments | |
Comment Actions
Amending the following in flight to make test-check-format.t (or black) happy:
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -55,6 +55,7 @@ svn_source = subversion.svn_source orig_encoding = b'ascii' + def readauthormap(ui, authorfile, authors=None): if authors is None: authors = {} @@ -84,6 +85,7 @@ def readauthormap(ui, authorfile, author ui.status(m % (srcauthor, authors[srcauthor], dstauthor)) return authors + def recode(s): if isinstance(s, pycompat.unicode): return s.encode(pycompat.sysstr(orig_encoding), 'replace')
We disallow usage of default mutable arguments. Hence test-check-code.t says hi.
+ hgext/convert/convcmd.py:58: + > def readauthormap(ui, authorfile, authors={}): + don't use mutable default arguments