Mercurial > public > mercurial-scm > hg-stable
diff mercurial/treediscovery.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | 89a2afe31e82 |
line wrap: on
line diff
--- a/mercurial/treediscovery.py Sun Oct 06 09:45:02 2019 -0400 +++ b/mercurial/treediscovery.py Sun Oct 06 09:48:39 2019 -0400 @@ -39,7 +39,7 @@ if not heads: with remote.commandexecutor() as e: - heads = e.callcommand('heads', {}).result() + heads = e.callcommand(b'heads', {}).result() if repo.changelog.tip() == nullid: base.add(nullid) @@ -49,7 +49,7 @@ # assume we're closer to the tip than the root # and start by examining the heads - repo.ui.status(_("searching for changes\n")) + repo.ui.status(_(b"searching for changes\n")) unknown = [] for h in heads: @@ -63,14 +63,14 @@ req = set(unknown) reqcnt = 0 - progress = repo.ui.makeprogress(_('searching'), unit=_('queries')) + progress = repo.ui.makeprogress(_(b'searching'), unit=_(b'queries')) # search through remote branches # a 'branch' here is a linear segment of history, with four parts: # head, root, first parent, second parent # (a branch always has two parents (or none) by definition) with remote.commandexecutor() as e: - branches = e.callcommand('branches', {'nodes': unknown}).result() + branches = e.callcommand(b'branches', {b'nodes': unknown}).result() unknown = collections.deque(branches) while unknown: @@ -80,15 +80,15 @@ if n[0] in seen: continue - repo.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1]))) + repo.ui.debug(b"examining %s:%s\n" % (short(n[0]), short(n[1]))) if n[0] == nullid: # found the end of the branch pass elif n in seenbranch: - repo.ui.debug("branch already found\n") + repo.ui.debug(b"branch already found\n") continue elif n[1] and knownnode(n[1]): # do we know the base? repo.ui.debug( - "found incomplete branch %s:%s\n" + b"found incomplete branch %s:%s\n" % (short(n[0]), short(n[1])) ) search.append(n[0:2]) # schedule branch range for scanning @@ -96,7 +96,7 @@ else: if n[1] not in seen and n[1] not in fetch: if knownnode(n[2]) and knownnode(n[3]): - repo.ui.debug("found new changeset %s\n" % short(n[1])) + repo.ui.debug(b"found new changeset %s\n" % short(n[1])) fetch.add(n[1]) # earliest unknown for p in n[2:4]: if knownnode(p): @@ -112,17 +112,17 @@ reqcnt += 1 progress.increment() repo.ui.debug( - "request %d: %s\n" % (reqcnt, " ".join(map(short, r))) + b"request %d: %s\n" % (reqcnt, b" ".join(map(short, r))) ) for p in pycompat.xrange(0, len(r), 10): with remote.commandexecutor() as e: branches = e.callcommand( - 'branches', {'nodes': r[p : p + 10],} + b'branches', {b'nodes': r[p : p + 10],} ).result() for b in branches: repo.ui.debug( - "received %s:%s\n" % (short(b[0]), short(b[1])) + b"received %s:%s\n" % (short(b[0]), short(b[1])) ) unknown.append(b) @@ -133,24 +133,24 @@ progress.increment() with remote.commandexecutor() as e: - between = e.callcommand('between', {'pairs': search}).result() + between = e.callcommand(b'between', {b'pairs': search}).result() for n, l in zip(search, between): l.append(n[1]) p = n[0] f = 1 for i in l: - repo.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i))) + repo.ui.debug(b"narrowing %d:%d %s\n" % (f, len(l), short(i))) if knownnode(i): if f <= 2: repo.ui.debug( - "found new branch changeset %s\n" % short(p) + b"found new branch changeset %s\n" % short(p) ) fetch.add(p) base.add(i) else: repo.ui.debug( - "narrowed branch search to %s:%s\n" + b"narrowed branch search to %s:%s\n" % (short(p), short(i)) ) newsearch.append((p, i)) @@ -161,22 +161,22 @@ # sanity check our fetch list for f in fetch: if knownnode(f): - raise error.RepoError(_("already have changeset ") + short(f[:4])) + raise error.RepoError(_(b"already have changeset ") + short(f[:4])) base = list(base) if base == [nullid]: if force: - repo.ui.warn(_("warning: repository is unrelated\n")) + repo.ui.warn(_(b"warning: repository is unrelated\n")) else: - raise error.Abort(_("repository is unrelated")) + raise error.Abort(_(b"repository is unrelated")) repo.ui.debug( - "found new changesets starting at " - + " ".join([short(f) for f in fetch]) - + "\n" + b"found new changesets starting at " + + b" ".join([short(f) for f in fetch]) + + b"\n" ) progress.complete() - repo.ui.debug("%d total queries\n" % reqcnt) + repo.ui.debug(b"%d total queries\n" % reqcnt) return base, list(fetch), heads