Patchwork [07,of,10] vfs: add "writelines"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 28, 2014, 3 p.m.
Message ID <7c8b2bdd6f3e6cbaa44a.1401289219@juju>
Download mbox | patch
Permalink /patch/4889/
State Superseded
Commit 1df6519eb3abe34990073935534553b181d7f06c
Headers show

Comments

Katsunori FUJIWARA - May 28, 2014, 3 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1401288802 -32400
#      Wed May 28 23:53:22 2014 +0900
# Node ID 7c8b2bdd6f3e6cbaa44ac59652e246fa506b95b0
# Parent  e8bcf7420213eb28e5f1217fbed7fd1c69200fc5
vfs: add "writelines"

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -170,6 +170,13 @@  class abstractvfs(object):
         finally:
             fp.close()
 
+    def writelines(self, path, data, mode='wb', notindexed=False):
+        fp = self(path, mode=mode, notindexed=notindexed)
+        try:
+            return fp.writelines(data)
+        finally:
+            fp.close()
+
     def append(self, path, data):
         fp = self(path, 'ab')
         try: