Mercurial > hg
diff mercurial/logexchange.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 | d783f945a701 |
line wrap: on
line diff
--- a/mercurial/logexchange.py Sun Oct 06 09:45:02 2019 -0400 +++ b/mercurial/logexchange.py Sun Oct 06 09:48:39 2019 -0400 @@ -16,7 +16,7 @@ ) # directory name in .hg/ in which remotenames files will be present -remotenamedir = 'logexchange' +remotenamedir = b'logexchange' def readremotenamefile(repo, filename): @@ -39,7 +39,7 @@ if lineno == 0: lineno += 1 try: - node, remote, rname = line.split('\0') + node, remote, rname = line.split(b'\0') yield node, remote, rname except ValueError: pass @@ -55,32 +55,32 @@ information, call the respective functions. """ - for bmentry in readremotenamefile(repo, 'bookmarks'): + for bmentry in readremotenamefile(repo, b'bookmarks'): yield bmentry - for branchentry in readremotenamefile(repo, 'branches'): + for branchentry in readremotenamefile(repo, b'branches'): yield branchentry def writeremotenamefile(repo, remotepath, names, nametype): vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) - f = vfs(nametype, 'w', atomictemp=True) + f = vfs(nametype, b'w', atomictemp=True) # write the storage version info on top of file # version '0' represents the very initial version of the storage format - f.write('0\n\n') + f.write(b'0\n\n') olddata = set(readremotenamefile(repo, nametype)) # re-save the data from a different remote than this one. for node, oldpath, rname in sorted(olddata): if oldpath != remotepath: - f.write('%s\0%s\0%s\n' % (node, oldpath, rname)) + f.write(b'%s\0%s\0%s\n' % (node, oldpath, rname)) for name, node in sorted(names.iteritems()): - if nametype == "branches": + if nametype == b"branches": for n in node: - f.write('%s\0%s\0%s\n' % (n, remotepath, name)) - elif nametype == "bookmarks": + f.write(b'%s\0%s\0%s\n' % (n, remotepath, name)) + elif nametype == b"bookmarks": if node: - f.write('%s\0%s\0%s\n' % (node, remotepath, name)) + f.write(b'%s\0%s\0%s\n' % (node, remotepath, name)) f.close() @@ -93,9 +93,9 @@ wlock = repo.wlock() try: if bookmarks: - writeremotenamefile(repo, remotepath, bookmarks, 'bookmarks') + writeremotenamefile(repo, remotepath, bookmarks, b'bookmarks') if branches: - writeremotenamefile(repo, remotepath, branches, 'branches') + writeremotenamefile(repo, remotepath, branches, b'branches') finally: wlock.release() @@ -114,7 +114,7 @@ rpath = remote._url # represent the remotepath with user defined path name if exists - for path, url in repo.ui.configitems('paths'): + for path, url in repo.ui.configitems(b'paths'): # remove auth info from user defined url noauthurl = util.removeauth(url) @@ -140,7 +140,7 @@ with remoterepo.commandexecutor() as e: bookmarks = e.callcommand( - 'listkeys', {'namespace': 'bookmarks',} + b'listkeys', {b'namespace': b'bookmarks',} ).result() # on a push, we don't want to keep obsolete heads since @@ -151,7 +151,7 @@ repo = localrepo.unfiltered() with remoterepo.commandexecutor() as e: - branchmap = e.callcommand('branchmap', {}).result() + branchmap = e.callcommand(b'branchmap', {}).result() for branch, nodes in branchmap.iteritems(): bmap[branch] = []