Mercurial > public > mercurial-scm > hg
diff mercurial/tagmerge.py @ 45942: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 | 687b865b95ad |
children | 59fa3890d40a |
line wrap: on
line diff
--- a/mercurial/tagmerge.py Fri Nov 27 17:00:00 2020 -0500 +++ b/mercurial/tagmerge.py Fri Nov 27 17:03:29 2020 -0500 @@ -87,12 +87,12 @@ def readtagsformerge(ui, repo, lines, fn=b'', keeplinenums=False): - '''read the .hgtags file into a structure that is suitable for merging + """read the .hgtags file into a structure that is suitable for merging Depending on the keeplinenums flag, clear the line numbers associated with each tag. This is done because only the line numbers of the first parent are useful for merging. - ''' + """ filetags = tagsmod._readtaghist( ui, repo, lines, fn=fn, recode=None, calcnodelines=True )[1] @@ -104,7 +104,7 @@ def grouptagnodesbyline(tagnodes): - ''' + """ Group nearby nodes (i.e. those that must be written next to each other) The input is a list of [node, position] pairs, corresponding to a given tag @@ -118,7 +118,7 @@ position is None). The result is a list of [position, [consecutive node list]] - ''' + """ firstlinenum = None for hexnode, linenum in tagnodes: firstlinenum = linenum @@ -139,14 +139,14 @@ def writemergedtags(fcd, mergedtags): - ''' + """ write the merged tags while trying to minimize the diff to the first parent This function uses the ordering info stored on the merged tags dict to generate an .hgtags file which is correct (in the sense that its contents correspond to the result of the tag merge) while also being as close as possible to the first parent's .hgtags file. - ''' + """ # group the node-tag pairs that must be written next to each other for tname, taglist in list(mergedtags.items()): mergedtags[tname] = grouptagnodesbyline(taglist) @@ -175,12 +175,12 @@ def singletagmerge(p1nodes, p2nodes): - ''' + """ merge the nodes corresponding to a single tag Note that the inputs are lists of node-linenum pairs (i.e. not just lists of nodes) - ''' + """ if not p2nodes: return p1nodes if not p1nodes: @@ -221,10 +221,10 @@ def merge(repo, fcd, fco, fca): - ''' + """ Merge the tags of two revisions, taking into account the base tags Try to minimize the diff between the merged tags and the first parent tags - ''' + """ ui = repo.ui # read the p1, p2 and base tags # only keep the line numbers for the p1 tags