diff mercurial/localrepo.py @ 24934:5abd0a76bc8f

requires: move requires file writing func from localrepo to scmutil The logic to read a requires file resides in scmutil, so it's only logical that the logic to write the file should be there too. And now I've typed logic too many times it no longer looks like a word. Logically.
author Drew Gottlieb <drgott@google.com>
date Mon, 13 Apr 2015 18:11:47 -0400
parents 2eac3ae0d088
children c44534209a0a
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun May 03 12:28:15 2015 -0400
+++ b/mercurial/localrepo.py	Mon Apr 13 18:11:47 2015 -0400
@@ -353,10 +353,7 @@
             self.svfs.options['usetreemanifest'] = usetreemanifest
 
     def _writerequirements(self):
-        reqfile = self.vfs("requires", "w")
-        for r in sorted(self.requirements):
-            reqfile.write("%s\n" % r)
-        reqfile.close()
+        scmutil.writerequires(self.vfs, self.requirements)
 
     def _checknested(self, path):
         """Determine if path is a legal nested repository."""