changeset 33421:d1aa3fee4ca4

tagmerge: use workingfilectx to write merged tags This function already does an excellent job of reading from context objects; we simply need to change the single write call to eliminate all uses of the wvfs. As with past changes, the effect should be a no-op but opens the door to in-memory merge later by using different context objects.
author Phil Cohen <phillco@fb.com>
date Tue, 11 Jul 2017 16:48:15 -0700
parents e80041832eec
children ba971f555cb0
files mercurial/tagmerge.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/tagmerge.py	Thu Jun 29 20:45:12 2017 +0900
+++ b/mercurial/tagmerge.py	Tue Jul 11 16:48:15 2017 -0700
@@ -136,7 +136,7 @@
             prevlinenum = linenum
     return groupednodes
 
-def writemergedtags(repo, mergedtags):
+def writemergedtags(fcd, mergedtags):
     '''
     write the merged tags while trying to minimize the diff to the first parent
 
@@ -169,9 +169,7 @@
     # finally we can join the sorted groups to get the final contents of the
     # merged .hgtags file, and then write it to disk
     mergedtagstring = '\n'.join([tags for rank, tags in finaltags if tags])
-    fp = repo.wvfs('.hgtags', 'wb')
-    fp.write(mergedtagstring + '\n')
-    fp.close()
+    fcd.write(mergedtagstring + '\n', fcd.flags())
 
 def singletagmerge(p1nodes, p2nodes):
     '''
@@ -268,7 +266,7 @@
             % (numconflicts, ', '.join(sorted(conflictedtags))))
         return True, 1
 
-    writemergedtags(repo, mergedtags)
+    writemergedtags(fcd, mergedtags)
     ui.note(_('.hgtags merged successfully\n'))
     return False, 0