diff mercurial/tagmerge.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 b77ff4fbe9ad
children 687b865b95ad
line wrap: on
line diff
--- a/mercurial/tagmerge.py	Sat Oct 05 10:29:34 2019 -0400
+++ b/mercurial/tagmerge.py	Sun Oct 06 09:45:02 2019 -0400
@@ -78,13 +78,14 @@
     hex,
     nullid,
 )
-from .import (
+from . import (
     tags as tagsmod,
     util,
 )
 
 hexnullid = hex(nullid)
 
+
 def readtagsformerge(ui, repo, lines, fn='', keeplinenums=False):
     '''read the .hgtags file into a structure that is suitable for merging
 
@@ -92,14 +93,16 @@
     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]
+    filetags = tagsmod._readtaghist(
+        ui, repo, lines, fn=fn, recode=None, calcnodelines=True
+    )[1]
     for tagname, taginfo in filetags.items():
         if not keeplinenums:
             for el in taginfo:
                 el[1] = None
     return filetags
 
+
 def grouptagnodesbyline(tagnodes):
     '''
     Group nearby nodes (i.e. those that must be written next to each other)
@@ -134,6 +137,7 @@
             prevlinenum = linenum
     return groupednodes
 
+
 def writemergedtags(fcd, mergedtags):
     '''
     write the merged tags while trying to minimize the diff to the first parent
@@ -169,6 +173,7 @@
     mergedtagstring = '\n'.join([tags for rank, tags in finaltags if tags])
     fcd.write(mergedtagstring + '\n', fcd.flags())
 
+
 def singletagmerge(p1nodes, p2nodes):
     '''
     merge the nodes corresponding to a single tag
@@ -214,6 +219,7 @@
     # whole list of lr nodes
     return lrnodes + hrnodes[commonidx:]
 
+
 def merge(repo, fcd, fco, fca):
     '''
     Merge the tags of two revisions, taking into account the base tags
@@ -223,14 +229,14 @@
     # read the p1, p2 and base tags
     # only keep the line numbers for the p1 tags
     p1tags = readtagsformerge(
-        ui, repo, fcd.data().splitlines(), fn="p1 tags",
-        keeplinenums=True)
+        ui, repo, fcd.data().splitlines(), fn="p1 tags", keeplinenums=True
+    )
     p2tags = readtagsformerge(
-        ui, repo, fco.data().splitlines(), fn="p2 tags",
-        keeplinenums=False)
+        ui, repo, fco.data().splitlines(), fn="p2 tags", keeplinenums=False
+    )
     basetags = readtagsformerge(
-        ui, repo, fca.data().splitlines(), fn="base tags",
-        keeplinenums=False)
+        ui, repo, fca.data().splitlines(), fn="base tags", keeplinenums=False
+    )
 
     # recover the list of "lost tags" (i.e. those that were found on the base
     # revision but not on one of the revisions being merged)
@@ -259,9 +265,13 @@
 
     if conflictedtags:
         numconflicts = len(conflictedtags)
-        ui.warn(_('automatic .hgtags merge failed\n'
-            'the following %d tags are in conflict: %s\n')
-            % (numconflicts, ', '.join(sorted(conflictedtags))))
+        ui.warn(
+            _(
+                'automatic .hgtags merge failed\n'
+                'the following %d tags are in conflict: %s\n'
+            )
+            % (numconflicts, ', '.join(sorted(conflictedtags)))
+        )
         return True, 1
 
     writemergedtags(fcd, mergedtags)