# HG changeset patch # User Kyle Lippincott # Date 1619824382 25200 # Node ID f38bf44e077f0cc395aa4992f8192ebbf3b9819a # Parent bd2ed1032b4e6e91f4b3e52b6f112393afdb4581 black: make codebase compatible with black v21.4b2 and v20.8b1 I don't know what exact version of black made it care about these whitespace differences, but this is the version I got when I just installed it with `pip3 install black`. I'm intentionally not increasing the version of black required, as I don't want to force everyone to upgrade their version of black, and these fixes are backwards compatible with black v20.8b1. If there are more issues in the future and this becomes a maintenance burden I may do so in a future change. Tested with both versions of black (I got the older version via `pip3 install black==20.8b1`) Differential Revision: https://phab.mercurial-scm.org/D10539 diff -r bd2ed1032b4e -r f38bf44e077f doc/hgmanpage.py --- a/doc/hgmanpage.py Tue May 04 13:28:42 2021 -0400 +++ b/doc/hgmanpage.py Fri Apr 30 16:13:02 2021 -0700 @@ -168,7 +168,7 @@ class Translator(nodes.NodeVisitor): - """""" + """ """ words_and_spaces = re.compile(r'\S+| +|\n') document_start = """Man page generated from reStructuredText.""" diff -r bd2ed1032b4e -r f38bf44e077f hgext/convert/git.py --- a/hgext/convert/git.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/convert/git.py Fri Apr 30 16:13:02 2021 -0700 @@ -527,5 +527,5 @@ return bookmarks def checkrevformat(self, revstr, mapname=b'splicemap'): - """ git revision string is a 40 byte hex """ + """git revision string is a 40 byte hex""" self.checkhexformat(revstr, mapname) diff -r bd2ed1032b4e -r f38bf44e077f hgext/convert/hg.py --- a/hgext/convert/hg.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/convert/hg.py Fri Apr 30 16:13:02 2021 -0700 @@ -729,5 +729,5 @@ return bookmarks.listbookmarks(self.repo) def checkrevformat(self, revstr, mapname=b'splicemap'): - """ Mercurial, revision string is a 40 byte hex """ + """Mercurial, revision string is a 40 byte hex""" self.checkhexformat(revstr, mapname) diff -r bd2ed1032b4e -r f38bf44e077f hgext/convert/subversion.py --- a/hgext/convert/subversion.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/convert/subversion.py Fri Apr 30 16:13:02 2021 -0700 @@ -778,7 +778,7 @@ return revcommit def checkrevformat(self, revstr, mapname=b'splicemap'): - """ fails if revision format does not match the correct format""" + """fails if revision format does not match the correct format""" if not re.match( br'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-' br'[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]' diff -r bd2ed1032b4e -r f38bf44e077f hgext/convert/transport.py --- a/hgext/convert/transport.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/convert/transport.py Fri Apr 30 16:13:02 2021 -0700 @@ -37,7 +37,7 @@ def _create_auth_baton(pool): - """Create a Subversion authentication baton. """ + """Create a Subversion authentication baton.""" import svn.client # Give the client context baton a suite of authentication diff -r bd2ed1032b4e -r f38bf44e077f hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/fsmonitor/pywatchman/__init__.py Fri Apr 30 16:13:02 2021 -0700 @@ -221,7 +221,7 @@ def _win32_strerror(err): - """ expand a win32 error code into a human readable message """ + """expand a win32 error code into a human readable message""" # FormatMessage will allocate memory and assign it here buf = ctypes.c_char_p() @@ -303,20 +303,20 @@ class Transport(object): - """ communication transport to the watchman server """ + """communication transport to the watchman server""" buf = None def close(self): - """ tear it down """ + """tear it down""" raise NotImplementedError() def readBytes(self, size): - """ read size bytes """ + """read size bytes""" raise NotImplementedError() def write(self, buf): - """ write some data """ + """write some data""" raise NotImplementedError() def setTimeout(self, value): @@ -348,7 +348,7 @@ class Codec(object): - """ communication encoding for the watchman server """ + """communication encoding for the watchman server""" transport = None @@ -366,7 +366,7 @@ class UnixSocketTransport(Transport): - """ local unix domain socket transport """ + """local unix domain socket transport""" sock = None @@ -449,7 +449,7 @@ class WindowsNamedPipeTransport(Transport): - """ connect to a named pipe """ + """connect to a named pipe""" def __init__(self, sockpath, timeout): self.sockpath = sockpath @@ -700,7 +700,7 @@ class BserCodec(Codec): - """ use the BSER encoding. This is the default, preferred codec """ + """use the BSER encoding. This is the default, preferred codec""" def __init__(self, transport, value_encoding, value_errors): super(BserCodec, self).__init__(transport) @@ -752,7 +752,7 @@ class Bser2WithFallbackCodec(BserCodec): - """ use BSER v2 encoding """ + """use BSER v2 encoding""" def __init__(self, transport, value_encoding, value_errors): super(Bser2WithFallbackCodec, self).__init__( @@ -824,7 +824,7 @@ class JsonCodec(Codec): - """ Use json codec. This is here primarily for testing purposes """ + """Use json codec. This is here primarily for testing purposes""" json = None @@ -861,7 +861,7 @@ class client(object): - """ Handles the communication with the watchman service """ + """Handles the communication with the watchman service""" sockpath = None transport = None @@ -1011,7 +1011,7 @@ return result["sockname"] def _connect(self): - """ establish transport connection """ + """establish transport connection""" if self.recvConn: if self.pid != os.getpid(): @@ -1176,7 +1176,7 @@ raise def capabilityCheck(self, optional=None, required=None): - """ Perform a server capability check """ + """Perform a server capability check""" res = self.query( "version", {"optional": optional or [], "required": required or []} ) diff -r bd2ed1032b4e -r f38bf44e077f hgext/gpg.py --- a/hgext/gpg.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/gpg.py Fri Apr 30 16:13:02 2021 -0700 @@ -76,7 +76,7 @@ return procutil.filter(data, gpgcmd) def verify(self, data, sig): - """ returns of the good and bad signatures""" + """returns of the good and bad signatures""" sigfile = datafile = None try: # create temporary files diff -r bd2ed1032b4e -r f38bf44e077f hgext/histedit.py --- a/hgext/histedit.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/histedit.py Fri Apr 30 16:13:02 2021 -0700 @@ -510,7 +510,7 @@ return cls(state, rev) def verify(self, prev, expected, seen): - """ Verifies semantic correctness of the rule""" + """Verifies semantic correctness of the rule""" repo = self.repo ha = hex(self.node) self.node = scmutil.resolvehexnodeidprefix(repo, ha) @@ -819,7 +819,7 @@ @action([b'fold', b'f'], _(b'use commit, but combine it with the one above')) class fold(histeditaction): def verify(self, prev, expected, seen): - """ Verifies semantic correctness of the fold rule""" + """Verifies semantic correctness of the fold rule""" super(fold, self).verify(prev, expected, seen) repo = self.repo if not prev: @@ -2403,7 +2403,7 @@ def parserules(rules, state): - """Read the histedit rules string and return list of action objects """ + """Read the histedit rules string and return list of action objects""" rules = [ l for l in (r.strip() for r in rules.splitlines()) diff -r bd2ed1032b4e -r f38bf44e077f hgext/remotenames.py --- a/hgext/remotenames.py Tue May 04 13:28:42 2021 -0400 +++ b/hgext/remotenames.py Fri Apr 30 16:13:02 2021 -0700 @@ -102,7 +102,7 @@ self.loaded = False def _load(self): - """ Read the remotenames file, store entries matching selected kind """ + """Read the remotenames file, store entries matching selected kind""" self.loaded = True repo = self._repo for node, rpath, rname in logexchange.readremotenamefile( @@ -112,7 +112,7 @@ self.potentialentries[name] = (node, rpath, name) def _resolvedata(self, potentialentry): - """ Check that the node for potentialentry exists and return it """ + """Check that the node for potentialentry exists and return it""" if not potentialentry in self.potentialentries: return None node, remote, name = self.potentialentries[potentialentry] @@ -160,13 +160,13 @@ return None def keys(self): - """ Get a list of bookmark or branch names """ + """Get a list of bookmark or branch names""" if not self.loaded: self._load() return self.potentialentries.keys() def iteritems(self): - """ Iterate over (name, node) tuples """ + """Iterate over (name, node) tuples""" if not self.loaded: self._load() @@ -190,7 +190,7 @@ self.clearnames() def clearnames(self): - """ Clear all remote names state """ + """Clear all remote names state""" self.bookmarks = lazyremotenamedict(b"bookmarks", self._repo) self.branches = lazyremotenamedict(b"branches", self._repo) self._invalidatecache() diff -r bd2ed1032b4e -r f38bf44e077f mercurial/branchmap.py --- a/mercurial/branchmap.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/branchmap.py Fri Apr 30 16:13:02 2021 -0700 @@ -220,7 +220,7 @@ self._hasnode = lambda x: True def _verifyclosed(self): - """ verify the closed nodes we have """ + """verify the closed nodes we have""" if self._closedverified: return for node in self._closednodes: @@ -230,7 +230,7 @@ self._closedverified = True def _verifybranch(self, branch): - """ verify head nodes for the given branch. """ + """verify head nodes for the given branch.""" if branch not in self._entries or branch in self._verifiedbranches: return for n in self._entries[branch]: @@ -240,7 +240,7 @@ self._verifiedbranches.add(branch) def _verifyall(self): - """ verifies nodes of all the branches """ + """verifies nodes of all the branches""" needverification = set(self._entries.keys()) - self._verifiedbranches for b in needverification: self._verifybranch(b) @@ -267,7 +267,7 @@ items = iteritems def hasbranch(self, label): - """ checks whether a branch of this name exists or not """ + """checks whether a branch of this name exists or not""" self._verifybranch(label) return label in self._entries @@ -385,7 +385,7 @@ yield (bn, heads) + self._branchtip(heads) def iterheads(self): - """ returns all the heads """ + """returns all the heads""" self._verifyall() return pycompat.itervalues(self._entries) @@ -784,7 +784,7 @@ wlock.release() def _writenames(self, repo): - """ write the new branch names to revbranchcache """ + """write the new branch names to revbranchcache""" if self._rbcnamescount != 0: f = repo.cachevfs.open(_rbcnames, b'ab') if f.tell() == self._rbcsnameslen: @@ -809,7 +809,7 @@ self._rbcnamescount = len(self._names) def _writerevs(self, repo, start): - """ write the new revs to revbranchcache """ + """write the new revs to revbranchcache""" revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) with repo.cachevfs.open(_rbcrevs, b'ab') as f: if f.tell() != start: diff -r bd2ed1032b4e -r f38bf44e077f mercurial/bundle2.py --- a/mercurial/bundle2.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/bundle2.py Fri Apr 30 16:13:02 2021 -0700 @@ -829,7 +829,7 @@ return params def _processallparams(self, paramsblock): - """""" + """ """ params = util.sortdict() for p in paramsblock.split(b' '): p = p.split(b'=', 1) diff -r bd2ed1032b4e -r f38bf44e077f mercurial/cmdutil.py --- a/mercurial/cmdutil.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/cmdutil.py Fri Apr 30 16:13:02 2021 -0700 @@ -326,7 +326,7 @@ def checknotesize(ui, opts): - """ make sure note is of valid format """ + """make sure note is of valid format""" note = opts.get(b'note') if not note: @@ -972,7 +972,7 @@ def changebranch(ui, repo, revs, label, opts): - """ Change the branch name of given revs to label """ + """Change the branch name of given revs to label""" with repo.wlock(), repo.lock(), repo.transaction(b'branches'): # abort in case of uncommitted merge or dirty wdir @@ -1108,7 +1108,7 @@ def logmessage(ui, opts): - """ get the log message according to -m and -l option """ + """get the log message according to -m and -l option""" check_at_most_one_arg(opts, b'message', b'logfile') @@ -3920,7 +3920,7 @@ def hgabortgraft(ui, repo): - """ abort logic for aborting graft using 'hg abort'""" + """abort logic for aborting graft using 'hg abort'""" with repo.wlock(): graftstate = statemod.cmdstate(repo, b'graftstate') return abortgraft(ui, repo, graftstate) diff -r bd2ed1032b4e -r f38bf44e077f mercurial/commandserver.py --- a/mercurial/commandserver.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/commandserver.py Fri Apr 30 16:13:02 2021 -0700 @@ -366,7 +366,7 @@ os.chdir(self.cwd) def getencoding(self): - """ writes the current encoding to the result channel """ + """writes the current encoding to the result channel""" self.cresult.write(encoding.encoding) def serveone(self): diff -r bd2ed1032b4e -r f38bf44e077f mercurial/crecord.py --- a/mercurial/crecord.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/crecord.py Fri Apr 30 16:13:02 2021 -0700 @@ -331,7 +331,7 @@ class uihunk(patchnode): - """ui patch hunk, wraps a hunk and keep track of ui behavior """ + """ui patch hunk, wraps a hunk and keep track of ui behavior""" maxcontext = 3 diff -r bd2ed1032b4e -r f38bf44e077f mercurial/debugcommands.py --- a/mercurial/debugcommands.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/debugcommands.py Fri Apr 30 16:13:02 2021 -0700 @@ -2909,7 +2909,7 @@ @command(b'debugrequires|debugrequirements', [], b'') def debugrequirements(ui, repo): - """ print the current repo requirements """ + """print the current repo requirements""" for r in sorted(repo.requirements): ui.write(b"%s\n" % r) diff -r bd2ed1032b4e -r f38bf44e077f mercurial/mail.py --- a/mercurial/mail.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/mail.py Fri Apr 30 16:13:02 2021 -0700 @@ -269,7 +269,7 @@ def codec2iana(cs): # type: (str) -> str - '''''' + ''' ''' cs = email.charset.Charset(cs).input_charset.lower() # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1" diff -r bd2ed1032b4e -r f38bf44e077f mercurial/mergestate.py --- a/mercurial/mergestate.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/mergestate.py Fri Apr 30 16:13:02 2021 -0700 @@ -307,11 +307,11 @@ yield f def allextras(self): - """ return all extras information stored with the mergestate """ + """return all extras information stored with the mergestate""" return self._stateextras def extras(self, filename): - """ return extras stored with the mergestate for the given filename """ + """return extras stored with the mergestate for the given filename""" return self._stateextras[filename] def _resolve(self, preresolve, dfile, wctx): diff -r bd2ed1032b4e -r f38bf44e077f mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/revlogutils/nodemap.py Fri Apr 30 16:13:02 2021 -0700 @@ -133,7 +133,7 @@ def delete_nodemap(tr, repo, revlog): - """ Delete nodemap data on disk for a given revlog""" + """Delete nodemap data on disk for a given revlog""" if revlog.nodemap_file is None: msg = "calling persist nodemap on a revlog without the feature enabled" raise error.ProgrammingError(msg) diff -r bd2ed1032b4e -r f38bf44e077f mercurial/scmutil.py --- a/mercurial/scmutil.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/scmutil.py Fri Apr 30 16:13:02 2021 -0700 @@ -1563,7 +1563,7 @@ def istreemanifest(repo): - """ returns whether the repository is using treemanifest or not """ + """returns whether the repository is using treemanifest or not""" return requirementsmod.TREEMANIFEST_REQUIREMENT in repo.requirements diff -r bd2ed1032b4e -r f38bf44e077f mercurial/state.py --- a/mercurial/state.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/state.py Fri Apr 30 16:13:02 2021 -0700 @@ -188,7 +188,7 @@ return self._cmdmsg def continuemsg(self): - """ returns appropriate continue message corresponding to command""" + """returns appropriate continue message corresponding to command""" return _(b'hg %s --continue') % (self._opname) def isunfinished(self, repo): diff -r bd2ed1032b4e -r f38bf44e077f mercurial/store.py --- a/mercurial/store.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/store.py Fri Apr 30 16:13:02 2021 -0700 @@ -629,7 +629,7 @@ fp.close() def _checkentries(self, fp, warn): - """ make sure there is no empty string in entries """ + """make sure there is no empty string in entries""" if b'' in self.entries: fp.seek(0) for n, line in enumerate(util.iterfile(fp)): diff -r bd2ed1032b4e -r f38bf44e077f mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/upgrade_utils/actions.py Fri Apr 30 16:13:02 2021 -0700 @@ -847,11 +847,11 @@ self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description)) def has_upgrade_action(self, name): - """ Check whether the upgrade operation will perform this action """ + """Check whether the upgrade operation will perform this action""" return name in self._upgrade_actions_names def print_post_op_messages(self): - """ print post upgrade operation warning messages """ + """print post upgrade operation warning messages""" for a in self.upgrade_actions: if a.postupgrademessage is not None: self.ui.warn(b'%s\n' % a.postupgrademessage) diff -r bd2ed1032b4e -r f38bf44e077f mercurial/upgrade_utils/engine.py --- a/mercurial/upgrade_utils/engine.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/upgrade_utils/engine.py Fri Apr 30 16:13:02 2021 -0700 @@ -134,7 +134,7 @@ sidedatacompanion, oncopiedrevision, ): - """ returns the new revlog object created""" + """returns the new revlog object created""" newrl = None if matchrevlog(upgrade_op.revlogs_to_process, rl_type): ui.note( diff -r bd2ed1032b4e -r f38bf44e077f mercurial/util.py --- a/mercurial/util.py Tue May 04 13:28:42 2021 -0400 +++ b/mercurial/util.py Fri Apr 30 16:13:02 2021 -0700 @@ -143,7 +143,7 @@ def setumask(val): # type: (int) -> None - ''' updates the umask. used by chg server ''' + '''updates the umask. used by chg server''' if pycompat.iswindows: return os.umask(val)