Mercurial > hg
changeset 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 | 022282152632 |
children | 3035b75cd594 |
files | mercurial/localrepo.py mercurial/scmutil.py |
diffstat | 2 files changed, 7 insertions(+), 4 deletions(-) [+] |
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."""
--- a/mercurial/scmutil.py Sun May 03 12:28:15 2015 -0400 +++ b/mercurial/scmutil.py Mon Apr 13 18:11:47 2015 -0400 @@ -1011,6 +1011,12 @@ " for more information")) return requirements +def writerequires(opener, requirements): + reqfile = opener("requires", "w") + for r in sorted(requirements): + reqfile.write("%s\n" % r) + reqfile.close() + class filecachesubentry(object): def __init__(self, path, stat): self.path = path