Mercurial > public > mercurial-scm > hg-stable
diff contrib/synthrepo.py @ 45957:89a2afe31e82
formating: upgrade to black 20.8b1
This required a couple of small tweaks to un-confuse black, but now it
works. Big formatting changes come from:
* Dramatically improved collection-splitting logic upstream
* Black having a strong (correct IMO) opinion that """ is better than '''
Differential Revision: https://phab.mercurial-scm.org/D9430
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 27 Nov 2020 17:03:29 -0500 |
parents | 74802979dd9d |
children | 5ced12cfa41b |
line wrap: on
line diff
--- a/contrib/synthrepo.py Fri Nov 27 17:00:00 2020 -0500 +++ b/contrib/synthrepo.py Fri Nov 27 17:03:29 2020 -0500 @@ -122,7 +122,7 @@ optionalrepo=True, ) def analyze(ui, repo, *revs, **opts): - '''create a simple model of a repository to use for later synthesis + """create a simple model of a repository to use for later synthesis This command examines every changeset in the given range (or all of history if none are specified) and creates a simple statistical @@ -133,7 +133,7 @@ :hg:`synthesize` to create or augment a repository with synthetic commits that have a structure that is statistically similar to the analyzed repository. - ''' + """ root = repo.root if not root.endswith(os.path.sep): root += os.path.sep @@ -281,7 +281,7 @@ _('hg synthesize [OPTION].. DESCFILE'), ) def synthesize(ui, repo, descpath, **opts): - '''synthesize commits based on a model of an existing repository + """synthesize commits based on a model of an existing repository The model must have been generated by :hg:`analyze`. Commits will be generated randomly according to the probabilities described in @@ -293,7 +293,7 @@ names, words will be chosen randomly from a dictionary that is presumed to contain one word per line. Use --dict to specify the path to an alternate dictionary to use. - ''' + """ try: fp = hg.openpath(ui, descpath) except Exception as err: @@ -542,12 +542,12 @@ replacements = {'': ''} def rename(dirpath): - '''Recursively rename the directory and all path prefixes. + """Recursively rename the directory and all path prefixes. The mapping from path to renamed path is stored for all path prefixes as in dynamic programming, ensuring linear runtime and consistent renaming regardless of iteration order through the model. - ''' + """ if dirpath in replacements: return replacements[dirpath] head, _ = os.path.split(dirpath)