Patchwork [09,of,11] vfs: add "writelines"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 19, 2014, 9:41 a.m.
Message ID <06bcf5cdf1e38238fa02.1416390114@juju>
Download mbox | patch
Permalink /patch/6796/
State Accepted
Commit 1df6519eb3abe34990073935534553b181d7f06c
Headers show

Comments

Katsunori FUJIWARA - Nov. 19, 2014, 9:41 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1416389714 -32400
#      Wed Nov 19 18:35:14 2014 +0900
# Node ID 06bcf5cdf1e38238fa022dd3e35b56f8ba13af5b
# Parent  fdebbb2775b7d9b4a94f5865f192c4a2da76e9f6
vfs: add "writelines"

This patch allows "writelines" to take "mode" and "notindexed"
arguments, because subsequent patch for subrepo requires both.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -229,6 +229,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: