diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1379,7 +1379,7 @@ t = repo.manifestlog._revlog.lookup(rev) except ValueError: raise error.Abort( - b'manifest revision must be integer or full ' b'node' + b'manifest revision must be integer or full node' ) def d(): diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -439,7 +439,7 @@ branch = ctx.branch() if denybranches and denybranches(branch): raise error.Abort( - _(b'acl: user "%s" denied on branch "%s"' b' (changeset "%s")') + _(b'acl: user "%s" denied on branch "%s" (changeset "%s")') % (user, branch, ctx) ) if allowbranches and not allowbranches(branch): @@ -457,7 +457,7 @@ for f in ctx.files(): if deny and deny(f): raise error.Abort( - _(b'acl: user "%s" denied on "%s"' b' (changeset "%s")') + _(b'acl: user "%s" denied on "%s" (changeset "%s")') % (user, f, ctx) ) if allow and not allow(f): diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -169,7 +169,7 @@ """ if not re.match(br'[0-9a-fA-F]{40,40}$', revstr): raise error.Abort( - _(b'%s entry %s is not a valid revision' b' identifier') + _(b'%s entry %s is not a valid revision identifier') % (mapname, revstr) ) diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -124,7 +124,7 @@ re_01 = re.compile(b'cvs \\[r?log aborted\\]: (.+)$') re_02 = re.compile(b'cvs (r?log|server): (.+)\n$') re_03 = re.compile( - b"(Cannot access.+CVSROOT)|" b"(can't create temporary directory.+)$" + b"(Cannot access.+CVSROOT)|(can't create temporary directory.+)$" ) re_10 = re.compile(b'Working file: (.+)$') re_20 = re.compile(b'symbolic names:') @@ -328,7 +328,7 @@ state = 5 else: assert not re_32.match(line), _( - b'must have at least ' b'some revisions' + b'must have at least some revisions' ) elif state == 5: @@ -563,7 +563,7 @@ raise error.Abort( inst, hint=_( - b'check convert.cvsps.logencoding' b' configuration' + b'check convert.cvsps.logencoding configuration' ), ) else: @@ -573,9 +573,7 @@ b" CVS log message for %s of %s" ) % (revstr(entry.revision), entry.file), - hint=_( - b'check convert.cvsps.logencoding' b' configuration' - ), + hint=_(b'check convert.cvsps.logencoding configuration'), ) hook.hook(ui, None, b"cvslog", True, log=log) diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -259,7 +259,7 @@ # This can happen if a file is in the repo that has permissions # 160000, but there is no .gitmodules file. self.ui.warn( - _(b"warning: cannot read submodules config file in " b"%s\n") + _(b"warning: cannot read submodules config file in %s\n") % version ) return diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -263,7 +263,7 @@ def getchanges(self, rev, full): if full: raise error.Abort( - _(b"convert from monotone does not support " b"--full") + _(b"convert from monotone does not support --full") ) revision = self.mtnrun(b"get_revision", rev).split(b"\n\n") files = {} @@ -369,7 +369,7 @@ version = float(versionstr) except Exception: raise error.Abort( - _(b"unable to determine mtn automate interface " b"version") + _(b"unable to determine mtn automate interface version") ) if version >= 12.0: diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -189,7 +189,7 @@ """ if svn is None: raise error.Abort( - _(b'debugsvnlog could not load Subversion python ' b'bindings') + _(b'debugsvnlog could not load Subversion python bindings') ) args = decodeargs(ui.fin.read()) @@ -647,7 +647,7 @@ revstr, ): raise error.Abort( - _(b'%s entry %s is not a valid revision' b' identifier') + _(b'%s entry %s is not a valid revision identifier') % (mapname, revstr) ) diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -460,7 +460,7 @@ continue if inconsistenteol(data): raise errormod.Abort( - _(b"inconsistent newline style " b"in %s\n") % f + _(b"inconsistent newline style in %s\n") % f ) return super(eolrepo, self).commitctx(ctx, error, origctx) diff --git a/hgext/fastannotate/commands.py b/hgext/fastannotate/commands.py --- a/hgext/fastannotate/commands.py +++ b/hgext/fastannotate/commands.py @@ -93,7 +93,7 @@ b'l', b'line-number', None, - _(b'show line number at the first ' b'appearance'), + _(b'show line number at the first appearance'), ), ( b'e', @@ -127,7 +127,7 @@ b'', b'rebuild', None, - _(b'rebuild cache even if it exists ' b'(EXPERIMENTAL)'), + _(b'rebuild cache even if it exists (EXPERIMENTAL)'), ), ] + commands.diffwsopts diff --git a/hgext/fastannotate/support.py b/hgext/fastannotate/support.py --- a/hgext/fastannotate/support.py +++ b/hgext/fastannotate/support.py @@ -116,7 +116,7 @@ return _doannotate(self, follow, diffopts) except Exception as ex: self._repo.ui.debug( - b'fastannotate: falling back to the vanilla ' b'annotate: %r\n' % ex + b'fastannotate: falling back to the vanilla annotate: %r\n' % ex ) return orig(self, follow=follow, skiprevs=skiprevs, diffopts=diffopts) diff --git a/hgext/fetch.py b/hgext/fetch.py --- a/hgext/fetch.py +++ b/hgext/fetch.py @@ -188,7 +188,7 @@ message, opts[b'user'], opts[b'date'], editor=editor ) ui.status( - _(b'new changeset %d:%s merges remote changes ' b'with local\n') + _(b'new changeset %d:%s merges remote changes with local\n') % (repo.changelog.rev(n), short(n)) ) diff --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -423,7 +423,7 @@ b'(%ld::) - (%ld)', revs, revs ): raise error.Abort( - _(b'can only fix a changeset together ' b'with all its descendants') + _(b'can only fix a changeset together with all its descendants') ) diff --git a/hgext/githelp.py b/hgext/githelp.py --- a/hgext/githelp.py +++ b/hgext/githelp.py @@ -66,7 +66,7 @@ if len(args) == 0 or (len(args) == 1 and args[0] == b'git'): raise error.Abort( - _(b'missing git command - ' b'usage: hg githelp -- ') + _(b'missing git command - usage: hg githelp -- ') ) if args[0] == b'git': diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -76,7 +76,7 @@ fp = os.fdopen(fd, r'wb') fp.write(data) fp.close() - gpgcmd = b"%s --logger-fd 1 --status-fd 1 --verify " b"\"%s\" \"%s\"" % ( + gpgcmd = b"%s --logger-fd 1 --status-fd 1 --verify \"%s\" \"%s\"" % ( self.path, sigfile, datafile, @@ -179,12 +179,12 @@ continue if key[0] == b"EXPSIG": ui.write( - _(b"%s Note: Signature has expired" b" (signed by: \"%s\")\n") + _(b"%s Note: Signature has expired (signed by: \"%s\")\n") % (prefix, key[2]) ) elif key[0] == b"EXPKEYSIG": ui.write( - _(b"%s Note: This key has expired" b" (signed by: \"%s\")\n") + _(b"%s Note: This key has expired (signed by: \"%s\")\n") % (prefix, key[2]) ) validkeys.append((key[1], key[2], key[3])) @@ -304,7 +304,7 @@ ] if len(nodes) > 1: raise error.Abort( - _(b'uncommitted merge - please provide a ' b'specific revision') + _(b'uncommitted merge - please provide a specific revision') ) if not nodes: nodes = [repo.changelog.tip()] diff --git a/hgext/highlight/highlight.py b/hgext/highlight/highlight.py --- a/hgext/highlight/highlight.py +++ b/hgext/highlight/highlight.py @@ -39,7 +39,7 @@ HtmlFormatter = pygments.formatters.HtmlFormatter SYNTAX_CSS = ( - b'\n' + b'\n' ) diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1884,7 +1884,7 @@ elif goal == b'edit-plan': if any((outg, revs, freeargs)): raise error.Abort( - _(b'only --commands argument allowed with ' b'--edit-plan') + _(b'only --commands argument allowed with --edit-plan') ) else: if state.inprogress(): diff --git a/hgext/infinitepush/sqlindexapi.py b/hgext/infinitepush/sqlindexapi.py --- a/hgext/infinitepush/sqlindexapi.py +++ b/hgext/infinitepush/sqlindexapi.py @@ -70,7 +70,7 @@ raise indexapi.indexexception(b"SQL connection already open") if self.sqlcursor: raise indexapi.indexexception( - b"SQL cursor already open without" b" connection" + b"SQL cursor already open without connection" ) retry = 3 while True: @@ -126,7 +126,7 @@ self.sqlconnect() self.log.info(b"ADD BUNDLE %r %r" % (self.reponame, bundleid)) self.sqlcursor.execute( - b"INSERT INTO bundles(bundle, reponame) VALUES " b"(%s, %s)", + b"INSERT INTO bundles(bundle, reponame) VALUES (%s, %s)", params=(bundleid, self.reponame), ) for ctx in nodesctx: diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -593,7 +593,7 @@ diffopts.git = self.gitmode == b'yes' else: raise error.Abort( - _(b'mq.git option can be auto/keep/yes/no' b' got %s') + _(b'mq.git option can be auto/keep/yes/no got %s') % self.gitmode ) if patchfn: @@ -1113,7 +1113,7 @@ if patcherr: self.ui.warn( - _(b"patch failed, rejects left in working " b"directory\n") + _(b"patch failed, rejects left in working directory\n") ) err = 2 break @@ -1214,7 +1214,7 @@ def delete(self, repo, patches, opts): if not patches and not opts.get(b'rev'): raise error.Abort( - _(b'qdelete requires at least one revision or ' b'patch name') + _(b'qdelete requires at least one revision or patch name') ) realpatches = [] @@ -1295,7 +1295,7 @@ if name != name.strip(): # whitespace is stripped by parseseries() raise error.Abort( - _(b'patch name cannot begin or end with ' b'whitespace') + _(b'patch name cannot begin or end with whitespace') ) for prefix in (b'.hg', b'.mq'): if name.startswith(prefix): @@ -1629,11 +1629,11 @@ ) if move: raise error.Abort( - _(b'cannot use --exact and --move ' b'together') + _(b'cannot use --exact and --move together') ) if self.applied: raise error.Abort( - _(b'cannot push --exact with applied ' b'patches') + _(b'cannot push --exact with applied patches') ) root = self.series[start] target = patchheader(self.join(root), self.plainmode).parent @@ -2390,7 +2390,7 @@ if rev: if files: raise error.Abort( - _(b'option "-r" not valid when importing ' b'files') + _(b'option "-r" not valid when importing files') ) rev = scmutil.revrange(repo, rev) rev.sort(reverse=True) @@ -2398,7 +2398,7 @@ raise error.Abort(_(b'no files or revisions specified')) if (len(files) > 1 or len(rev) > 1) and patchname: raise error.Abort( - _(b'option "-n" not valid when importing multiple ' b'patches') + _(b'option "-n" not valid when importing multiple patches') ) imported = [] if rev: @@ -2408,7 +2408,7 @@ heads = repo.changelog.heads(repo.changelog.node(rev.first())) if len(heads) > 1: raise error.Abort( - _(b'revision %d is the root of more than one ' b'branch') + _(b'revision %d is the root of more than one branch') % rev.last() ) if self.applied: @@ -2419,7 +2419,7 @@ ) if heads != [self.applied[-1].node]: raise error.Abort( - _(b'revision %d is not the parent of ' b'the queue') + _(b'revision %d is not the parent of the queue') % rev.first() ) base = repo.changelog.rev(self.applied[0].node) @@ -2447,7 +2447,7 @@ ) if lastparent and lastparent != r: raise error.Abort( - _(b'revision %d is not the parent of ' b'%d') + _(b'revision %d is not the parent of %d') % (r, lastparent) ) lastparent = p1 @@ -2849,7 +2849,7 @@ hg.peer(ui, opts, patchespath) except error.RepoError: raise error.Abort( - _(b'versioned patch repository not found' b' (see init --mq)') + _(b'versioned patch repository not found (see init --mq)') ) qbase, destrev = None, None if sr.local(): @@ -3359,7 +3359,7 @@ if opts.get(r'list'): if args or opts.get(r'none'): raise error.Abort( - _(b'cannot mix -l/--list with options or ' b'arguments') + _(b'cannot mix -l/--list with options or arguments') ) for i in pycompat.xrange(len(q.series)): status(i) @@ -3671,13 +3671,12 @@ if os.path.exists(newpath): if not os.path.isdir(newpath): raise error.Abort( - _(b'destination %s exists and is not ' b'a directory') + _(b'destination %s exists and is not a directory') % newpath ) if not opts.get(b'force'): raise error.Abort( - _(b'destination %s exists, ' b'use -f to force') - % newpath + _(b'destination %s exists, use -f to force') % newpath ) else: newpath = savename(path) @@ -4157,7 +4156,7 @@ for patch in mqtags: if patch[1] in tags: self.ui.warn( - _(b'tag %s overrides mq patch of the same ' b'name\n') + _(b'tag %s overrides mq patch of the same name\n') % patch[1] ) else: @@ -4191,13 +4190,13 @@ repopath = args[0] if not hg.islocal(repopath): raise error.Abort( - _(b'only a local queue repository ' b'may be initialized') + _(b'only a local queue repository may be initialized') ) else: repopath = cmdutil.findrepo(encoding.getcwd()) if not repopath: raise error.Abort( - _(b'there is no Mercurial repository here ' b'(.hg not found)') + _(b'there is no Mercurial repository here (.hg not found)') ) repo = hg.repository(ui, repopath) return qinit(ui, repo, True) diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -249,7 +249,7 @@ if not force: raise error.Abort( _(b'local changes found'), - hint=_(b'use --force-delete-local-changes to ' b'ignore'), + hint=_(b'use --force-delete-local-changes to ignore'), ) with ui.uninterruptible(): diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -377,7 +377,7 @@ continue if len(subs) == 0: self.ui.debug( - b'notify: no subscribers to selected repo ' b'and revset\n' + b'notify: no subscribers to selected repo and revset\n' ) return diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -162,7 +162,7 @@ # destination before patchbombing anything. publicurl = repo.ui.config(b'patchbomb', b'publicurl') if publicurl: - return b'Available At %s\n' b'# hg pull %s -r %s' % ( + return b'Available At %s\n# hg pull %s -r %s' % ( publicurl, publicurl, ctx, @@ -343,9 +343,7 @@ prev = repo[b'.'].rev() for r in revs: if r == prev and (repo[None].files() or repo[None].deleted()): - ui.warn( - _(b'warning: working directory has ' b'uncommitted changes\n') - ) + ui.warn(_(b'warning: working directory has uncommitted changes\n')) output = stringio() cmdutil.exportfile( repo, [r], output, opts=patch.difffeatureopts(ui, opts, git=True) @@ -391,7 +389,7 @@ body = open(opts.get(r'desc')).read() else: ui.write( - _(b'\nWrite the introductory message for the ' b'patch series.\n\n') + _(b'\nWrite the introductory message for the patch series.\n\n') ) body = ui.edit( defaultbody, sender, repopath=repo.path, action=b'patchbombbody' @@ -911,7 +909,7 @@ ui.write(ds, label=b'patchbomb.diffstats') ui.write(b'\n') if ui.promptchoice( - _(b'are you sure you want to send (yn)?' b'$$ &Yes $$ &No') + _(b'are you sure you want to send (yn)?$$ &Yes $$ &No') ): raise error.Abort(_(b'patchbomb canceled')) diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -830,7 +830,7 @@ ) if ui.promptchoice( - _(b'Send the above changes to %s (yn)?' b'$$ &Yes $$ &No') % url + _(b'Send the above changes to %s (yn)?$$ &Yes $$ &No') % url ): return False diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -469,7 +469,7 @@ branches.add(repo[rev].branch()) if len(branches) > 1: raise error.Abort( - _(b'cannot collapse multiple named ' b'branches') + _(b'cannot collapse multiple named branches') ) # Calculate self.obsoletenotrebased @@ -589,14 +589,11 @@ elif rev in self.obsoletenotrebased: succ = self.obsoletenotrebased[rev] if succ is None: - msg = ( - _(b'note: not rebasing %s, it has no ' b'successor\n') - % desc - ) + msg = _(b'note: not rebasing %s, it has no successor\n') % desc else: succdesc = _ctxdesc(repo[succ]) msg = _( - b'note: not rebasing %s, already in ' b'destination as %s\n' + b'note: not rebasing %s, already in destination as %s\n' ) % (desc, succdesc) repo.ui.status(msg) # Make clearrebased aware state[rev] is not a true successor @@ -1111,7 +1108,7 @@ ui.status(_(b'starting in-memory rebase\n')) else: ui.status( - _(b'starting dry-run rebase; repository will not be ' b'changed\n') + _(b'starting dry-run rebase; repository will not be changed\n') ) with repo.wlock(), repo.lock(): needsabort = True @@ -1136,9 +1133,7 @@ else: if confirm: ui.status(_(b'rebase completed successfully\n')) - if not ui.promptchoice( - _(b'apply changes (yn)?' b'$$ &Yes $$ &No') - ): + if not ui.promptchoice(_(b'apply changes (yn)?$$ &Yes $$ &No')): # finish unfinished rebase rbsrt._finishrebase() else: @@ -1415,8 +1410,7 @@ ui.note(_(b'skipping %s - empty destination\n') % repo[r]) else: raise error.Abort( - _(b'rebase destination for %s is not ' b'unique') - % repo[r] + _(b'rebase destination for %s is not unique') % repo[r] ) if dest is not None: @@ -1638,7 +1632,7 @@ if divergencebasecandidates and not divergenceok: divhashes = (bytes(repo[r]) for r in divergencebasecandidates) - msg = _(b"this rebase will cause " b"divergences from: %s") + msg = _(b"this rebase will cause divergences from: %s") h = _( b"to force the rebase please set " b"experimental.evolution.allowdivergence=True" diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -300,7 +300,7 @@ continue else: ui.write( - _(b"Invalid admonition '%s' present in changeset %s" b"\n") + _(b"Invalid admonition '%s' present in changeset %s\n") % (admonition.group(1), ctx.hex()[:12]) ) sim = lambda x: difflib.SequenceMatcher( @@ -376,7 +376,7 @@ # TODO consider using title as paragraph for more concise notes. if not paragraphs: repo.ui.warn( - _(b"error parsing releasenotes for revision: " b"'%s'\n") + _(b"error parsing releasenotes for revision: '%s'\n") % node.hex(ctx.node()) ) if title: @@ -422,7 +422,7 @@ continue elif block[b'type'] != b'paragraph': raise error.Abort( - _(b'unexpected block type in release notes: ' b'%s') + _(b'unexpected block type in release notes: %s') % block[b'type'] ) if title: diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py --- a/hgext/remotefilelog/__init__.py +++ b/hgext/remotefilelog/__init__.py @@ -273,7 +273,7 @@ b'', b'shallow', None, - _(b"create a shallow clone which uses remote file " b"history"), + _(b"create a shallow clone which uses remote file history"), ) ) @@ -796,8 +796,7 @@ for filename in match.files(): if filename not in pctx: raise error.Abort( - _(b'cannot follow file not in parent ' b'revision: "%s"') - % filename + _(b'cannot follow file not in parent revision: "%s"') % filename ) fctx = pctx[filename] diff --git a/hgext/remotefilelog/contentstore.py b/hgext/remotefilelog/contentstore.py --- a/hgext/remotefilelog/contentstore.py +++ b/hgext/remotefilelog/contentstore.py @@ -137,7 +137,7 @@ def add(self, name, node, data): raise RuntimeError( - b"cannot add content only to remotefilelog " b"contentstore" + b"cannot add content only to remotefilelog contentstore" ) def getmissing(self, keys): @@ -209,7 +209,7 @@ def add(self, name, node, data): raise RuntimeError( - b"cannot add content only to remotefilelog " b"contentstore" + b"cannot add content only to remotefilelog contentstore" ) def _sanitizemetacache(self): diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -414,7 +414,7 @@ ): if not isinstance(remote, _sshv1peer): raise error.Abort( - b'remotefilelog requires ssh ' b'servers' + b'remotefilelog requires ssh servers' ) step = self.ui.configint( b'remotefilelog', b'getfilesstep' diff --git a/hgext/remotefilelog/metadatastore.py b/hgext/remotefilelog/metadatastore.py --- a/hgext/remotefilelog/metadatastore.py +++ b/hgext/remotefilelog/metadatastore.py @@ -99,7 +99,7 @@ def add(self, name, node, data): raise RuntimeError( - b"cannot add content only to remotefilelog " b"contentstore" + b"cannot add content only to remotefilelog contentstore" ) def getmissing(self, keys): @@ -136,7 +136,7 @@ def add(self, name, node, parents, linknode): raise RuntimeError( - b"cannot add metadata only to remotefilelog " b"metadatastore" + b"cannot add metadata only to remotefilelog metadatastore" ) diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py --- a/hgext/remotefilelog/remotefilelogserver.py +++ b/hgext/remotefilelog/remotefilelogserver.py @@ -194,7 +194,7 @@ # since it would require fetching every version of every # file in order to create the revlogs. raise error.Abort( - _(b"Cannot clone from a shallow repo " b"to a full repo.") + _(b"Cannot clone from a shallow repo to a full repo.") ) else: for x in orig(repo, matcher): diff --git a/hgext/remotefilelog/shallowutil.py b/hgext/remotefilelog/shallowutil.py --- a/hgext/remotefilelog/shallowutil.py +++ b/hgext/remotefilelog/shallowutil.py @@ -55,7 +55,7 @@ return None else: raise error.Abort( - _(b"could not find config option " b"remotefilelog.cachepath") + _(b"could not find config option remotefilelog.cachepath") ) return util.expandpath(cachepath) @@ -427,7 +427,7 @@ s = stream.read(n) if len(s) < n: raise error.Abort( - _(b"stream ended unexpectedly" b" (got %d bytes, expected %d)") + _(b"stream ended unexpectedly (got %d bytes, expected %d)") % (len(s), n) ) return s diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -70,7 +70,7 @@ b'', b'relative', None, - _(b'point to source using a relative path ' b'(EXPERIMENTAL)'), + _(b'point to source using a relative path (EXPERIMENTAL)'), ), ], _(b'[-U] [-B] SOURCE [DEST]'), diff --git a/hgext/split.py b/hgext/split.py --- a/hgext/split.py +++ b/hgext/split.py @@ -108,7 +108,7 @@ ) if not alloworphaned and len(torebase) != len(descendants): raise error.Abort( - _(b'split would leave orphaned changesets ' b'behind') + _(b'split would leave orphaned changesets behind') ) else: if not alloworphaned and descendants: @@ -164,7 +164,7 @@ firstline = c.description().split(b'\n', 1)[0] header += _(b'HG: - %s: %s\n') % (short(c.node()), firstline) header += _( - b'HG: Write commit message for the next split ' b'changeset.\n' + b'HG: Write commit message for the next split changeset.\n' ) else: header = _( diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py --- a/hgext/sqlitestore.py +++ b/hgext/sqlitestore.py @@ -358,7 +358,7 @@ if i != rev: raise SQLiteStoreError( - _(b'sqlite database has inconsistent ' b'revision numbers') + _(b'sqlite database has inconsistent revision numbers') ) if p1rev == nullrev: @@ -772,7 +772,7 @@ # SQLite, since columns can be resized at will. if len(tombstone) > len(self.rawdata(censornode)): raise error.Abort( - _(b'censor tombstone must be no longer than ' b'censored data') + _(b'censor tombstone must be no longer than censored data') ) # We need to replace the censored revision's data with the tombstone. @@ -1161,7 +1161,7 @@ # This restriction can be lifted once we have more confidence. if b'sharedrepo' in createopts: raise error.Abort( - _(b'shared repositories not supported with SQLite ' b'store') + _(b'shared repositories not supported with SQLite store') ) # This filtering is out of an abundance of caution: we want to ensure @@ -1176,7 +1176,7 @@ unsupported = set(createopts) - known if unsupported: raise error.Abort( - _(b'SQLite store does not support repo creation ' b'option: %s') + _(b'SQLite store does not support repo creation option: %s') % b', '.join(sorted(unsupported)) ) diff --git a/hgext/strip.py b/hgext/strip.py --- a/hgext/strip.py +++ b/hgext/strip.py @@ -124,24 +124,19 @@ ), ), (b'', b'no-backup', None, _(b'do not save backup bundle')), - ( - b'', - b'nobackup', - None, - _(b'do not save backup bundle ' b'(DEPRECATED)'), - ), + (b'', b'nobackup', None, _(b'do not save backup bundle (DEPRECATED)'),), (b'n', b'', None, _(b'ignored (DEPRECATED)')), ( b'k', b'keep', None, - _(b"do not modify working directory during " b"strip"), + _(b"do not modify working directory during strip"), ), ( b'B', b'bookmark', [], - _(b"remove revs only reachable from given" b" bookmark"), + _(b"remove revs only reachable from given bookmark"), _(b'BOOKMARK'), ), ( diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -438,7 +438,7 @@ p1 = repo.dirstate.p1() if p1 != parent: raise error.Abort( - _(b'working directory not at transplant ' b'parent %s') + _(b'working directory not at transplant parent %s') % nodemod.hex(parent) ) if merge: @@ -661,7 +661,7 @@ b'c', b'continue', None, - _(b'continue last transplant session ' b'after fixing conflicts'), + _(b'continue last transplant session after fixing conflicts'), ), ( b'', @@ -788,7 +788,7 @@ raise error.Abort(_(b'--all requires a branch revision')) if revs: raise error.Abort( - _(b'--all is incompatible with a ' b'revision list') + _(b'--all is incompatible with a revision list') ) opts = pycompat.byteskwargs(opts) diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -165,7 +165,7 @@ if not allowdirtywcopy and (not pats or isdirtypath): cmdutil.bailifchanged( repo, - hint=_(b'requires ' b'--allow-dirty-working-copy to uncommit'), + hint=_(b'requires --allow-dirty-working-copy to uncommit'), ) old = repo[b'.'] rewriteutil.precheck(repo, [old.rev()], b'uncommit') @@ -190,7 +190,7 @@ for f in sorted(badfiles): if f in s.clean: hint = _( - b"file was not changed in working directory " b"parent" + b"file was not changed in working directory parent" ) elif repo.wvfs.exists(f): hint = _(b"file was untracked in working directory parent") diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -128,7 +128,7 @@ return enc(func(*dec(args), **dec(kwds))) except UnicodeError: raise error.Abort( - _(b"[win32mbcs] filename conversion failed with" b" %s encoding\n") + _(b"[win32mbcs] filename conversion failed with %s encoding\n") % _encoding ) diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -302,7 +302,7 @@ ) return delbms raise error.Abort( - _(b"bookmark '%s' already exists " b"(use -f to force)") % mark + _(b"bookmark '%s' already exists (use -f to force)") % mark ) if ( mark in self._repo.branchmap() @@ -893,7 +893,7 @@ mark = mark.strip() if not mark: raise error.Abort( - _(b"bookmark names cannot consist entirely of " b"whitespace") + _(b"bookmark names cannot consist entirely of whitespace") ) scmutil.checknewlabel(repo, mark, b'bookmark') return mark diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1233,7 +1233,7 @@ def __call__(self): self.ui.debug( - b'bundle2-input-stream-interrupt:' b' opening out of band context\n' + b'bundle2-input-stream-interrupt: opening out of band context\n' ) indebug(self.ui, b'bundle2 stream interruption, looking for a part.') headerblock = self._readpartheader() @@ -1252,7 +1252,7 @@ if not hardabort: part.consume() self.ui.debug( - b'bundle2-input-stream-interrupt:' b' closing out of band context\n' + b'bundle2-input-stream-interrupt: closing out of band context\n' ) @@ -1320,7 +1320,7 @@ s = read(headersize) if len(s) < headersize: raise error.Abort( - _(b'stream ended unexpectedly ' b' (got %d bytes, expected %d)') + _(b'stream ended unexpectedly (got %d bytes, expected %d)') % (len(s), chunksize) ) @@ -1889,7 +1889,7 @@ assert compression is None if cg.version != b'01': raise error.Abort( - _(b'old bundle types only supports v1 ' b'changegroups') + _(b'old bundle types only supports v1 changegroups') ) header, comp = bundletypes[bundletype] if comp not in util.compengines.supportedbundletypes: @@ -2136,7 +2136,7 @@ op.gettransaction() if sorted(heads) != sorted(op.repo.heads()): raise error.PushRaced( - b'remote repository changed while pushing - ' b'please try again' + b'remote repository changed while pushing - please try again' ) diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -269,7 +269,7 @@ if part.type == b'changegroup': if cgpart: raise NotImplementedError( - b"can't process " b"multiple changegroups" + b"can't process multiple changegroups" ) cgpart = part diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1551,7 +1551,7 @@ if version == b'01' and not matcher.always(): raise error.ProgrammingError( - b'version 01 changegroups do not support ' b'sparse file matchers' + b'version 01 changegroups do not support sparse file matchers' ) if ellipses and version in (b'01', b'02'): diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -257,13 +257,9 @@ the ``date`` option is set. """ if opts.get(b'date') and opts.get(b'currentdate'): - raise error.Abort( - _(b'--date and --currentdate are mutually ' b'exclusive') - ) + raise error.Abort(_(b'--date and --currentdate are mutually exclusive')) if opts.get(b'user') and opts.get(b'currentuser'): - raise error.Abort( - _(b'--user and --currentuser are mutually ' b'exclusive') - ) + raise error.Abort(_(b'--user and --currentuser are mutually exclusive')) datemaydiffer = False # date-only change should be ignored? @@ -1010,7 +1006,7 @@ if message and logfile: raise error.Abort( - _(b'options --message and --logfile are mutually ' b'exclusive') + _(b'options --message and --logfile are mutually exclusive') ) if not message and logfile: try: @@ -1180,7 +1176,7 @@ newname.append(stringutil.escapestr(pat[i:n])) if n + 2 > end: raise error.Abort( - _(b"incomplete format spec in output " b"filename") + _(b"incomplete format spec in output filename") ) c = pat[n + 1 : n + 2] i = n + 2 @@ -1188,7 +1184,7 @@ newname.append(expander[c]) except KeyError: raise error.Abort( - _(b"invalid format spec '%%%s' in output " b"filename") % c + _(b"invalid format spec '%%%s' in output filename") % c ) return b''.join(newname) @@ -2264,7 +2260,7 @@ if follow: raise error.Abort( - _(b'can only follow copies/renames for explicit ' b'filenames') + _(b'can only follow copies/renames for explicit filenames') ) # The slow path checks files modified in every changeset. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -830,7 +830,7 @@ hg._showstats(repo, stats) if stats.unresolvedcount: repo.ui.status( - _(b"use 'hg resolve' to retry unresolved " b"file merges\n") + _(b"use 'hg resolve' to retry unresolved file merges\n") ) return 1 else: @@ -839,7 +839,7 @@ cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) if opts.get(b'no_commit'): - msg = _(b"changeset %s backed out, " b"don't forget to commit.\n") + msg = _(b"changeset %s backed out, don't forget to commit.\n") ui.status(msg % short(node)) return 0 @@ -1353,7 +1353,7 @@ if not opts.get(b'force') and label in repo.branchmap(): if label not in [p.branch() for p in repo[None].parents()]: raise error.Abort( - _(b'a branch of the same name already' b' exists'), + _(b'a branch of the same name already exists'), # i18n: "it" refers to an existing branch hint=_(b"use 'hg update' to switch to it"), ) @@ -1562,9 +1562,7 @@ except error.UnsupportedBundleSpecification as e: raise error.Abort( pycompat.bytestr(e), - hint=_( - b"see 'hg help bundlespec' for supported " b"values for --type" - ), + hint=_(b"see 'hg help bundlespec' for supported values for --type"), ) cgversion = bundlespec.contentopts[b"cg.version"] @@ -1578,7 +1576,7 @@ if opts.get(b'all'): if dest: raise error.Abort( - _(b"--all is incompatible with specifying " b"a destination") + _(b"--all is incompatible with specifying a destination") ) if opts.get(b'base'): ui.warn(_(b"ignoring --base because --all was specified\n")) @@ -1593,7 +1591,7 @@ if base: if dest: raise error.Abort( - _(b"--base is incompatible with specifying " b"a destination") + _(b"--base is incompatible with specifying a destination") ) common = [repo[rev].node() for rev in base] heads = [repo[r].node() for r in revs] if revs else None @@ -2048,7 +2046,7 @@ if repo[b'.'].closesbranch(): raise error.Abort( - _(b'current revision is already a branch closing' b' head') + _(b'current revision is already a branch closing head') ) elif not bheads: raise error.Abort(_(b'branch "%s" has no heads to close') % branch) @@ -2298,7 +2296,7 @@ if not contstate.continuefunc: raise error.Abort( ( - _(b"%s in progress but does not support " b"'hg continue'") + _(b"%s in progress but does not support 'hg continue'") % (contstate._opname) ), hint=contstate.continuemsg(), @@ -2987,19 +2985,19 @@ if opts.get(b'no_commit'): if opts.get(b'edit'): raise error.Abort( - _(b"cannot specify --no-commit and " b"--edit together") + _(b"cannot specify --no-commit and --edit together") ) if opts.get(b'currentuser'): raise error.Abort( - _(b"cannot specify --no-commit and " b"--currentuser together") + _(b"cannot specify --no-commit and --currentuser together") ) if opts.get(b'currentdate'): raise error.Abort( - _(b"cannot specify --no-commit and " b"--currentdate together") + _(b"cannot specify --no-commit and --currentdate together") ) if opts.get(b'log'): raise error.Abort( - _(b"cannot specify --no-commit and " b"--log together") + _(b"cannot specify --no-commit and --log together") ) graftstate = statemod.cmdstate(repo, b'graftstate') @@ -3007,7 +3005,7 @@ if opts.get(b'stop'): if opts.get(b'continue'): raise error.Abort( - _(b"cannot use '--continue' and " b"'--stop' together") + _(b"cannot use '--continue' and '--stop' together") ) if opts.get(b'abort'): raise error.Abort(_(b"cannot use '--abort' and '--stop' together")) @@ -3028,7 +3026,7 @@ elif opts.get(b'abort'): if opts.get(b'continue'): raise error.Abort( - _(b"cannot use '--continue' and " b"'--abort' together") + _(b"cannot use '--continue' and '--abort' together") ) if any( ( @@ -3866,7 +3864,7 @@ opts = pycompat.byteskwargs(opts) if not repo and not source: raise error.Abort( - _(b"there is no Mercurial repository here " b"(.hg not found)") + _(b"there is no Mercurial repository here (.hg not found)") ) default = not (num or id or branch or tags or bookmarks) @@ -4904,7 +4902,7 @@ cmdmsg=_(b'outstanding uncommitted merge'), abortfunc=hg.abortmerge, statushint=_( - b'To continue: hg commit\n' b'To abort: hg merge --abort' + b'To continue: hg commit\nTo abort: hg merge --abort' ), cmdhint=_(b"use 'hg commit' or 'hg merge --abort'"), ) @@ -5305,7 +5303,7 @@ ) elif currentbranchheads > 1: ui.status( - _(b"(run 'hg heads .' to see heads, 'hg merge' to " b"merge)\n") + _(b"(run 'hg heads .' to see heads, 'hg merge' to merge)\n") ) else: ui.status(_(b"(run 'hg heads' to see heads)\n")) @@ -5615,7 +5613,7 @@ revs = [repo[rev].node() for rev in revs] if not revs: raise error.Abort( - _(b'default push revset for path evaluates to an ' b'empty set') + _(b'default push revset for path evaluates to an empty set') ) repo._subtoppath = dest @@ -5882,7 +5880,7 @@ if confirm: if all: if ui.promptchoice( - _(b're-merge all unresolved files (yn)?' b'$$ &Yes $$ &No') + _(b're-merge all unresolved files (yn)?$$ &Yes $$ &No') ): raise error.Abort(_(b'user quit')) if mark and not pats: @@ -6474,7 +6472,7 @@ if opts[b"stdio"]: if repo is None: raise error.RepoError( - _(b"there is no Mercurial repository here" b" (.hg not found)") + _(b"there is no Mercurial repository here (.hg not found)") ) s = wireprotoserver.sshserver(ui, repo) s.serve_forever() @@ -7234,7 +7232,7 @@ scmutil.checknewlabel(repo, n, b'tag') if not n: raise error.Abort( - _(b'tag names cannot consist entirely of ' b'whitespace') + _(b'tag names cannot consist entirely of whitespace') ) if opts.get(b'rev') and opts.get(b'remove'): raise error.Abort(_(b"--rev and --remove are incompatible")) @@ -7269,7 +7267,7 @@ for n in names: if n in repo.tags(): raise error.Abort( - _(b"tag '%s' already exists " b"(use -f to force)") % n + _(b"tag '%s' already exists (use -f to force)") % n ) if not opts.get(b'local'): p1, p2 = repo.dirstate.parents() diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1619,7 +1619,7 @@ return if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): self._repo.ui.warn( - _(b"copy failed: %s is not a file or a " b"symbolic link\n") + _(b"copy failed: %s is not a file or a symbolic link\n") % self._repo.dirstate.pathto(dest) ) else: @@ -1678,7 +1678,7 @@ or stringutil.binary(d) ): self._repo.ui.debug( - b'ignoring suspect symlink placeholder' b' "%s"\n' % f + b'ignoring suspect symlink placeholder "%s"\n' % f ) continue sane.append(f) @@ -1750,7 +1750,7 @@ # already changed simultaneously after last # caching (see also issue5584 for detail) self._repo.ui.debug( - b'skip updating dirstate: ' b'identity mismatch\n' + b'skip updating dirstate: identity mismatch\n' ) except error.LockError: pass diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -677,7 +677,7 @@ if df not in copy: movewithdir[f] = df repo.ui.debug( - (b" pending file src: '%s' -> " b"dst: '%s'\n") + b" pending file src: '%s' -> dst: '%s'\n" % (f, df) ) break diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py --- a/mercurial/dagparser.py +++ b/mercurial/dagparser.py @@ -275,7 +275,7 @@ i += 1 c = nextch() raise error.Abort( - _(b'invalid character in dag description: ' b'%s...') % s + _(b'invalid character in dag description: %s...') % s ) @@ -381,7 +381,7 @@ yield b'\n' else: raise error.Abort( - _(b"invalid event type in dag: " b"('%s', '%s')") + _(b"invalid event type in dag: ('%s', '%s')") % ( stringutil.escapestr(kind), stringutil.escapestr(data), diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -109,7 +109,7 @@ elif len(args) == 2: if not repo: raise error.Abort( - _(b'there is no Mercurial repository here ' b'(.hg not found)') + _(b'there is no Mercurial repository here (.hg not found)') ) rev1, rev2 = args r = repo.changelog @@ -1464,7 +1464,7 @@ fm.condwrite( err, b'encodingerror', - _(b" %s\n" b" (check that your locale is properly set)\n"), + _(b" %s\n (check that your locale is properly set)\n"), err, ) @@ -1577,7 +1577,7 @@ ) fm.write( b'compenginesavail', - _(b'checking available compression engines ' b'(%s)\n'), + _(b'checking available compression engines (%s)\n'), fm.formatlist( sorted(e.name() for e in compengines if e.available()), name=b'compengine', @@ -1701,7 +1701,7 @@ fm.condwrite( problems, b'problems', - _(b"%d problems detected," b" please check your install!\n"), + _(b"%d problems detected, please check your install!\n"), problems, ) fm.end() @@ -2071,7 +2071,7 @@ b'', b'exclusive', False, - _(b'restrict display to markers only ' b'relevant to REV'), + _(b'restrict display to markers only relevant to REV'), ), (b'', b'index', False, _(b'display index of the marker')), (b'', b'delete', [], _(b'delete markers specified by indices')), @@ -2115,7 +2115,7 @@ if repo.currenttransaction(): raise error.Abort( - _(b'cannot delete obsmarkers in the middle ' b'of transaction.') + _(b'cannot delete obsmarkers in the middle of transaction.') ) with repo.lock(): @@ -2949,7 +2949,7 @@ if format == 0: if ui.verbose: ui.writenoi18n( - (b" rev offset length linkrev" b" %s %s p2\n") + b" rev offset length linkrev %s %s p2\n" % (b"nodeid".ljust(idlen), b"p1".ljust(idlen)) ) else: @@ -3096,7 +3096,7 @@ stages = stages[:-1] if opts[b'verify_optimized'] and opts[b'no_optimized']: raise error.Abort( - _(b'cannot use --verify-optimized with ' b'--no-optimized') + _(b'cannot use --verify-optimized with --no-optimized') ) stagenames = set(n for n, f in stages) @@ -3276,7 +3276,7 @@ ''' if not pycompat.iswindows: raise error.Abort( - _(b'certificate chain building is only possible on ' b'Windows') + _(b'certificate chain building is only possible on Windows') ) if not source: @@ -3422,7 +3422,7 @@ if opts[r'rev']: if repo is None: raise error.RepoError( - _(b'there is no Mercurial repository here ' b'(.hg not found)') + _(b'there is no Mercurial repository here (.hg not found)') ) revs = scmutil.revrange(repo, opts[r'rev']) @@ -3882,9 +3882,7 @@ ) if path and opts[b'localssh']: - raise error.Abort( - _(b'cannot specify --localssh with an explicit ' b'path') - ) + raise error.Abort(_(b'cannot specify --localssh with an explicit path')) if ui.interactive(): ui.write(_(b'(waiting for commands on stdin)\n')) @@ -4153,7 +4151,7 @@ elif action.startswith(b'httprequest '): if not opener: raise error.Abort( - _(b'cannot use httprequest without an HTTP ' b'peer') + _(b'cannot use httprequest without an HTTP peer') ) request = action.split(b' ', 2) diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -129,9 +129,9 @@ heads = repo.branchheads(currentbranch, closed=True) assert heads, b"any branch has at least one head" node = repo.revs(b'max(.::(%ln))', heads).first() - assert node is not None, ( - b"any revision has at least " b"one descendant branch head" - ) + assert ( + node is not None + ), b"any revision has at least one descendant branch head" if bookmarks.isactivewdirparent(repo): movemark = repo[b'.'].node() else: diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -467,7 +467,7 @@ '''Mark as coming from the other parent, always dirty.''' if self._pl[1] == nullid: raise error.Abort( - _(b"setting %r to other parent " b"only allowed in merges") % f + _(b"setting %r to other parent only allowed in merges") % f ) if f in self and self[f] == b'n': # merge-like @@ -1470,7 +1470,7 @@ if self._pendingmode is not None and self._pendingmode != mode: fp.close() raise error.Abort( - _(b'working directory state may be ' b'changed parallelly') + _(b'working directory state may be changed parallelly') ) self._pendingmode = mode return fp @@ -1494,7 +1494,7 @@ self._parents = (nullid, nullid) else: raise error.Abort( - _(b'working directory state appears ' b'damaged!') + _(b'working directory state appears damaged!') ) return self._parents @@ -1671,7 +1671,7 @@ if self._pendingmode is not None and self._pendingmode != mode: fp.close() raise error.Abort( - _(b'working directory state may be ' b'changed parallelly') + _(b'working directory state may be changed parallelly') ) self._pendingmode = mode return fp @@ -1697,7 +1697,7 @@ self._parents = self._rustmap.parents(st) except ValueError: raise error.Abort( - _(b'working directory state appears ' b'damaged!') + _(b'working directory state appears damaged!') ) return self._parents diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -412,11 +412,11 @@ heads = scmutil.nodesummaries(repo, unsyncedheads) if heads is None: repo.ui.status( - _(b"remote has heads that are " b"not known locally\n") + _(b"remote has heads that are not known locally\n") ) elif branch is None: repo.ui.status( - _(b"remote has heads that are " b"not known locally: %s\n") + _(b"remote has heads that are not known locally: %s\n") % heads ) else: @@ -447,7 +447,7 @@ if errormsg is None: if branch not in (b'default', None): errormsg = _( - b"push creates new remote head %s " b"on branch '%s'!" + b"push creates new remote head %s on branch '%s'!" ) % (short(dhs[0]), branch) elif repo[dhs[0]].bookmarks(): errormsg = _( diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -631,7 +631,7 @@ continue if not encoding.isasciistr(v): self.badalias = _( - b"non-ASCII character in alias definition " b"'%s:%s'" + b"non-ASCII character in alias definition '%s:%s'" ) % (name, k) return cfg[k] = v diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -319,7 +319,7 @@ b'a known bundlespec' ) % version, - hint=_(b'try upgrading your Mercurial ' b'client'), + hint=_(b'try upgrading your Mercurial client'), ) elif part.type == b'stream2' and version is None: # A stream2 part requires to be part of a v2 bundle @@ -330,7 +330,7 @@ if not version: raise error.Abort( - _(b'could not identify changegroup version in ' b'bundle') + _(b'could not identify changegroup version in bundle') ) return b'%s-%s' % (comp, version) @@ -383,7 +383,7 @@ ) elif behavior == b'confirm': if ui.promptchoice( - _(b'push and publish %i changesets (yn)?' b'$$ &Yes $$ &No') + _(b'push and publish %i changesets (yn)?$$ &Yes $$ &No') % len(published) ): raise error.Abort(_(b'user quit')) @@ -1166,8 +1166,7 @@ """abort if a given bookmark points to a secret changeset""" if node and pushop.repo[node].phase() == phases.secret: raise error.Abort( - _(b'cannot push bookmark %s as it points to a secret' b' changeset') - % b + _(b'cannot push bookmark %s as it points to a secret changeset') % b ) @@ -2696,7 +2695,7 @@ # someone else committed/pushed/unbundled while we # were transferring data raise error.PushRaced( - b'repository changed while %s - ' b'please try again' % context + b'repository changed while %s - please try again' % context ) @@ -2842,7 +2841,7 @@ ) ) repo.ui.warn( - _(b'(you may want to report this to the server ' b'operator)\n') + _(b'(you may want to report this to the server operator)\n') ) return diff --git a/mercurial/exchangev2.py b/mercurial/exchangev2.py --- a/mercurial/exchangev2.py +++ b/mercurial/exchangev2.py @@ -219,7 +219,7 @@ vfs = repo.svfs else: raise error.Abort( - _(b'invalid location for raw file data: ' b'%s') + _(b'invalid location for raw file data: %s') % filemeta[b'location'] ) diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -315,7 +315,7 @@ # conflicts. if fcd.changectx().isinmemory(): raise error.InMemoryMergeConflictsError( - b'in-memory merge does not ' b'support file conflicts' + b'in-memory merge does not support file conflicts' ) prompts = partextras(labels) @@ -415,7 +415,7 @@ if premerge not in validkeep: _valid = b', '.join([b"'" + v + b"'" for v in validkeep]) raise error.ConfigError( - _(b"%s.premerge not valid " b"('%s' is neither boolean nor %s)") + _(b"%s.premerge not valid ('%s' is neither boolean nor %s)") % (tool, premerge, _valid) ) @@ -440,7 +440,7 @@ uipathfn = scmutil.getuipathfn(repo) if symlink: repo.ui.warn( - _(b'warning: internal %s cannot merge symlinks ' b'for %s\n') + _(b'warning: internal %s cannot merge symlinks for %s\n') % (tool, uipathfn(fcd.path())) ) return False @@ -606,7 +606,7 @@ if isinstance(fcd, context.overlayworkingfilectx): raise error.InMemoryMergeConflictsError( - b'in-memory merge does not ' b'support the :dump tool.' + b'in-memory merge does not support the :dump tool.' ) util.writefile(a + b".local", fcd.decodeddata()) @@ -635,7 +635,7 @@ # directory and tell the user how to get it is my best idea, but it's # clunky.) raise error.InMemoryMergeConflictsError( - b'in-memory merge does not support ' b'external merge tools' + b'in-memory merge does not support external merge tools' ) @@ -698,7 +698,7 @@ uipathfn = scmutil.getuipathfn(repo) if fcd.isabsent() or fco.isabsent(): repo.ui.warn( - _(b'warning: %s cannot merge change/delete conflict ' b'for %s\n') + _(b'warning: %s cannot merge change/delete conflict for %s\n') % (tool, uipathfn(fcd.path())) ) return False, 1, None @@ -1064,7 +1064,7 @@ if onfailure: if wctx.isinmemory(): raise error.InMemoryMergeConflictsError( - b'in-memory merge does ' b'not support merge ' b'conflicts' + b'in-memory merge does not support merge conflicts' ) ui.warn(onfailure % fduipath) return True, 1, False @@ -1150,7 +1150,7 @@ def _onfilemergefailure(ui): action = ui.config(b'merge', b'on-failure') if action == b'prompt': - msg = _(b'continue merge operation (yn)?' b'$$ &Yes $$ &No') + msg = _(b'continue merge operation (yn)?$$ &Yes $$ &No') if ui.promptchoice(msg, 0) == 1: _haltmerge() if action == b'halt': @@ -1180,7 +1180,7 @@ if b'prompt' in _toollist(ui, tool, b"check"): checked = True if ui.promptchoice( - _(b"was merge of '%s' successful (yn)?" b"$$ &Yes $$ &No") + _(b"was merge of '%s' successful (yn)?$$ &Yes $$ &No") % uipathfn(fd), 1, ): diff --git a/mercurial/help.py b/mercurial/help.py --- a/mercurial/help.py +++ b/mercurial/help.py @@ -860,7 +860,7 @@ ) if name == b'shortlist': rst.append( - _(b"\n(use 'hg help' for the full list " b"of commands)\n") + _(b"\n(use 'hg help' for the full list of commands)\n") ) else: if name == b'shortlist': @@ -872,7 +872,7 @@ ) elif name and not full: rst.append( - _(b"\n(use 'hg help %s' to show the full help " b"text)\n") + _(b"\n(use 'hg help %s' to show the full help text)\n") % name ) elif name and syns and name in syns.keys(): @@ -929,7 +929,7 @@ try: cmdutil.findcmd(name, commands.table) rst.append( - _(b"\nuse 'hg help -c %s' to see help for " b"the %s command\n") + _(b"\nuse 'hg help -c %s' to see help for the %s command\n") % (name, name) ) except error.UnknownCommand: @@ -985,7 +985,7 @@ doc = doc.splitlines()[0] rst = listexts( - _(b"'%s' is provided by the following " b"extension:") % cmd, + _(b"'%s' is provided by the following extension:") % cmd, {ext: doc}, indent=4, showdeprecated=True, diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -379,7 +379,7 @@ """ default = defaultpath or sourcerepo.ui.config(b'paths', b'default') if default: - template = b'[paths]\n' b'default = %s\n' + template = b'[paths]\ndefault = %s\n' destrepo.vfs.write(b'hgrc', util.tonativeeol(template % default)) if repositorymod.NARROW_REQUIREMENT in sourcerepo.requirements: with destrepo.wlock(): @@ -1182,9 +1182,7 @@ # there were no conficts, mergestate was not stored node = repo[b'.'].hex() - repo.ui.status( - _(b"aborting the merge, updating back to" b" %s\n") % node[:12] - ) + repo.ui.status(_(b"aborting the merge, updating back to %s\n") % node[:12]) stats = mergemod.update(repo, node, branchmerge=False, force=True) _showstats(repo, stats) return stats.unresolvedcount > 0 diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py --- a/mercurial/hgweb/__init__.py +++ b/mercurial/hgweb/__init__.py @@ -119,6 +119,6 @@ else: if not repo: raise error.RepoError( - _(b"there is no Mercurial repository" b" here (.hg not found)") + _(b"there is no Mercurial repository here (.hg not found)") ) return hgweb_mod.hgweb(repo, baseui=baseui) diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -516,7 +516,7 @@ if self._bodygen is not None or self._bodywillwrite: raise error.ProgrammingError( - b"must use setbodybytes('') with " b"304 responses" + b"must use setbodybytes('') with 304 responses" ) # Various HTTP clients (notably httplib) won't read the HTTP response diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -242,7 +242,7 @@ def send_headers(self): if not self.saved_status: raise AssertionError( - b"Sending headers before " b"start_response() called" + b"Sending headers before start_response() called" ) saved_status = self.saved_status.split(None, 1) saved_status[0] = int(saved_status[0]) diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1295,7 +1295,7 @@ web.res.setbodywillwrite() if list(web.res.sendresponse()): raise error.ProgrammingError( - b'sendresponse() should not emit data ' b'if writing later' + b'sendresponse() should not emit data if writing later' ) bodyfh = web.res.getbodyfile() diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -117,7 +117,7 @@ ui.warn(_(b'error: %s hook failed: %s\n') % (hname, exc.args[0])) else: ui.warn( - _(b'error: %s hook raised an exception: ' b'%s\n') + _(b'error: %s hook raised an exception: %s\n') % (hname, stringutil.forcebytestr(exc)) ) if throw: diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -383,14 +383,13 @@ return respurl, proto, resp else: raise error.RepoError( - _(b'unexpected CBOR response from ' b'server') + _(b'unexpected CBOR response from server') ) version_info = tuple([int(n) for n in subtype.split(b'.')]) except ValueError: raise error.RepoError( - _(b"'%s' sent a broken Content-Type " b"header (%s)") - % (safeurl, proto) + _(b"'%s' sent a broken Content-Type header (%s)") % (safeurl, proto) ) # TODO consider switching to a decompression reader that uses @@ -685,12 +684,12 @@ def callcommand(self, command, args): if self._sent: raise error.ProgrammingError( - b'callcommand() cannot be used after ' b'commands are sent' + b'callcommand() cannot be used after commands are sent' ) if self._closed: raise error.ProgrammingError( - b'callcommand() cannot be used after ' b'close()' + b'callcommand() cannot be used after close()' ) # The service advertises which commands are available. So if we attempt @@ -763,7 +762,7 @@ if len(permissions) > 1: raise error.RepoError( - _(b'cannot make request requiring multiple ' b'permissions: %s') + _(b'cannot make request requiring multiple permissions: %s') % _(b', ').join(sorted(permissions)) ) @@ -1101,7 +1100,7 @@ try: if path.startswith(b'https:') and not urlmod.has_https: raise error.Abort( - _(b'Python support for SSL and HTTPS ' b'is not installed') + _(b'Python support for SSL and HTTPS is not installed') ) inst = makepeer(ui, path) diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -296,7 +296,7 @@ # a DIFFERENT exception if DEBUG: DEBUG.error( - b"unexpected exception - closing " b"connection to %s (%d)", + b"unexpected exception - closing connection to %s (%d)", host, id(h), ) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -223,12 +223,12 @@ def callcommand(self, command, args): if self._sent: raise error.ProgrammingError( - b'callcommand() cannot be used after ' b'sendcommands()' + b'callcommand() cannot be used after sendcommands()' ) if self._closed: raise error.ProgrammingError( - b'callcommand() cannot be used after ' b'close()' + b'callcommand() cannot be used after close()' ) # We don't need to support anything fancy. Just call the named @@ -343,9 +343,7 @@ return self._repo.pushkey(namespace, key, old, new) def stream_out(self): - raise error.Abort( - _(b'cannot perform stream clone against local ' b'peer') - ) + raise error.Abort(_(b'cannot perform stream clone against local peer')) def unbundle(self, bundle, heads, url): """apply a bundle on a repo @@ -568,7 +566,7 @@ if not sharedvfs.exists(): raise error.RepoError( - _(b'.hg/sharedpath points to nonexistent ' b'directory %s') + _(b'.hg/sharedpath points to nonexistent directory %s') % sharedvfs.base ) @@ -1453,7 +1451,7 @@ if not self._dirstatevalidatewarned: self._dirstatevalidatewarned = True self.ui.warn( - _(b"warning: ignoring unknown" b" working parent %s!\n") + _(b"warning: ignoring unknown working parent %s!\n") % short(node) ) return nullid @@ -2302,7 +2300,7 @@ ) % (oldtip, desc, detail) else: msg = _( - b'repository tip rolled back to revision %d' b' (undo %s)\n' + b'repository tip rolled back to revision %d (undo %s)\n' ) % (oldtip, desc) except IOError: msg = _(b'rolling back unknown transaction\n') @@ -2367,8 +2365,7 @@ ) else: ui.status( - _(b'working directory now based on ' b'revision %d\n') - % parents + _(b'working directory now based on revision %d\n') % parents ) mergemod.mergestate.clean(self, self[b'.'].node()) @@ -3600,7 +3597,7 @@ if not isinstance(unknownopts, dict): raise error.ProgrammingError( - b'filterknowncreateopts() did not return ' b'a dict' + b'filterknowncreateopts() did not return a dict' ) if unknownopts: @@ -3687,7 +3684,7 @@ return object.__getattribute__(self, item) raise error.ProgrammingError( - b'repo instances should not be used ' b'after unshare' + b'repo instances should not be used after unshare' ) def close(self): diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -925,8 +925,7 @@ for fname, (fromline, toline) in _parselinerangeopt(repo, opts): if fname not in wctx: raise error.Abort( - _(b'cannot follow file not in parent ' b'revision: "%s"') - % fname + _(b'cannot follow file not in parent revision: "%s"') % fname ) fctx = wctx.filectx(fname) for fctx, linerange in dagop.blockancestors(fctx, fromline, toline): diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -236,8 +236,7 @@ else: if not procutil.findexe(method): raise error.Abort( - _(b'%r specified as email transport, ' b'but not in PATH') - % method + _(b'%r specified as email transport, but not in PATH') % method ) diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -778,7 +778,7 @@ def readsubtree(subdir, subm): raise AssertionError( - b'treemanifest constructor only accepts ' b'flat manifests' + b'treemanifest constructor only accepts flat manifests' ) self.parse(text, readsubtree) diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -66,7 +66,7 @@ if kind == b'set': if ctx is None: raise error.ProgrammingError( - b"fileset expression with no " b"context" + b"fileset expression with no context" ) matchers.append(ctx.matchfileset(pat, badfn=badfn)) @@ -546,7 +546,7 @@ def normalizerootdir(dir, funcname): if dir == b'.': util.nouideprecwarn( - b"match.%s() no longer accepts " b"'.', use '' instead." % funcname, + b"match.%s() no longer accepts '.', use '' instead." % funcname, b'5.1', ) return b'' diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -83,7 +83,7 @@ self.context = int(self.context) except ValueError: raise error.Abort( - _(b'diff context lines count must be ' b'an integer, not %r') + _(b'diff context lines count must be an integer, not %r') % pycompat.bytestr(self.context) ) diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -760,7 +760,7 @@ if config not in valid: validstr = b', '.join([b"'" + v + b"'" for v in valid]) raise error.ConfigError( - _(b"%s.%s not valid " b"('%s' is none of %s)") + _(b"%s.%s not valid ('%s' is none of %s)") % (section, name, config, validstr) ) return config @@ -1048,7 +1048,7 @@ if fold.startswith(foldprefix) and not f.startswith(unfoldprefix): # the folded prefix matches but actual casing is different raise error.Abort( - _(b"case-folding collision between " b"%s and directory of %s") + _(b"case-folding collision between %s and directory of %s") % (lastfull, f) ) foldprefix = fold + b'/' @@ -1225,11 +1225,11 @@ b'which is not yet supported' ) % f, - hint=_(b'merging in the other direction ' b'may work'), + hint=_(b'merging in the other direction may work'), ) else: raise error.Abort( - _(b'conflict in file \'%s\' is outside ' b'narrow clone') % f + _(b'conflict in file \'%s\' is outside narrow clone') % f ) @@ -1992,7 +1992,7 @@ if usemergedriver: if wctx.isinmemory(): raise error.InMemoryMergeConflictsError( - b"in-memory merge does not " b"support mergedriver" + b"in-memory merge does not support mergedriver" ) ms.commit() proceed = driverpreprocess(repo, ms, wctx, labels=labels) @@ -2334,7 +2334,7 @@ if not mergeancestor and wc.branch() == p2.branch(): raise error.Abort( _(b"nothing to merge"), - hint=_(b"use 'hg update' " b"or check 'hg heads'"), + hint=_(b"use 'hg update' or check 'hg heads'"), ) if not force and (wc.files() or wc.deleted()): raise error.Abort( diff --git a/mercurial/mergeutil.py b/mercurial/mergeutil.py --- a/mercurial/mergeutil.py +++ b/mercurial/mergeutil.py @@ -15,7 +15,7 @@ def checkunresolved(ms): if list(ms.unresolved()): raise error.Abort( - _(b"unresolved merge conflicts " b"(see 'hg help resolve')") + _(b"unresolved merge conflicts (see 'hg help resolve')") ) if ms.mdstate() != b's' or list(ms.driverresolved()): raise error.Abort( diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py --- a/mercurial/narrowspec.py +++ b/mercurial/narrowspec.py @@ -110,7 +110,7 @@ """ if not isinstance(pats, set): raise error.ProgrammingError( - b'narrow patterns should be a set; ' b'got %r' % pats + b'narrow patterns should be a set; got %r' % pats ) for pat in pats: diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -667,7 +667,7 @@ Return the number of new marker.""" if self._readonly: raise error.Abort( - _(b'creating obsolete markers is not enabled on ' b'this repo') + _(b'creating obsolete markers is not enabled on this repo') ) known = set() getsuccessors = self.successors.get diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -929,7 +929,7 @@ b"superseded": _(b"hidden revision '%s' was rewritten as: %s"), b"superseded_split": _(b"hidden revision '%s' was split as: %s"), b"superseded_split_several": _( - b"hidden revision '%s' was split as: %s and " b"%d more" + b"hidden revision '%s' was split as: %s and %d more" ), } diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -163,12 +163,12 @@ ) if kwstart < len(poskeys): raise error.ParseError( - _(b"%(func)s takes at least %(nargs)d positional " b"arguments") + _(b"%(func)s takes at least %(nargs)d positional arguments") % {b'func': funcname, b'nargs': len(poskeys)} ) if not varkey and kwstart > len(poskeys) + len(keys): raise error.ParseError( - _(b"%(func)s takes at most %(nargs)d positional " b"arguments") + _(b"%(func)s takes at most %(nargs)d positional arguments") % {b'func': funcname, b'nargs': len(poskeys) + len(keys)} ) args = util.sortdict() @@ -193,7 +193,7 @@ d = args elif not optkey: raise error.ParseError( - _(b"%(func)s got an unexpected keyword " b"argument '%(key)s'") + _(b"%(func)s got an unexpected keyword argument '%(key)s'") % {b'func': funcname, b'key': k} ) else: @@ -713,7 +713,7 @@ raise error.Abort(a.error) if a in expanding: raise error.ParseError( - _(b'infinite expansion of %(section)s ' b'"%(name)s" detected') + _(b'infinite expansion of %(section)s "%(name)s" detected') % {b'section': cls._section, b'name': a.name} ) # get cacheable replacement tree by expanding aliases recursively diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -51,7 +51,7 @@ gitre = re.compile(br'diff --git a/(.*) b/(.*)') tabsplitter = re.compile(br'(\t+|[^\t]+)') wordsplitter = re.compile( - br'(\t+| +|[a-zA-Z0-9_\x80-\xff]+|' b'[^ \ta-zA-Z0-9_\x80-\xff])' + br'(\t+| +|[a-zA-Z0-9_\x80-\xff]+|[^ \ta-zA-Z0-9_\x80-\xff])' ) PatchError = error.PatchError @@ -805,7 +805,7 @@ if self.exists and self.create: if self.copysource: self.ui.warn( - _(b"cannot create %s: destination already " b"exists\n") + _(b"cannot create %s: destination already exists\n") % self.fname ) else: @@ -3191,7 +3191,7 @@ if stats: output.append( - _(b' %d files changed, %d insertions(+), ' b'%d deletions(-)\n') + _(b' %d files changed, %d insertions(+), %d deletions(-)\n') % (len(stats), totaladds, totalremoves) ) diff --git a/mercurial/profiling.py b/mercurial/profiling.py --- a/mercurial/profiling.py +++ b/mercurial/profiling.py @@ -43,9 +43,7 @@ climit = ui.configint(b'profiling', b'nested') if format not in [b'text', b'kcachegrind']: - ui.warn( - _(b"unrecognized profiling format '%s'" b" - Ignored\n") % format - ) + ui.warn(_(b"unrecognized profiling format '%s' - Ignored\n") % format) format = b'text' try: diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -361,7 +361,7 @@ setattr = setattr # this can't be parsed on Python 3 - exec(b'def raisewithtb(exc, tb):\n' b' raise exc, None, tb\n') + exec(b'def raisewithtb(exc, tb):\n raise exc, None, tb\n') def fsencode(filename): """ diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -359,7 +359,7 @@ if notstrip: nodestr = b', '.join(sorted(short(repo[n].node()) for n in notstrip)) ui.warn( - _(b'warning: orphaned descendants detected, ' b'not stripping %s\n') + _(b'warning: orphaned descendants detected, not stripping %s\n') % nodestr ) return [c.node() for c in repo.set(b'roots(%ld)', tostrip)] diff --git a/mercurial/repocache.py b/mercurial/repocache.py --- a/mercurial/repocache.py +++ b/mercurial/repocache.py @@ -70,7 +70,7 @@ """ if self._thread and self._thread.is_alive(): raise error.ProgrammingError( - b'cannot obtain cached repo while ' b'loader is active' + b'cannot obtain cached repo while loader is active' ) return self._cache.peek(path, None) diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -244,7 +244,7 @@ def packentry(self, entry, node, version, rev): if gettype(entry[0]): raise error.RevlogError( - _(b'index entry flags need revlog ' b'version 1') + _(b'index entry flags need revlog version 1') ) e2 = ( getoffset(entry[0]), @@ -451,12 +451,12 @@ if self._chunkcachesize <= 0: raise error.RevlogError( - _(b'revlog chunk cache size %r is not ' b'greater than 0') + _(b'revlog chunk cache size %r is not greater than 0') % self._chunkcachesize ) elif self._chunkcachesize & (self._chunkcachesize - 1): raise error.RevlogError( - _(b'revlog chunk cache size %r is not a ' b'power of 2') + _(b'revlog chunk cache size %r is not a power of 2') % self._chunkcachesize ) @@ -492,7 +492,7 @@ if fmt == REVLOGV0: if flags: raise error.RevlogError( - _(b'unknown flags (%#04x) in version %d ' b'revlog %s') + _(b'unknown flags (%#04x) in version %d revlog %s') % (flags >> 16, fmt, self.indexfile) ) @@ -502,7 +502,7 @@ elif fmt == REVLOGV1: if flags & ~REVLOGV1_FLAGS: raise error.RevlogError( - _(b'unknown flags (%#04x) in version %d ' b'revlog %s') + _(b'unknown flags (%#04x) in version %d revlog %s') % (flags >> 16, fmt, self.indexfile) ) @@ -512,7 +512,7 @@ elif fmt == REVLOGV2: if flags & ~REVLOGV2_FLAGS: raise error.RevlogError( - _(b'unknown flags (%#04x) in version %d ' b'revlog %s') + _(b'unknown flags (%#04x) in version %d revlog %s') % (flags >> 16, fmt, self.indexfile) ) @@ -2707,7 +2707,7 @@ if len(tombstone) > self.rawsize(censorrev): raise error.Abort( - _(b'censor tombstone must be no longer than ' b'censored data') + _(b'censor tombstone must be no longer than censored data') ) # Rewriting the revlog in place is hard. Our strategy for censoring is diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -980,7 +980,7 @@ raise error.ParseError(_(b'invalid set of arguments')) minsize, maxsize = getintrange( args[b'size'], - _(b'expectsize requires a size range' b' or a positive integer'), + _(b'expectsize requires a size range or a positive integer'), _(b'size range bounds must be integers'), minsize, maxsize, @@ -989,11 +989,13 @@ raise error.ParseError(_(b'negative size')) rev = getset(repo, fullreposet(repo), args[b'set'], order=order) if minsize != maxsize and (len(rev) < minsize or len(rev) > maxsize): - err = _( - b'revset size mismatch.' b' expected between %d and %d, got %d' - ) % (minsize, maxsize, len(rev)) + err = _(b'revset size mismatch. expected between %d and %d, got %d') % ( + minsize, + maxsize, + len(rev), + ) elif minsize == maxsize and len(rev) != minsize: - err = _(b'revset size mismatch.' b' expected %d, got %d') % ( + err = _(b'revset size mismatch. expected %d, got %d') % ( minsize, len(rev), ) @@ -1043,14 +1045,14 @@ raise error.ParseError(_(b'extra takes at least 1 argument')) # i18n: "extra" is a keyword label = getstring( - args[b'label'], _(b'first argument to extra must be ' b'a string') + args[b'label'], _(b'first argument to extra must be a string') ) value = None if b'value' in args: # i18n: "extra" is a keyword value = getstring( - args[b'value'], _(b'second argument to extra must be ' b'a string') + args[b'value'], _(b'second argument to extra must be a string') ) kind, value, matcher = stringutil.stringmatcher(value) @@ -1314,7 +1316,7 @@ elif prefix == b'r:': if rev is not None: raise error.ParseError( - b'_matchfiles expected at most one ' b'revision' + b'_matchfiles expected at most one revision' ) if value == b'': # empty means working directory rev = node.wdirrev @@ -1323,7 +1325,7 @@ elif prefix == b'd:': if default is not None: raise error.ParseError( - b'_matchfiles expected at most one ' b'default mode' + b'_matchfiles expected at most one default mode' ) default = value else: @@ -2127,7 +2129,7 @@ fieldlist = getstring( l[1], # i18n: "matching" is a keyword - _(b"matching requires a string " b"as its second argument"), + _(b"matching requires a string as its second argument"), ).split() # Make sure that there are no repeated fields, @@ -2284,7 +2286,7 @@ if len(keyflags) > 1 and any(k == b'topo' for k, reverse in keyflags): # i18n: "topo" is a keyword raise error.ParseError( - _(b'topo sort order cannot be combined ' b'with other sort keys') + _(b'topo sort order cannot be combined with other sort keys') ) opts = {} diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -456,7 +456,7 @@ stat = repo.status(match=scmutil.match(repo[None], pats, opts)) if stat.deleted: ui.status( - _(b"nothing changed (%d missing files, see " b"'hg status')\n") + _(b"nothing changed (%d missing files, see 'hg status')\n") % len(stat.deleted) ) else: @@ -707,7 +707,7 @@ """check parent while resuming an unshelve""" if state.parents != repo.dirstate.parents(): raise error.Abort( - _(b'working directory parents do not match unshelve ' b'state') + _(b'working directory parents do not match unshelve state') ) diff --git a/mercurial/sparse.py b/mercurial/sparse.py --- a/mercurial/sparse.py +++ b/mercurial/sparse.py @@ -121,7 +121,7 @@ if rev is None: raise error.Abort( - _(b'cannot parse sparse patterns from working ' b'directory') + _(b'cannot parse sparse patterns from working directory') ) includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') @@ -483,7 +483,7 @@ if abort: raise error.Abort( - _(b'could not update sparseness due to pending ' b'changes') + _(b'could not update sparseness due to pending changes') ) # Calculate actions diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -210,7 +210,7 @@ if not (fingerprint.startswith((b'sha1:', b'sha256:', b'sha512:'))): raise error.Abort( _(b'invalid fingerprint for %s: %s') % (bhostname, fingerprint), - hint=_(b'must begin with "sha1:", "sha256:", ' b'or "sha512:"'), + hint=_(b'must begin with "sha1:", "sha256:", or "sha512:"'), ) alg, fingerprint = fingerprint.split(b':', 1) @@ -328,7 +328,7 @@ if supportedprotocols == {b'tls1.0'}: if protocol != b'tls1.0': raise error.Abort( - _(b'current Python does not support protocol ' b'setting %s') + _(b'current Python does not support protocol setting %s') % protocol, hint=_( b'upgrade Python or disable setting since ' @@ -616,7 +616,7 @@ for f in (certfile, keyfile, cafile): if f and not os.path.exists(f): raise error.Abort( - _(b'referenced certificate file (%s) does not ' b'exist') % f + _(b'referenced certificate file (%s) does not exist') % f ) protocol, options, _protocolui = protocolsettings(b'tls1.0') @@ -928,7 +928,7 @@ if not peercert: raise error.Abort( - _(b'%s certificate error: ' b'no certificate received') % host + _(b'%s certificate error: no certificate received') % host ) if settings[b'disablecertverification']: @@ -990,7 +990,7 @@ section = b'hostsecurity' nice = b'%s:%s' % (hash, fmtfingerprint(peerfingerprints[hash])) raise error.Abort( - _(b'certificate for %s has unexpected ' b'fingerprint %s') + _(b'certificate for %s has unexpected fingerprint %s') % (host, nice), hint=_(b'check %s configuration') % section, ) diff --git a/mercurial/state.py b/mercurial/state.py --- a/mercurial/state.py +++ b/mercurial/state.py @@ -60,7 +60,7 @@ """ if not isinstance(version, int): raise error.ProgrammingError( - b"version of state file should be" b" an integer" + b"version of state file should be an integer" ) with self._repo.vfs(self.fname, b'wb', atomictemp=True) as fp: @@ -76,7 +76,7 @@ int(fp.readline()) except ValueError: raise error.CorruptedState( - b"unknown version of state file" b" found" + b"unknown version of state file found" ) return cborutil.decodeall(fp.read())[0] diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -468,14 +468,14 @@ """ if len(repo): raise error.Abort( - _(b'cannot apply stream clone bundle on non-empty ' b'repo') + _(b'cannot apply stream clone bundle on non-empty repo') ) filecount, bytecount, requirements = readbundle1header(fp) missingreqs = requirements - repo.supportedformats if missingreqs: raise error.Abort( - _(b'unable to apply stream clone: ' b'unsupported format: %s') + _(b'unable to apply stream clone: unsupported format: %s') % b', '.join(sorted(missingreqs)) ) @@ -715,7 +715,7 @@ missingreqs = [r for r in requirements if r not in repo.supported] if missingreqs: raise error.Abort( - _(b'unable to apply stream clone: ' b'unsupported format: %s') + _(b'unable to apply stream clone: unsupported format: %s') % b', '.join(sorted(missingreqs)) ) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1232,7 +1232,7 @@ def remove(self): if self.dirty(): self.ui.warn( - _(b'not removing repo %s because ' b'it has changes.\n') + _(b'not removing repo %s because it has changes.\n') % self._path ) return @@ -1572,7 +1572,7 @@ self._gitcommand([b'fetch']) if not self._githavelocally(revision): raise error.Abort( - _(b'revision %s does not exist in subrepository ' b'"%s"\n') + _(b'revision %s does not exist in subrepository "%s"\n') % (revision, self._relpath) ) @@ -1630,11 +1630,11 @@ def rawcheckout(): # no branch to checkout, check it out with no branch self.ui.warn( - _(b'checking out detached HEAD in ' b'subrepository "%s"\n') + _(b'checking out detached HEAD in subrepository "%s"\n') % self._relpath ) self.ui.warn( - _(b'check out a git branch if you intend ' b'to make changes\n') + _(b'check out a git branch if you intend to make changes\n') ) checkout([b'-q', revision]) @@ -1822,7 +1822,7 @@ return if self.dirty(): self.ui.warn( - _(b'not removing repo %s because ' b'it has changes.\n') + _(b'not removing repo %s because it has changes.\n') % self._relpath ) return diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -593,7 +593,7 @@ repo.hook(b'pretag', throw=True, node=hex(node), tag=name, local=local) if name in branches: repo.ui.warn( - _(b"warning: tag %s conflicts with existing" b" branch name\n") + _(b"warning: tag %s conflicts with existing branch name\n") % name ) diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -409,7 +409,7 @@ ) upgrademessage = _( - b'revlog content will be recompressed with the new ' b'algorithm.' + b'revlog content will be recompressed with the new algorithm.' ) @classmethod @@ -1106,7 +1106,7 @@ missingreqs = requiredsourcerequirements(repo) - repo.requirements if missingreqs: raise error.Abort( - _(b'cannot upgrade repository; requirement ' b'missing: %s') + _(b'cannot upgrade repository; requirement missing: %s') % _(b', ').join(sorted(missingreqs)) ) @@ -1173,7 +1173,7 @@ raise error.Abort( _(b'unknown optimization action requested: %s') % b', '.join(sorted(optimize)), - hint=_(b'run without arguments to see valid ' b'optimizations'), + hint=_(b'run without arguments to see valid optimizations'), ) deficiencies = finddeficiencies(repo) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -2034,12 +2034,12 @@ ) if ord(c) <= 31: return _( - b"filename contains '%s', which is invalid " b"on Windows" + b"filename contains '%s', which is invalid on Windows" ) % stringutil.escapestr(c) base = n.split(b'.')[0] if base and base.lower() in _winreservednames: return ( - _(b"filename contains '%s', which is reserved " b"on Windows") + _(b"filename contains '%s', which is reserved on Windows") % base ) t = n[-1:] @@ -3506,7 +3506,7 @@ addpath(f) elif skip is not None: raise error.ProgrammingError( - b"skip character is only supported " b"with a dict source" + b"skip character is only supported with a dict source" ) else: for f in map: @@ -3583,7 +3583,7 @@ s = stream.read(n) if len(s) < n: raise error.Abort( - _(b"stream ended unexpectedly" b" (got %d bytes, expected %d)") + _(b"stream ended unexpectedly (got %d bytes, expected %d)") % (len(s), n) ) return s diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py --- a/mercurial/utils/cborutil.py +++ b/mercurial/utils/cborutil.py @@ -404,7 +404,7 @@ if special != SPECIAL_START_ARRAY: raise CBORDecodeError( - b'expected array after finite set ' b'semantic tag' + b'expected array after finite set semantic tag' ) return True, size, readcount + readcount2 + 1, SPECIAL_START_SET @@ -746,7 +746,7 @@ SPECIAL_START_SET, ): raise CBORDecodeError( - b'collections not supported as map ' b'keys' + b'collections not supported as map keys' ) # We do not allow special values to be used as map keys. @@ -841,7 +841,7 @@ SPECIAL_START_SET, ): raise CBORDecodeError( - b'collections not allowed as set ' b'values' + b'collections not allowed as set values' ) # We don't allow non-trivial types to exist as set values. diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -685,7 +685,7 @@ """Schedule a file for closing.""" if not self._entered: raise error.Abort( - _(b'can only call close() when context manager ' b'active') + _(b'can only call close() when context manager active') ) # If a background thread encountered an exception, raise now so we fail diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -711,7 +711,7 @@ def __init__(self, ui, extraobjs): if extraobjs: raise error.Abort( - _(b'identity decoder received unexpected ' b'additional values') + _(b'identity decoder received unexpected additional values') ) def decode(self, data): @@ -745,7 +745,7 @@ if extraobjs: raise error.Abort( - _(b'zlib decoder received unexpected ' b'additional values') + _(b'zlib decoder received unexpected additional values') ) self._decompressor = zlib.decompressobj() @@ -802,7 +802,7 @@ def __init__(self, ui, extraobjs): if extraobjs: raise error.Abort( - _(b'zstd8mb decoder received unexpected ' b'additional values') + _(b'zstd8mb decoder received unexpected additional values') ) super(zstd8mbdecoder, self).__init__(maxwindowsize=8 * 1048576) @@ -1116,7 +1116,7 @@ # TODO handle decoding frames self._state = b'errored' raise error.ProgrammingError( - b'support for decoding stream payloads ' b'not yet implemented' + b'support for decoding stream payloads not yet implemented' ) if frame.streamflags & STREAM_FLAG_END_STREAM: @@ -1361,7 +1361,7 @@ if not entry[b'requestdone']: self._state = b'errored' raise error.ProgrammingError( - b'should not be called without ' b'requestdone set' + b'should not be called without requestdone set' ) del self._receivingcommands[requestid] @@ -1664,9 +1664,7 @@ return self._makeruncommandresult(frame.requestid) else: self._state = b'errored' - return self._makeerrorresult( - _(b'command data frame without ' b'flags') - ) + return self._makeerrorresult(_(b'command data frame without flags')) def _onframeerrored(self, frame): return self._makeerrorresult(_(b'server already errored')) @@ -1796,7 +1794,7 @@ else: if not self._cansend: raise error.ProgrammingError( - b'sends cannot be performed on ' b'this instance' + b'sends cannot be performed on this instance' ) if not self._hasmultiplesend: @@ -1824,7 +1822,7 @@ if not self._cansend: raise error.ProgrammingError( - b'sends cannot be performed on this ' b'instance' + b'sends cannot be performed on this instance' ) # If the instance only allows sending once, mark that we have fired diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -679,7 +679,7 @@ _sshv1respondooberror( fout, ui.ferr, - b'cannot upgrade protocols multiple ' b'times', + b'cannot upgrade protocols multiple times', ) state = b'shutdown' continue @@ -787,7 +787,7 @@ _sshv1respondooberror( fout, ui.ferr, - b'malformed handshake protocol: ' b'missing %s' % line, + b'malformed handshake protocol: missing %s' % line, ) ok = False state = b'shutdown' diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -143,12 +143,12 @@ def callcommand(self, command, args): if self._sent: raise error.ProgrammingError( - b'callcommand() cannot be used ' b'after commands are sent' + b'callcommand() cannot be used after commands are sent' ) if self._closed: raise error.ProgrammingError( - b'callcommand() cannot be used ' b'after close()' + b'callcommand() cannot be used after close()' ) # Commands are dispatched through methods on the peer. diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -41,7 +41,7 @@ bundle2requiredmain = _(b'incompatible Mercurial client; bundle2 required') bundle2requiredhint = _( - b'see https://www.mercurial-scm.org/wiki/' b'IncompatibleClient' + b'see https://www.mercurial-scm.org/wiki/IncompatibleClient' ) bundle2required = b'%s\n(%s)\n' % (bundle2requiredmain, bundle2requiredhint) @@ -165,13 +165,13 @@ if not isinstance(args, bytes): raise error.ProgrammingError( - b'arguments for version 1 commands ' b'must be declared as bytes' + b'arguments for version 1 commands must be declared as bytes' ) def register(func): if name in commands: raise error.ProgrammingError( - b'%s command already registered ' b'for version 1' % name + b'%s command already registered for version 1' % name ) commands[name] = wireprototypes.commandentry( func, args=args, transports=transports, permission=permission diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py --- a/mercurial/wireprotov2server.py +++ b/mercurial/wireprotov2server.py @@ -140,7 +140,7 @@ # since client does Accept it. res.headers[b'Content-Type'] = b'text/plain' res.setbodybytes( - _(b'client MUST send Content-Type header with ' b'value: %s\n') + _(b'client MUST send Content-Type header with value: %s\n') % FRAMINGTYPE ) return @@ -324,7 +324,7 @@ res.status = b'403 Forbidden' res.headers[b'Content-Type'] = b'text/plain' res.setbodybytes( - _(b'insufficient permissions to execute ' b'command: %s') + _(b'insufficient permissions to execute command: %s') % command[b'command'] ) return True @@ -340,7 +340,7 @@ res.status = b'200 OK' res.headers[b'Content-Type'] = b'text/plain' res.setbodybytes( - _(b'multiple commands cannot be issued to this ' b'URL') + _(b'multiple commands cannot be issued to this URL') ) return True @@ -725,13 +725,13 @@ if not isinstance(args, dict): raise error.ProgrammingError( - b'arguments for version 2 commands ' b'must be declared as dicts' + b'arguments for version 2 commands must be declared as dicts' ) for arg, meta in args.items(): if arg == b'*': raise error.ProgrammingError( - b'* argument name not allowed on ' b'version 2 commands' + b'* argument name not allowed on version 2 commands' ) if not isinstance(meta, dict): @@ -773,7 +773,7 @@ def register(func): if name in COMMANDS: raise error.ProgrammingError( - b'%s command already registered ' b'for version 2' % name + b'%s command already registered for version 2' % name ) COMMANDS[name] = wireprototypes.commandentry( @@ -890,7 +890,7 @@ if not isinstance(revisions, list): raise error.WireprotoCommandError( - b'revisions must be defined as an ' b'array' + b'revisions must be defined as an array' ) for spec in revisions: