Mercurial > hg
diff mercurial/logexchange.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 876494fd967d |
children | 687b865b95ad |
line wrap: on
line diff
--- a/mercurial/logexchange.py Sat Oct 05 10:29:34 2019 -0400 +++ b/mercurial/logexchange.py Sun Oct 06 09:45:02 2019 -0400 @@ -18,6 +18,7 @@ # directory name in .hg/ in which remotenames files will be present remotenamedir = 'logexchange' + def readremotenamefile(repo, filename): """ reads a file from .hg/logexchange/ directory and yields it's content @@ -45,6 +46,7 @@ f.close() + def readremotenames(repo): """ read the details about the remotenames stored in .hg/logexchange/ and @@ -58,6 +60,7 @@ for branchentry in readremotenamefile(repo, 'branches'): yield branchentry + def writeremotenamefile(repo, remotepath, names, nametype): vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) f = vfs(nametype, 'w', atomictemp=True) @@ -81,6 +84,7 @@ f.close() + def saveremotenames(repo, remotepath, branches=None, bookmarks=None): """ save remotenames i.e. remotebookmarks and remotebranches in their @@ -95,6 +99,7 @@ finally: wlock.release() + def activepath(repo, remote): """returns remote path""" # is the remote a local peer @@ -123,6 +128,7 @@ return rpath + def pullremotenames(localrepo, remoterepo): """ pulls bookmarks and branches information of the remote repo during a @@ -133,9 +139,9 @@ remotepath = activepath(localrepo, remoterepo) with remoterepo.commandexecutor() as e: - bookmarks = e.callcommand('listkeys', { - 'namespace': 'bookmarks', - }).result() + bookmarks = e.callcommand( + 'listkeys', {'namespace': 'bookmarks',} + ).result() # on a push, we don't want to keep obsolete heads since # they won't show up as heads on the next pull, so we